{Begin SubSec Type Number Functions} {Title Type Number Functions} {Text {index type numbers} Each data type in Interlisp has an associated "type name". In Interlisp-10, each data type also has a "type number", which can be accessed and manipulated with the functions below. In general, it is preferable to use the type name functions (see {PageRef Fn TYPENAME}). {FnDef {FnName NTYP} {FnArgs DATUM} {Text Returns the type number for the data type of {arg DATUM}, e.g., {lisp (NTYP '(A . B))} is 8, the type number for lists. }} {FnDef {FnName TYPEP} {FnArgs DATUM N} {Text Value is {lisp T}, if the type number of {arg DATUM} is equal to {arg N}. }} {FnDef {FnName TYPENAMEFROMNUMBER} {FnArgs N} {Text Value is type name for type number {arg N}, or {lisp NIL} if {arg N} is not a valid type number, e.g. {lisp (TYPENAMEFROMNUMBER 30)}={lisp STRING.CHARS}. }} {FnDef {FnName TYPENUMBERFROMNAME} {FnArgs NAME} {Text Value is corresponding type number for {arg NAME}, or {lisp NIL} if {arg NAME} is not a type name, e.g. {lisp (TYPENUMBERFROMNAME 'STRING.CHARS)}={lisp 30}. {fn TYPENUMBERFROMNAME} will accept {lisp READTABLEP}, {lisp TERMTABLEP}, {lisp CCODEP}, and {lisp ARRAYP}, and return the same value for each, which for Interlisp-10 is 1. Note however that {lisp (TYPENAMEFROMNUMBER 1)}={lisp ARRAYP}. }} {FnDef {FnName GETTYPEDESCRIPTION} {FnArgs TYPE} {Text Returns the type description string for {arg TYPE}, a type name or type number.{index type description} }} {FnDef {FnName SETTYPEDESCRIPTION} {FnArgs TYPE STRING} {Text Sets the type description string for {arg TYPE} to be {arg STRING}. The type description is used in garbage collection messages and by {fn STORAGE}.{index type description} }} {Begin Note} Date: 4 June 1981 1:31 pm PDT (Thursday) From: Masinter.PA Subject: machine dependent functions To: LispDiscussion^ Principle: implementation-dependent functions which have different behavior should not have the same name; this is to aid in converting from one system to another. For example, Interlisp-D's PUTBASE function deals with 16 bit quantities; thus Interlisp-Jericho should not have a function with the same name which deals with 32 bit quantitites. > Interlisp-D internal functions ADDBASE, PUTBASE, etc. will be renamed with "\" to more readily identify them. > We will standardize a set of constants for internal datatype numbers including \FIXP, \FLOATP, \SMALLP, \LITATOM, \STRINGP, \ARRAYP, \STACKP. I propose the function (NTYPX) become an Interlisp standard which returns a type-number; the reason for renaming is so that old Interlisp-10 programs which contain explicit type numbers (rather than using constants) can be detected; in Interlisp-10 (and in Interlisp-Jericho) NTYPX = NTYP. I propose that TYPENAMEFROMNUMBER and TYPENUMBERFROMNAME become part of the Interlisp standard. {End Note} }{End SubSec Type Number Functions}