home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / rflic2 / readflic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-27  |  2.0 KB  |  62 lines

  1. /* Readflic.h - file containing prototypes and other
  2.  * structural info for readflic program.
  3.  *
  4.  * Copyright (c) 1992 Jim Kent.  This file may be freely used, modified,
  5.  * copied and distributed.  This file was first published as part of
  6.  * an article for Dr. Dobb's Journal March 1993 issue.
  7.  */
  8.  
  9. char *flic_err_string(ErrCode err);
  10.  
  11. /* Some handy macros I use in lots of programs: */
  12.  
  13. #define ArrayEls(a) (sizeof(a)/sizeof((a)[0]))
  14.     /* Count up number of elements in an array */
  15.  
  16. #define ClearMem(buf,size)    memset(buf, 0, size)
  17.     /* Clear a block of memory. */
  18.  
  19. #define ClearStruct(pt)    ClearMem(pt, sizeof(*(pt)))
  20.     /* Clear a structure (pass in pointer) */
  21.  
  22.  
  23. /* Data structures peculiar to readflic program: */
  24.  
  25. typedef struct
  26.     {
  27.     FlicHead head;    /* Flic file header. */
  28.     int handle;        /* File handle. */
  29.     int frame;        /* Current frame in flic. */
  30.     char *name;        /* Name from flic_open.  Helps error reporting. */
  31.     int xoff,yoff;    /* Offset to display flic at. */
  32.     } Flic;
  33.  
  34.  
  35. /* Prototypes peculiar to readflic program: */
  36.  
  37. ErrCode flic_open(Flic *flic, char *name);
  38.     /* Open flic file.  Read header and verify it's a flic. */
  39.  
  40. void flic_close(Flic *flic);
  41.     /* Close flic file and scrub flic. */
  42.  
  43. ErrCode flic_play_once(Flic *flic, Machine *machine);
  44.     /* Play a flic through once. */
  45.  
  46. ErrCode flic_play_loop(Flic *flic, Machine *machine);
  47.     /* Play a flic until key is pressed. */
  48.  
  49. ErrCode flic_next_frame(Flic *flic, Screen *screen);
  50.     /* Advance to next frame of flic. */
  51.  
  52. /* Various error codes flic reader can get. */
  53. #define ErrNoMemory    -2        /* Not enough memory. */
  54. #define ErrBadFlic    -3        /* File isn't a flic. */
  55. #define ErrBadFrame    -4        /* Bad frame in flic. */
  56. #define ErrOpen        -5        /* Couldn't open file.  Check errno. */
  57. #define ErrRead        -6        /* Couldn't read file.  Check errno. */
  58. #define ErrDisplay    -7        /* Couldn't open display. */
  59. #define ErrClock    -8        /* Couldn't open clock. */
  60. #define ErrKey        -9        /* Couldn't open keyboard. */
  61. #define ErrCancel    -10        /* User cancelled. */
  62.