Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind
 Top of Book   Previous Chapter   Next Chapter 

9 Service functions
 9.1 Tools for making documentation
  9.1-1 SCSCPBuildManual

  9.1-2 SCSCPBuildManualHTML
 9.2 Other commands
  9.2-1 PingSCSCPservice

  9.2-2 PingStatistic

  9.2-3 InfoSCSCP

  9.2-4 DateISO8601

  9.2-5 CurrentTimestamp

  9.2-6 Hostname

  9.2-7 MemoryUsageByGAPinKbytes

  9.2-8 LastReceivedCallID

  9.2-9 IO_PickleToString

  9.2-10 IO_UnpickleFromString

9 Service functions

9.1 Tools for making documentation

9.1-1 SCSCPBuildManual
> SCSCPBuildManual( )( function )

This function is used to build the manual in PDF and HTML formats and also in the plain text format for the online help. To build the PDF version, a recent and fairly complete TeX distribution is recommended.

Since the SCSCP manual is distributed together with the package, it is not necessary for the user to use this function, which is normally used only by developers.

9.1-2 SCSCPBuildManualHTML
> SCSCPBuildManualHTML( )( function )

This function is used to build the manual only in HTML format. This does not require TeX installation and works in any operating system.

Since the SCSCP manual is distributed together with the package, it is not necessary for the user to use this function, which is normally used only by developers.

9.2 Other commands

9.2-1 PingSCSCPservice
> PingSCSCPservice( hostname, portnumber )( function )

Returns: true or fail

This function returns true if the client can establish connection with the SCSCP server at hostname:portnumber. Otherwise, it returns fail.


gap> PingSCSCPservice("localhost",26133);
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message
true
gap> PingSCSCPservice("localhost",26134);                     
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
Error: rec(
  number := 61,
  message := "Connection refused" )
fail

9.2-2 PingStatistic
> PingStatistic( hostname, portnumber, n )( function )

Returns: nothing

The function is similar to the UNIX ping. It tries n times to establish connection with the SCSCP server at hostname:portnumber, and then displays statistical information.


gap> PingStatistic("localhost",26133,5);
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message nr 1
...
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message nr 5
100 packets transmitted, 100 received, 0% packet loss, time 26ms
min/avg/max = [ 0, 13/50, 2 ]

9.2-3 InfoSCSCP
> InfoSCSCP( info class )

InfoSCSCP is a special Info class for the SCSCP package. The amount of information to be displayed can be specified by the user by setting InfoLevel for this class from 0 to 4, and the default value of InfoLevel for the package is specified in the file scscp/config.g. The higher the level is, the more information will be displayed. To change the InfoLevel to k, use the command SetInfoLevel(InfoSCSCP, k). In the following examples we demonstrate various degrees of output details using Info messages.


gap> EvaluateBySCSCP( "WS_Factorial",[10],"localhost",26133); 
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message 
#I  Request sent ...
#I  Waiting for reply ...
rec( object := "3628800", attributes := [ [ "call_id", "localhost:26133:38" ] ] )


gap> SetInfoLevel(InfoSCSCP,0);                              
gap> EvaluateBySCSCP( "WS_Factorial",[10],"localhost",26133);
rec( object := "3628800", attributes := [ [ "call_id", "localhost:26133:41" ] ] )


gap> SetInfoLevel(InfoSCSCP,3);
gap> G:=SymmetricGroup(4);;
gap> gens:=GeneratorsOfGroup(G);  
[ (1,2,3,4), (1,2) ]
gap> EvaluateBySCSCP( "GroupIdentificationService",[gens],"localhost",26133);
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message
#I Composing procedure_call message: 
<?scscp start ?>
<OMOBJ>
    <OMATTR>
		<OMATP>
			<OMS cd="scscp1" name="call_id"/>
			<OMSTR>localhost:26133:1212</OMSTR>
		</OMATP>
		<OMA>
			<OMS cd="scscp1" name="procedure_call"/>
			<OMA>
				<OMS cd="scscp_transient_1" name="GroupIdentificationService"/>
				<OMA>
					<OMS cd="list1" name="list"/>
					<OMA>
						<OMS cd="permut1" name="permutation"/>
						<OMI> 2</OMI>
						<OMI> 3</OMI>
						<OMI> 4</OMI>
						<OMI> 1</OMI>
					</OMA>
					<OMA>
						<OMS cd="permut1" name="permutation"/>
						<OMI> 2</OMI>
						<OMI> 1</OMI>
					</OMA>
				</OMA>
			</OMA>
		</OMA>
	</OMATTR>
