| 11 |
|
#include "paths.h" |
| 12 |
|
#include "otypes.h" |
| 13 |
|
#include "func.h" |
| 14 |
+ |
#include <ctype.h> |
| 15 |
|
|
| 16 |
|
|
| 17 |
|
#define INITFILE "rayinit.cal" |
| 60 |
|
setprismfuncs(); |
| 61 |
|
loadfunc(rayinitcal); |
| 62 |
|
rayinitcal[0] = '\0'; |
| 63 |
+ |
} |
| 64 |
+ |
|
| 65 |
+ |
|
| 66 |
+ |
/* Set parameters for current evaluation */ |
| 67 |
+ |
void |
| 68 |
+ |
set_eparams(char *prms) |
| 69 |
+ |
{ |
| 70 |
+ |
static char *last_params = NULL; |
| 71 |
+ |
char vname[RMAXWORD]; |
| 72 |
+ |
double value; |
| 73 |
+ |
char *cpd; |
| 74 |
+ |
/* check if already set */ |
| 75 |
+ |
if ((prms == NULL) | (prms == last_params)) |
| 76 |
+ |
return; |
| 77 |
+ |
if (last_params != NULL && !strcmp(prms, last_params)) |
| 78 |
+ |
return; |
| 79 |
+ |
last_params = prms; /* assign each variable */ |
| 80 |
+ |
while (*prms) { |
| 81 |
+ |
if (isspace(*prms)) { |
| 82 |
+ |
++prms; continue; |
| 83 |
+ |
} |
| 84 |
+ |
if (!isalpha(*prms)) |
| 85 |
+ |
goto bad_params; |
| 86 |
+ |
cpd = vname; |
| 87 |
+ |
while (*prms && (*prms != '=') & !isspace(*prms)) { |
| 88 |
+ |
if (!isid(*prms)) |
| 89 |
+ |
goto bad_params; |
| 90 |
+ |
*cpd++ = *prms++; |
| 91 |
+ |
} |
| 92 |
+ |
if (cpd == vname) |
| 93 |
+ |
goto bad_params; |
| 94 |
+ |
*cpd = '\0'; |
| 95 |
+ |
while (isspace(*prms)) prms++; |
| 96 |
+ |
if (*prms++ != '=') |
| 97 |
+ |
goto bad_params; |
| 98 |
+ |
value = atof(prms); |
| 99 |
+ |
if ((prms = fskip(prms)) == NULL) |
| 100 |
+ |
goto bad_params; |
| 101 |
+ |
while (isspace(*prms)) prms++; |
| 102 |
+ |
prms += (*prms == ',') | (*prms == ';'); |
| 103 |
+ |
varset(vname, '=', value); |
| 104 |
+ |
} |
| 105 |
+ |
return; |
| 106 |
+ |
bad_params: |
| 107 |
+ |
sprintf(errmsg, "bad parameter list '%s'", last_params); |
| 108 |
+ |
error(USER, errmsg); |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
|