|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T i
Length: 6367 (0x18df)
Types: TextFile
Names: »interpret.h«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki
└─⟦this⟧ »EUUGD11/gnu-31mar87/scheme/microcode/interpret.h«
/* Emacs, -*-C-*-an't you guess? */
/****************************************************************
* *
* Copyright (c) 1986 *
* Massachusetts Institute of Technology *
* *
* This material was developed by the Scheme project at the *
* Massachusetts Institute of Technology, Department of *
* Electrical Engineering and Computer Science. Permission to *
* copy this software, to redistribute it, and to use it for any *
* purpose is granted, subject to the following restrictions and *
* understandings. *
* *
* 1. Any copy made of this software must include this copyright *
* notice in full. *
* *
* 2. Users of this software agree to make their best efforts (a)*
* to return to the MIT Scheme project any improvements or *
* extensions that they make, so that these may be included in *
* future releases; and (b) to inform MIT of noteworthy uses of *
* this software. *
* *
* 3. All materials developed as a consequence of the use of *
* this software shall duly acknowledge such use, in accordance *
* with the usual standards of acknowledging credit in academic *
* research. *
* *
* 4. MIT has made no warrantee or representation that the *
* operation of this software will be error-free, and MIT is *
* under no obligation to provide any services, by way of *
* maintenance, update, or otherwise. *
* *
* 5. In conjunction with products arising from the use of this *
* material, there shall be no use of the name of the *
* Massachusetts Institute of Technology nor of any adaptation *
* thereof in any advertising, promotional, or sales literature *
* without prior written consent from MIT in each case. *
* *
****************************************************************/
\f
/* File: INTERPRET.H
*
* Macros used by the interpreter but not expected for utilities.
*
*/
\f
/********************/
/* OPEN CODED RACKS */
/********************/
#ifndef ENABLE_DEBUGGING_TOOLS
#ifdef In_Main_Interpreter
#define Using_Registers
#endif
#endif
#ifdef Using_Registers
#define Val Reg_Val
#define Stack_Pointer Reg_Stack_Pointer
#define Expression Reg_Expression
#else
#define Val Ext_Val
#define Stack_Pointer Ext_Stack_Pointer
#define Expression Ext_Expression
#endif
#define Stack_Check(P) if ((P) <= Stack_Guard) \
{ if ((P) <= Free_Constant) \
Microcode_Termination(TERM_STACK_OVERFLOW); \
Request_GC(); \
User_Vector_Set(Fixed_Objects,Stack_Overflow,TRUTH);\
}
#ifdef ENABLE_DEBUGGING_TOOLS
#define Will_Push(N) { Pointer *End_Stack; \
End_Stack = Stack_Pointer - (N); \
Stack_Check(End_Stack)
#define Pushed() if (Stack_Pointer < End_Stack) \
Microcode_Termination(TERM_BAD_STACK); \
}
#else
#define Will_Push(N) Stack_Check(Stack_Pointer - (N))
#define Pushed() /* No op */
#endif
#define Push(P) *--Stack_Pointer = (P)
#define Pop() *Stack_Pointer++
#define Top_Of_Stack() *Stack_Pointer
#define Pop_Frame() Stack_Pointer += *Stack_Pointer+1
#define Pop_Primitive_Frame(NArgs) Stack_Pointer += NArgs
/* Pop_Frame assumes that the environemnt length has type code 0 */
/* Racks operations continue on the next page */
\f
/* Rack operations, continued */
/* Fetch from register */
#define Fetch_Expression() Expression
#define Fetch_Env() Env
#define Fetch_Return() Return
/* Store into register */
#define Store_Expression(P) Expression = (P)
#define Store_Env(P) Env = (P)
#define Store_Return(P) Return = \
Make_Non_Pointer(TC_RETURN_CODE, (P))
/* Save register on stack */
#define Save_Cont() { Push(Expression);\
Push(Return);\
Cont_Print();\
}
#define Cont_Print() if (Cont_Debug)\
{ Print_Return(CONT_PRINT_RETURN_MESSAGE);\
Print_Expression(Fetch_Expression(),\
CONT_PRINT_EXPR_MESSAGE);\
CRLF();\
}\
/* Racks operations continue on the next page */
\f
/* Rack operations, continued */
#define Save_Env() Push(Env)
/* Restore register from stack */
#define Restore_Cont() { Return = Pop();\
Expression = Pop();\
if (Cont_Debug)\
{ Print_Return(RESTORE_CONT_RETURN_MESSAGE);\
Print_Expression(Fetch_Expression(),\
RESTORE_CONT_EXPR_MESSAGE);\
CRLF();\
}\
}
#define Restore_Env() Env = Pop()
#define Restore_Then_Save_Env() Env = Top_Of_Stack()
/* Move from register to static storage and back */
#ifdef Using_Registers
#define Import_Val() Reg_Val = Ext_Val
#define Import_Registers_Except_Val() \
{ Reg_Expression = Ext_Expression;\
Reg_Stack_Pointer = Ext_Stack_Pointer;\
}
#define Import_Registers() \
{ Import_Registers_Except_Val();\
Import_Val();\
}
#define Export_Registers() { Ext_Val = Reg_Val;\
Ext_Expression = Reg_Expression;\
Ext_Stack_Pointer = Reg_Stack_Pointer;\
}
#else
#define Import_Val()
#define Import_Registers()
#define Import_Registers_Except_Val()
#define Export_Registers()
#endif
#define Stop_Trapping() \
{ Trapping = false;\
if (Return_Hook_Address != NULL)\
*Return_Hook_Address = Old_Return_Code;\
Return_Hook_Address = NULL;\
}