</OMOBJ>
<?scscp end ?>
#I  Request sent ...
#I  Waiting for reply ...
#I  <?scscp start ?>
#I Received message: 
<OMOBJ>
	<OMATTR>
		<OMATP>
			<OMS cd="scscp1" name="call_id"/>
			<OMSTR>localhost:26133:1212</OMSTR>
		</OMATP>
		<OMA>
			<OMS cd="scscp1" name="procedure_completed"/>
			<OMA>
				<OMS cd="list1" name="list"/>
				<OMI> 24</OMI>
				<OMI> 12</OMI>
			</OMA>
		</OMA>
	</OMATTR>
</OMOBJ>
#I  <?scscp end ?>
#I  Got back: object [ 24, 12 ] with attributes [ [ "call_id", "localhost:26133:1212" ] ]
rec( object := [ 24, 12 ], attributes := [ [ "call_id", "localhost:26133:1212" ] ] )

9.2-4 DateISO8601
> DateISO8601( )( function )

Returns: string

Returns the current date in the ISO-8601 YYYY-MM-DD format. This is an internal function of the package which is used by the SCSCP server to generate the transient content dictionary, accordingly to the definition of the OpenMath symbol meta.CDDate.


gap> DateISO8601();
"2009-03-31"

9.2-5 CurrentTimestamp
> CurrentTimestamp( )( function )

Returns: string

Returns the result of the call to date. This is an internal function of the package which is used to add the timestamp to the SCSCP service description.


gap> CurrentTimestamp();
"Tue 31 Mar 2009 11:19:38 BST"

9.2-6 Hostname
> Hostname( )( function )

Returns: string

Returns the result of the call to hostname. This function may be used in the configuration file scscp/config.g to specify that the default hostname which will be used by the SCSCP server will be detected automatically using hostname.


gap> Hostname();
"scscp.symbolic-computation.co.uk"

9.2-7 MemoryUsageByGAPinKbytes
> MemoryUsageByGAPinKbytes( )( function )

Returns: integer

Returns the current volume of the memory used by GAP in kylobytes. This is equivalent to calling ps -p <PID> -o vsz, where <PID> is the process ID of the GAP process. This is an internal function of the package which is used by the SCSCP server to report its memory usage in the info_memory attribute when being called with the option debuglevel=2 (see options in EvaluateBySCSCP (6.1-4) and NewProcess (6.1-2)).


gap> MemoryUsageByGAPinKbytes();
649848

9.2-8 LastReceivedCallID
> LastReceivedCallID( )( function )

Returns: string

Returns the call ID contained in the most recently received message. It may contain some useful debugging information; in particular, the call ID for the GAP SCSCP client and server contains colon-separated server name, port number, process ID and a random string.


gap> LastReceivedCallID();
"scscp.symbolic-computation.co.uk:26133:77372:choDZBgA"

9.2-9 IO_PickleToString
> IO_PickleToString( obj )( function )

Returns: string containing "pickled" object

This function "pickles" or "serialises" the object obj using the operation IO_Pickle (IO: IO_Pickle) from the IO package, and writes it to a string, from which it could be later restored using IO_UnpickleFromString (9.2-10). This provides a way to design SCSCP procedures which transmit GAP objects in the "pickled" format as OpenMath strings, which may be useful for objects which may be "pickled" by the IO package but can not be converted to OpenMath or for which the "pickled" representation is more compact or can be encoded/decoded much faster.

See IO_Pickle (IO: IO_Pickle) and IO_Unpickle (IO: IO_Unpickle) for more details.


gap> f := IO_PickleToString( GF( 125 ) );
"FFIEINTG\>15INTG\>13FAIL"

9.2-10 IO_UnpickleFromString
> IO_UnpickleFromString( s )( function )

Returns: "unpickled" GAP object

This function "unpickles" the string s which was created using the function IO_PickleToString (9.2-9), using the operation IO_Unpickle (IO: IO_Unpickle) from the IO package. See IO_PickleToString (9.2-9) for more details and suggestions about its usage.


gap> IO_UnpickleFromString( f );                    
GF(5^3)
gap> f = IO_UnpickleFromString( IO_PickleToString( f ) ); 
true

 Top of Book   Previous Chapter   Next Chapter 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 Bib Ind

generated by GAPDoc2HTML