1: #include "../h/rt.h"
   2: #include "../h/record.h"
   3: 
   4: /*
   5:  * type(x) - return type of x as a string.
   6:  */
   7: 
   8: Xtype(nargs, arg1, arg0)
   9: int nargs;
  10: struct descrip arg1, arg0;
  11:    {
  12:    DeRef(arg1)
  13: 
  14:    /*
  15:     * This is pretty simple. Just make a string naming the type of
  16:     *  x and return it.  For records, the name of the record is returned.
  17:     */
  18:    if (NULLDESC(arg1)) {
  19:       STRLEN(arg0) = 4;
  20:       STRLOC(arg0) = "null";
  21:       }
  22:    else if (QUAL(arg1)) {
  23:       STRLEN(arg0) = 6;
  24:       STRLOC(arg0) = "string";
  25:       }
  26:    else {
  27:       switch (TYPE(arg1)) {
  28:          case T_INTEGER:
  29: #ifdef LONGS
  30:          case T_LONGINT:
  31: #endif LONGS
  32:             STRLEN(arg0) = 7;
  33:             STRLOC(arg0) = "integer";
  34:             break;
  35:          case T_REAL:
  36:             STRLEN(arg0) = 4;
  37:             STRLOC(arg0) = "real";
  38:             break;
  39:          case T_CSET:
  40:             STRLEN(arg0) = 4;
  41:             STRLOC(arg0) = "cset";
  42:             break;
  43:          case T_FILE:
  44:             STRLEN(arg0) = 4;
  45:             STRLOC(arg0) = "file";
  46:             break;
  47:          case T_PROC:
  48:             STRLEN(arg0) = 9;
  49:             STRLOC(arg0) = "procedure";
  50:             break;
  51:          case T_LIST:
  52:             STRLEN(arg0) = 4;
  53:             STRLOC(arg0) = "list";
  54:             break;
  55:          case T_LELEM:
  56:             STRLEN(arg0) = 18;
  57:             STRLOC(arg0) = "list element block";
  58:             break;
  59:          case T_TABLE:
  60:             STRLEN(arg0) = 5;
  61:             STRLOC(arg0) = "table";
  62:             break;
  63:          case T_TELEM:
  64:             STRLEN(arg0) = 19;
  65:             STRLOC(arg0) = "table element block";
  66:             break;
  67: #ifdef SETS
  68:          case T_SET:
  69:             STRLEN(arg0) = 3;
  70:             STRLOC(arg0) = "set";
  71:             break;
  72:          case T_SELEM:
  73:             STRLEN(arg0) = 17;
  74:             STRLOC(arg0) = "set element block";
  75:             break;
  76: #endif SETS
  77: 
  78:          case T_RECORD:
  79:             arg0 = BLKLOC(arg1)->record.recptr->recname;
  80:             break;
  81:          case T_ESTACK:
  82:             STRLEN(arg0) = 13;
  83:             STRLOC(arg0) = "co-expression";
  84:             break;
  85:          default:
  86:             syserr("type: unknown type.");
  87:          }
  88:       }
  89:    }
  90: 
  91: Procblock(type,1)

Defined functions

Xtype defined in line 8; never used
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 810
Valid CSS Valid XHTML 1.0 Strict