"Fossies" - the Fresh Open Source Software Archive

Member "epstool-3.08/src/cmac.h" (10 Jun 2005, 3179 Bytes) of package /linux/misc/old/ghost/ghostgum/epstool-3.08-os2.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 2003-2005 Ghostgum Software Pty Ltd.  All rights reserved.
    2 
    3   This software is provided AS-IS with no warranty, either express or
    4   implied.
    5 
    6   This software is distributed under licence and may not be copied,
    7   modified or distributed except as expressly authorised under the terms
    8   of the licence contained in the file LICENCE in this distribution.
    9 
   10   For more information about licensing, please refer to
   11   http://www.ghostgum.com.au/ or contact Ghostsgum Software Pty Ltd, 
   12   218 Gallaghers Rd, Glen Waverley VIC 3150, AUSTRALIA, 
   13   Fax +61 3 9886 6616.
   14 */
   15 
   16 /* $Id: cmac.h,v 1.3 2005/06/10 09:39:24 ghostgum Exp $ */
   17 /* Macintosh AppleSingle, AppleDouble and MacBinary file formats */
   18 
   19 typedef enum CMAC_TYPE_e {
   20     CMAC_TYPE_NONE=0,
   21     CMAC_TYPE_SINGLE=1,
   22     CMAC_TYPE_DOUBLE=2,
   23     CMAC_TYPE_MACBIN=3,
   24     CMAC_TYPE_RSRC=4
   25 } CMAC_TYPE;
   26 
   27 /* Mac finder and fork details */
   28 typedef struct CMACFILE_s {
   29     CMAC_TYPE type;
   30     unsigned char file_type[4]; /* usually EPSF for us */
   31     unsigned char file_creator[4];
   32     DWORD finder_begin;
   33     DWORD finder_length;
   34     DWORD data_begin;
   35     DWORD data_length;
   36     DWORD resource_begin;
   37     DWORD resource_length;
   38     DWORD pict_begin;   /* PICT resource in EPSF file */
   39     DWORD pict_length;
   40 } CMACFILE;
   41 
   42 
   43 DWORD get_bigendian_dword(const unsigned char *buf);
   44 WORD get_bigendian_word(const unsigned char *buf);
   45 void put_bigendian_dword(unsigned char *dw, DWORD val);
   46 void put_bigendian_word(unsigned char *w, WORD val);
   47 
   48 /* Read header and identify if MacBinary, AppleSingle or AppleDouble */
   49 CMACFILE *get_mactype(GFile *f);
   50 
   51 /* Read resources and find location of EPSF PICT preview */
   52 /* Return 0 on success, +ve on unsuitable file, -ve on error */
   53 int get_pict(GFile *f, CMACFILE *mac, int debug);
   54 
   55 /* Copy PICT from resources to another file */
   56 /* Return 0 on succes, -ve on error */
   57 int extract_mac_pict(GFile *f, CMACFILE *mac, LPCTSTR outname);
   58 
   59 /* Extract EPSF from data fork to a file */
   60 /* Returns 0 on success, negative on failure */
   61 int extract_mac_epsf(GFile *f, CMACFILE *mac, LPCTSTR outname);
   62 
   63 /* Write Macintosh binary files in one of several formats.
   64  * The data fork if present contains the EPSF.
   65  * The resource fork if present contains a preview image in PICT
   66  * format with id=256.
   67  * The finder informations give type "EPSF" and creator "MSWD".
   68  */
   69 
   70 /* Write preview to AppleDouble format */
   71 int write_appledouble(GFile *f, LPCTSTR pictname);
   72 
   73 /* Write EPSF and preview to AppleSingle format */
   74 int write_applesingle(GFile *f, LPCTSTR epsname, LPCTSTR pictname);
   75 
   76 /* Write EPSF and preview to MacBinary I format */
   77 /* name is the 1-63 character filename written in the MacBinary header */
   78 int write_macbin(GFile *f, const char *name, LPCTSTR epsname, LPCTSTR pictname);
   79 
   80 /* Write resources containing a single PICT with id=256 to file.
   81  * Return number of bytes written if OK, -ve if not OK.
   82  * If f==NULL, return number of bytes required for resources.
   83  */
   84 int write_resource_pict(GFile *f, LPCTSTR pictname);
   85 
   86 /* Returns -1 for error, 0 for Mac and 1 for non-Mac */
   87 /* If Macintosh format and verbose, print some details to stdout */
   88 int dump_macfile(LPCTSTR filename, int verbose);