home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / Blitz / OSProject / p1 / System.h < prev   
Text File  |  2007-09-19  |  3KB  |  53 lines

  1. header System
  2.  
  3.   -- The following routines print data directly and immediately to the output.
  4.   -- They are intended only for use in debugging kernel code; as such they
  5.   -- bypass the serial I/O device entirely and use the debug2 "back-door" to
  6.   -- the virtual machine.  They may be called from any code, including
  7.   -- from within an interrupt handler.  NOTE: A process switch may occur at
  8.   -- any time, but each of these routines will print atomically.  In
  9.   -- other words, each will either print all of its output before the switch
  10.   -- or all of its output when the process resumes.  However, if several calls
  11.   -- are made in sequence, the output may be intermixed with the output from
  12.   -- another thread.  To avoid this and ensure all output from several calls
  13.   -- is printed together, you may wish to create and use a "lock" and
  14.   -- force all threads to acquire the lock before printing.  Another approach
  15.   -- is to explicitly disable interrupts before making a series of printing
  16.   -- calls and then restore the interrupt status after printing is complete.
  17.   functions
  18.     external print (s: ptr to array of char)
  19.     external printInt (i: int)
  20.     external printHex (i: int)           -- prints, e.g., 0x0012ABCD
  21.     external printChar (c: char)         -- prints non-printables as, e.g., \x05
  22.     external printBool (b: bool)         -- prints "TRUE" or "FALSE"
  23.     external printDouble (d: double)
  24.     nl ()                                -- Short for printChar ('\n')
  25.  
  26.   -- The following routines are implemented in assembly in the Runtime.s file.
  27.   functions
  28.     external RuntimeExit ()           -- Terminate all execution and do not return
  29.     external getCatchStack () returns int  -- Actually returns ptr to a CATCH_RECORD
  30.     external MemoryZero (p: ptr to void, byteCount: int)  -- Set block of mem to zeros
  31.     external MemoryCopy (destPtr: ptr to void,  -- Copy bytes from one memory area
  32.                          srcPtr: ptr to void,   -- to another memory area.  Need not
  33.                          byteCount: int)        -- be aligned, but must not overlap!
  34.  
  35.   -- The following functions are part of the KPL language support.
  36.   functions
  37.     KPLMemoryInitialize ()
  38.     KPLMemoryAlloc (byteCount: int) returns ptr to char
  39.     KPLMemoryFree (p: ptr to char)
  40.     KPLUncaughtThrow (errorID: ptr to char, line: int, rPtr: int)
  41.     KPLIsKindOf (objPtr: ptr to Object, typeDesc: ptr to int) returns int
  42.     KPLSystemError (message: ptr to array of char)
  43.   errors
  44.     UncaughtThrowError (errorID: ptr to char, line: int, routineDescPtr: int)
  45.  
  46.   --
  47.   -- The class "Object" is the root of the superclass/subclass tree.
  48.   --
  49.   class Object
  50.   endClass
  51.  
  52. endHeader
  53.