The Core Interface (C)

Top  Previous  Next

The Core Interface presents an interface to commonly-used features of the server. It is made available to clusters as the pointer C.

 

Version

const char  *Core::Version(void);

 

Return a string showing the version of the server that is running.  A typical value would be  "Windows Server V2.6".

Monitor

void  Core::Monitor(const char *format, ...);

 

Display a monitoring message in the server's output window. The message always starts with "MON: ". The call may be thought of as equivalent to:

 

fprintf(stderr, format,...);

Quit

 Core::Quit(const char *format, ...);

 

Terminate the running Diamond application after printing a message to the server's output window. The message starts with "Server terminated: " and is generated as though the call were:

 

fprintf(stderr, format,...);

Dump

void Core::Dump(const char *heading, void *b, unsigned int n);

 

Output a sequence of n 32-bit integer values, taken from b, in hexadecimal to stderr. The sequence is introduced with the string "MON: heading n words".

SetCommandLine

int Core::SetCommandLine(const char *string);

 

Copy the given string into the command line parameter.

GetCommandLine

const char *Core::GetCommandLine(void);

 

Return a pointer to the command line parameter.

GetCommandLineMax

int Core::GetCommandLineMax(void);

 

Return the maximum number of characters that can be put into the command line parameter.

GetBootFile

const char *Core::GetBootFile(void);

 

Return a pointer to the currently-selected application file name.

SetResultCode

void Core::SetResultCode(int n);

 

Set a 32-bit value that can be used to control program termination.

GetResultCode

int Core::GetResultCode(int n);

 

Return the result code, set either by an explicit call to SetResultCode or by the user program calling exit(n).

Output

void Core::Output(char *buffer, int length, int is_error);

 

Send length bytes from buffer to either stdout (is_error == 0) or stderr (is_error != 0).

ReadLine

int Core::ReadLine(char *s, int max);

 

Read a line of characters from either the input prompt or a file, depending on the current stdin settings. The function reads up to max characters and returns the number of characters read. The characters are terminated with a NUL char, not included in the number of characters. See fgets.

OpenLogFiles

void Core::OpenLogFiles(void);

 

Activate the files associated with stdin, stdout, and stderr.

CloseLogFiles

void Core::CloseLogFiles(void);

 

Deactivate and close all the files associated with stdin, stdout, and stderr.

StopRunning

void Core::StopRunning(void);

 

Signal the server to stop responding to requests from the CPU. Note that the server stops only when the next command from the CPU has been completed.

IsRunning

bool Core::IsRunning(void);

 

Returns true if a program is running in the CPU and the server is able to process commands from it; returns false otherwise.

G

SerCom *Core::G;

 

A pointer to the SerCom object the server is currently using to communicate with the GUI.

Opt

Options3L *Core::Opt;

 

A pointer to the active Options3L object.

NoReply

int Core::NoReply;

 

This flag is set when the NoReply bit is set in a command from the CPU.

 

The following five functions manipulate the arguments, argv and argc, that are passed to the application when it is started. The arguments are considered to be in two parts: a verb and the rest. The verb is made available as argv[0] while the rest is broken down into 'words' and made available through argv[1]... The total number of words, plus one for the verb, is passed as argc. The most common situation is when the verb is the application file being executed and the rest is the string set as the command line parameter.

 

SetVerb

void Core::SetVerb(const char *v);

 

Define the string used to initialize argv[0].

SetRest

void Core::SetRest(const char *r);

 

Define the string used to initialize argv[1]argv[argc].

GetVerb

const char *Core::GetVerb(void);

 

Return a pointer to the string to be used to set argv[0].

GetRest

const char *Core::GetVerb(void);

 

Return a pointer to the string used to initialize argv[1]argv[argc].

FreeArgs

void Core::FreeArgs(void);

 

Delete any strings set by SetVerb and SetRest. After this has been called, argv and argc will be derived from the command line parameter.