Skip to content

Commit

Permalink
Merge branch 'master' into lg/cite-year
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Jun 27, 2024
2 parents 65b46cf + 1a9d941 commit a633a92
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 89 deletions.
4 changes: 1 addition & 3 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,12 @@ multiple parts.
- `testinstall`: quick test suite that one can test frequently.
Run via `./gap tst/testinstall.g`
- `teststandard`: slower but more comprehensive test suite.
Run via `./gap tst/testinstall.g`
Run via `./gap tst/teststandard.g`
- `testextra`: very slow test suite that tests even more
Run via `./gap tst/testextra.g`
- `testbugfix`: additional small test files that are created to verify
specific bugfixes work as intended
Run via `./gap tst/testbugfix.g`
- `testinstall`: quick test suite that one can test frequently.
Run via `./gap tst/testinstall.g`


## Tracking down regressions
Expand Down
2 changes: 1 addition & 1 deletion dev/releases/HelpLinks-to-JSON.g
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ for x in NamesOfComponents(HELP_BOOKS_INFO) do

for i in [1 .. Length(book.entries)] do
entry := HELP_BOOK_HANDLER.HelpDataRef(book, i);
name := StripEscapeSequences(entry[1]);
name := _StripEscapeSequences(entry[1]);
name := ReplacedString(name, match, "");
NormalizeWhitespace(name);

Expand Down
1 change: 1 addition & 0 deletions doc/ref/files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ for more information how to do this.
<Heading>File Names</Heading>

<#Include Label="Filename">
<#Include Label="PathSystemProgram">

</Section>

Expand Down
21 changes: 3 additions & 18 deletions hpcgap/lib/helpbase.gi
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ end);
## This utility will first be used in some debug tools showing what is newly
## installed by loading a package. Can be documented if desired.
##
# avoid warning for vars from GAPDoc package
if not IsBound(StripEscapeSequences) then
StripEscapeSequences := 0;
fi;

BindGlobal( "IsDocumentedWord", function( arg )
local inid, word, case, simple, cword, book, matches, a, match;

Expand All @@ -76,7 +71,7 @@ BindGlobal( "IsDocumentedWord", function( arg )
for book in HELP_KNOWN_BOOKS[1] do
matches:= HELP_GET_MATCHES( [ book ], simple, true );
for a in Concatenation( matches ) do
match:= case( StripEscapeSequences( a[1].entries[ a[2] ][1] ) );
match:= case( _StripEscapeSequences( a[1].entries[ a[2] ][1] ) );
if cword in SplitString( match, "", Difference( match, inid ) ) then
return true;
fi;
Expand Down Expand Up @@ -285,7 +280,7 @@ for pair in TRANSATL do
for book in HELP_KNOWN_BOOKS[1] do
matches:= HELP_GET_MATCHES( [ book ], word, false );
for a in Concatenation( matches ) do
match:= StripEscapeSequences( a[1].entries[ a[2] ][1] );
match:= _StripEscapeSequences( a[1].entries[ a[2] ][1] );
patterns:=[];
for i in [1..Length(TRANSATL)] do
patterns[i]:=[];
Expand Down Expand Up @@ -315,10 +310,6 @@ return report;
od; # end atomic
end);

if StripEscapeSequences = 0 then
Unbind(StripEscapeSequences);
fi;


#############################################################################
##
Expand Down Expand Up @@ -1061,9 +1052,6 @@ end);
if not IsBound( InitialSubstringUTF8String ) then
InitialSubstringUTF8String:= "dummy";
fi;
if not IsBound( LETTERS ) then
LETTERS:= "dummy";
fi;
if not IsBound( WidthUTF8String ) then
WidthUTF8String:= "dummy";
fi;
Expand Down Expand Up @@ -1094,7 +1082,7 @@ BindGlobal( "InitialSubstringUTF8Text", function( str, cols )
fi;
# Now pos points at an ESC character; all escape sequences we
# support are terminated by a letter, so search for one.
j:= PositionProperty( str, c -> c in LETTERS, pos );
j:= PositionProperty( str, c -> c in CHARS_ALPHA, pos );
if j = fail then
Error( "string end inside escape sequence" );
fi;
Expand All @@ -1106,9 +1094,6 @@ end );
if not IsReadOnlyGlobal( "InitialSubstringUTF8String" ) then
Unbind( InitialSubstringUTF8String );
fi;
if not IsReadOnlyGlobal( "LETTERS" ) then
Unbind( LETTERS );
fi;
if not IsReadOnlyGlobal( "WidthUTF8String" ) then
Unbind( WidthUTF8String );
fi;
Expand Down
2 changes: 1 addition & 1 deletion lib/debug.g
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Debug := function(arg)
fi;

