1: _Iint (iptr, length, numbase)
   2:     int *iptr, length;
   3: {
   4:     int n, minus, numdig;
   5:     extern int _Isfil, (*_Iungc)(), (*_Igetc)();
   6:     int c, dval;
   7: 
   8: n = minus = numdig = 0;
   9: switch ((c=_Inxch()))
  10:     {
  11:     case '-': minus = 1;
  12:     case '+': break;
  13:     default: (*_Iungc)(c,_Isfil);
  14:     }
  15: while ((dval=_Idigt(c=((*_Igetc)(_Isfil)), numbase ) ) >= 0 && numdig++ < length)
  16:     n = n*numbase + dval;
  17: (*_Iungc)(c,_Isfil);
  18: if (numdig == 0)
  19:     return (-1);
  20: if (iptr == 0)
  21:     return (0);
  22: *iptr = minus ? -n : n;
  23: return (1);
  24: }
  25: 
  26: _Idigt (x, base)
  27: {
  28: switch (x)
  29:     {
  30:     case '0':
  31:     case '1':
  32:     case '2':
  33:     case '3':
  34:     case '4':
  35:     case '5':
  36:     case '6':
  37:     case '7':
  38:         return(x-'0');
  39:     case '8':
  40:     case '9':
  41:         if (base > 8)
  42:             return(x - '0');
  43:     case 'a':
  44:     case 'b':
  45:     case 'c':
  46:     case 'd':
  47:     case 'e':
  48:     case 'f':
  49:         if (base >10)
  50:             return(x - 'a' + 10);
  51:     case 'A':
  52:     case 'B':
  53:     case 'C':
  54:     case 'D':
  55:     case 'E':
  56:     case 'F':
  57:         if (base > 10)
  58:             return(x-'A' + 10);
  59:     }
  60: return(-1);
  61: }
  62: 
  63: _Ilong (dptr, length)
  64:     double *dptr;
  65:     int length;
  66: {
  67:     char temp[75];
  68:     int _Inodg();
  69:     double x;
  70:     double atof();
  71: 
  72: if (_Isstr(temp, length, _Inodg) < 0)
  73:     return (-1);
  74: x = atof(temp);
  75: if (dptr == 0)
  76:     return (0);
  77: *dptr = x;
  78: return (1);
  79: }
  80: 
  81: _Isstr (sptr, length, stopf)
  82:     char *sptr;
  83:     int length, (*stopf)();
  84: {
  85:     int ch, initlen, _Inxch();
  86:     extern int _Isfil, (*_Igetc)(), (*_Iungc)();
  87: 
  88: initlen = length;
  89: if ((ch=_Inxch()) < 0)
  90:     return (-1);
  91: (*_Iungc)(ch,_Isfil);
  92: while (!((*stopf)(ch=(*_Igetc)(_Isfil))) && length-- > 0)
  93:     if (sptr != 0)
  94:         *(sptr++) = ch;
  95: if (ch >= 0)
  96:     (*_Iungc)(ch,_Isfil);
  97: if (length == initlen)
  98:     return (-1);
  99: if (sptr == 0)
 100:     return (0);
 101: *sptr = '\0';
 102: return (1);
 103: }
 104: 
 105: _Iestr (c)
 106: char c;
 107: {
 108: if (_Ispce(c)) return (1);
 109: if (c == '\0') return (1);
 110: return (0);
 111: }

Defined functions

_Idigt defined in line 26; used 2 times
_Iestr defined in line 105; used 2 times
_Iint defined in line 1; used 3 times
_Ilong defined in line 63; used 1 times
_Isstr defined in line 81; used 4 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 505
Valid CSS Valid XHTML 1.0 Strict