The "dumpSC" Program

Matt Wright, 6/14/96

The program "dumpSC" listens on a UDP or Unix port for messages in the SynthControl network format, and prints their contents to the screen as they are received. This is useful primarily for debugging SynthControl clients.

Availability

The "dumpSC" program is available in CAST release 1.0 in the bin subdirectory of the distribution directory.

Invoking dumpSC

Invoke dumpSC with exactly one command-line argument: the port number (UDP or Unix) to which dumpSC should listen. For example, the following invocation causes dumpSC to listen to port 7123:

dumpSC 7123

Interpreting dumpSC's output


The output of dumpSC is the inverse of the input to sendSC.
Here is some sample text that dumpSC might print:

[
Atime_scale 0.900000
Ctpe_points -4.000000 15.000000 4.000000 8.120000 10.000000 5.000000
_load_dataset "/usr/local/cast/data/foo.fmt"
]
[
Astart 0.560000
]

The square brackets delimit the messages that were received in the same packet, grouped by the SynthControl "#group" mechanism. In the above example, the two pairs of square brackets indicate that two packets were received, the first containing three messages and the second containing only one.

dumpSC prints each message on its own line, starting with the message address and name and continuing with all of the arguments to the message.

In the above example, the first message received was "Atime_scale", with a single floating point argument 0.9. The second message received was "Ctpe_points", with six floating point arguments. The third message, "_load_dataset", had a single string argument. Note that string arguments are always delimited by double-quote characters.

Message argument type-guessing heuristics

In the SynthControl data format, arguments to messages are represented in their binary form, with no type-tagging information. It is assumed that the client and server both have the same notion of what the argument types should be to a given message.

Therefore, when dumpSC receives a message, it has to guess what the types of the arguments are. Here are the heuristics used:

1) If a given argument word represents an integer between -1000 and 1000000 (inclusive), it's interpreted (i.e., printed) as an integer.

2) Otherwise, if a given argument word represents a floating point number between -1000.0f and 0.f or between 0.000001f and 1000000.0f, it's interpreted as a float. (Note that all of the integers from 0 to 1000000000 represent floating point numbers between 0. and 0.005, so any reasonably small nonnegative integer value will also appear to be a very small floating point value. Also, the first four characters of strings like "/usr" and "/home" have bit representations that look like very small positive floating point numbers.)

3) Otherwise, if a given argument word is the beginning of a valid SynthControl-formatted string, all of the bytes of that string are interpreted as a string. A valid string is a sequence of characters that satisfy the isprint() test (from ctype.h) ending with a null character and enough extra null characters to align the string on a 4-byte boundary.

4) Lastly, if a given argument word satisfies none of these criteria, it's printed in hex, followed by a question mark, e.g., "0xDE23C860(?)".

Obviously, these heuristics are just heuristics. Floats between 0. and 0.00001 will be interpreted as integers or strings. The string "@" will be interpreted as the floating point number 2.000. But for most reasonable data, these heuristics work fine.