Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the -X command line option, and various other tweaks #1421

Merged
merged 6 commits into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions doc/ref/run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,6 @@ suppresses the usual break loop behaviour of ⪆. With this option
This is intended for automated testing of ⪆. This option may be
repeated to toggle this behavior on and off.
</Item>
<Mark><Index Key="-X"><C>-X</C></Index>
<C>-X</C></Mark>
<Item>
tells &GAP; to do a consistency check of the library file and the
corresponding compiled module when loading the compiled module. This
option may be repeated to toggle this behavior on and off.
</Item>
<Mark><Index Key="-x"><C>-x</C></Index>
<C>-x </C><A>length</A></Mark>
<Item>
Expand Down
1 change: 0 additions & 1 deletion hpcgap/lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ BIND_GLOBAL( "GAPInfo", AtomicRecord(rec(
rec( short:= "M", default := false, help := ["disable/enable loading of compiled modules"] ),
rec( short:= "N", default := false, help := ["unused, for backward compatibility only"] ),
rec( short:= "O", default := false, help := ["disable/enable loading of obsolete files"] ),
rec( short:= "X", default := false, help := ["enable/disable CRC checking for compiled modules"] ),
rec( short:= "T", default := false, help := ["disable/enable break loop"] ),
rec( long := "quitonbreak", default := false, help := ["quit GAP with non-zero return value instead of entering break loop"]),
,
Expand Down
1 change: 0 additions & 1 deletion lib/system.g
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ BIND_GLOBAL( "GAPInfo", rec(
rec( short:= "M", default := false, help := ["disable/enable loading of compiled modules"] ),
rec( short:= "N", default := false, help := ["unused, for backward compatibility only"] ),
rec( short:= "O", default := false, help := ["disable/enable loading of obsolete files"] ),
rec( short:= "X", default := false, help := ["enable/disable CRC checking for compiled modules"] ),
rec( short:= "T", default := false, help := ["disable/enable break loop"] ),
rec( long := "quitonbreak", default := false, help := ["quit GAP with non-zero return value instead of entering break loop"]),
,
Expand Down
14 changes: 6 additions & 8 deletions src/gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,10 +1484,10 @@ Obj FuncLOAD_DYN (
Obj filename,
Obj crc )
{
InitInfoFunc init;
StructInitInfo * info;
Obj crc1;
Int res;
InitInfoFunc init;

/* check the argument */
while ( ! IsStringConv( filename ) ) {
Expand All @@ -1496,7 +1496,7 @@ Obj FuncLOAD_DYN (
(Int)TNAM_OBJ(filename), 0L,
"you can replace <filename> via 'return <filename>;'" );
}
while ( ! IS_INTOBJ(crc) && crc!=False ) {
while ( ! IS_INTOBJ(crc) && crc != False ) {
crc = ErrorReturnObj(
"<crc> must be a small integer or 'false' (not a %s)",
(Int)TNAM_OBJ(crc), 0L,
Expand Down Expand Up @@ -1569,8 +1569,8 @@ Obj FuncLOAD_STAT (
{
StructInitInfo * info = 0;
Obj crc1;
Int k;
Int res;
Int k;

/* check the argument */
while ( ! IsStringConv( filename ) ) {
Expand All @@ -1579,7 +1579,7 @@ Obj FuncLOAD_STAT (
(Int)TNAM_OBJ(filename), 0L,
"you can replace <filename> via 'return <filename>;'" );
}
while ( !IS_INTOBJ(crc) && crc!=False ) {
while ( ! IS_INTOBJ(crc) && crc != False ) {
crc = ErrorReturnObj(
"<crc> must be a small integer or 'false' (not a %s)",
(Int)TNAM_OBJ(crc), 0L,
Expand All @@ -1589,10 +1589,7 @@ Obj FuncLOAD_STAT (
/* try to find the module */
for ( k = 0; CompInitFuncs[k]; k++ ) {
info = (*(CompInitFuncs[k]))();
if ( info == 0 ) {
continue;
}
if ( ! strcmp( CSTR_STRING(filename), info->name ) ) {
if ( info && ! strcmp( CSTR_STRING(filename), info->name ) ) {
break;
}
}
Expand Down Expand Up @@ -1622,6 +1619,7 @@ Obj FuncLOAD_STAT (
/* link and init me */
res = (info->initKernel)(info);
UpdateCopyFopyInfo();

/* Start a new executor to run the outer function of the module
in global context */
ExecBegin( STATE(BottomLVars) );
Expand Down
5 changes: 0 additions & 5 deletions src/gvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,12 @@ extern Int IsReadOnlyGVar (

/****************************************************************************
**

*F * * * * * * * * * * * * * copies and fopies * * * * * * * * * * * * * * *
*/


/****************************************************************************
**

*F InitCopyGVar( <name>, <copy> ) . . declare C variable as copy of global
**
** 'InitCopyGVar' makes the C variable <cvar> at address <copy> a copy of
Expand Down Expand Up @@ -300,14 +298,12 @@ extern void SetGVar(GVarDescriptor *gvar, Obj obj);

/****************************************************************************
**

*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *
*/


/****************************************************************************
**

*F InitInfoGVars() . . . . . . . . . . . . . . . . . table of init functions
*/
StructInitInfo * InitInfoGVars ( void );
Expand All @@ -317,6 +313,5 @@ StructInitInfo * InitInfoGVars ( void );

/****************************************************************************
**

*E gvars.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
*/
48 changes: 14 additions & 34 deletions src/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,38 +431,21 @@ Int READ_GAP_ROOT ( Char * filename )
StructInitInfo * info;

/* try to find the file */
res = SyFindOrLinkGapRootFile( filename, 0L, &result );
res = SyFindOrLinkGapRootFile( filename, &result );

/* not found */
if ( res == 0 ) {
return 0;
}

/* dynamically linked */
else if ( res == 1 ) {
/* dynamically or statically linked */
else if ( res == 1 || res == 2 ) {
// This code section covers loading of GAC compiled code; in contrast
// to FuncLOAD_STAT and FuncLOAD_DYN, which are typically used by
// kernel extensions to load C/C++ code.
if ( SyDebugLoading ) {
Pr( "#I READ_GAP_ROOT: loading '%s' dynamically\n",
(Int)filename, 0L );
}
info = result.module_info;
res = info->initKernel(info);
if (!SyRestoring) {
UpdateCopyFopyInfo();
res = res || info->initLibrary(info);
}
if ( res ) {
Pr( "#W init functions returned non-zero exit code\n", 0L, 0L );
}

RecordLoadedModule(info, 1, filename);
return 1;
}

/* statically linked */
else if ( res == 2 ) {
if ( SyDebugLoading ) {
Pr( "#I READ_GAP_ROOT: loading '%s' statically\n",
(Int)filename, 0L );
const char *s = (res == 1) ? "dynamically" : "statically";
Pr( "#I READ_GAP_ROOT: loading '%s' %s\n", (Int)filename, (Int)s );
}
info = result.module_info;
res = info->initKernel(info);
Expand All @@ -479,21 +462,18 @@ Int READ_GAP_ROOT ( Char * filename )

/* special handling for the other cases, if we are trying to load compiled
modules needed for a saved workspace ErrorQuit is not available */
else if (SyRestoring)
{
if (res == 3 || res == 4)
{
else if (SyRestoring) {
if ( res == 3 ) {
Pr("Can't find compiled module '%s' needed by saved workspace\n",
(Int) filename, 0L);
return 0;
}
else
Pr("unknown result code %d from 'SyFindGapRoot'", res, 0L );
}
Pr("unknown result code %d from 'SyFindGapRoot'", res, 0L );
SyExit(1);
}
}

/* ordinary gap file */
else if ( res == 3 || res == 4 ) {
else if ( res == 3 ) {
if ( SyDebugLoading ) {
Pr( "#I READ_GAP_ROOT: loading '%s' as GAP file\n",
(Int)filename, 0L );
Expand Down
30 changes: 7 additions & 23 deletions src/sysfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ ssize_t writeandcheck(int fd, const char *buf, size_t count) {

/****************************************************************************
**


*F * * * * * * * * * * * * * * dynamic loading * * * * * * * * * * * * * * *
*/


/****************************************************************************
**
*F SyFindOrLinkGapRootFile( <filename>, <crc>, <res> ) . . . . load or link
*F SyFindOrLinkGapRootFile( <filename>, <result> ) . . . . . . load or link
**
** 'SyFindOrLinkGapRootFile' tries to find a GAP file in the root area and
** check if there is a corresponding statically or dynamically linked
Expand All @@ -122,17 +120,14 @@ ssize_t writeandcheck(int fd, const char *buf, size_t count) {
** 1: if a dynamically linked module was found
** 2: if a statically linked module was found
** 3: a GAP file was found
** 4: a GAP file was found and the CRC value didn't match
*/
#include <src/compstat.h> /* statically linked modules */


Int SyFindOrLinkGapRootFile (
const Char * filename,
Int4 crc_gap,
TypGRF_Data * result )
{
UInt4 crc_sta = 0;
Int found_gap = 0;
Int found_sta = 0;
Char module[GAP_PATH_MAX];
Expand All @@ -152,36 +147,25 @@ Int SyFindOrLinkGapRootFile (

/* try to find any statically link module */
strxcpy( module, "GAPROOT/", sizeof(module) );

strxcat( module, filename, sizeof(module) );
for ( k = 0; CompInitFuncs[k]; k++ ) {
info_sta = (*(CompInitFuncs[k]))();
if ( info_sta == 0 ) {
continue;
}
if ( ! strcmp( module, info_sta->name ) ) {
crc_sta = info_sta->crc;
found_sta = 1;
break;
}
}

/* check if we have to compute the crc */
if ( found_gap && ( found_sta ) ) {
if ( crc_gap == 0 ) {
crc_gap = SyGAPCRC(result->pathname);
} else if ( SyCheckCRCCompiledModule ) {
if ( crc_gap != SyGAPCRC(result->pathname) ) {
return 4;
}
/* if there is both a GAP and a statically linked module, check CRC */
if ( found_gap && found_sta ) {
if ( info_sta->crc != SyGAPCRC(result->pathname) ) {
Pr("#W Static module %s has CRC mismatch, ignoring\n", (Int)filename, 0);
found_sta = 0;
}
}

/* now decide what to do */
if ( found_gap && found_sta && crc_gap != crc_sta ) {
Pr("#W Static module %s has CRC mismatch, ignoring\n", (Int) filename, 0);
found_sta = 0;
}
if ( found_gap && found_sta ) {
result->module_info = info_sta;
return 2;
Expand All @@ -206,7 +190,7 @@ Int SyFindOrLinkGapRootFile (
**
** This function *never* returns a 0 unless an error occurred.
*/
static UInt4 syCcitt32[ 256 ] =
static const UInt4 syCcitt32[ 256 ] =
{
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL,
Expand Down
16 changes: 1 addition & 15 deletions src/sysfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@

/****************************************************************************
**


*F * * * * * * * * * * * * * * dynamic loading * * * * * * * * * * * * * * *
*/


/****************************************************************************
**
*F SyFindOrLinkGapRootFile( <filename>, <crc>, <res> ) . . . . load or link
*F SyFindOrLinkGapRootFile( <filename>, <result> ) . . . . . . load or link
**
** 'SyFindOrLinkGapRootFile' tries to find a GAP file in the root area and
** check if there is a corresponding statically or dynamically linked
Expand All @@ -43,7 +41,6 @@
** 1: if a dynamically linked module was found
** 2: if a statically linked module was found
** 3: a GAP file was found
** 4: a GAP file was found and the CRC value didn't match
*/

typedef union {
Expand All @@ -53,7 +50,6 @@ typedef union {

extern Int SyFindOrLinkGapRootFile (
const Char * filename,
Int4 crc_gap,
TypGRF_Data * result );


Expand Down Expand Up @@ -82,7 +78,6 @@ extern Int SyLoadModule( const Char * name, InitInfoFunc * func );

/****************************************************************************
**

*F * * * * * * * * * * * * * * * window handler * * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -119,8 +114,6 @@ extern Char * SyWinCmd (

/****************************************************************************
**


*F * * * * * * * * * * * * * * * * open/close * * * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -339,7 +332,6 @@ extern UInt SyIsIntr ( void );

/****************************************************************************
**

*F * * * * * * * * * * * * * * * * * output * * * * * * * * * * * * * * * * *
*/

Expand All @@ -356,7 +348,6 @@ extern Int SyEchoch (

/****************************************************************************
**

*F * * * * * * * * * * * * * * * * * input * * * * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -392,7 +383,6 @@ extern Int SyGetch (

/****************************************************************************
**

*F * * * * * * * * * * * * system error messages * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -427,7 +417,6 @@ extern void SySetErrorNo ( void );

/****************************************************************************
**

*F * * * * * * * * * * * * * file and execution * * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -548,7 +537,6 @@ extern Char *SyFindGapRootFile(const Char *filename, Char *buffer, size_t buffer

/****************************************************************************
**

*F * * * * * * * * * * * * * * * directories * * * * * * * * * * * * * * * *
*/

Expand Down Expand Up @@ -630,7 +618,6 @@ extern Obj SyReadStringFileGeneric(Int fid);

/****************************************************************************
**

*F * * * * * * * * * * * * * initialize package * * * * * * * * * * * * * * *
*/

Expand All @@ -646,6 +633,5 @@ StructInitInfo * InitInfoSysFiles ( void );

/****************************************************************************
**

*E sysfiles.h . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
*/
Loading