PLplot  5.11.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
metadefs.h
Go to the documentation of this file.
1 // Geoffrey Furnish
2 // 5 May 1991
3 //
4 // This file contains definitions of constants and structures which
5 // are needed by the PLplot metafile writer and renderer.
6 //
7 
8 //
9 // PLMETA_HEADER holds the magic string at head of metafile.
10 // PLMETA_VERSION holds the version number (year & letter).
11 //
12 // Note: All strings written into the file header are limited to a maximum
13 // of 80 characters.
14 //
15 
16 #define PLMETA_HEADER "PLPLOT"
17 #define PLMETA_VERSION "2005a"
18 
19 // These are used by the TK driver client/server code
20 
21 #define PLSERV_HEADER "PLPLOT"
22 #define PLSERV_VERSION "2005b"
23 
24 // Symbolic constants for old metafile versions (prior to 1992a).
25 // Now these are stored in the metafile header.
26 
27 #define PLMETA_X_OLD 10000
28 #define PLMETA_Y_OLD 10000
29 
30 // Virtual dots/mm for our virtual display space.
31 
32 #define PIXEL_RES_X_OLD 42
33 #define PIXEL_RES_Y_OLD 56
34 
35 // Macros to make it easier to abort on nonzero return code
36 // Can't call plexit on a write failure since that would be circular
37 
38 #define plm_wr( code ) \
39  if ( code ) { fprintf( stderr, "Unable to write to MetaFile\n" ); exit( 1 ); }
40 
41 #define plm_rd( code ) \
42  if ( code ) plexit( "Unable to read from MetaFile" )
43 
44 //
45 // Metafile commands.
46 //
47 //** NOTICE !!! ***
48 // If you change ANY of the following, you will wreck backward
49 // backward compatibility with old metafiles. You may add, but do
50 // NOT delete !!!
51 //
52 
53 #define INITIALIZE 1
54 #define CLOSE 2
55 #define SWITCH_TO_TEXT 3 // Obsolete, replaced by ESCAPE
56 #define SWITCH_TO_GRAPH 4 // Obsolete, replaced by ESCAPE
57 #define EOP 5
58 #define BOP 6
59 #define NEW_COLOR 7 // Obsolete, replaced by CHANGE_STATE
60 #define NEW_WIDTH 8 // Obsolete, replaced by CHANGE_STATE
61 #define LINE 9
62 #define LINETO 10
63 #define ESCAPE 11
64 #define ADVANCE 12 // Obsolete, BOP/EOP used instead
65 #define POLYLINE 13
66 #define NEW_COLOR0 NEW_COLOR
67 #define NEW_COLOR1 14
68 #define CHANGE_STATE 15
69 #define BOP0 16 // First BOP in a file
70 #define DRIVER_INTERFACE 17
71 #define SETSUB 18
72 #define SSUB 19
73 #define CLIP 20
74 #define END_OF_FIELD 255
75 
76 // Data structures
77 
78 // Metafile index data structure
79 typedef struct
80 {
82 } PLmIndex;
83 
84 // plmeta output device data structure. Define it here so that
85 // it can be shared between the input/output modules.
86 typedef struct
87 {
88  PLFLT pxlx, pxly;
89  PLINT xold, yold;
90 
91  PLINT xmin, xmax, xlen;
92  PLINT ymin, ymax, ylen;
93 
94  FPOS_T index_offset; // Position of the metafile index
95  FPOS_T lp_offset; // Position of the previous page
96 
97  int notfirst;
98 
99  PLINT version; // Metafile version number
100  U_SHORT page; // Current page
101 
102  // Metafile coordinates to physical (virtual pixels) coordinates
103  // transformation
104  PLFLT mfpcxa, mfpcxb; // x = mfpcxa * x + mfpcxb
105  PLFLT mfpcya, mfpcyb; // y = mfpcya * y + mfpcyb
106 
107  // Temporary storage used for metafile processing.
108  void * buffer;
109  size_t buffer_size;
110 } PLmDev;