51 quoted = (*format ==
'{');
92 for(cp = text = copy; !done; cp++) {
100 if(*cp == 0 || *cp ==
'.' || (*cp ==
'}' && quoted))
117 f = strtol(text, NULL, 0);
131 t = strtol(text, NULL, 0);
137 s = strtol(text, NULL, 0);
139 if(lower_given && upper_given)
141 else if(lower_given) {
147 }
else if(upper_given) {
164 one.
type = this_type;
179 if(quoted && *cp ==
'}')
182 *endptr = (
char *)format + (cp - copy);
183 if(curr && curr < size)
204 for(i = 0; i < 11; i++)
212 mdvi_error(
_(
"invalid page specification `%s'\n"), format);
218 if(*format ==
'D' || *format ==
'd' || *ptr !=
'.')
232 mdvi_warning(
_(
"garbage after DVI page specification ignored\n"));
236 for(i++; *ptr ==
'.' && i <= 10; i++) {
260 mdvi_warning(
_(
"more than 10 counters in page specification\n"));
262 mdvi_warning(
_(
"garbage after TeX page specification ignored\n"));
277 spec[0]->nranges, dvipage);
281 for(i = 1; i <= 10; i++) {
285 spec[i]->nranges, (
int)page[i]);
296 for(i = 0; i < 11; i++)
308 for(r = range; r < range + nitems; r++) {
316 cond = (value <= r->
from) && (value >= r->
to);
318 cond = (value <= r->
to) && (value >= r->
from);
319 if(cond && ((value - r->
from) % r->
step) == 0)
326 cond = (value < r->
from);
328 cond = (value > r->
from);
329 if(cond && ((value - r->
from) % r->
step) == 0)
336 cond = (value > r->
to);
338 cond = (value < r->
to);
339 if(cond && ((value - r->
to) % r->
step) == 0)
343 if((value % r->
step) == 0)
356 for(r = range; r < range + nitems; r++) {
373 switch(range->
type) {
375 printf(
"From %d to %d, step %d\n",
379 printf(
"From %d, step %d\n",
383 printf(
"From %d, step -%d\n",
387 printf(
"From 0, step %d and %d\n",
409 printf(
"Range> "); fflush(stdout);
410 if(fgets(buf, 256, stdin) == NULL)
412 if(buf[strlen(buf)-1] ==
'\n')
413 buf[strlen(buf)-1] = 0;
419 printf(
"range is empty\n");
423 for(i = 0; i < count; i++) {
424 printf(
"Range %d (%d elements):\n",
426 print_range(&range[i]);
429 printf(
"Tail: [%s]\n", end);
430 printf(
"range has %d elements\n",
436 printf(
"Value: "); fflush(stdout);
437 if(fgets(buf, 256, stdin) == NULL)
439 if(buf[strlen(buf)-1] ==
'\n')
440 buf[strlen(buf)-1] = 0;
446 printf(
"%d not in range\n", v);
448 printf(
"%d in range: ", v);
449 print_range(&range[i]);
460 printf(
"Spec> "); fflush(stdout);
461 if(fgets(buf, 256, stdin) == NULL)
463 if(buf[strlen(buf)-1] ==
'\n')
464 buf[strlen(buf)-1] = 0;
469 printf(
"no spec parsed\n");
474 for(i = 0; i < 11; i++) {
475 printf(
"Counter %d:\n", i);
479 for(k = 0; k < spec[i]->
nranges; k++)
480 print_range(&spec[i]->ranges[k]);