Skip to content

Commit

Permalink
kernel: rename NameGVarObj => NameGVar
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Apr 10, 2018
1 parent d9bb46e commit 8de5914
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 43 deletions.
26 changes: 13 additions & 13 deletions src/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -2990,10 +2990,10 @@ CVar CompRefGVar (
val = CVAR_TEMP( NewTemp( "val" ) );

/* emit the code to get the value */
Emit( "%c = GC_%n;\n", val, NameGVarObj(gvar) );
Emit( "%c = GC_%n;\n", val, NameGVar(gvar) );

/* emit the code to check that the variable has a value */
CompCheckBound( val, NameGVarObj(gvar) );
CompCheckBound( val, NameGVar(gvar) );

/* return the value */
return val;
Expand All @@ -3018,7 +3018,7 @@ CVar CompRefGVarFopy (
val = CVAR_TEMP( NewTemp( "val" ) );

/* emit the code to get the value */
Emit( "%c = GF_%n;\n", val, NameGVarObj(gvar) );
Emit( "%c = GF_%n;\n", val, NameGVar(gvar) );

/* we know that the object in a function copy is a function */
SetInfoCVar( val, W_FUNC );
Expand Down Expand Up @@ -3048,7 +3048,7 @@ CVar CompIsbGVar (
val = CVAR_TEMP( NewTemp( "val" ) );

/* emit the code to get the value */
Emit( "%c = GC_%n;\n", val, NameGVarObj(gvar) );
Emit( "%c = GC_%n;\n", val, NameGVar(gvar) );

/* emit the code to check that the variable has a value */
Emit( "%c = ((%c != 0) ? True : False);\n", isb, val );
Expand Down Expand Up @@ -4229,7 +4229,7 @@ void CompFor (
}
else if ( vart == 'g' ) {
Emit( "AssGVar( G_%n, %c );\n",
NameGVarObj(var), elm );
NameGVar(var), elm );
}

/* set what we know about the loop variable */
Expand Down Expand Up @@ -4588,7 +4588,7 @@ void CompAssGVar (
/* emit the code for the assignment */
gvar = (GVar)(ADDR_STAT(stat)[0]);
CompSetUseGVar( gvar, COMP_USE_GVAR_ID );
Emit( "AssGVar( G_%n, %c );\n", NameGVarObj(gvar), rhs );
Emit( "AssGVar( G_%n, %c );\n", NameGVar(gvar), rhs );

/* free the temporary */
if ( IS_TEMP_CVAR( rhs ) ) FreeTemp( TEMP_CVAR( rhs ) );
Expand All @@ -4612,7 +4612,7 @@ void CompUnbGVar (
/* emit the code for the assignment */
gvar = (GVar)(ADDR_STAT(stat)[0]);
CompSetUseGVar( gvar, COMP_USE_GVAR_ID );
Emit( "AssGVar( G_%n, 0 );\n", NameGVarObj(gvar) );
Emit( "AssGVar( G_%n, 0 );\n", NameGVar(gvar) );
}


Expand Down Expand Up @@ -5580,13 +5580,13 @@ Int CompileFunc (
Emit( "\n/* global variables used in handlers */\n" );
for ( i = 1; i < SIZE_OBJ(CompInfoGVar)/sizeof(UInt); i++ ) {
if ( CompGetUseGVar( i ) ) {
Emit( "static GVar G_%n;\n", NameGVarObj(i) );
Emit( "static GVar G_%n;\n", NameGVar(i) );
}
if ( CompGetUseGVar( i ) & COMP_USE_GVAR_COPY ) {
Emit( "static Obj GC_%n;\n", NameGVarObj(i) );
Emit( "static Obj GC_%n;\n", NameGVar(i) );
}
if ( CompGetUseGVar( i ) & COMP_USE_GVAR_FOPY ) {
Emit( "static Obj GF_%n;\n", NameGVarObj(i) );
Emit( "static Obj GF_%n;\n", NameGVar(i) );
}
}

Expand Down Expand Up @@ -5615,7 +5615,7 @@ Int CompileFunc (
for ( i = 1; i < SIZE_OBJ(CompInfoGVar)/sizeof(UInt); i++ ) {
if ( CompGetUseGVar( i ) ) {
Emit( "G_%n = GVarName( \"%g\" );\n",
NameGVarObj(i), NameGVarObj(i) );
NameGVar(i), NameGVar(i) );
}
}
Emit( "\n/* record names used in handlers */\n" );
Expand Down Expand Up @@ -5648,11 +5648,11 @@ Int CompileFunc (
for ( i = 1; i < SIZE_OBJ(CompInfoGVar)/sizeof(UInt); i++ ) {
if ( CompGetUseGVar( i ) & COMP_USE_GVAR_COPY ) {
Emit( "InitCopyGVar( \"%g\", &GC_%n );\n",
NameGVarObj(i), NameGVarObj(i) );
NameGVar(i), NameGVar(i) );
}
if ( CompGetUseGVar( i ) & COMP_USE_GVAR_FOPY ) {
Emit( "InitFopyGVar( \"%g\", &GF_%n );\n",
NameGVarObj(i), NameGVarObj(i) );
NameGVar(i), NameGVar(i) );
}
}
Emit( "\n/* information for the functions */\n" );
Expand Down
30 changes: 15 additions & 15 deletions src/gvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,15 +320,15 @@ void AssGVar (

// Make certain variable is not constant
if (writeval == INTOBJ_INT(-1)) {
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVarObj(gvar), 0L);
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVar(gvar), 0L);
}

/* make certain that the variable is not read only */
while ( (REREADING != True) &&
(ELM_GVAR_LIST( WriteGVars, gvar ) == INTOBJ_INT(0)) ) {
ErrorReturnVoid(
"Variable: '%g' is read only",
(Int)NameGVarObj(gvar), 0L,
(Int)NameGVar(gvar), 0L,
"you can 'return;' after making it writable" );
}

Expand Down Expand Up @@ -394,7 +394,7 @@ void AssGVar (
if (IS_BAG_REF(val) && REGION(val) == 0) { /* public region? */
#endif
if ( val != 0 && TNUM_OBJ(val) == T_FUNCTION && NAME_FUNC(val) == 0 ) {
onam = CopyToStringRep(NameGVarObj(gvar));
onam = CopyToStringRep(NameGVar(gvar));
MakeImmutableString(onam);
SET_NAME_FUNC(val, onam);
CHANGED_BAG(val);
Expand Down Expand Up @@ -441,7 +441,7 @@ Obj ValAutoGVar (
while ( (val = ValGVar(gvar)) == 0 ) {
ErrorReturnVoid(
"Variable: automatic variable '%g' must get a value by function call",
(Int)NameGVarObj(gvar), 0L,
(Int)NameGVar(gvar), 0L,
"you can 'return;' after assigning a value" );
}

Expand Down Expand Up @@ -502,7 +502,7 @@ Obj NewGVarBucket(void) {
}
#endif

Obj NameGVarObj ( UInt gvar )
Obj NameGVar ( UInt gvar )
{
return ELM_GVAR_LIST( NameGVars, gvar );
}
Expand Down Expand Up @@ -578,7 +578,7 @@ UInt GVarName (
sizeGVars = LEN_PLIST(TableGVars);
pos = (hash % sizeGVars) + 1;
while ( (gvar = ELM_PLIST( TableGVars, pos )) != 0
&& strncmp( CSTR_STRING( NameGVarObj( INT_INTOBJ(gvar) ) ), name, 1023 ) ) {
&& strncmp( CSTR_STRING( NameGVar( INT_INTOBJ(gvar) ) ), name, 1023 ) ) {
pos = (pos % sizeGVars) + 1;
}

Expand All @@ -592,7 +592,7 @@ UInt GVarName (
sizeGVars = LEN_PLIST(TableGVars);
pos = (hash % sizeGVars) + 1;
while ( (gvar = ELM_PLIST( TableGVars, pos )) != 0
&& strncmp( CSTR_STRING( NameGVarObj( INT_INTOBJ(gvar) ) ), name, 1023 ) ) {
&& strncmp( CSTR_STRING( NameGVar( INT_INTOBJ(gvar) ) ), name, 1023 ) ) {
pos = (pos % sizeGVars) + 1;
}
}
Expand Down Expand Up @@ -655,7 +655,7 @@ UInt GVarName (
for ( i = 1; i <= (sizeGVars-1)/2; i++ ) {
gvar2 = ELM_PLIST( table, i );
if ( gvar2 == 0 ) continue;
pos = HashString( CSTR_STRING( NameGVarObj( INT_INTOBJ(gvar2) ) ) );
pos = HashString( CSTR_STRING( NameGVar( INT_INTOBJ(gvar2) ) ) );
pos = (pos % sizeGVars) + 1;
while ( ELM_PLIST( TableGVars, pos ) != 0 ) {
pos = (pos % sizeGVars) + 1;
Expand All @@ -682,7 +682,7 @@ void MakeReadOnlyGVar (
UInt gvar )
{
if (ELM_GVAR_LIST(WriteGVars, gvar) == INTOBJ_INT(-1)) {
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVarObj(gvar), 0L);
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVar(gvar), 0L);
}
SET_ELM_GVAR_LIST( WriteGVars, gvar, INTOBJ_INT(0) );
CHANGED_GVAR_LIST( WriteGVars, gvar );
Expand All @@ -698,7 +698,7 @@ void MakeConstantGVar(UInt gvar)
if (!IS_INTOBJ(val) && val != True && val != False) {
ErrorMayQuit(
"Variable: '%g' must be assigned a small integer, true or false",
(Int)NameGVarObj(gvar), 0L);
(Int)NameGVar(gvar), 0L);
}
SET_ELM_GVAR_LIST(WriteGVars, gvar, INTOBJ_INT(-1));
CHANGED_GVAR_LIST(WriteGVars, gvar);
Expand Down Expand Up @@ -791,7 +791,7 @@ void MakeReadWriteGVar (
UInt gvar )
{
if (ELM_GVAR_LIST(WriteGVars, gvar) == INTOBJ_INT(-1)) {
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVarObj(gvar), 0L);
ErrorMayQuit("Variable: '%g' is constant", (Int)NameGVar(gvar), 0L);
}
SET_ELM_GVAR_LIST( WriteGVars, gvar, INTOBJ_INT(1) );
CHANGED_GVAR_LIST( WriteGVars, gvar );
Expand Down Expand Up @@ -976,7 +976,7 @@ UInt iscomplete_gvar (

numGVars = INT_INTOBJ(CountGVars);
for ( i = 1; i <= numGVars; i++ ) {
curr = CSTR_STRING( NameGVarObj( i ) );
curr = CSTR_STRING( NameGVar( i ) );
for ( k = 0; name[k] != 0 && curr[k] == name[k]; k++ ) ;
if ( k == len && curr[k] == '\0' ) return 1;
}
Expand All @@ -997,7 +997,7 @@ UInt completion_gvar (
for ( i = 1; i <= numGVars; i++ ) {
/* consider only variables which are currently bound for completion */
if ( VAL_GVAR_INTERN( i ) || ELM_GVAR_LIST( ExprGVars, i )) {
curr = CSTR_STRING( NameGVarObj( i ) );
curr = CSTR_STRING( NameGVar( i ) );
for ( k = 0; name[k] != 0 && curr[k] == name[k]; k++ ) ;
if ( k < len || curr[k] <= name[k] ) continue;
if ( next != 0 ) {
Expand Down Expand Up @@ -1042,7 +1042,7 @@ Obj FuncIDENTS_GVAR (
for ( i = 1; i <= numGVars; i++ ) {
/* Copy the string here, because we do not want members of NameGVars
* accessible to users, as these strings must not be changed */
strcopy = CopyToStringRep( NameGVarObj( i ) );
strcopy = CopyToStringRep( NameGVar( i ) );
SET_ELM_PLIST( copy, i, strcopy );
CHANGED_BAG( copy );
}
Expand Down Expand Up @@ -1072,7 +1072,7 @@ Obj FuncIDENTS_BOUND_GVARS (
/* Copy the string here, because we do not want members of
* NameGVars accessible to users, as these strings must not be
* changed */
strcopy = CopyToStringRep( NameGVarObj( i ) );
strcopy = CopyToStringRep( NameGVar( i ) );
SET_ELM_PLIST( copy, j, strcopy );
CHANGED_BAG( copy );
j++;
Expand Down
6 changes: 3 additions & 3 deletions src/gvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ extern Obj ValGVarTL (

/****************************************************************************
**
*F NameGVarObj(<gvar>) . . . . . . . . . . . . . name of a global variable
*F NameGVar(<gvar>) . . . . . . . . . . . . . . . name of a global variable
**
** 'NameGVarObj' returns the name of the global variable <gvar> as a GAP
** 'NameGVar' returns the name of the global variable <gvar> as a GAP
** string.
*/
extern Obj NameGVarObj (
extern Obj NameGVar (
UInt gvar );


Expand Down
2 changes: 1 addition & 1 deletion src/hpc/threadapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2320,7 +2320,7 @@ Obj FuncMakeThreadLocal(Obj self, Obj var)
"MakeThreadLocal: Argument must be a variable name");
name = CSTR_STRING(var);
gvar = GVarName(name);
name = CSTR_STRING(NameGVarObj(gvar)); /* to apply namespace scopes where needed. */
name = CSTR_STRING(NameGVar(gvar)); /* to apply namespace scopes where needed. */
MakeThreadLocalVar(gvar, RNamName(name));
return (Obj)0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/intrprtr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2908,7 +2908,7 @@ void IntrRefGVar (
if ( (val = ValAutoGVar( gvar )) == 0 ) {
ErrorQuit(
"Variable: '%g' must have a value",
(Int)NameGVarObj(gvar), 0L );
(Int)NameGVar(gvar), 0L );
}

/* push the value */
Expand Down
10 changes: 5 additions & 5 deletions src/modules.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void InitGVarFiltsFromTable(const StructGVarFilt * tab)

for (i = 0; tab[i].name != 0; i++) {
UInt gvar = GVarName(tab[i].name);
Obj name = NameGVarObj(gvar);
Obj name = NameGVar(gvar);
Obj args = ValidatedArgList(tab[i].name, 1, tab[i].argument);
AssReadOnlyGVar(gvar, NewFilter(name, 1, args, tab[i].handler));
}
Expand All @@ -485,7 +485,7 @@ void InitGVarAttrsFromTable(const StructGVarAttr * tab)

for (i = 0; tab[i].name != 0; i++) {
UInt gvar = GVarName(tab[i].name);
Obj name = NameGVarObj(gvar);
Obj name = NameGVar(gvar);
Obj args = ValidatedArgList(tab[i].name, 1, tab[i].argument);
AssReadOnlyGVar(gvar, NewAttribute(name, 1, args, tab[i].handler));
}
Expand All @@ -501,7 +501,7 @@ void InitGVarPropsFromTable(const StructGVarProp * tab)

for (i = 0; tab[i].name != 0; i++) {
UInt gvar = GVarName(tab[i].name);
Obj name = NameGVarObj(gvar);
Obj name = NameGVar(gvar);
Obj args = ValidatedArgList(tab[i].name, 1, tab[i].argument);
AssReadOnlyGVar(gvar, NewProperty(name, 1, args, tab[i].handler));
}
Expand All @@ -518,7 +518,7 @@ void InitGVarOpersFromTable(const StructGVarOper * tab)

for (i = 0; tab[i].name != 0; i++) {
UInt gvar = GVarName(tab[i].name);
Obj name = NameGVarObj(gvar);
Obj name = NameGVar(gvar);
Obj args = ValidatedArgList(tab[i].name, tab[i].nargs, tab[i].args);
AssReadOnlyGVar(
gvar, NewOperation(name, tab[i].nargs, args, tab[i].handler));
Expand Down Expand Up @@ -569,7 +569,7 @@ void InitGVarFuncsFromTable(const StructGVarFunc * tab)

for (i = 0; tab[i].name != 0; i++) {
UInt gvar = GVarName(tab[i].name);
Obj name = NameGVarObj(gvar);
Obj name = NameGVar(gvar);
Obj args = ValidatedArgList(tab[i].name, tab[i].nargs, tab[i].args);
Obj func = NewFunction(name, tab[i].nargs, args, tab[i].handler);
SetupFuncInfo(func, tab[i].cookie);
Expand Down
10 changes: 5 additions & 5 deletions src/vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Obj EvalRefGVar (
while ( (val = ValAutoGVar( (UInt)(ADDR_EXPR(expr)[0]) )) == 0 ) {
ErrorReturnVoid(
"Variable: '%g' must have an assigned value",
(Int)NameGVarObj( (UInt)(ADDR_EXPR(expr)[0]) ), 0L,
(Int)NameGVar( (UInt)(ADDR_EXPR(expr)[0]) ), 0L,
"you can 'return;' after assigning a value" );
}

Expand Down Expand Up @@ -476,7 +476,7 @@ void PrintAssGVar (
Stat stat )
{
Pr( "%2>", 0L, 0L );
Pr( "%H", (Int)NameGVarObj( (UInt)(ADDR_STAT(stat)[0]) ), 0L );
Pr( "%H", (Int)NameGVar( (UInt)(ADDR_STAT(stat)[0]) ), 0L );
Pr( "%< %>:= ", 0L, 0L );
PrintExpr( ADDR_EXPR(stat)[1] );
Pr( "%2<;", 0L, 0L );
Expand All @@ -486,7 +486,7 @@ void PrintUnbGVar (
Stat stat )
{
Pr( "Unbind( ", 0L, 0L );
Pr( "%H", (Int)NameGVarObj( (UInt)(ADDR_STAT(stat)[0]) ), 0L );
Pr( "%H", (Int)NameGVar( (UInt)(ADDR_STAT(stat)[0]) ), 0L );
Pr( " );", 0L, 0L );
}

Expand All @@ -500,14 +500,14 @@ void PrintUnbGVar (
void PrintRefGVar (
Expr expr )
{
Pr( "%H", (Int)NameGVarObj( (UInt)(ADDR_STAT(expr)[0]) ), 0L );
Pr( "%H", (Int)NameGVar( (UInt)(ADDR_STAT(expr)[0]) ), 0L );
}

void PrintIsbGVar (
Expr expr )
{
Pr( "IsBound( ", 0L, 0L );
Pr( "%H", (Int)NameGVarObj( (UInt)(ADDR_EXPR(expr)[0]) ), 0L );
Pr( "%H", (Int)NameGVar( (UInt)(ADDR_EXPR(expr)[0]) ), 0L );
Pr( " )", 0L, 0L );
}

Expand Down

0 comments on commit 8de5914

Please sign in to comment.