home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / pascal / src / pc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-16  |  6.5 KB  |  230 lines

  1. /*-
  2.  * Copyright (c) 1980 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  *
  33.  *    @(#)pc.h    5.3 (Berkeley) 4/16/91
  34.  */
  35.  
  36. #include <setjmp.h>
  37.  
  38.     /*
  39.      *    random constants for pc
  40.      */
  41.     
  42.     /*
  43.      *    the name of the display.
  44.      */
  45. #define    DISPLAYNAME    "__disply"
  46.  
  47.     /*
  48.      *    the structure below describes the locals used by the run time system.
  49.      *    at function entry, at least this much space is allocated,
  50.      *    and the following information is filled in:
  51.      *    the address of a routine to close the current frame for unwinding,
  52.      *    a pointer to the display entry for the current static level and
  53.      *    the previous contents of the display for this static level.
  54.      *    the curfile location is used to point to the currently active file,
  55.      *    and is filled in as io is initiated.
  56.      *    one of these structures is allocated on the (negatively growing) stack.
  57.      *    at function entry, fp is set to point to the last field of the struct,
  58.      *    thus the offsets of the fields are as indicated below.
  59.      */
  60. #ifdef vax
  61. struct rtlocals {
  62.     jmp_buf        gotoenv;
  63.     struct iorec    *curfile;
  64.     struct dispsave    dsave;
  65. } rtlocs;
  66. #endif vax
  67.  
  68. #ifdef tahoe
  69. struct rtlocals {
  70.     jmp_buf        gotoenv;
  71.     struct iorec    *curfile;
  72.     struct dispsave    dsave;
  73.     long        savedregs[9];
  74. } rtlocs;
  75. #endif tahoe
  76.  
  77. #ifdef mc68000
  78. struct rtlocals {
  79.     jmp_buf        gotoenv;
  80.     struct iorec    *curfile;
  81.     struct dispsave    dsave;
  82. } rtlocs;
  83. #endif mc68000
  84.  
  85. #define    GOTOENVOFFSET    ( -sizeof rtlocs )
  86. #define    CURFILEOFFSET    ( GOTOENVOFFSET + sizeof rtlocs.gotoenv )
  87. #define    DSAVEOFFSET    ( CURFILEOFFSET + sizeof rtlocs.curfile )
  88.  
  89.     /*
  90.      *    this is a cookie used to communicate between the
  91.      *    routine entry code and the routine exit code.
  92.      *    mostly it's for labels shared between the two.
  93.      */
  94. #ifdef vax
  95. struct entry_exit_cookie {
  96.     struct nl    *nlp;
  97.     char    extname[BUFSIZ];
  98.     int        toplabel;
  99.     int        savlabel;
  100. };
  101. #define    FRAME_SIZE_LABEL    "LF"
  102. #define    SAVE_MASK_LABEL        "L"
  103. #endif vax
  104.  
  105. #ifdef tahoe
  106. struct entry_exit_cookie {
  107.     struct nl    *nlp;
  108.     char    extname[BUFSIZ];
  109.     int        toplabel;
  110.     int        savlabel;
  111. };
  112. #define    FRAME_SIZE_LABEL    "LF"
  113. #define    SAVE_MASK_LABEL        "L"
  114. #endif tahoe
  115.  
  116. #ifdef mc68000
  117. struct entry_exit_cookie {
  118.     struct nl    *nlp;
  119.     char    extname[BUFSIZ];
  120.     int        toplabel;
  121. };
  122. #define    FRAME_SIZE_LABEL    "LF"
  123. #define    PAGE_BREAK_LABEL    "LP"
  124. #define    SAVE_MASK_LABEL        "LS"
  125. #endif mc68000
  126.  
  127.     /*
  128.      *    formats for various names
  129.      *        NAMEFORMAT        arbitrary length strings.
  130.      *        EXTFORMAT        for externals, a preceding underscore.
  131.      *        LABELFORMAT        for label names, a preceding dollar-sign.
  132.      *        PREFIXFORMAT    used to print made up names with prefixes.
  133.      *        LABELPREFIX        with getlab() makes up label names.
  134.      *        LLABELPREFIX    with getlab() makes up sdb labels.
  135.      *        FORMALPREFIX    prefix for EXTFORMAT for formal entry points.
  136.      *    a typical use might be to print out a name with a preceeding underscore
  137.      *    with putprintf( EXTFORMAT , 0 , name );
  138.      */
  139. #define    NAMEFORMAT    "%s"
  140. #define    EXTFORMAT    "_%s"
  141. #define    LABELFORMAT    "$%s"
  142. #define    PREFIXFORMAT    "%s%d"
  143. #define    LABELPREFIX    "L"
  144. #define    LLABELPREFIX    "LL"
  145. #define    FORMALPREFIX    "__"
  146.  
  147.     /*
  148.      *    the name of the statement counter
  149.      */
  150. #define    STMTCOUNT    "__stcnt"
  151.  
  152.     /*
  153.      *    the name of the pcp counters
  154.      */
  155. #define    PCPCOUNT    "__pcpcount"
  156.  
  157.     /*
  158.      *    a vector of pointer to enclosing functions for fully qualified names.
  159.      */
  160. char    *enclosing[ DSPLYSZ ];
  161.  
  162. #ifdef vax
  163.     /*
  164.      *    the runtime framepointer and argumentpointer registers
  165.      */
  166. #   define    P2FP        13
  167. #   define    P2FPNAME    "fp"
  168. #   define    P2AP        12
  169. #   define    P2APNAME    "ap"
  170.  
  171.     /*
  172.      *    the register save mask for saving no registers
  173.      */
  174. #   define    RSAVEMASK    ( 0 )
  175.  
  176.     /*
  177.      *    runtime check mask for divide check and integer overflow
  178.      */
  179. #   define    RUNCHECK    ( ( 1 << 15 ) | ( 1 << 14 ) )
  180.  
  181.     /*
  182.      *    and of course ...
  183.      */
  184. #   define    BITSPERBYTE    8
  185. #endif vax
  186.  
  187. #ifdef tahoe
  188.     /*
  189.      *    the runtime framepointer and argumentpointer registers
  190.      */
  191. #   define    P2FP        13
  192. #   define    P2FPNAME    "fp"
  193. #   define    P2AP        13
  194. #   define    P2APNAME    "fp"
  195.  
  196.     /*
  197.      *    the register save mask for saving no registers
  198.      */
  199. #   define    RSAVEMASK    ( 0 )
  200.  
  201.     /*
  202.      *    divide check and integer overflow don't exist in the save mask
  203.      */
  204. #   define    RUNCHECK    ( 0 )
  205.  
  206.     /*
  207.      *    and of course ...
  208.      */
  209. #   define    BITSPERBYTE    8
  210. #endif tahoe
  211.  
  212. #ifdef mc68000
  213.     /*
  214.      *    these magic numbers lifted from pcc/mac2defs
  215.      *    the offsets are for mapping data and address register numbers
  216.      *    to linear register numbers.  e.g. d2 ==> r2, and a2 ==> r10.
  217.      */
  218. #   define    DATA_REG_OFFSET    0
  219. #   define    ADDR_REG_OFFSET 8
  220. #   define    P2FPNAME    "a6"
  221. #   define    P2FP        (ADDR_REG_OFFSET + 6)
  222. #   define    P2APNAME    "a6"
  223. #   define    P2AP        (ADDR_REG_OFFSET + 6)
  224.  
  225.     /*
  226.      *    and still ...
  227.      */
  228. #   define    BITSPERBYTE    8
  229. #endif mc68000
  230.