Topic : TOS - The Operating System Author : Version : tos.hyp (December 19, 2008) Subject : Programmieren/Atari Nodes : 3010 Index Size : 93790 HCP-Version : 5 Compiled on : Atari @charset : atarist @lang : @default : Title @help : @options : +g -i -s +x +zz -t4 @width : 70 View Ref-File13.14.2.1 A simple xFSL call TOS In view of the multitude of parameters and setting options, the following note seems appropriate: Don't panic! An xFSL call is simpler than it appears at first. In particular one can adopt here the strategy of 'step-by-step refinement', since one can set (almost) all parameters to zero at first. A possible simple xFSL call can look like this, for instance: #include <stdio.h> #include <aes.h> #include <vdi.h> #include <xfsl.h> void call_xfsl (void) { int xhandle, xret; xFSL_PAR xpar; PFONTINFO pfont; xFSL *xfsl; memset (&xpar, 0, sizeof (xFSL_PAR)); memset (&pfont, 0, sizeof (PFONTINFO)); xpar.par_size = sizeof (xFSL_PAR); xpar.pfi_size = sizeof (PFONTINFO); xpar.font = &pfont; xpar.font->fontcol = BLACK; if (get_cookie ('xFSL', &xfsl)) { xhandle = xfsl->xfsl_init (0, &xpar); if (xhandle >= 0) { do xret = xfsl->xfsl_event (xhandle, 0L); while (xret > xFS_OK); xfsl->xfsl_exit (xhandle); if (xret == xFS_STOP) printf ("Cancel\n"); else if (xret == xFS_OK) printf ("Font with ID %d selected\n", xpar.font->fontid); else if (xret < 0) printf ("Error %d\n", xret); } else printf ("Error %d\n", xhandle); } else printf ("Cookie not found!\n"); } With the two memset calls all elements of the structures xFSL_PAR and PFONTINFO are set to zero. Subsequently some absolutely necessary values are entered: . The size of the two structures xFSL_PAR and PFONTINFO . The address of the PFONTINFO structure is entered in the xFSL_PAR structure . The font colour is set to black (one could also omit this, but normally one wants to write in black type on a white background) MNo further preparation is required, and now the actual call follows. First the xFSL cookie is searched for and on success the font-selector will be initialized by passing the xFSL_PAR structure. If this call was successful (xhandle is greater or equal to zero), then the font- selector is already on the screen. In the main loop one now waits until the font-selector is terminated either with xFS_STOP or xFS_OK by the user, or until an error occurs (other positive return values are simply ignored here). With the call of xfsl_exit the font-selector is removed from the screen once more and subsequently the return value is evaluated. That wasn't too complicated, was it? From here on you can now continue experimenting with various parameters and flags.