Programming Guide



sm_*initcrt

Initializes the display and Panther data structures

int sm_initcrt(char *path);
void sm_jinitcrt(char *path);
void sm_jxinitcrt(char *path);

path
Specifies where to look for a library file after Panther searches the current directory. If you supply an empty string, Panther looks only in the current directory or in the paths specified by SMPATH. Panther searches for library files in these areas:
  1. The current directory.
  2. The directory specified by path.
  3. The paths specified in the environment variable SMPATH.

Environment

C only

Returns

Description

sm_initcrt is called automatically by Panther. Use this function only if you write your own executive.

A custom executive should call sm_initcrt when screen handling starts—that is, before any screens display and the keyboard opens for screen input. sm_initcrt can be preceded only by those functions that set options, such as sm_option, and those that install functions or configuration files such as sm_install or sm_vinit.

sm_initcrt performs these tasks:

  1. Sets a path that Panther uses to search for libraries.
  2. Calls an optional user-defined initialization function. This function initializes the character string sm_term. If sm_term contains the terminal type, sm_initcrt proceeds to step 4.
  3. Tries to ascertain the terminal type with this search algorithm:
  4. Finds and reads the setup file specified by SMVARS or the default configuration file smvars. If the SMSETUP variable is set, it also finds and reads this setup file.
  5. Finds and reads the binary message file specified by SMMSGS. If SMMSGS cannot be found, Panther aborts initialization.
  6. Finds and reads the binary video and keyboard files defined by SMVIDEO and SMKEY, respectively. These variables are defined in the SMVARS or SMSETUP setup files, or in the environment. If Panther cannot determine which files to use, it prompts for a terminal type and repeats this step.
  7. Allocates memory for various data structures shared among Panther library functions.
  8. Initializes the operating system's terminal channel. It is set to no echo and non-buffered input, if appropriate.
  9. Initializes the operating system display.

Example

/* To initialize Panther without supplying a path
* for screens:
*/

sm_initcrt("");

See Also

sm_resetcrt