Annotation of pmsdk/samples/petzold/chap16/hdrlib.c, revision 1.1.1.1

1.1       root        1: /*-----------------------------------------------------------
                      2:    HDRLIB.C -- "Handy Drawing Routines" Dynamic Link Library
                      3:   -----------------------------------------------------------*/
                      4: 
                      5: #define INCL_GPI
                      6: #include <os2.h>
                      7: #include <stdio.h>
                      8: #include <stdarg.h>
                      9: #include <stdlib.h>
                     10: #include <string.h>
                     11: #include "hdrlib.h"
                     12: 
                     13: SHORT APIENTRY HdrPuts (HPS hps, PPOINTL pptl, PCHAR szText)
                     14:      {
                     15:      SHORT sLength = strlen (szText) ;
                     16: 
                     17:      if (pptl == NULL)
                     18:           GpiCharString (hps, (LONG) sLength, szText) ;
                     19:      else
                     20:           GpiCharStringAt (hps, pptl, (LONG) sLength, szText) ;
                     21: 
                     22:      return sLength ;
                     23:      }
                     24: 
                     25: SHORT cdecl FAR HdrPrintf (HPS hps, PPOINTL pptl, PCHAR szFormat, ...)
                     26:      {
                     27:      static CHAR chBuffer [1024] ;
                     28:      SHORT       sLength ;
                     29:      va_list     pArguments ;
                     30: 
                     31:      va_start (pArguments, szFormat) ;
                     32:      sLength = vsprintf (chBuffer, szFormat, pArguments) ;
                     33: 
                     34:      if (pptl == NULL)
                     35:           GpiCharString (hps, (LONG) sLength, chBuffer) ;
                     36:      else
                     37:           GpiCharStringAt (hps, pptl, (LONG) sLength, chBuffer) ;
                     38: 
                     39:      va_end (pArguments) ;
                     40:      return sLength ;
                     41:      }
                     42: 
                     43: LONG APIENTRY HdrEllipse (HPS hps, LONG lOption, PPOINTL pptl)
                     44:      {
                     45:      POINTL ptlCurrent ;
                     46: 
                     47:      GpiQueryCurrentPosition (hps, &ptlCurrent) ;
                     48: 
                     49:      return GpiBox (hps, lOption, pptl, labs (pptl->x - ptlCurrent.x),
                     50:                                         labs (pptl->y - ptlCurrent.y)) ;
                     51:      }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.