File: vdef.h

package info (click to toggle)
vfu 5.09-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,552 kB
  • sloc: cpp: 16,739; ansic: 2,605; perl: 678; makefile: 349; sh: 75
file content (156 lines) | stat: -rw-r--r-- 4,441 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/****************************************************************************
 #
 #  VSTRING Library
 #
 #  Copyright (c) 1996-2023 Vladi Belperchinov-Shabanski "Cade" 
 #  http://cade.noxrun.com/  <cade@noxrun.com> <cade@bis.bg> <cade@cpan.org>
 #
 #  Distributed under the GPL license, you should receive copy of GPLv2!
 #
 #  SEE 'README', 'LICENSE' OR 'COPYING' FILE FOR LICENSE AND OTHER DETAILS!
 #
 #  VSTRING library provides wide set of string manipulation features
 #  including dynamic string object that can be freely exchanged with
 #  standard char* (or wchar_t*) type, so there is no need to change 
 #  function calls nor the implementation when you change from 
 #  char* to VString (and from wchar_t* to WString). 
 # 
 ***************************************************************************/

  #undef PCRE2_CODE_UNIT_WIDTH

  #undef VS_CHAR          
  #undef VS_CHAR_R
  #undef VS_CHAR_L
  #undef VS_SFMT

  #undef VS_STRING_CLASS  
  #undef VS_STRING_CLASS_R
  #undef VS_ARRAY_CLASS   
  #undef VS_TRIE_CLASS    
  #undef VS_REGEXP_CLASS
  #undef VS_CHARSET_CLASS

  #undef VS_STRING_BOX    
  #undef VS_ARRAY_BOX     
  #undef VS_TRIE_BOX      
  #undef VS_TRIE_NODE     

  #undef VS_FN_PRINTF     
  #undef VS_FN_SPRINTF    
  #undef VS_FN_VSPRINTF   
  #undef VS_FN_STRLEN     
  #undef VS_FN_STRCPY     
  #undef VS_FN_STRCAT     
  #undef VS_FN_STRCMP     
  #undef VS_FN_STRNCMP    
  #undef VS_FN_STRCHR     
  #undef VS_FN_STRRCHR
  #undef VS_FN_STRSTR     
  #undef VS_FN_STRDUP     
  #undef VS_FN_STRTOL
  #undef VS_FN_STRTOLL
  #undef VS_FN_STRTOD
  #undef VS_FN_TOUPPER    
  #undef VS_FN_TOLOWER    
  
  #undef VS_FN_CONVERT

  #undef LENOF_VS_CHAR

#ifdef _VSTRING_WIDE_

  #include <wctype.h>
  #include <wchar.h>

  #define PCRE2_CODE_UNIT_WIDTH 32
  
  #define VS_CHAR           wchar_t
  #define VS_CHAR_R         char
  #define VS_CHAR_L(s)      L##s
  #define VS_SFMT           "%ls"

  #define VS_STRING_CLASS   WString
  #define VS_STRING_CLASS_R VString
  #define VS_ARRAY_CLASS    WArray
  #define VS_TRIE_CLASS     WTrie
  #define VS_REGEXP_CLASS   WRegexp
  #define VS_CHARSET_CLASS  WCharSet

  #define VS_STRING_BOX     WStringBox
  #define VS_ARRAY_BOX      WArrayBox
  #define VS_TRIE_BOX       WTrieBox
  #define VS_TRIE_NODE      WTrieNode

  #define VS_FN_PRINTF      wprintf
  #define VS_FN_SPRINTF     swprintf
  #define VS_FN_VSPRINTF    vswprintf
  #define VS_FN_STRLEN      wcslen
  #define VS_FN_STRCPY      wcscpy
  #define VS_FN_STRCAT      wcscat
  #define VS_FN_STRCMP      wcscmp
  #define VS_FN_STRNCMP     wcsncmp
  #define VS_FN_STRCHR      wcschr
  #define VS_FN_STRRCHR     wcsrchr
  #define VS_FN_STRSTR      wcsstr
  #define VS_FN_STRDUP      wcsdup
  #define VS_FN_STRTOL(s)   wcstol(s,NULL,10)
  #define VS_FN_STRTOLL(s)  wcstoll(s,NULL,10)
  #define VS_FN_STRTOD(s)   wcstod(s,NULL)
  #define VS_FN_TOUPPER     towupper
  #define VS_FN_TOLOWER     towlower

  #define VS_FN_CONVERT     mbstowcs

#else

  #define PCRE2_CODE_UNIT_WIDTH  8

  #define VS_CHAR           char
  #define VS_CHAR_R         wchar_t
  #define VS_CHAR_L
  #define VS_SFMT           "%s"

  #define VS_STRING_CLASS   VString
  #define VS_STRING_CLASS_R WString
  #define VS_ARRAY_CLASS    VArray
  #define VS_TRIE_CLASS     VTrie
  #define VS_REGEXP_CLASS   VRegexp
  #define VS_CHARSET_CLASS  VCharSet

  #define VS_STRING_BOX     VStringBox
  #define VS_ARRAY_BOX      VArrayBox
  #define VS_TRIE_BOX       VTrieBox
  #define VS_TRIE_NODE      VTrieNode

  #define VS_FN_PRINTF      printf
  #define VS_FN_SPRINTF     snprintf
  #define VS_FN_VSPRINTF    vsnprintf
  #define VS_FN_STRLEN      strlen
  #define VS_FN_STRCPY      strcpy
  #define VS_FN_STRCAT      strcat
  #define VS_FN_STRCMP      strcmp
  #define VS_FN_STRNCMP     strncmp
  #define VS_FN_STRCHR      strchr
  #define VS_FN_STRRCHR     strrchr
  #define VS_FN_STRSTR      strstr
  #define VS_FN_STRDUP      strdup
  #define VS_FN_STRTOL(s)   strtol(s,NULL,10)
  #define VS_FN_STRTOLL(s)  strtoll(s,NULL,10)
  #define VS_FN_STRTOD(s)   strtod(s,NULL)
  #define VS_FN_TOUPPER     toupper
  #define VS_FN_TOLOWER     tolower

  #define VS_FN_CONVERT     wcstombs

#endif

  #define LENOF_VS_CHAR(n) ((sizeof(n)<1)?(0):(sizeof(n)/sizeof(VS_CHAR)))

/***************************************************************************
**
** EOF
**
****************************************************************************/