1 #ifndef LIBRARIES_PPD_H
    2 #define LIBRARIES_PPD_H
    3 
    4 /*
    5 **  ppd.h - PostScript Printer Description parser header    
    6 **  (c) 2012-2018 Michal Zukowski and MorphOS Team
    7 **  
    8 */
    9 
   10 #ifndef EXEC_TYPES_H
   11 #include <sys/types.h>
   12 #endif
   13 
   14 #ifndef EXEC_LISTS_H
   15 #include <exec/lists.h>
   16 #endif
   17 
   18 #define NAME_LEN_MAX	     81	
   19 
   20 #  ifdef __cplusplus
   21 extern "C" {
   22 #  endif 
   23 
   24 typedef enum
   25 {
   26 	PPD_ERR_OK,
   27 	PPD_ERR_BADHEADER,
   28 	PPD_ERR_SYNTAX,
   29 	PPD_ERR_MEMORY,
   30 	PPD_ERR_FILE,
   31 	PPD_ERR_EOF,
   32 	PPD_ERR_PREFS
   33 } 
   34 PPD_ERROR;	
   35 		
   36 
   37 typedef enum   				
   38 {
   39 	PPD_OPT_BOOL,
   40 	PPD_OPT_SINGLESELECT,
   41 	PPD_OPT_MULTISELECT
   42 } OPTION_TYPE;
   43 
   44 typedef enum 
   45 {
   46 	PPD_TR_NONE,		    // device doesn't have Type 42 rasterizer
   47 	PPD_TR_ACCEPT68K,       // device has M68K rasterizer
   48 	PPD_TR_TYPE24,          // device has Type 42 rasterizer
   49 	PPD_TR_TRUEIMAGE        // device has TrueImage resterizer
   50 } TTRASTERIZER;
   51 
   52 typedef enum
   53 {
   54 	PPD_SECTION_ANY,        // any place in the postscript file
   55 	PPD_SECTION_DOCUMENT,	// only in document setup
   56 	PPD_SECTION_EXIT,       // to be sent before document
   57 	PPD_SECTION_PAGESETUP,	// to be sent in page setup
   58 	PPD_SECTION_PROLOG,		// to be sent in prolog		
   59 	PPD_SECTION_JCL,		// sent as JCL command			
   60 } OPTION_SECTION;
   61 
   62 
   63 typedef enum 
   64 {
   65 	PPD_CM_GRAY,
   66 	PPD_CM_COLOR
   67 } COLOR_MODE;
   68 
   69 typedef enum 
   70 {
   71 	PPD_CS_GRAY,             // gray colorspace
   72 	PPD_CS_CMYK,             // cmyk colorspace
   73 	PPD_CS_CMY,				 // cmy  colorspace
   74 	PPD_CS_RGB,	             // rgb  colorspace
   75 	PPD_CS_RGBK,			 // rgb+gray colorspace	
   76 	PPD_CS_N				 // device colorspace
   77 } COLOR_SPACE;
   78 
   79 typedef enum 
   80 {
   81 	PPD_LO_PLUS90,
   82 	PPD_LO_ANY,
   83 	PPD_LO_MINUS90
   84 } LANDSCAPE_ORIENTATION;
   85 
   86 
   87 
   88 typedef struct
   89 {
   90 	struct MinNode   Node;    
   91 	STRPTR	Name;	
   92 	STRPTR	Full_Name;		
   93 	STRPTR	PS_Code;
   94 	LONG	Left_Margin;
   95 	LONG	Right_Margin;	   
   96 	LONG	Top_Margin;
   97 	LONG	Bottom_Margin;
   98 	LONG	Width;
   99 	LONG	Height;
  100 } PAGE_SIZE_NODE;
  101 
  102 
  103 typedef struct  
  104 {
  105 	struct MinNode   Node;    
  106 	STRPTR		Name;		
  107 	STRPTR		Full_Name;	
  108 	STRPTR		PS_Code; 
  109 } OPTION_ITEM_NODE;
  110 
  111 
  112 typedef struct		
  113 {		
  114 	struct MinNode		Node;   
  115 	STRPTR				Name;	
  116 	STRPTR				Full_Name;	
  117 	struct MinList		Items;  
  118 } GROUP_NODE;
  119 
  120 
  121 typedef struct		
  122 {		
  123 	struct MinNode		Node;    
  124 	STRPTR				Name;	
  125 	STRPTR				Full_Name;	
  126 	OPTION_ITEM_NODE	*Default;
  127 	OPTION_ITEM_NODE 	*Selected;
  128 	OPTION_TYPE			Type;
  129 	OPTION_SECTION		Section; 
  130 	LONG				Order;
  131 	struct MinList		Items;
  132 } OPTION_NODE;
  133 
  134 
  135 typedef struct
  136 {
  137 	struct MinNode	Node;  
  138 	STRPTR 			Name;  
  139 	OPTION_NODE		*Option;	
  140 	struct MinList  Items;
  141 
  142 } CUSTOM_OPTION_NODE;
  143 
  144 typedef enum 		
  145 {
  146   PPD_CUSTOM_CURVE,			
  147   PPD_CUSTOM_INTEGER,			
  148   PPD_CUSTOM_INVCURVE,			
  149   PPD_CUSTOM_PASSCODE,			
  150   PPD_CUSTOM_PASSWORD,			
  151   PPD_CUSTOM_POINTS,		
  152   PPD_CUSTOM_FLOAT,		
  153   PPD_CUSTOM_STRING			
  154 } CUSTOM_TYPE;
  155 
  156 
  157 typedef union
  158 {
  159   FLOAT		Curve;		
  160   LONG		Integer;		
  161   FLOAT		Invcurve;
  162   STRPTR	Passcode;	
  163   STRPTR	Password;	
  164   FLOAT		Points;		
  165   FLOAT		Float;		
  166   STRPTR	String;		
  167   LONG      TextLen;
  168 } CUSTOM_VALUE;
  169 
  170 
  171 typedef struct
  172 {
  173 	struct MinNode	Node;  
  174 	STRPTR			Name;
  175 	STRPTR			Full_Name;	
  176 	LONG			Order;			
  177 	CUSTOM_TYPE		Type;	
  178 	CUSTOM_VALUE	Minimum;
  179 	CUSTOM_VALUE  	Maximum;		
  180 	CUSTOM_VALUE	Current;
  181 } CUSTOM_ITEM_NODE;
  182 
  183 
  184 typedef struct 
  185 {
  186 	struct MinNode   Node;    
  187 	STRPTR	Option1;
  188 	STRPTR	Value1;
  189 	STRPTR	Option2;
  190 	STRPTR	Value2;
  191 } CONSTRAINT_NODE;
  192 
  193 
  194 
  195 typedef struct 
  196 {
  197 	struct MinNode   Node;    
  198 	STRPTR Font_Name;
  199 } FONT_NODE;
  200 
  201 
  202 typedef struct 
  203 {
  204 	struct MinNode   Node;    
  205 	STRPTR		Resolution;
  206 	STRPTR		Media_Type;
  207 	float		Density;	
  208 	float		Gamma;		
  209 	float		Matrix[3][3];		
  210 } PROFILE_NODE;
  211 
  212 
  213 
  214 typedef struct
  215 {
  216  	LONG			PS_Level;			// 1, 2 or 3
  217     LONG        	Throughput;         // pages per minute
  218 	COLOR_MODE		Color_Mode;
  219 	COLOR_SPACE     Color_Space;
  220     TTRASTERIZER	TTRasterizer;
  221 	LANDSCAPE_ORIENTATION Landscape_Orientation;  // -90, Any, +90
  222 	BOOL 			Print_PSErrors;
  223 	LONG			HW_Left_Margin;
  224 	LONG			HW_Right_Margin;	   
  225 	LONG			HW_Top_Margin;
  226 	LONG			HW_Bottom_Margin;
  227 	BOOL            Variable_PageSize;
  228 	BYTE			Filters;
  229 	BYTE			Model_Number;
  230 	BYTE			Manual_Copies;
  231 	BYTE			Flip_Duplex;
  232 	BYTE			Unused[60];
  233 } PRINTER_PARAMS;
  234 
  235 
  236 typedef struct 
  237 {
  238     struct MinNode   Node;    
  239 	STRPTR Name;
  240 	STRPTR Value;
  241 	STRPTR Option;
  242 
  243 } ATTRIBUTE_NODE;
  244 
  245 typedef struct
  246 {
  247 	char Nick_Name[NAME_LEN_MAX];			// name of device
  248 	char PCFile_Name[NAME_LEN_MAX];
  249 	char Model_Name[NAME_LEN_MAX];
  250 	char Manufacturer[NAME_LEN_MAX];
  251 	char Language_Version[NAME_LEN_MAX];
  252 	char Language_Encoding[NAME_LEN_MAX];
  253 } PRINTER_DESC;
  254 
  255 typedef struct 
  256 {
  257 	PRINTER_DESC	Description;		
  258     PRINTER_PARAMS 	Parameters;
  259 	STRPTR			JCL_Begin;		// start JCL cmds
  260 	STRPTR			JCL_ToPS;
  261 	STRPTR			JCL_End;		// end JCL cmds 
  262     STRPTR 			DefaultFont;
  263 	PAGE_SIZE_NODE* DefaultPageSize;
  264 	PAGE_SIZE_NODE* SelectedPageSize;
  265 	struct MinList	Fonts;
  266 	struct MinList	PageSizes;
  267 	struct MinList	Constraints;
  268 	struct MinList  Attributes;
  269 	struct MinList  CustomOptions;
  270 	struct MinList  ColorProfiles;
  271 	struct MinList  Groups;
  272 } PPD;
  273 
  274 
  275 # ifdef __cplusplus
  276 }
  277 # endif 
  278 
  279 #endif
  280