version 1.1, 2025/01/19 02:04:04
|
version 1.8, 2025/04/10 01:24:39
|
Line 1
|
Line 1
|
/* |
/* |
* * |
* $Id$ |
* * * |
|
* * * |
|
* *************** |
|
* * * * * |
|
* * MUMPS * |
|
* * * * * |
|
* *************** |
|
* * * |
|
* * * |
|
* * |
|
* |
|
* transact.c |
|
* FreeM transaction processing support |
* FreeM transaction processing support |
* |
* |
* |
* |
* Author: Serena Willis <jpw@coherent-logic.com> |
* Author: Serena Willis <snw@coherent-logic.com> |
* Copyright (C) 1998 MUG Deutschland |
* Copyright (C) 1998 MUG Deutschland |
* Copyright (C) 2020 Coherent Logic Development LLC |
* Copyright (C) 2020, 2025 Coherent Logic Development LLC |
* |
* |
* |
* |
* This file is part of FreeM. |
* This file is part of FreeM. |
Line 35
|
Line 23
|
* You should have received a copy of the GNU Affero Public License |
* You should have received a copy of the GNU Affero Public License |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* |
* |
|
* $Log$ |
|
* Revision 1.8 2025/04/10 01:24:39 snw |
|
* Remove C++ style comments |
|
* |
|
* Revision 1.7 2025/04/09 19:52:02 snw |
|
* Eliminate as many warnings as possible while building with -Wall |
|
* |
|
* Revision 1.6 2025/03/24 04:13:12 snw |
|
* Replace action macro dat with fra_dat to avoid symbol conflict on OS/2 |
|
* |
|
* Revision 1.5 2025/03/24 02:54:47 snw |
|
* Transaction compat fixes for OS/2 |
|
* |
|
* Revision 1.4 2025/03/09 19:50:47 snw |
|
* Second phase of REUSE compliance and header reformat |
|
* |
|
* |
|
* SPDX-FileCopyrightText: (C) 2025 Coherent Logic Development LLC |
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
**/ |
**/ |
|
|
#include <string.h> |
#include <string.h> |
Line 55
|
Line 62
|
#define FALSE 0 |
#define FALSE 0 |
#define TRUE 1 |
#define TRUE 1 |
|
|
#if !defined(__OpenBSD__) && !defined(__APPLE__) |
#if !defined(__OpenBSD__) && !defined(__APPLE__) && !defined(__OS2__) |
union semun { |
union semun { |
int val; /* Value for SETVAL */ |
int val; /* Value for SETVAL */ |
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ |
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */ |
Line 76 tp_transaction transactions[TP_MAX_NEST]
|
Line 83 tp_transaction transactions[TP_MAX_NEST]
|
void tp_init(void) |
void tp_init(void) |
{ |
{ |
union semun arg; |
union semun arg; |
char err[255]; |
|
key_t tp_sk; |
key_t tp_sk; |
|
|
tp_sk = ftok (config_file, 4); |
tp_sk = ftok (config_file, 4); |
Line 311 int tp_add_op(short islock, short action
|
Line 317 int tp_add_op(short islock, short action
|
transactions[tp_level].ops[oc].is_lock = islock; |
transactions[tp_level].ops[oc].is_lock = islock; |
transactions[tp_level].ops[oc].action = action; |
transactions[tp_level].ops[oc].action = action; |
|
|
stcpy (&transactions[tp_level].ops[oc].key, key); |
stcpy ((char *) &transactions[tp_level].ops[oc].key, key); |
stcpy (&transactions[tp_level].ops[oc].data, data); |
stcpy ((char *) &transactions[tp_level].ops[oc].data, data); |
|
|
|
|
return TRUE; |
return TRUE; |
Line 384 int tp_trollback(int levels)
|
Line 390 int tp_trollback(int levels)
|
register int i; |
register int i; |
register int j; |
register int j; |
|
|
// for (i = 0; i < levels; i++) { |
|
for (i = tp_level; i >= (((tp_level - levels) >= 0) ? tp_level - levels : 0); i--) { |
for (i = tp_level; i >= (((tp_level - levels) >= 0) ? tp_level - levels : 0); i--) { |
|
|
for (j = 1; j <= transactions[i].opcount; j++) { |
for (j = 1; j <= transactions[i].opcount; j++) { |
Line 495 void tp_get_op_name(char *buf, const sho
|
Line 500 void tp_get_op_name(char *buf, const sho
|
strcpy (buf, "GET"); |
strcpy (buf, "GET"); |
break; |
break; |
|
|
case dat: |
case fra_dat: |
strcpy (buf, "$DATA"); |
strcpy (buf, "$DATA"); |
break; |
break; |
|
|