The file may also contain a comment which describes how the server program can be invoked in a way which brings back its state at the time of the object creation. The format of the comment is:
/* EmBeDcommand string */The command string will, when handed over to the shell, start the server with whatever parameters are appropriate. For example, if an object is created from Siag with the document heaven.siag loaded, the command string will be:
siag heaven.siag
Fully conforming servers and/or clients must implement the "should" capabilities. It is possible for a program to be a server, a client or both.
#define EMBED_OK 0 #define EMBED_ERR 1Conditions that may give the return EMBED_ERR include out of memory, specified object file does not exist, tag does not refer to a loaded object.
int embed_init(Widget toplevel)Called before any other functions.
char *embed_load(char *filename)Loads an object. Returns the file name if successful, otherwise NULL. This is used as a tag to the object in subsequent calls to embedding functions.
int embed_unload(char *tag)Unloads a previously loaded object.
int embed_open(char *tag)Starts the creating server program according to the description comment. If there is no description comment, as is the case with X11 Bitmap files created by nonconforming applications, the file is loaded into the application bitmap.
int embed_save(char *filename, char *command, Pixmap bitmap)A new object file is created, using filename as file name, command as the description (without the "EmBeD") and bitmap as the bitmap of depth 1 which should be displayed by a client.
int embed_print(FILE *fp, char *tag, int x, int y)Creates Postscript code to print the object at offset x,y on a page. This is not yet implemented, only the outline rectangle is drawn.
int embed_size(char *tag, unsigned int width, unsigned int height)Returns the width and height of the object.
int embed_draw(Drawable d, int x, int y, char *tag)Draws the object on the specified drawable.
Many applications created before the IOA specification are capable of creating and/or displaying X11 Bitmaps, including XPaint, Netscape, Chimera and XV.
XPM shares with XBM the property that the file format is plain C which can trivially be #included in a C program. This makes it monumentally simple to create a basic object server.