source: gsdl/trunk/trunk/mgpp/lib/local_strings.h@ 16583

Last change on this file since 16583 was 16583, checked in by davidb, 16 years ago

Undoing change commited in r16582

  • 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 **************************************************************************/
21
22#ifndef LOCAL_STRINGS_H
23#define LOCAL_STRINGS_H
24
25#include "sysfuncs.h"
26
27class mgString
28{
29 u_char *data;
30 public:
31 inline int length()
32 {
33 return data[0];
34 }
35 inline u_char *rawdata()
36 {
37 return data;
38 }
39 inline void read(u_char **base)
40 {
41 unsigned int copy, suff;
42
43 copy = **base;
44 *base = *base + 1;
45 suff = **base;
46 *base = *base + 1;
47 memcpy( (data + copy + 1), *base, suff);
48 *data = copy + suff;
49 *base += suff;
50 }
51 inline void read(FILE *dict)
52 {
53 unsigned int copy, suff;
54 copy = fgetc(dict);
55 suff = fgetc(dict);
56 fread(data + copy + 1, sizeof(u_char), suff, dict);
57 *data = copy + suff;
58 }
59 inline static void readString(u_char **base, u_char *prev)
60 {
61 ((mgString *) &prev)->read(base);
62 }
63 inline static void readString(FILE *dict, u_char *prev)
64 {
65 ((mgString *) &prev)->read(dict);
66 }
67};
68
69int arg_atoi (char *str);
70int compare (u_char * s1, u_char * s2);
71int casecompare (u_char * s1, u_char * s2); /* [RPAP - Jan 97: Stem Index Change] */
72u_char *copy_string (u_char * src_str);
73char *str255_to_string (u_char * str255, char *str);
74int prefixlen (u_char * s1, u_char * s2);
75char *char2str (u_char c);
76char *word2str (u_char * s);
77char *de_escape_string (char *s);
78
79#endif
Note: See TracBrowser for help on using the repository browser.