[Prev] [Next] [Top] [Bottom] [Contents] (6 out of 22)

Printing Out From Sapphire/Web CGIs

Using Templates

If you use HTML templates, you should generate your output calls in the Population callbacks. The reason is that Sapphire/Web CGIs always print out the required:

Content-type: text/html\n\n

However, the <HTML> tag has not been output yet, but now your HTML template will probably contain that tag. This template is not "played" until all of your Main has executed (see SgeProcessInputStream in the Using Sapphire/Web Client API chapter of the Reference Manual and all of the Data Objects for that activator function have executed. Only from within the Population Callbacks will the beginning of the HTML template have been "played". If you do want to send status or error information from outside of your Population Callback, look at the function SaPrintHtmlError in the Using Sapphire/Web Client API chapter of the Reference Manual.

HTML without Templates

If you are not using HTML templates, expect the following Sapphire/Web behavior. The CGI only outputs the Content-type header; it is your responsibility to produce all the HTML tags. Also, there is no "playing" of HTML files. Your Population Callbacks are called as each Data Object is executed. This is not a cause for concern, as SaPopulateMsgBox and SaPopulateTableMsgBox are potential callbacks. Callbacks can be added to an HTML-related module, as an additional source file for that project, as a library for the project, or added in a library for all projects. Look at the file SaHtmlC.c, in client/src of the Sapphire/Web distribution for examples and conventions. You can make use of lower-level examples using SaMakeHtmlString to print out information. See Writing Population Callbacks in the Reference Manual.

The Client Libraries

The client library for a Sapphire/Web CGI is libwebdb.a. If you choose the non-gateway version (see sachmake.sh) you will use libwebdbSY.a, libwebdbOR.a, or libwebdbIF.a, depending on which database vendor you use. These vendor-specific client libraries depend on the database vendor's library. These client libraries do not have any dependency on X or Motif (this keeps the CGI efficient). The API and the client libraries can be used to build stand-alone, command-line driven executables.

The Makefile templates

In the config directory of the Sapphire/Web distribution is a file Makefile.tem. This file is used to generate the CGI's makefile whenever you save your project. You can choose three modes of compilation: KR-C, ANSI C, and C++. Each has its own compile and link flags and options. You should make the appropriate changes for your developers during the tool setup, if needed. The Sapphire/Web client libraries are compiled with C linkage with the appropriate declarations for C or C++ in the headers.

The Shell scripts

During the operation of Sapphire/Web, a variety of shell scripts are called. This is your opportunity to customize the tool. You can add source code control, change the HTML browser, or editor by changing these scripts. See the Reference Manual for the various shell scripts.


[Prev] [Next] [Top] [Bottom] [Contents] (6 out of 22)