5 #define _(s) gettext(s)
6 #define gettext_noop(s) s
7 #define N_(s) gettext_noop(s)
15 char bfr[BFRSZ], *bp = 0;
20 FILE *ifp = 0, *ofp = 0;
24 if( lastch < 0 ) return -1;
25 if ((lastch=getc(ifp)) == '\n') linenum++;
32 if( c == '\n' ) --linenum;
36 // return uncommented char
41 if( in_quote || c != '/' ) return c;
45 *bp++ = '/'; *bp++ = '*';
48 int ch = c; c = ngetc();
51 if( ch == '*' && c == '/') break;
55 *bp++ = '/'; *bp++ = '/';
70 // skip preprocessor lines
75 int ch = c; c = cch();
77 if( !start_line || c != '#' ) break;
82 } while( c != '\n' || ch == '\\' );
85 start_line = c == '\n' ? 1 : 0;
91 if( c < '0' ) return 0;
92 if( c <= '9' ) return 1;
93 if( c < 'A' ) return 0;
94 if( c <= 'Z' ) return 1;
95 if( c == '_' ) return 1;
96 if( c < 'a' ) return 0;
97 if( c <= 'z' ) return 1;
103 if( c <= ' ' ) return 1;
107 // scan next seperator + symbol
111 if( c < 0 ) return c;
112 if( c == '\"' || c == '\'' ) return c;
117 if( c < 0 ) return c;
118 if( c == '"' || c == '\'' ) break;
119 if( !is_idch(c) ) break;
128 if( c < 0 ) return c;
129 if( c == '\"' || c == '\'' ) break;
130 if( is_idch(c) ) break;
140 // sym has preceeding symbol string
141 // sep has non-ws seperator string
142 // bfr has "string" in it
145 if( strlen(bfr) < 2 ) return 0;
146 if( !strcmp(sym,"_") && !strcmp(sep,"(") ) return 0;
147 // add protected names here
148 if( !strcmp(sym,"get") && !strcmp(sep,"(") ) return 0;
149 if( !strcmp(sym,"get_property") && !strcmp(sep,"(") ) return 0;
150 if( !strcmp(sym,"set_property") && !strcmp(sep,"(") ) return 0;
151 if( !strcmp(sym,"set_title") && !strcmp(sep,"(") ) return 0;
152 if( !strcmp(sym,"title_is") && !strcmp(sep,"(") ) return 0;
153 if( !strcmp(sym,"GET_DEFAULT") && !strcmp(sep,"(") ) return 0;
154 if( !strcmp(sym,"UPDATE_DEFAULT") && !strcmp(sep,"(") ) return 0;
155 if( !strcmp(sym,"TRACE") && !strcmp(sep,"(") ) return 0;
156 if( !strcmp(sym,"lock") && !strcmp(sep,"(") ) return 0;
157 if( !strcmp(sym,"unlock") && !strcmp(sep,"(") ) return 0;
158 if( !strcmp(sym,"lock_window") && !strcmp(sep,"(") ) return 0;
159 if( !strcmp(sym,"unlock_window") && !strcmp(sep,"(") ) return 0;
160 if( !strcmp(sym,"update") && !strcmp(sep,"(") ) return 0;
161 if( !strcmp(sym,"new_image") && !strcmp(sep,"(") ) return 0;
162 if( !strcmp(sym,"get_image") && !strcmp(sep,"(") ) return 0;
163 if( !strcmp(sym,"get_image_set") && !strcmp(sep,"(") ) return 0;
164 if( !strcmp(sym,"Mutex") && !strcmp(sep,"(") ) return 0;
165 if( !strcmp(sym,"SceneNode") && !strcmp(sep,"(") ) return 0;
166 if( !strcmp(sym,"Garbage") && !strcmp(sep,"(") ) return 0;
167 if( !strcmp(sym,"dbmsg") && !strcmp(sep,"(") ) return 0;
168 if( strstr(bfr, "::") || !strncmp(bfr, "/dev/", 5) ) return 0;
169 if( !strcmp(bfr,"toc") || !strcmp(bfr,".toc") ) return 0;
170 if( !strcmp(bfr,"idx") || !strcmp(bfr,".idx") ) return 0;
171 if( !strcmp(bfr,"ads") || !strcmp(bfr,".ads") ) return 0;
173 for( bp=bfr; *bp; ++bp ) {
174 if( is_ws(*bp) ) continue;
175 if( *bp == '\\' ) { ++bp; continue; }
176 if( *bp != '%' ) break;
177 while( bp[1] && !strchr("diojxXeEfFgFaAcsCSpnm%",*++bp) );
183 int main(int ac, char **av)
189 bp = &bfr[0]; *bp = 0;
194 bp = &bfr[0]; *bp = 0;
197 while( (c=nch()) >= 0 ) {
198 if( c == in_quote ) break;
200 *bp++ = c; c = nch();
208 int do_nl = need_nl();
220 else if( c == '\'' ) {
222 while( (c=nch()) >= 0 ) {
223 if( c == in_quote ) break;
225 *bp++ = c; c = nch();