Convert uses of XKeycodeToKeysym (deprecated) to XkbKeycodeToKeysym
[oweals/cde.git] / cde / lib / DtSearch / raima / recnext.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: recnext.c /main/2 1996/05/09 04:14:47 drk $ */
24 /*
25  *   COMPONENT_NAME: austext
26  *
27  *   FUNCTIONS: d_recnext
28  *
29  *   ORIGINS: 157
30  *
31  *   OBJECT CODE ONLY SOURCE MATERIALS
32  */
33
34 /* ********************** EDIT HISTORY *******************************
35
36  SCR    DATE    INI                   DESCRIPTION
37 ----- --------- --- -----------------------------------------------------
38   101 21-Jun-88 RSC Use rn_type and rn_dba instead of curr_rec
39   103 24-Jun-88 RSC Improve generation of single user version
40       04-Aug-88 RTK MULTI_TASK changes
41       18-Aug-88 RSC moved rn_type/dba to separate table
42
43 */
44
45 #include <stdio.h>
46 #include "vista.h"
47 #include "dbtype.h"
48
49
50 /* Find next record of type
51 */
52 int
53 d_recnext(int dbn)
54 {
55    INT rectype;
56    FILE_NO fno;
57    FILE_NO ft;
58    DB_ADDR dba;
59    int rec_ndx;                 /* Index into record table */
60    RECORD_ENTRY *rec_ptr;       /* Pointer to record table */
61    char *recptr;
62    F_ADDR rno, last;
63
64    DB_ENTER(DB_ID TASK_ID LOCK_SET(RECORD_IO));
65
66    /* look for the current record type */
67    if ( RN_REF(rn_type) < 0 ) RETURN( dberr(S_NOTYPE) );
68
69    /* get the record number and file number from the current record */
70    if (RN_REF(rn_dba)) {
71       fno = (FILE_NO)((RN_REF(rn_dba) >> FILESHIFT) & FILEMASK);
72       rno = RN_REF(rn_dba) & ADDRMASK;
73    }
74    else {                       /* No current rec - get fno from rn_type */
75       nrec_check(RN_REF(rn_type) + RECMARK, &rec_ndx, (RECORD_ENTRY * *)&rec_ptr);
76       fno = (FILE_NO)NUM2EXT(rec_ptr->rt_file, ft_offset);
77       fno = (int)((fno >> FILESHIFT) & FILEMASK);
78       rno = 1;
79    }
80    ft = NUM2INT( fno, ft_offset );
81
82    /* start looking at the next record number */
83    if ( (last = dio_pznext(ft)) <= 0 )
84       RETURN( db_status );
85
86    ++rno;
87    do {
88         /* make sure we haven't gone past the end of the file */
89         if ( rno >= last ) RETURN( db_status = S_NOTFOUND );
90
91         /* create the database address to read */
92         dba = ( (FILEMASK & fno) << FILESHIFT ) | (ADDRMASK & rno);
93
94         /* set up to allow unlocked read */
95
96         /* read the record */
97         dio_read( dba, (char * *)&recptr, NOPGHOLD );
98         if ( db_status != S_OKAY )
99             RETURN( db_status );
100
101         /* get the record type out of the record */
102         bytecpy( &rectype, recptr, sizeof(INT) );
103
104         ++rno;
105    } while ( rectype != RN_REF(rn_type) );
106
107    /* set the current record */
108    curr_rec = dba;
109    RN_REF(rn_type) = rectype;
110    RN_REF(rn_dba)  = dba;
111
112    RETURN( db_status = S_OKAY );
113 }
114 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin recnext.c */