3#ifdef STANDALONE_PARSER
27 printf(
"libparse: a syntax-checker for Singular Libraries.\n");
30 printf(
" -f <singular library> : performs syntax-checks\n");
31 printf(
" -d [digit] : digit=1,..,4 increases the verbosity of the checks\n");
32 printf(
" -s : turns on reporting about violations of unenforced syntax rules\n");
33 printf(
" -i : perl output of examples and help of procs\n");
34 printf(
" -c : print category of lib to stdout and exit\n");
35 printf(
" -h : print this message\n");
105 printf(
"No library found to parse.\n");
117 printf(
"*** INFO-string should come before every procedure definition.\n");
119 printf(
"*** VERSION-string should come before every procedure definition.\n");
123 const char *procname,
int line,
long pos,
128 *(
pi->libname+
strlen(libname)) =
'\0';
135 pi->data.s.proc_start = pos;
136 pi->data.s.def_end = 0L;
137 pi->data.s.help_start = 0L;
138 pi->data.s.body_start = 0L;
139 pi->data.s.body_end = 0L;
140 pi->data.s.example_start = 0L;
141 pi->data.s.proc_lineno = line;
142 pi->data.s.body_lineno = 0;
143 pi->data.s.example_lineno = 0;
145 pi->data.s.help_chksum = 0;
178 if (c ==
'@' || c ==
'$')
putchar(
'\\');
200 if(
pi->data.s.body_end==0)
201 pi->data.s.body_end =
pi->data.s.proc_end;
205 if ((!
pi->is_static) &&
206 (
pi->data.s.body_start -
pi->data.s.def_end > 10) &&
209 printf(
"push(@procs, \"%s\");\n",
pi->procname);
210 printf(
"$help{\"%s\"} = <<EOT;\n",
pi->procname);
213 if ((
pi->data.s.example_start > 0) &&
214 (
pi->data.s.proc_end -
pi->data.s.example_start > 10))
216 printf(
"$example{\"%s\"} = <<EOT;\n",
pi->procname);
220 printf(
"$chksum{\"%s\"} = %ld;\n",
pi->procname,
pi->data.s.help_chksum);
226 printf(
"%c %-15s %20s ",
pi->is_static ?
'l' :
'g',
pi->libname,
228 printf(
"line %4d,%5ld-%-5ld %4d,%5ld-%-5ld %4d,%5ld-%-5ld\n",
229 pi->data.s.proc_lineno,
pi->data.s.proc_start,
pi->data.s.def_end,
230 pi->data.s.body_lineno,
pi->data.s.body_start,
pi->data.s.body_end,
231 pi->data.s.example_lineno,
pi->data.s.example_start,
232 pi->data.s.proc_end);
234 if(!
pi->is_static && (
pi->data.s.body_start-
pi->data.s.def_end)<4)
235 printf(
"*** Procedure '%s' is global and has no help-section.\n",
237 if(!
pi->is_static && !
pi->data.s.example_start)
238 printf(
"*** Procedure '%s' is global and has no example-section.\n",\
241 printf(
"*** found proc within procedure '%s'.\n",
pi->procname);
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
VAR int found_proc_in_proc