| Revision: | 2.2 |
| Committed: | Sat Feb 22 02:07:30 2003 UTC (22 years, 10 months ago) by greg |
| Content type: | text/plain |
| Branch: | MAIN |
| CVS Tags: | rad3R5 |
| Changes since 2.1: | +1 -4 lines |
| Log Message: | Changes and check-in for 3.5 release Includes new source files and modifications not recorded for many years See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release |
| # | Content |
|---|---|
| 1 | #ifndef lint |
| 2 | static const char RCSid[] = "$Id$"; |
| 3 | #endif |
| 4 | /* |
| 5 | * Convert angle ranges of the form a-b:s,c to discrete values |
| 6 | */ |
| 7 | |
| 8 | #include <ctype.h> |
| 9 | |
| 10 | #include "setscan.h" |
| 11 | |
| 12 | |
| 13 | setscan(ang, arg) /* set up scan according to arg */ |
| 14 | register ANGLE *ang; |
| 15 | register char *arg; |
| 16 | { |
| 17 | int state = ','; |
| 18 | int start, finish, step; |
| 19 | |
| 20 | while (state) { |
| 21 | switch (state) { |
| 22 | case ',': |
| 23 | start = atoi(arg); |
| 24 | finish = start; |
| 25 | step = 1; |
| 26 | break; |
| 27 | case '-': |
| 28 | finish = atoi(arg); |
| 29 | if (finish < start) |
| 30 | return(-1); |
| 31 | break; |
| 32 | case ':': |
| 33 | step = atoi(arg); |
| 34 | break; |
| 35 | default: |
| 36 | return(-1); |
| 37 | } |
| 38 | if (!isdigit(*arg)) |
| 39 | return(-1); |
| 40 | do |
| 41 | arg++; |
| 42 | while (isdigit(*arg)); |
| 43 | state = *arg++; |
| 44 | if (!state || state == ',') |
| 45 | while (start <= finish) { |
| 46 | *ang++ = start; |
| 47 | start += step; |
| 48 | } |
| 49 | } |
| 50 | *ang = AEND; |
| 51 | return(0); |
| 52 | } |