# Call the editor:
execpath := Filename(DirectoriesSystemPrograms(),DEBUG.EDITOR.command);
execpath := PathSystemProgram(DEBUG.EDITOR.command);
l:= List( DEBUG.EDITOR.args, x -> ReplacedString( x, "###", String( i ) ) );
Add(l,t); # append the temporary filename
Process(DirectoryCurrent(),execpath,InputTextUser(),OutputTextUser(),l);
Expand Down
47 changes: 33 additions & 14 deletions lib/files.gd
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,10 @@ DeclareGlobalFunction( "DirectoryDesktop" );
## <P/>
## <E>For example</E>,
## in order to locate the system program <C>date</C> use
## <Ref Func="DirectoriesSystemPrograms"/> together with the second form of
## <Ref Oper="Filename" Label="for a list of directories and a string"/>.
## <Ref Func="PathSystemProgram"/>.
## <P/>
## <Log><![CDATA[
## gap> path := DirectoriesSystemPrograms();;
## gap> date := Filename( path, "date" );
## gap> date := PathSystemProgram( "date" );
## "/bin/date"
## ]]></Log>
## <P/>
Expand Down Expand Up @@ -431,6 +429,37 @@ BIND_GLOBAL( "DirectoriesSystemPrograms", function()
end );


#############################################################################
##
#F PathSystemProgram( <name> ) . . . . . . . . . . path of a system program
##
## <#GAPDoc Label="PathSystemProgram">
## <ManSection>
## <Func Name="PathSystemProgram" Arg='name'/>
##
## <Description>
## <Ref Func="PathSystemProgram"/> returns either the path of the first
## executable file <A>name</A> in one of the directories returned by
## <Ref Func="DirectoriesSystemPrograms"/>,
## or <K>fail</K> if no such file exists.
## </Description>
## </ManSection>
## <#/GAPDoc>
##
BIND_GLOBAL( "PathSystemProgram", function( name )
local dir, path;

for dir in DirectoriesSystemPrograms() do
path:= Filename( dir, name );
if IsExecutableFile( path ) then
return path;
fi;
od;

return fail;
end );


#############################################################################
##
#F DirectoryTemporary() . . . . . . . . . . . . create a temporary directory
Expand Down Expand Up @@ -794,16 +823,6 @@ end );
##
DeclareGlobalFunction( "Edit" );

# the character set definitions might be needed when processing files, thus
# they must come earlier.
BIND_GLOBAL("CHARS_DIGITS",Immutable(SSortedList("0123456789")));
BIND_GLOBAL("CHARS_UALPHA",
Immutable(SSortedList("ABCDEFGHIJKLMNOPQRSTUVWXYZ")));
BIND_GLOBAL("CHARS_LALPHA",
Immutable(SSortedList("abcdefghijklmnopqrstuvwxyz")));
BIND_GLOBAL("CHARS_SYMBOLS",Immutable(SSortedList(
" !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")));


## <#GAPDoc Label="HexSHA256">
## <ManSection>
Expand Down
2 changes: 1 addition & 1 deletion lib/files.gi
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ InstallGlobalFunction( Edit, function( name )
local editor, ret;

name := UserHomeExpand(name);
editor := Filename( DirectoriesSystemPrograms(), UserPreference("Editor") );
editor := PathSystemProgram( UserPreference("Editor") );
if editor = fail then
Error( "cannot locate editor `", UserPreference("Editor"),
"' (reset via SetUserPreference(\"Editor\", ...))" );
Expand Down
21 changes: 3 additions & 18 deletions lib/helpbase.gi
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ end);
## This utility will first be used in some debug tools showing what is newly
## installed by loading a package. Can be documented if desired.
##
# avoid warning for vars from GAPDoc package
if not IsBound(StripEscapeSequences) then
StripEscapeSequences := 0;
fi;

