source: trunk/gsdl/src/mgpp/lib/local_strings.h@ 2442

Last change on this file since 2442 was 2442, checked in by jrm21, 23 years ago

portability changes, use getopt from unistd.h (all POSIX systems)

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/**************************************************************************
2 *
3 * local_strings.h -- string routines
4 * Copyright (C) 1994 Neil Sharman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id: local_strings.h 2442 2001-05-17 04:38:16Z jrm21 $
21 *
22 **************************************************************************/
23
24#ifndef LOCAL_STRINGS_H
25#define LOCAL_STRINGS_H
26
27#include "sysfuncs.h"
28
29class mgString
30{
31 u_char *data;
32 public:
33 inline int length()
34 {
35 return data[0];
36 }
37 inline u_char *rawdata()
38 {
39 return data;
40 }
41 inline void read(u_char **base)
42 {
43 unsigned int copy, suff;
44
45 copy = **base;
46 *base = *base + 1;
47 suff = **base;
48 *base = *base + 1;
49 memcpy( (data + copy + 1), *base, suff);
50 *data = copy + suff;
51 *base += suff;
52 }
53 inline void read(FILE *dict)
54 {
55 unsigned int copy, suff;
56 copy = fgetc(dict);
57 suff = fgetc(dict);
58 fread(data + copy + 1, sizeof(u_char), suff, dict);
59 *data = copy + suff;
60 }
61 inline static void readString(u_char **base, u_char *prev)
62 {
63 ((mgString *) &prev)->read(base);
64 }
65 inline static void readString(FILE *dict, u_char *prev)
66 {
67 ((mgString *) &prev)->read(dict);
68 }
69};
70
71int arg_atoi (char *str);
72int compare (u_char * s1, u_char * s2);
73int casecompare (u_char * s1, u_char * s2); /* [RPAP - Jan 97: Stem Index Change] */
74u_char *copy_string (u_char * src_str);
75char *str255_to_string (u_char * str255, char *str);
76int prefixlen (u_char * s1, u_char * s2);
77char *char2str (u_char c);
78char *word2str (u_char * s);
79char *de_escape_string (char *s);
80
81#endif
Note: See TracBrowser for help on using the repository browser.