This file is indexed.

/usr/share/axiom-20170501/src/algebra/OMSERVER.spad is in axiom-source 20170501-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
)abbrev package OMSERVER OpenMathServerPackage
++ Author: Vilya Harvey
++ References:
++ Corl00 According to Abramowitz and Stegun or arccoth needn't be Uncouth
++ Fate01a A Critique of OpenMath and Thoughts on Encoding Mathematics
++ Description: 
++ \spadtype{OpenMathServerPackage} provides the necessary
++ operations to run AXIOM as an OpenMath server, reading/writing objects
++ to/from a port.  Please note the facilities available here are very basic.
++ The idea is that a user calls, for example, \axiom{Omserve(4000,60)} and then
++ another process sends OpenMath objects to port 4000 and reads the result.

OpenMathServerPackage() : SIG == CODE where

  SIG ==> with

    OMreceive : OpenMathConnection -> Any
      ++ OMreceive(c) reads an OpenMath object from connection \axiom{c} and
      ++ returns the appropriate AXIOM object.

    OMsend : (OpenMathConnection, Any) -> Void
      ++ OMsend(c,u) attempts to output \axiom{u} on \axiom{c} in OpenMath.

    OMserve : (SingleInteger, SingleInteger) -> Void
      ++ OMserve(portnum,timeout) puts AXIOM into server mode on port number
      ++ \axiom{portnum}.  The parameter \axiom{timeout} specifies the timeout
      ++ period for the connection.

  CODE ==> add

    import OpenMathDevice
    import OpenMathConnection
    import OpenMathPackage
    import OpenMath

    OMreceive(conn: OpenMathConnection): Any ==
      dev: OpenMathDevice := OMconnInDevice(conn)
      OMsetEncoding(dev, OMencodingUnknown);
      OMread(dev)

    OMsend(conn: OpenMathConnection, value: Any): Void ==
      dev: OpenMathDevice := OMconnOutDevice(conn)
      OMsetEncoding(dev, OMencodingXML);
      --retractable?(value)$AnyFunctions1(Expression Integer) =>
      --  OMwrite(dev, retract(value)$AnyFunctions1(Expression Integer), true)
      retractable?(value)$AnyFunctions1(Integer) =>
        OMwrite(dev, retract(value)$AnyFunctions1(Integer), true)
      retractable?(value)$AnyFunctions1(Float) =>
        OMwrite(dev, retract(value)$AnyFunctions1(Float), true)
      retractable?(value)$AnyFunctions1(SingleInteger) =>
        OMwrite(dev, retract(value)$AnyFunctions1(SingleInteger), true)
      retractable?(value)$AnyFunctions1(DoubleFloat) =>
        OMwrite(dev, retract(value)$AnyFunctions1(DoubleFloat), true)
      retractable?(value)$AnyFunctions1(String) =>
        OMwrite(dev, retract(value)$AnyFunctions1(String), true)

    OMserve(portNum: SingleInteger, timeout: SingleInteger): Void ==
      conn: OpenMathConnection := OMmakeConn(timeout)
      OMbindTCP(conn, portNum)
      val: Any
      while true repeat
        val := OMreceive(conn)
        OMsend(conn, val)