home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / util / unix / mcread1.tz / mcread1 / mcread.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-30  |  4.5 KB  |  144 lines

  1. /* mcread: mcread.h */
  2. /*    COPYRIGHT NOTICE:
  3.     All mcread code is Copyright (C) 1991, Mike Gleason Jr.  All
  4.     Rights reserved, use at your own risk, blah, blah, blah.
  5.     Feel free to glean from or modify the code as you wish... but, you
  6.     must retain this notice, keep my shareware notice intact, and
  7.     not tack on additional fees for yourself.  You must also provide
  8.     source code on request to anyone who asks for it. 
  9.     
  10.     I'd like to see others add on other modules, like those to read
  11.     Microsoft Word, WriteNow, FullWrite, and MacWrite II.  I suppose
  12.     support for MacWrite 2.2 should also be added...  */
  13.     
  14. /*     IMPORTANT:
  15.         make sure the size of a MacLongword is 4 bytes, and
  16.         insure that the size of a MacWord is 2 bytes.  */
  17.  
  18. /*    VERSION HISTORY:
  19.     1.0   --   (MJG, Jun '91) Initial "release."
  20.     1.0.1 --   (MJG, Jun '91) Fixed a silly bug in TEXT reader.  */
  21.  
  22. #if defined(THINK_C) || defined(applec)
  23.  
  24. #define READ_BINARY             "rb"
  25. typedef long int MacLongword;    /* these should work on both Think & MPW. */
  26. typedef short int MacWord;
  27.  
  28. #else
  29.  
  30. #define READ_BINARY             "r"
  31. typedef long MacLongword;        /* may need to be changed! */
  32. typedef short MacWord;            /* may need to be changed! */
  33.  
  34. #endif    /* if unix */
  35.  
  36.  
  37.  
  38. #ifndef SEEK_SET
  39. #define SEEK_SET 0
  40. #define SEEK_CUR 1
  41. #endif
  42.  
  43. #ifndef FALSE
  44. #define FALSE 0
  45. #define TRUE 1
  46. #endif
  47.  
  48. #ifndef EXIT_SUCCESS
  49. #define EXIT_SUCCESS 1
  50. #endif
  51.  
  52. #ifndef EXIT_FAILURE
  53. #define EXIT_FAILURE 0
  54. #endif
  55.  
  56. #define USAGE "\n\t\
  57. -tN (tab = N spaces)\n\t\
  58. -wN (line width)\n\t\
  59. -pN (pager, pauses every N lines.  N is optional (default=23)).\n\t\
  60. files...\n\n\
  61. mcread 1.0 -- (C) 1991 by Mike Gleason Jr., NCEMRSoft.\n\
  62. mcread can decode MacWrite, TeachText, and TEXT files, created on\n\
  63. Apple Macintosh(tm) computers, for reading on other platforms.\n\
  64. This is Un*x ShareWare.  If you use this tool, you can show your\n\
  65. gratitude in one or both of the following ways:\n\
  66.   1. Whip out a 1$US bill (or the equivalent foreign currency;\n\
  67.      I like foreign coins) and mail it to the address below;\n\
  68.      It's only a dollar, and it goes towards a good cause: my tuition!\n\
  69.   2. Mail me a short note written on your company stationery saying\n\
  70.      how useful this is to you, blah, blah, blah.  This is for\n\
  71.      the scholarship committee here at the University of Nebraska;\n\
  72.      If I can hand in a bunch of these letters with my scholarship\n\
  73.      form, they'll be impressed, and maybe give me a grant!\n\
  74. Thanks!!!\n\
  75. Mike Gleason\n\
  76. 5705 North 117th Plaza, Omaha, NE, USA, 68164."
  77.  
  78. #define MACWRITE_TYPE                    "WORD"
  79. #define MACWRITE_CREATOR                "MACA"    /* (Not used, though.) */
  80. #define TEXT_TYPE                        "TEXT"
  81. #define TEACHTEXT_TYPE                    "ttro"
  82. #define WORD_TYPE                        "WDBN"
  83. #define STR_TYPE                        "STR "
  84.  
  85. #define isspace(c)            ( (c)==' ' || (c)=='\r' || (c)=='\t' )
  86. #define EIGHTBIT(c)            ( (c) > 0x7f )
  87. #define NONPRINTING(c)        ( !isspace(c) && ((c)<' ' || (c)==0x7f) )
  88. #define HARDSPACE            0xca
  89.  
  90. #ifdef NOT_USED
  91. typedef struct
  92. {
  93.     unsigned char    version;                /* 000: should be zero. */
  94.     unsigned char    nameLen;                /* 001: */
  95.     unsigned char    name[63];                /* 002: */
  96.     unsigned long    fileType;                /* 065: */
  97.     unsigned long    fileCreator;            /* 069: */
  98.     unsigned char    finderFlagsHiByte;        /* 073: */
  99.     unsigned char    zero1;                    /* 074: Must be zero. */
  100.     unsigned short    vertWindowPos;            /* 075: Obselete. */
  101.     unsigned short    horizWindowPos;            /* 077: Obselete. */
  102.     unsigned short    folderID;                /* 079: Obselete. */
  103.     unsigned char    protected;                /* 081: Obselete. */
  104.     unsigned char    zero2;                    /* 082: Must be zero. */
  105.     unsigned long    dataForkLen;            /* 083: */
  106.     unsigned long    rsrcForkLen;            /* 087: */
  107.     unsigned long    creationDate;            /* 091: */
  108.     unsigned long    modificationDate;        /* 095: */
  109.     unsigned short    getInfoLen;                /* 099: Obselete. */
  110.     unsigned char    finderFlagsLoByte;        /* 101: */
  111.     unsigned char    zeros[14];                /* 102: */
  112.     unsigned long    totalUnpackLen;            /* 116: Obselete. */
  113.     unsigned short    secondaryHeaderLen;        /* 120: Obselete. */
  114.     unsigned char    uploadVersion;            /* 122: Must be 129. */
  115.     unsigned char    minDecodeVersion;        /* 123: Must be 129. */
  116.     unsigned short    CRC;                    /* 124: Don't forget this! */
  117.     unsigned short    unused;                    /* 126: */
  118. } MBHeader;
  119. #endif
  120.  
  121. /* protos */
  122.  
  123. /* mbinary.c: */
  124. long                             CheckMBHeader ();
  125.  
  126. /* wordwrap.c: */
  127. int                                wwInit ();
  128. int                                wwPutchar ();
  129. int                                wwFlush ();
  130. int                                CheckPage ();
  131.  
  132. /* macwrite.c: */
  133. int                                Getn ();
  134. int                                thrash_macwrite ();
  135. int                                FindCommon ();
  136.  
  137. /* text.c: */
  138. int                                thrash_text ();
  139.  
  140. /* main.c: */
  141. int                                thrash ();
  142. MacWord                            Getw ();
  143. MacLongword                        Getl ();
  144.