File: private.g

package info (click to toggle)
gap-scscp 2.3.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,704 kB
  • sloc: xml: 1,247; sh: 389; makefile: 19
file content (122 lines) | stat: -rw-r--r-- 4,268 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#############################################################################
#
# This file contains some experimental code for SCSCP services,
# which is not included in the package release and collected here
# for easier release maintenance.
#
#############################################################################

#############################################################################
#
# List of necessary packages and other commands if needed
#
#############################################################################

#LoadPackage("automata");
#ReadPackage("scscp", "par/automata.g");

#############################################################################
#
# Installation of procedures to make them available for WS 
#
#############################################################################

#############################################################################
#
# procedures for automata
#
#InstallSCSCPprocedure( "EpsilonToNFA", EpsilonToNFA ); # from the 'automata' package
#InstallSCSCPprocedure( "TwoStackSerAut", TwoStackSerAut );
#InstallSCSCPprocedure( "DerivedStatesOfAutomaton", DerivedStatesOfAutomaton );


#############################################################################
#
# procedures for MIP checks from the autiso package
#
if LoadPackage("autiso") = true then
	InstallSCSCPprocedure( "CheckBin512", bin -> [ bin,CheckBin(2,9, bin) ] );
fi;

#############################################################################
#
# Karatsuba multiplication of polynomials
#
ReadPackage("scscp", "example/karatsuba.g");

KaratsubaPolynomialMultiplicationExtRepByString:=function(s1,s2)
return String( KaratsubaPolynomialMultiplicationExtRep( EvalString(s1), EvalString(s2) ) );
end;

InstallSCSCPprocedure("WS_Karatsuba", KaratsubaPolynomialMultiplicationExtRepByString, 
	"See Examples chapter in the SCSCP package manual", 2, 2 );

#############################################################################
#
# Some debugging tricks that we should not include in the public service
#
#############################################################################


#############################################################################
#
# ApplyFunction( <string with function name>, <list of arguments> );
#
# Allows to call GAP functions even if they are not installed as SCSCP 
# procedures, for example:
# EvaluateBySCSCP("ApplyFunction",["Factorial",[10]],"localhost",26133);  
# EvaluateBySCSCP("ApplyFunction",["Binomial",[50,10]],"localhost",26133);
#
ApplyFunction:=function( func, args )
return CallFuncList( EvalString( func ), args );
end;

InstallSCSCPprocedure( "ApplyFunction", ApplyFunction, 
	"1st argument is a string with the name of the function, the rest is the list of its arguments", 2, 2 );


#############################################################################
#
# EvaluateOpenMathCode( <OpenMath plain string> )
#
# Evaluates OpenMath code given as an input (without OMOBJ tags) wrapped in 
# OMPlainString, for example:
# EvaluateBySCSCP( "EvaluateOpenMathCode", 
#   [ OMPlainString("<OMA><OMS cd=\"arith1\" name=\"plus\"/><OMI>1</OMI><OMI>2</OMI></OMA>")],
#   "localhost",26133 ); 
EvaluateOpenMathCode:=function( omc );
return omc;
end;

InstallSCSCPprocedure( "EvaluateOpenMathCode", EvaluateOpenMathCode, 
	"Evaluates OpenMath code given as an input (without OMOBJ tags) wrapped in OMPlainString", 1, 1 );
	
	
#############################################################################
#
# ChangeInfoLevel( <n> )
#
# Changes InfoSCSCP level on the server without restarting it.
#
ChangeInfoLevel:=function( n )
SetInfoLevel( InfoSCSCP, n );
return true;
end;

InstallSCSCPprocedure( "ChangeInfoLevel", ChangeInfoLevel, 
	"To change InfoSCSCP level on the server without restarting", 1, 1 );
	
	
#############################################################################
#
# SCSCPRestoreErrorsOnServer( )
#
# After this call, the break loop will occure on the server again.
#
SCSCPRestoreErrorsOnServer:=function( )
RereadLib("error.g"); # to restore the library version of ErrorInner
return true;
end;

InstallSCSCPprocedure( "SCSCPRestoreErrorsOnServer", SCSCPRestoreErrorsOnServer, 
	"To make break loops happening on the server", 0, 0 );