Skip to content
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ Installing `singular`:
gap> LoadPackage("singular");
true

To check whether GAP can already find the Singular executable, run

gap> IsSingularExecutableAvailable();

4. The documentation is in the `doc` subdirectory: it is more up-to-date
than this README file.

Expand Down
33 changes: 32 additions & 1 deletion doc/singular.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,36 @@ In this case, with a standard installation of Cygwin and

</Description>

</ManSection>
</ManSection>

<ManSection>
<Func Name="IsSingularExecutableAvailable" Arg = ""/>
<Description>


The function <A>IsSingularExecutableAvailable</A> checks whether the
current value of <Ref Var="sing_exec"/> already points to an executable
file, and otherwise tries to resolve it automatically. In particular, if
<Ref Var="sing_exec"/> names only a directory, then the file
<File>Singular</File> inside that directory is tried; if it contains no
directory separator, then it is searched in the system program path; and
if <Ref Var="sing_exec"/> is not set or cannot be used, then the program
name <File>Singular</File> is searched in the system program path.

<Example>
gap> IsSingularExecutableAvailable();
true
</Example>

If the function returns <K>true</K>, then <Ref Var="sing_exec"/> has been
normalized to a usable executable path. If it returns <K>false</K>, then
the package still does not know how to start <Package>Singular</Package>,
and <Ref Var="sing_exec"/> should be set explicitly before calling
<Ref Func="StartSingular"/>.

</Description>

</ManSection>



Expand All @@ -488,6 +517,8 @@ After the package <Package>singular</Package> has been loaded,
<Package>Singular</Package> is started automatically when one of the
functions of the interface is called. Alternatively, one can start
<Package>Singular</Package> with the command <A>StartSingular</A>.
To check beforehand whether the executable can be found, use
<Ref Func="IsSingularExecutableAvailable"/>.

<Example>
gap> StartSingular();
Expand Down
13 changes: 10 additions & 3 deletions gap/singular.g
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ end );



BindGlobal( "CheckSingularExecutableAndTempDir", function ( )
local i, IsExec;
BindGlobal( "IsSingularExecutableAvailable", function ( )
local IsExec;

# check the Singular executable file, and if needed try to
# autodetermine, or print an appropriate error message
Expand Down Expand Up @@ -260,8 +260,15 @@ BindGlobal( "CheckSingularExecutableAndTempDir", function ( )
fi;
fi;

return IsBound( sing_exec ) and IsExec( sing_exec );
end );


BindGlobal( "CheckSingularExecutableAndTempDir", function ( )
local i;

# check the executable file, if failed print an error message
while not IsBound( sing_exec ) or not IsExec( sing_exec ) do
while not IsSingularExecutableAvailable() do
Print( " Type 'sing_exec:=\"<path>\"; return;' where <path>\n" );
Print( " is the path of the Singular executable file on your \
system.\n" );
Expand Down