Оболочка ядра программы
 Указатель Структуры данных Файлы Функции Переменные Определения типов Перечисления Элементы перечислений Макросы Страницы
См. документацию.
1 /* ----------------------------------------------------------------<Prolog>-
2  Name: sflstr.h
3  Title: String-handling functions
4  Package: Standard Function Library (SFL)
6  Written: 1992/10/25 iMatix SFL project team <sfl@imatix.com>
7  Revised: 1999/06/22
9  Synopsis: Provides various string-handling functions. Some of these
10  functions are available on some but not all platforms; others
11  are useful tools for string handling.
13  Copyright: Copyright (c) 1996-2000 iMatix Corporation
14  License: This is free software; you can redistribute it and/or modify
15  it under the terms of the SFL License Agreement as provided
16  in the file LICENSE.TXT. This software is distributed in
17  the hope that it will be useful, but without any warranty.
18  ------------------------------------------------------------------</Prolog>-*/
20 #ifndef SFLSTR_INCLUDED /* Allow multiple inclusions */
23 /* Macro to prepare call to xstrcpy */
24 #if (defined (DEBUG))
25 # define xstrcpy_debug() { xstrcpy_file = __FILE__; xstrcpy_line = __LINE__;}
26 #else
27 # define xstrcpy_debug()
28 #endif
30 extern char *xstrcpy_file;
31 extern word xstrcpy_line;
33 /* Structure defines simple unsorted lookup table */
34 typedef struct {
35  char *key;
36  int value;
37 } LOOKUP;
39 /* Function prototypes */
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
45 char *strdupl (const char *string);
46 char **strfree (char **string);
47 char *strskp (const char *string);
48 char *strcset (char *string, char ch);
49 char *strpad (char *string, char ch, int length);
50 char *strlwc (char *string);
51 char *strupc (char *string);
52 char *strcrop (char *string);
53 char *stropen (char *string, Bool align);
54 char *strclose (char *string, Bool align);
55 char *strunique (char *string, char unique);
56 int strmatch (const char *string1, const char *string2);
57 qbyte strhash (const char *string);
58 Bool strprefixed (const char *string, const char *prefix);
59 char *strprefix (const char *string, const char *delims);
60 char *strdefix (const char *string, const char *prefix);
61 char *strconvch (char *string, char from, char to);
62 char *xstrcat (char *dest, const char *src, ...);
63 char *xstrcpy (char *dest, const char *src, ...);
64 int lexcmp (const char *string1, const char *string2);
65 int lexncmp (const char *string1, const char *string2,
66  const int count);
67 int lexwcmp (const char *string1, const char *string2);
68 char *soundex (const char *string);
69 char *soundexn (const char *string, int size, Bool fold);
70 DESCR *strt2descr (char **strings);
71 char **descr2strt (const DESCR *descr);
72 void strtfree (char **strings);
73 int strcntch (const char *string, char value);
74 int strlookup (const LOOKUP *lookup, const char *key);
75 char *strreformat (const char *source, size_t width, const char *prefix);
77 char *removechars (char *str, char *chrs);
78 char *replacechrswith (char *str, char *chrs, char ctorlcwth);
79 char *insertstring (char *str, char *chrstoins, int pos);
80 char *insertchar (char *str, char chrtoins, int pos);
81 char *leftfill (char *str, char chrtofill, unsigned len);
82 char *rightfill (char *str, char chrtofill, unsigned len);
83 char *trim (char *strin);
84 char *ltrim (char *string);
85 char *searchreplace (char *str, char *strtofnd, char *strtoins);
86 char *deletestring (char *str, char *strtodel, int ignorecase);
87 char *getstrfld (char *str, int fln, int ofset,
88  char *sep, char *ret);
89 char *setstrfld (char *str, int fln, int ofset,
90  char *sep, char *ins);
91 int getstrfldlen (char *str, int fln, int ofset, char *sep);
92 char *findstrinfile (FILE *fp, char *find, char *retstr, int *iLnNo);
93 char *getequval (char *strline, char *strretstr);
94 int matchtable (char *str, char *strmatch,
95  char *strsept, int ncse);
96 char *stringreplace (char *strbuf, char *strpattern);
97 char *wordwrapstr (char *strbuff, int iwid);
98 char *stricstr (const char *str1, const char *str2);
99 int strtempcmp (const char *str1, const char *strPat);
100 int istoken (char **strLine, const char *strtoken,
101  int *iWasToken);
102 int isoneoftokens (char **str, char *strmat,
103  char *strsep, int *iWasTk);
104 char *eatstr (char **strBuff, char *strToEat);
105 char *eatstrpast (char **strBuff, char *strCharsToEatPast);
106 char *movestrpast (char **strBuff, char cCharToEatPast);
107 char *eatchar (char **strBuff, char cChar);
109 #ifdef __cplusplus
110 }
111 #endif
113 /* Macros & defines */
114 #define IGNORECASE 0
115 #define SENSECASE 1
117 #define mstrncpy(dest,src,len) {strncpy(dest,src,len);*(dest+len)='\0';}
118 #define cstrcpy(dest,src) {*dest=src;*(dest+1)='\0';}
119 #define deletechar(strbuf,pos) strcpy((strbuf+pos),(strbuf+pos+1))
120 #define deletechars(strbuf,pos,cnt) strcpy((strbuf+pos),(strbuf+pos+cnt))
121 #define getcommandlinearg(argnum) ((argnum)<=(argc-1))?argv[argnum]:""
122 #define numofcmdargs() ((argc-1)>0?argc-1:0)
123 #define checkargcnt(reqnum) ((argc-1)>=(reqnum)?1:0)
125 #endif
int strcntch(const char *string, char value)
Definition: sflstr.c:772
char * getequval(char *strline, char *strretstr)
Definition: sflstr.c:1345
qbyte strhash(const char *string)
Definition: sflstr.c:494
char * insertstring(char *str, char *chrstoins, int pos)
Definition: sflstr.c:887
int lexncmp(const char *string1, const char *string2, const int count)
Definition: sflstr.c:610
char * strpad(char *string, char ch, int length)
Definition: sflstr.c:134
char * eatstrpast(char **strBuff, char *strCharsToEatPast)
Definition: sflstr.c:1766
char * leftfill(char *str, char chrtofill, unsigned len)
Definition: sflstr.c:932
int lexcmp(const char *string1, const char *string2)
Definition: sflstr.c:578
char * removechars(char *str, char *chrs)
Definition: sflstr.c:821
char * strupc(char *string)
Definition: sflstr.c:184
char * strreformat(const char *source, size_t width, const char *prefix)
char * rightfill(char *str, char chrtofill, unsigned len)
Definition: sflstr.c:956
char * strlwc(char *string)
Definition: sflstr.c:157
char * key
Definition: sflstr.h:35
char * searchreplace(char *str, char *strtofnd, char *strtoins)
Definition: sflstr.c:1022
int value
Definition: sflstr.h:36
char * setstrfld(char *str, int fln, int ofset, char *sep, char *ins)
Definition: sflstr.c:1173
char * soundexn(const char *string, int size, Bool fold)
Definition: sflstr.c:712
void strtfree(char **strings)
char * movestrpast(char **strBuff, char cCharToEatPast)
Definition: sflstr.c:1797
char * xstrcpy_file
Definition: sflstr.c:21
char ** descr2strt(const DESCR *descr)
int istoken(char **strLine, const char *strtoken, int *iWasToken)
Definition: sflstr.c:1682
int matchtable(char *str, char *strmatch, char *strsept, int ncse)
Definition: sflstr.c:1380
int lexwcmp(const char *string1, const char *string2)
Definition: sflstr.c:649
int strlookup(const LOOKUP *lookup, const char *key)
Definition: sflstr.c:797
word xstrcpy_line
Definition: sflstr.c:22
char * deletestring(char *str, char *strtodel, int ignorecase)
Definition: sflstr.c:1063
char * strcrop(char *string)
Definition: sflstr.c:211
char * ltrim(char *string)
Definition: sflstr.c:1001
char str[100]
Definition: asterisk_tools_taxi.c:47
int getstrfldlen(char *str, int fln, int ofset, char *sep)
Definition: sflstr.c:1224
char * xstrcat(char *dest, const char *src,...)
Definition: sflstr.c:552
char * insertchar(char *str, char chrtoins, int pos)
Definition: sflstr.c:910
char * strprefix(const char *string, const char *delims)
Bool strprefixed(const char *string, const char *prefix)
Definition: sflstr.c:438
char * trim(char *strin)
Definition: sflstr.c:981
char * stricstr(const char *str1, const char *str2)
Definition: sflstr.c:1559
char * strskp(const char *string)
Definition: sflstr.c:94
char * findstrinfile(FILE *fp, char *find, char *retstr, int *iLnNo)
Definition: sflstr.c:1278
char * getstrfld(char *str, int fln, int ofset, char *sep, char *ret)
Definition: sflstr.c:1109
char * soundex(const char *string)
Definition: sflstr.c:686
Definition: sflstr.h:34
int isoneoftokens(char **str, char *strmat, char *strsep, int *iWasTk)
Definition: sflstr.c:1864
DESCR * strt2descr(char **strings)
char * strunique(char *string, char unique)
Definition: sflstr.c:298
int strtempcmp(const char *str1, const char *strPat)
Definition: sflstr.c:1607
char * strcset(char *string, char ch)
Definition: sflstr.c:115
char ** strfree(char **string)
Definition: sflstr.c:73
char * replacechrswith(char *str, char *chrs, char ctorlcwth)
Definition: sflstr.c:851
char * eatstr(char **strBuff, char *strToEat)
Definition: sflstr.c:1734
char * stringreplace(char *strbuf, char *strpattern)
Definition: sflstr.c:1454
char * eatchar(char **strBuff, char cChar)
Definition: sflstr.c:1829
int strmatch(const char *string1, const char *string2)
Definition: sflstr.c:334
char * strclose(char *string, Bool align)
Definition: sflstr.c:271
char * strdefix(const char *string, const char *prefix)
Definition: sflstr.c:464
char * strdupl(const char *string)
Definition: sflstr.c:41
char * strconvch(char *string, char from, char to)
Definition: sflstr.c:521
char * wordwrapstr(char *strbuff, int iwid)
Definition: sflstr.c:1505
char * stropen(char *string, Bool align)
Definition: sflstr.c:241
char * xstrcpy(char *dest, const char *src,...)