|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ T c ┃
Length: 1272 (0x4f8) Types: TextFile Names: »convert.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen └─ ⟦this⟧ »cph85dist/stat/src/convert.c«
#include "unixstat.h" FUN(convert,conversion functions with type and range checking,0.0,1985) int str_int (input, purpose, min, max) char *input; /* the input value to be converted */ char *purpose; /* the value in English */ int min; /* minimum allowable value */ int max; /* maximum allowable value */ { int atoi (); if (!INTEGER (input)) ERRMSG2 (input value '%s' (%s) is not an integer, input, purpose) ival = atoi (input); if (ival < min) ERRMSG3 (input value %d (%s) is less than minimum: %d, ival, purpose, min) if (ival > max) return (ERR_MAX); ERRMSG3 (input value %d (%s) is greater than maximum: %d, ival, purpose, max) return (ival); } double str_dbl (input, purpose, min, max) char *input; /* the input value to be converted */ char *purpose; /* the value in English */ double min; /* minimum allowable value */ double max; /* maximum allowable value */ { double atoi (); double dval; if (!number (input)) ERRMSG2 (input value '%s' (%s) is not a number, input, purpose) dval = atof (input); if (dval < min) ERRMSG3 (input value %g (%s) is less than minimum: %g, ival, purpose, min) if (dval > max) ERRMSG3 (input value %g (%s) is greater than maximum: %g, ival, purpose, max) return (dval); }