DtSearch/raima: remove register keyword
[oweals/cde.git] / cde / lib / DtSearch / raima / disdel.c
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these libraries and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: disdel.c /main/2 1996/05/09 04:04:57 drk $ */
24 /*
25  *   COMPONENT_NAME: austext
26  *
27  *   FUNCTIONS: d_disdel
28  *
29  *   ORIGINS: 157
30  *
31  *   OBJECT CODE ONLY SOURCE MATERIALS
32  */
33 /*-----------------------------------------------------------------------
34    disdel.c -- db_VISTA set disconnection/deletion module
35
36    (C) Copyright 1985, 1986, 1987 by Raima Corp.
37 -----------------------------------------------------------------------*/
38
39 /* ********************** EDIT HISTORY *******************************
40
41  SCR    DATE    INI                   DESCRIPTION
42 ----- --------- --- -----------------------------------------------------
43       04-Aug-88 RTK MULTI_TASK changes
44   518 06-Jan-89 RSC d_discon infinite loops (not checking d_discon status)
45 */
46
47 #include <stdio.h>
48 #include "vista.h"
49 #include "dbtype.h"
50
51 /* Disconnect from all sets (owner and member) and delete record
52 */
53 int
54 d_disdel(TASK_DBN_ONLY)
55 TASK_DECL
56 DBN_DECL
57 {
58    int rectype, nset, cset;
59    int set, mem;
60    DB_ADDR dba, odba, mdba;
61    DB_ADDR FAR *co_ptr, FAR *cm_ptr;
62    SET_ENTRY FAR *set_ptr;
63    MEMBER_ENTRY FAR *mem_ptr;
64    int memtot;
65
66    DB_ENTER(DB_ID TASK_ID LOCK_SET(SET_IO));
67
68    if ( d_crtype(&rectype TASK_PARM DBN_PARM) != S_OKAY )
69       RETURN( db_status );
70    rectype += NUM2INT(-RECMARK, rt_offset);
71
72    d_crget(&dba TASK_PARM DBN_PARM);
73    for (set = 0, set_ptr = &set_table[ORIGIN(st_offset)];
74         set < TABLE_SIZE(Size_st);
75         ++set, ++set_ptr) {
76       nset = set + SETMARK;
77       cset = set + ORIGIN(st_offset);
78       co_ptr = &curr_own[cset];
79       cm_ptr = &curr_mem[cset];
80       odba = *co_ptr;
81       mdba = *cm_ptr;
82       if (set_ptr->st_own_rt == rectype) {
83          /* disconnect all member records from set s */
84          d_setor(nset TASK_PARM DBN_PARM);
85          while (d_findfm(nset TASK_PARM DBN_PARM) == S_OKAY)
86             if (d_discon(nset TASK_PARM DBN_PARM) < S_OKAY)
87                   RETURN (db_status);
88          d_setro(nset TASK_PARM DBN_PARM);
89       }
90       for (mem = set_ptr->st_members, memtot = mem + set_ptr->st_memtot,
91                                                 mem_ptr = &member_table[mem];
92            mem < memtot;
93            ++mem, ++mem_ptr) {
94          if (mem_ptr->mt_record == rectype) {
95             /* disconnect current record from set */
96             if (d_ismember(nset TASK_PARM DBN_PARM) == S_OKAY) {
97                d_csmset(nset, &dba TASK_PARM DBN_PARM);
98                if (d_discon(nset TASK_PARM DBN_PARM) < S_OKAY)
99                   RETURN (db_status);
100             }
101          }
102       }
103       curr_rec = dba;
104       if ( dba == odba ) {
105          *co_ptr = NULL_DBA;
106          *cm_ptr = NULL_DBA;
107       }
108       else 
109          *co_ptr = odba;
110
111       if ( dba == mdba ) 
112          *cm_ptr = NULL_DBA;
113       else
114          *cm_ptr = mdba;
115    }
116    RETURN( d_delete(TASK_DBN_ONLY) );
117 }
118 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin disdel.c */