grafquery -- API to query grafinfo and moninfo files




   	int grafQuery (
   		grafData *g,
   		char	*query )	
Queries the function, string, and integer linked lists and returns one of G_FUNCTION, G_INTEGER, or G_STRING if the object is found. FAILURE is returned otherwise.


   	int grafGetFunction(
   		grafData *g;
   		char *id;
   		codePnt** code )
Returns SUCCESS or FAILURE depending on whether the function pointed to by id exists in the grafData structure pointed to by g.


   	int grafGetInt (
   		grafData *g;
   		char *id;
   		int *val )
Returns SUCCESS if identifier is found, and returns an integer or FAILURE otherwise. For example, if PIXWIDTH is set to 640 in the grafinfo file, grafGetInt(g, ``PIXWIDTH`` &pixwidth, sets pixwidth to 640, and returns TRUE. To retrieve a parameter from a moninfo file, use the MON_ prefix.


   	int grafGetString (
   		grafData *g;
   		char	*id;
   		char	**val )
Returns a sting pointer in val and SUCCESS or FAILURE depending on whether it found the identifier. This string should be copied if the grafData structure is to be freed.


   	int grafExec (
   		grafData *g,
   		char *function,
   		int *result,
   		int a0,
   		int a1,
   		int a2,
   		int a3,
   		int a4,
   		int a5,
   		int a6,
   		int a7,
   		int a8,
   		int a9)
Finds and executes the function and returns SUCCESS. FAILURE is returned if function was not found. If a non-NULL address is passed in as result, the value of R0 in the grafinfo file is returned in the pointer. R0 through R9 in the grafinfo procedure are initialized with the values that are passed into a0 through a9.


   	int grafGetMemInfo (
   		grafData *g;
   		char *name;
   		unsigned int *pbase, *psize, *pmapped)
Retrieve memory information from the grafinfo file. Any display driver that needs to access memory on the adapter must use this routine. This replaces the MAP_CLASS ioctl used to access memory in earlier adapters.

The arguments are:

Pointer to the grafinfo data.

Name for the memory section where information is returned. Used when there are multiple memory areas to be mapped. If the name is NULL, the CLASS name from the grafinfo file is used.

Pointer to the physical base address of the memory area. This parameter is ignored if NULL.

Pointer to the size of the mapped memory. This parameter is ignored if NULL.

Pointer to the virtual address of the mapped memory. This value should be used whenever the driver wishes to access memory on the adapter. This parameter is ignored if NULL.


   	int grafPmemVmem (
   		grafData *g;
   		unsigned int pmem )
Returns a virtual memory address from a physical memory address. The return value is the virtual address of 0 if it fails. The physical address must have been specified in the grafinfo file using one of the MEMORY statements. The arguments are:

Pointer to the grafinfo data.

Physical address to be converted.


   void grafRunFunction ( g, code, result, a0 a1 a2 a3 a4 a5 a6 a7 a8 a9)
   	grafData *g;
   	codePtr *code;
   	int *result, a0 a1 a2 a3 a4 a5 a6 a7 a8 a9;
Performs the same function as grafExec, but instead of searching for the function, runs the one passed in. Replaces the grafRunCode routine in the X11R4 Server Link Kit.

Pointer to the grafinfo data.

Pointer to the grafinfo function to be run. This value must be retrieved via grafGetFunction.

See grafExec.


int grafVBRun(g, preg, nreg)
     grafData *g;
     int	 *preg;
     int	 nreg;
Video BIOS execution.




Internal functions

The following functions are used internally but are not called in NFB drivers.


   	char *grafGetFullMode )
   		char *modename,
   		char *ttyname )	
Determines the full mode name from the partial modename that is specified (in the format [[[[[vendor,]model,]class,]mode]]) as well as the ttyname. The mode information is derived from the grafdev file if ttyname is specified and is in grafdev. is used otherwise. NULL is returned if the information cannot be found. Both arguments are optional. (NULL should be passed if they are unspecified).


   	char *grafGetName (
   		char *modename )
Returns a pointer to a string with a full filename for a grafinfo file of that mode. The mode must be a full mode (as returned by grafGetFullMode). Returns NULL if the mode is specified incorrectly.


   	int grafParseFile (
   		char *filename;
   		char *modenam;
   		grafData *g)
Parses the grafinfo file and returns a pointer to the grafData structure corresponding to the mode in g. The mode must be full. FAILURE is returned if the function fails. The data from the DATA part of the grafinfo file for that mode is placed in a couple of linked lists that are accessed easily by grafGetInt and grafGetString. Extensions to the DATA section are therefore automatic. Similarly, the other procedures for that mode, usually SetText and SetGraphics, are in a linked list. These can be called by grafExec. Adding arbitrary functions to a grafinfo file is automatic. jgrafQuery can be used to check if a function has been declared and can be used by the server (for example ``blitting'' routines).


   	int grafFreeMode (
   		grafData *g )
Frees all data associated with a mode. Returns SUCCESS if identifier was found and is an integer, or FAILURE otherwise. For example, grafGetInt(g, ``PIXWIDTH`` &pixwidth, sets pixwidth to 640 specified with a PIXWIDTH = 640 entry in the grafinfo file and return TRUE. In this example FAILURE is returned if PIXWIDTH is not present in the DATA section.


   	char *grafError ()

Version applicability

These functions are supported for NFB drivers on all releases of SCO OpenServer 5 and SVR5.

The grafGetFullMode( ), grafGetFunction( ), grafGetInt( ), grafGetName( ), and grafGetString( ) functions are supported on AIX 5L. The other functions listed on this page cannot be used in NFB drivers for AIX 5L.

Differences between versions

The SCO OpenServer 5 and SVR5 Server Link Kits support the grafRunCode function, which is similar to grafRunFunction but executes the code without the grafData environment. The syntax is:
   void grafRunCode ( g, code, result, a0 a1 a2 a3 a4 a5 a6 a7 a8 a9)
   	codePtr *code;
   	int *result, a0 a1 a2 a3 a4 a5 a6 a7 a8 a9;
New drivers should use grafRunFunction rather than grafRunCode.

Platform compatibility notes

The grafinfo files are replaced by equivalent ODM structures on AIX 5L. A translation script is available to convert UnixWare 7 grafinfo files to their equivalent ODM data structures. moninfo files are unnecessary for the AIX 5L implementation of the NFB interface.

Source files

Routine source

Driver source file




grafinfo(DSP/4dsp), moninfo(DSP/4dsp), SetText(D3nfb), SetGraphics(D3nfb),

``Setting up the grafinfo file (SVR5 and SCO OpenServer 5)'' in Developing NFB graphics adapter drivers.

19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005