Skip to content

Commit

Permalink
kernel: move some doc comments for GAPState members
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Dec 14, 2022
1 parent c7cff9d commit bb861ab
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 75 deletions.
27 changes: 26 additions & 1 deletion src/gapstate.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ typedef struct GAPState {
#endif

/* From intrprtr.c */

// 'Tilde' is the object referenced by the operator '~', used in
// expressions such as '[ [ 1, 2 ], ~[ 1 ] ]'.
Obj Tilde;

// The current assertion level for use in Assert
Expand All @@ -50,13 +53,33 @@ typedef struct GAPState {
Obj CurrNamespace;

/* From vars.c */
Bag CurrLVars;

// 'CurrLVars' is the bag containing the values of the local variables of
// the currently executing interpreted function.
//
// Assignments to the local variables change this bag. We do not call
// 'CHANGED_BAG' for each of such change. Instead we wait until a garbage
// collection begins and then call 'CHANGED_BAG' in 'BeginCollectBags'.
Bag CurrLVars;

// 'PtrLVars' is a pointer to the 'CurrLVars' bag. This makes it faster to
// access local variables.
//
// Since a garbage collection may move this bag around, the pointer
// 'PtrLVars' must be recalculated afterwards in 'VarsAfterCollectBags'.
Obj * PtrLVars;

Bag LVarsPool[16];

/* From read.c */
jmp_buf ReadJmpError;

// 'Prompt' holds the string that is to be printed if a new line is read
// from the interactive files '*stdin*' or '*errin*'.
//
// It is set to 'gap> ' or 'brk> ' in the read-eval-print loops and
// changed to the partial prompt '> ' in 'Read' after the first symbol is
// read.
char Prompt[80];

/* From stats.c */
Expand All @@ -69,6 +92,8 @@ typedef struct GAPState {
ExecStatFunc * CurrExecStatFuncs;

/* From code.c */

// A pointer to the current function body being executed
void * PtrBody;

/* From opers.c */
Expand Down
2 changes: 0 additions & 2 deletions src/gvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,6 @@ Obj ExprGVar ( UInt gvar )

#define NSCHAR '@'

/* TL: Obj CurrNamespace = 0; */

static Obj FuncSET_NAMESPACE(Obj self, Obj str)
{
STATE(CurrNamespace) = str;
Expand Down
7 changes: 2 additions & 5 deletions src/intrprtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1918,13 +1918,10 @@ void IntrFalseExpr(IntrState * intr)

/****************************************************************************
**
*F IntrTildeExpr() . . . . . . . . . . . . interpret tilde expression
*F IntrTildeExpr() . . . . . . . . . . . . . . . interpret tilde expression
**
** 'IntrTildeExpr' is the action to interpret a tilde expression.
**
** 'Tilde' is the identifier for the operator '~', used in
** expressions such as '[ [ 1, 2 ], ~[ 1 ] ]'.
**
*/
void IntrTildeExpr(IntrState * intr)
{
Expand All @@ -1936,7 +1933,7 @@ void IntrTildeExpr(IntrState * intr)
return;
}

if(! (STATE(Tilde)) ) {
if (!STATE(Tilde)) {
// this code should be impossible to reach, the parser won't allow us
// to get here; but we leave it here out of paranoia
ErrorQuit("'~' does not have a value here", 0, 0);
Expand Down
12 changes: 0 additions & 12 deletions src/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,18 +272,6 @@ UInt OpenInputLogStream(Obj stream);
*/
UInt CloseInputLog(void);

/****************************************************************************
**
*V Prompt . . . . . . . . . . . . . . . . . . . . . . prompt to be printed
**
** 'Prompt' holds the string that is to be printed if a new line is read
** from the interactive files '*stdin*' or '*errin*'.
**
** It is set to 'gap> ' or 'brk> ' in the read-eval-print loops and changed
** to the partial prompt '> ' in 'Read' after the first symbol is read.
*/
/* TL: extern const Char * Prompt; */

/****************************************************************************
**
*F SetPrompt( <prompt> ) . . . . . . . . . . . . . set the user input prompt
Expand Down
28 changes: 0 additions & 28 deletions src/vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@

#include <stdio.h>


/****************************************************************************
**
*V CurrLVars . . . . . . . . . . . . . . . . . . . . . local variables bag
**
** 'CurrLVars' is the bag containing the values of the local variables of
** the currently executing interpreted function.
**
** Assignments to the local variables change this bag. We do not call
** 'CHANGED_BAG' for each of such change. Instead we wait until a garbage
** collection begins and then call 'CHANGED_BAG' in 'BeginCollectBags'.
*/
/* TL: Bag CurrLVars; */


/****************************************************************************
**
*V BottomLVars . . . . . . . . . . . . . . . . . bottom local variables bag
Expand All @@ -72,19 +57,6 @@
static Bag BottomLVars;


/****************************************************************************
**
*V PtrLVars . . . . . . . . . . . . . . . . pointer to local variables bag
**
** 'PtrLVars' is a pointer to the 'STATE(CurrLVars)' bag. This makes it faster to
** access local variables.
**
** Since a garbage collection may move this bag around, the pointer
** 'PtrLVars' must be recalculated afterwards in 'VarsAfterCollectBags'.
*/
/* TL: Obj * PtrLVars; */


/****************************************************************************
**
*F ObjLVar(<lvar>) . . . . . . . . . . . . . . . . value of a local variable
Expand Down
27 changes: 0 additions & 27 deletions src/vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,13 @@
#include "objects.h"


/****************************************************************************
**
*V CurrLVars . . . . . . . . . . . . . . . . . . . . . local variables bag
**
** 'CurrLVars' is the bag containing the values of the local variables of
** the currently executing interpreted function.
**
** Assignments to the local variables change this bag. We do not call
** 'CHANGED_BAG' for each of such change. Instead we wait until a garbage
** collection begins and then call 'CHANGED_BAG' in 'BeginCollectBags'.
*/
/* TL: extern Bag CurrLVars; */


/****************************************************************************
**
*F IsBottomLVars(<lvars>) . . test whether lvars is at the call stack bottom
*/
BOOL IsBottomLVars(Obj lvars);


/****************************************************************************
**
*V PtrLVars . . . . . . . . . . . . . . . . pointer to local variables bag
**
** 'PtrLVars' is a pointer to the 'CurrLVars' bag. This makes it faster to
** access local variables.
**
** Since a garbage collection may move this bag around, the pointer
** 'PtrLVars' must be recalculated afterwards in 'VarsAfterCollectBags'.
*/
/* TL: extern Obj * PtrLVars; */


/****************************************************************************
**
*F IS_LVARS_OR_HVARS()
Expand Down

0 comments on commit bb861ab

Please sign in to comment.