source: git/MP/examples/README @ 678cfd

spielwiese
Last change on this file since 678cfd was 678cfd, checked in by Olaf Bachmann <obachman@…>, 27 years ago
This commit was generated by cvs2svn to compensate for changes in r337, which included commits to RCS files with non-trunk default branches. git-svn-id: file:///usr/local/Singular/svn/trunk@338 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.9 KB
Line 
1The routines in this directory provide some simple tests of the MP put
2and get routines. They may also be used as a first example for writing
3MP code.  The programs are divded into three sets.
4
5First Set:
6
7gmptest.c - test arbitrary precision integer routines
8
9This program simply tests the use of the arbitrary precision integer
10routines.  Respond to the prompts and compare the output with what you
11entered.
12 
13
14Second and Third Sets:
15
16The second and third sets of test programs communicate MP data between
17a client (the sender) and a server (the receiver).  The data may be
18sent via files or sockets.
19
20See the documention for how to access the TCP and FILE transport
21mechanisms and the additional arguments required.
22
23Second Set:
24
25The client.c and server.c programs use the packet-level routines
26(e.g., MP_PutSint32Packet()), while the imp-client and imp-server
27programs use data level routines (the packets are sent/received
28piecemeal; for example, IMP_PutNodeHeader() followed by
29IMP_PutSint32Type()).  See the documentation in doc subdirectory of
30this distribution for further explanation of packet-level versus
31data-level access.
32
33client.c      - send MP data using packet-level routines
34imp-client.c  - send MP data using data-level routines
35server.c      - receive MP data using packet-level routines
36imp-server.c  - receive MP data using data-level routines
37
38You may use either of the sample test file (test.ex1 or test.ex2) as
39input.  Output produced by the server is sent to the screen and to the
40output file test.out in an ascii format for comparison with the source
41file (e.g., with diff).  test.ex2 contains Label and Reference
42annotations not recognized by the code in the second set of test
43programs (see the test programs in the third set below for that).
44
45Note that, on the client side, there is no understanding of what a
46tree "looks like".  Specifically, MP_EndMsgReset() is not called until
47after all the source input has been read.  Similarly, on the receving
48side, MP_SkipMsg() is called only once, before any MP data is read.
49The code in the third set of examples is more realistic in this
50respect.  For this reason, the client-side test routines from the
51second set will only work with the server-side test routines from the
52second set.  Similarly for the routines from the third set.
53
54
55Third Set:
56
57send-tree.c  - send an MP tree using data-level routines
58recv-tree.c  - receive an MP tree using data-level routines.
59
60The client code (send-tree.c) and server code (recv-tree.c) know
61something of MP tree structure.  So the client will make a call to
62MP_EndMsgReset() at the end of each tree.  Correspondingly, the server
63makes a call to MP_SkipMsg() before receiving each tree. The server
64code (recv-tree.c and node.c) builds the incoming tree in memory
65before printing it out to the file test.out.  The server recognizes
66Label and Reference annotations, but expects the Label annotation to
67appear before the Reference annotation.  Test this code with file
68test.ex2, but don't expect the test.out to be identical to the input
69since Labels and References are used.
70
71
72Format of the test files:
73
74To make the comparison of the source files and the server's output
75file (test.out), the format of the source file must be precise.  There
76must be no trailing blanks and one a single blank space separating
77fields (e.g. type field from number-of-annotations field).
78
79For data nodes the format is:
80
81Type  [dictionary]  Data-value  Number-of-annotations  [Number-of-children]
82
83with fields given between brackets ([]) not present for all types.
84See the MP documentation for more information.
85
86For annotation nodes the format is:
87
88Type  dictionary  Flags
89
90Currently the annotation Type field is a string representing a MP
91defined annotation.  The Flags field is given as a hexadecimal number.
92
93The dictionary is identified by it tag number.  Values for the common
94types defined in dictionaries (common operator and common constant)
95are specified using their tag number.
Note: See TracBrowser for help on using the repository browser.