BindGlobal( "IsDocumentedWord", function( arg )
local inid, word, case, simple, cword, book, matches, a, match;

Expand All @@ -75,7 +70,7 @@ BindGlobal( "IsDocumentedWord", function( arg )
for book in HELP_KNOWN_BOOKS[1] do
matches:= HELP_GET_MATCHES( [ book ], simple, true );
for a in Concatenation( matches ) do
match:= case( StripEscapeSequences( a[1].entries[ a[2] ][1] ) );
match:= case( _StripEscapeSequences( a[1].entries[ a[2] ][1] ) );
if cword in SplitString( match, "", Difference( match, inid ) ) then
return true;
fi;
Expand Down Expand Up @@ -279,7 +274,7 @@ for pair in TRANSATL do
for book in HELP_KNOWN_BOOKS[1] do
matches:= HELP_GET_MATCHES( [ book ], word, false );
for a in Concatenation( matches ) do
match:= StripEscapeSequences( a[1].entries[ a[2] ][1] );
match:= _StripEscapeSequences( a[1].entries[ a[2] ][1] );
patterns:=[];
for i in [1..Length(TRANSATL)] do
patterns[i]:=[];
Expand Down Expand Up @@ -308,10 +303,6 @@ od;
return report;
end);

if StripEscapeSequences = 0 then
Unbind(StripEscapeSequences);
fi;


#############################################################################
##
Expand Down Expand Up @@ -1037,9 +1028,6 @@ end);
if not IsBound( InitialSubstringUTF8String ) then
InitialSubstringUTF8String:= "dummy";
fi;
if not IsBound( LETTERS ) then
LETTERS:= "dummy";
fi;
if not IsBound( WidthUTF8String ) then
WidthUTF8String:= "dummy";
fi;
Expand Down Expand Up @@ -1070,7 +1058,7 @@ BindGlobal( "InitialSubstringUTF8Text", function( str, cols )
fi;
# Now pos points at an ESC character; all escape sequences we
# support are terminated by a letter, so search for one.
j:= PositionProperty( str, c -> c in LETTERS, pos );
j:= PositionProperty( str, c -> c in CHARS_ALPHA, pos );
if j = fail then
Error( "string end inside escape sequence" );
fi;
Expand All @@ -1082,9 +1070,6 @@ end );
if not IsReadOnlyGlobal( "InitialSubstringUTF8String" ) then
Unbind( InitialSubstringUTF8String );
fi;
if not IsReadOnlyGlobal( "LETTERS" ) then
Unbind( LETTERS );
fi;
if not IsReadOnlyGlobal( "WidthUTF8String" ) then
Unbind( WidthUTF8String );
fi;
Expand Down
4 changes: 2 additions & 2 deletions lib/helpview.gi
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ local s,l,a,e,n,c;
FWITF:=Filename(DirectoryTemporary(),"clients");
fi;
if XLSCLIENTSCMD=false then
XLSCLIENTSCMD:=Filename(DirectoriesSystemPrograms(),"xlsclients");
XLSCLIENTSCMD:=PathSystemProgram("xlsclients");
fi;
if XLSCLIENTSCMD=fail then
return fail;
Expand Down Expand Up @@ -393,7 +393,7 @@ show := function(file)
file := file.file;
fi;
if XRMTCMD=false then
XRMTCMD:=Filename(DirectoriesSystemPrograms(),"xrmtcmd");
XRMTCMD:=PathSystemProgram("xrmtcmd");
fi;
if XRMTCMD<>fail then
wnum:=FindWindowId("xdvi",file); # get the window ID of a running XDVI
Expand Down
9 changes: 1 addition & 8 deletions lib/package.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2086,10 +2086,6 @@ InstallGlobalFunction( AutoloadPackages, function()
##
#F GAPDocManualLab(<pkgname>) . create manual.lab for package w/ GAPDoc docs
##
# avoid warning (will be def. in GAPDoc)
if not IsBound(StripEscapeSequences) then
StripEscapeSequences := 0;
fi;
InstallGlobalFunction( GAPDocManualLabFromSixFile,
function( bookname, sixfilepath )
local stream, entries, SecNumber, esctex, file;
Expand All @@ -2112,7 +2108,7 @@ InstallGlobalFunction( GAPDocManualLabFromSixFile,

# throw away TeX critical characters here
esctex:= function( str )
return Filtered( StripEscapeSequences( str ), c -> not c in "%#$&^_~" );
return Filtered( _StripEscapeSequences( str ), c -> not c in "%#$&^_~" );
end;

bookname:= LowercaseString( bookname );
Expand Down Expand Up @@ -2160,9 +2156,6 @@ InstallGlobalFunction( GAPDocManualLab, function(pkgname)
GAPDocManualLabFromSixFile( book.BookName, file );
od;
end );
if StripEscapeSequences = 0 then
Unbind(StripEscapeSequences);
fi;


#############################################################################
Expand Down
5 changes: 2 additions & 3 deletions lib/pager.gi
Original file line number Diff line number Diff line change
Expand Up @@ -290,13 +290,12 @@ end);
# +num for starting display in line num

BindGlobal("PAGER_EXTERNAL", function( lines )
local path, pager, linepos, str, i, cmdargs, stream;
local pager, linepos, str, i, cmdargs, stream;

pager := UserPreference("Pager");
if not (Length(pager) > 0 and pager[1] = '/' and IsExecutableFile(pager))
then
path := DirectoriesSystemPrograms();
pager := Filename( path, UserPreference("Pager") );
pager := PathSystemProgram( UserPreference("Pager") );
fi;
if pager=fail then
Error( "Pager ", UserPreference("Pager"),
Expand Down
2 changes: 1 addition & 1 deletion lib/polyconw.gi
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ end);
## str := "";
## get := OutputTextString(str, false);
## comm := "wget -q ftp://ftp.comlab.ox.ac.uk/pub/Documents/techpapers/Richard.Brent/factors/factors.gz -O - | gzip -dc ";
## Process(DirectoryCurrent(), Filename(DirectoriesSystemPrograms(),"sh"),
## Process(DirectoryCurrent(), PathSystemProgram("sh"),
## InputTextUser(), get, ["-c", comm]);
## res := [[],[]];
## n := 0;
Expand Down
10 changes: 4 additions & 6 deletions lib/process.gd
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
## directory.
## <P/>
## <Log><![CDATA[
## gap> path := DirectoriesSystemPrograms();;
## gap> ls := Filename( path, "ls" );;
## gap> ls := PathSystemProgram( "ls" );;
## gap> stdin := InputTextUser();;
## gap> stdout := OutputTextUser();;
## gap> path := DirectoriesSystemPrograms();;
## gap> Process( path[1], ls, stdin, stdout, ["-c"] );;
## awk ls mkdir
## gap> # current directory, here the root directory
Expand Down Expand Up @@ -123,12 +123,10 @@
## Note that input/output redirection commands are <E>not</E> allowed as
## <A>options</A>.
## <P/>
## In order to find a system program use <Ref Func="DirectoriesSystemPrograms"/>
## together with <Ref Oper="Filename" Label="for a directory and a string"/>.
## In order to find a system program use <Ref Func="PathSystemProgram"/>.
## <P/>
## <Log><![CDATA[
## gap> path := DirectoriesSystemPrograms();;
## gap> date := Filename( path, "date" );
## gap> date := PathSystemProgram( "date" );
## "/bin/date"
## ]]></Log>
## <P/>
Expand Down
4 changes: 2 additions & 2 deletions lib/process.gi
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ InstallGlobalFunction( Exec, function( arg )
# on Windows, we use the native shell such that behaviour does
# not depend on whether cygwin is installed or not.
# cmd.exe is preferable to old-style `command.com'
shell := Filename( DirectoriesSystemPrograms(), "cmd.exe" );
shell := PathSystemProgram( "cmd.exe" );
cs := "/C";
else
shell := Filename( DirectoriesSystemPrograms(), "sh" );
shell := PathSystemProgram( "sh" );
cs := "-c";
fi;

Expand Down
4 changes: 2 additions & 2 deletions lib/profile.g
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ BIND_GLOBAL("ProfileOperationsOff",function()
UnprofileMethods(\+,\-,\*,\/,\^,\mod,\<,\=,\in,
\.,\.\:\=,IsBound\.,Unbind\.,
\[\],\[\]\:\=,IsBound\[\],Unbind\[\]);
#T Why? These operations are listed in PFOFILED_OPERATIONS!
#T Why? These operations are listed in PROFILED_OPERATIONS!
end);

BIND_GLOBAL("ProfileOperations",function( arg )
Expand Down Expand Up @@ -836,7 +836,7 @@ BIND_GLOBAL("ProfileOperationsAndMethodsOn",function()
ProfileMethods(\+,\-,\*,\/,\^,\mod,\<,\=,\in,
\.,\.\:\=,IsBound\.,Unbind\.,
\[\],\[\]\:\=,IsBound\[\],Unbind\[\]);
#T Why? These operations are listed in PFOFILED_OPERATIONS!
#T Why? These operations are listed in PROFILED_OPERATIONS!
end);

ProfileOperationsAndMethodsOff := ProfileOperationsOff;
Expand Down
Loading

0 comments on commit a633a92

Please sign in to comment.