tt/mini_isam: remove all ancient sccsid blocks
[oweals/cde.git] / cde / lib / tt / mini_isam / isindexconv.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 /*%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                   */
24 /*%%  (c) Copyright 1993, 1994 International Business Machines Corp.     */
25 /*%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                    */
26 /*%%  (c) Copyright 1993, 1994 Novell, Inc.                              */
27 /*%%  $XConsortium: isindexconv.c /main/3 1995/10/23 11:40:48 rswiston $                                                         */
28 /*
29  * Copyright (c) 1988 by Sun Microsystems, Inc.
30  */
31
32 /*
33  * isindexconv.c
34  *
35  * Description:
36  *      Encode/decode key descriptor
37  */
38
39 #include "isam_impl.h"
40
41 void
42 stkey(Keydesc2 *pkeydesc2, char *p)
43 {
44     int                         i;
45     struct keypart2     *ppart;
46     char               *pp;
47     int                         nparts;
48
49     stshort(pkeydesc2->k2_flags, p + K2_FLAGS_OFF);
50     stshort(pkeydesc2->k2_nparts, p + K2_NPARTS_OFF);
51     stshort(pkeydesc2->k2_len, p + K2_LEN_OFF);
52     stblkno(pkeydesc2->k2_rootnode, p + K2_ROOT_OFF);
53     stlong((long)pkeydesc2->k2_keyid, p + K2_KEYID_OFF);
54
55     ppart = pkeydesc2->k2_part;
56     pp    = p + K2_KEYPART_OFF;
57     nparts = pkeydesc2->k2_nparts + 1;       /* +1 for recno part */
58
59     if (ALLOWS_DUPS2(pkeydesc2))             /* +1 for dups serial number*/
60         nparts++;
61  
62     for (i = 0; i < nparts;i++) {
63         stshort(ppart->kp2_start, pp);
64         pp += SHORTSIZE;
65  
66         stshort(ppart->kp2_leng, pp);
67         pp += SHORTSIZE;
68  
69         stshort(ppart->kp2_type, pp);
70         pp += SHORTSIZE;
71  
72         stshort(ppart->kp2_offset, pp);
73         pp += SHORTSIZE;
74         
75         ppart++;
76     }
77 }      
78
79 void
80 ldkey(struct keydesc2 *pkeydesc2, char *p)
81 {
82     int                         i;
83     struct keypart2    *ppart;
84     char               *pp;
85     int                         nparts;
86
87     memset ((char *) pkeydesc2, 0, sizeof (*pkeydesc2));
88     pkeydesc2->k2_flags = ldshort(p + K2_FLAGS_OFF);
89     pkeydesc2->k2_nparts = ldshort(p + K2_NPARTS_OFF);
90     pkeydesc2->k2_len = ldshort(p + K2_LEN_OFF);
91     pkeydesc2->k2_rootnode = ldblkno(p + K2_ROOT_OFF);
92     pkeydesc2->k2_keyid = ldlong(p + K2_KEYID_OFF);
93
94     ppart = pkeydesc2->k2_part;
95     pp    = p + K2_KEYPART_OFF;
96     nparts = pkeydesc2->k2_nparts + 1;       /* +1 for recno part */
97
98     if (ALLOWS_DUPS2(pkeydesc2))             /* +1 for dups serial number*/
99         nparts++;
100
101     for (i = 0; i < nparts;i++) {
102         ppart->kp2_start = ldunshort(pp);
103         pp += SHORTSIZE;
104
105         ppart->kp2_leng = ldshort(pp);
106         pp += SHORTSIZE;
107
108         ppart->kp2_type = ldshort(pp);
109         pp += SHORTSIZE;
110
111         ppart->kp2_offset = ldunshort(pp);
112         pp += SHORTSIZE;
113         
114         ppart++;
115     }
116 }