1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
| /*
-------------------------------------------------------------------------------
Project: ePost/Open 2
File Name: ps_parslib_parsers.h
Subsystem: PS
Library: PARSLIB
Description: header file containing macro, data structures and prototypes of
functions which are used in parsers.
Author: Giusti Marco
Created: January, 13 1997
-------------------------------------------------------------------------------
Modification History
Revision Date Who Modified Description
22/10/97 C.Ratti Removed duplicated COUNTRY_CODE_LEN and
POSTAL_CODE_LEN defines
30/10/97 Freccia Removed PROFILE_SEND_LOG prototype
Inserted header file ps_base_error_code.h
Removed BASE_CODE_XXX error code definitions
00.02.01 20/04/98 Freccia Added new define for production management
15/12/98 T.A. Jensen Added DEPARTMENT_CODE_LEN define
08/01/99 T.A. Jensen Added STAMP_PRICE_LEN
Apr 28 1999 H.Feldthaus identvar is made static
-------------------------------------------------------------------------------
*/
#include <stdbool.h>
#ifndef PS_PARSLIB_PARSERS_H
#define PS_PARSLIB_PARSERS_H
static char parsers[] = "@(#)$Workfile: ps_parslib_parsers.h $,$Revision: 2.1 $,$Modtime: 20 Aug 2003 15:28:26 $";
#ifdef PS_PARSLIB_PARSERS_H_WHAT
static char ident_ps_parslib_parsers_h[] = "@(#)## ps_parslib_parsers.h 00.02.01 20/04/98";
static char * ref_ident_ps_parslib_parsers_h = ident_ps_parslib_parsers_h;
#endif
/*-----------------------------------------------------------------------------
INCLUSIONS
---------------------------------------------------------------------------*/
#include <stdio.h>
#include <time.h>
#include "ps_errdef.h"
#include "ps_lstlib_def.h"
#include "ps_length.h"
#include "ps_dblib_def.h"
#include "ps_base_error_code.h"
/*-----------------------------------------------------------------------------
LOCAL ERROR CODES
---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
TYPES
---------------------------------------------------------------------------*/
/* structure containing info about parsers errors */
typedef struct
{
int err_reason_code;
} Pars_Err;
typedef enum
{
COM_ERR_BUFINIT = -BASE_CODE_BUF,
/* the lex buffer has already been inited */
COM_ERR_LIST, /* error in list handling */
COM_ERR_MALLOC, /* error in memory allocation */
COM_OK = 0, /* no error occurrence */
COM_WRN_ENDLIST /* found termination in list items browsing */
} Com_Err_Code;
enum /* HLF 1999.06.21: Not typedef on solaris */
{
PMNG_MEMORY_ERR = -BASE_PMNG_ERR,
PMNG_MAILBAG_ERR,
PMNG_FILE_SYSTEM_ERR,
PMNG_DATA_BASE_ERR,
PMNG_RESOURCE_ERR,
PMNG_CONFIGURATION_ERR,
PMNG_INTERNAL_ERR,
PMNG_PARTIAL_PRINT_WL_ERR,
PMNG_MBBROKE_ERR,
PMNG_LETTER_ERR,
PMNG_NO_LETTER_PROC,
PMNG_WL_OVERFLOW_ERR,
PMNG_RESET = 0
};
/*=============================================================================
LEX BUFFER
===========================================================================*/
/*-----------------------------------------------------------------------------
FUNCTIONS
---------------------------------------------------------------------------*/
Com_Err_Code LexBuffer_Create(unsigned char *pars_data);
int LexBuffer_Get_Char(void);
void LexBuffer_Free(void);
void LexBuffer_Reset(void);
/*=============================================================================
STRING INFO
===========================================================================*/
/*-----------------------------------------------------------------------------
MACROS
---------------------------------------------------------------------------*/
#define STRING_INFO_TEXT_LEN 500
#ifdef DEBUG
#define StringInfo_Print(string_info) StringInfo_Fprint(stdout,string_info)
#define StrInfoList_Print(str_info_list) \
StrInfoList_Fprint(stdout,str_info_list)
#endif
/*-----------------------------------------------------------------------------
TYPES
---------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
COORDINATES
---------------------------------------------------------------------------*/
/* Coordinates type */
typedef struct
{
unsigned int x;
unsigned int y;
unsigned int minor_x;
unsigned int minor_y;
unsigned int unit_base;
} Coordinates;
/* Functions */
void Coord_Reset(Coordinates *coord);
/*-----------------------------------------------------------------------------
IDENTIFIERS, INDEXES, ...
---------------------------------------------------------------------------*/
typedef unsigned long Counter; /* for totals, sequence numbers, etc. */
typedef unsigned long Identifier;
typedef unsigned long Index;
/*-----------------------------------------------------------------------------
FONT
---------------------------------------------------------------------------*/
/* Macros */
#define FONT_NAME_LEN 30
#ifdef DEBUG
#define Font_Print(font) Font_Fprint(stdout,font)
#endif
/* Font type */
typedef struct
{
unsigned char name[FONT_NAME_LEN+1];
Identifier id;
int ascii;
} Font;
/* Information about a generic string that must be printed on a page */
typedef struct
{
/* name of the font that must be used to print the string */
Font font;
/* rotation in the page */
short int rotation;
/* coordinates in the page */
Coordinates coord;
/* content of the string */
unsigned char text[STRING_INFO_TEXT_LEN+1];
} String_Info;
/*-----------------------------------------------------------------------------
DIMENSIONS
---------------------------------------------------------------------------*/
typedef struct
{
unsigned int width;
unsigned int height;
} Dimensions;
/* List of information about strings that must be printed on a page */
typedef struct
{
List *string_info_list;
} String_Info_List;
/*-----------------------------------------------------------------------------
FUNCTIONS
---------------------------------------------------------------------------*/
#ifdef DEBUG
void Font_Fprint(FILE *fd, const Font *font);
#endif
void StringInfo_Reset(String_Info *string_info);
Com_Err_Code StrInfoList_Init(String_Info_List *string_info_list);
Com_Err_Code StrInfoList_Add_StrInfo(String_Info_List *string_info_list,
const String_Info *string_info);
Com_Err_Code
StrInfoList_GetFirst_StrInfo(const String_Info_List *string_info_list,
String_Info *string_info);
Com_Err_Code
StrInfoList_GetNext_StrInfo(const String_Info_List *string_info_list,
String_Info *string_info);
Com_Err_Code StrInfoList_Delete(String_Info_List *string_info_list);
#ifdef DEBUG
void StringInfo_Fprint(FILE *fd, const String_Info *string_info);
void StrInfoList_Fprint(FILE *fd, const String_Info_List *string_info_list);
#endif
/*=============================================================================
COMMON MACROS
===========================================================================*/
/* for mailbag and service data lines */
/*
#define SENDER_LEN 8
*/
#define WHERE_LEN 8 /* for letter file and service data lines */
#define CUST_NAME_LEN 128 /* for letter file and service data lines */
#define COUNTRY_CODE_LEN 2 /* for letter and environment data */
#define POSTAL_CODE_LEN 11 /* for letter and OMR */
#define DOMAIN_ID_LEN 8 /* for letter file and environment data */
#define PS_ID_LEN 100 /* for SDL and environment data */
#define MAX_TS_LEN 50
#define DEPARTMENT_CODE_LEN 6 /* length of department code field */
#define ENVELOPE_TYPE_LEN 1 /* length of envelope type field */
#define PAPER_DEF_LEN 1 /* length of paper definition field */
#define STAMP_PRICE_LEN 20 /* length of stamp price field for SDL */
#define RECIPIENT_ID_LEN 60 /* length of recipient ID field */
/*=============================================================================
DATA STRUCTURE TimeStamp
===========================================================================*/
/*-----------------------------------------------------------------------------
EXTERNALS
---------------------------------------------------------------------------*/
extern const time_t NOW;
/*-----------------------------------------------------------------------------
TYPES
---------------------------------------------------------------------------*/
typedef struct
{
struct tm tm_data;
} TimeStamp;
typedef enum { GMT = 1, LOCAL } TStype;
typedef enum { DATE_TIME = 1, DATE , YMD_DATE_TIME} TSformat;
/*-----------------------------------------------------------------------------
FUNCTIONS
---------------------------------------------------------------------------*/
void TS_Set(TimeStamp *ts, time_t seconds, TStype type);
void TS_Reset(TimeStamp *ts);
unsigned char *TS_StrPrint(const TimeStamp *ts, TSformat format);
/*=============================================================================
RESOURCE INFO
===========================================================================*/
/*-----------------------------------------------------------------------------
MACROS
---------------------------------------------------------------------------*/
#define BOF_RES_NAME_LEN 21
/*-----------------------------------------------------------------------------
TYPES
---------------------------------------------------------------------------*/
typedef enum
{
FPDEF = '0',
FDEF = '1',
PDEF = '2',
PSEG = '3',
OVL = '4',
FONT = '5',
CPAGE = '6',
CSET = '7'
} Resource_Type;
typedef unsigned int Resolution;
typedef unsigned int Version;
typedef unsigned char Pdl_Type;
/*=============================================================================
OTHER FUNCTIONS
===========================================================================*/
bool CheckAndAssign_String(unsigned char dst_string[],
unsigned char *src_string,
int max_len);
void get_error_prod_mng(int *);
void set_error_prod_mng(int );
void reset_error_prod_mng(void);
void set_send_log_flag(void);
void reset_send_log_flag(void);
bool get_send_log_flag(void);
#define PROFILE_SEND_LOG(args) if( get_send_log_flag() == TRUE ) { \
SEND_LOG args; \
}
#endif /* PS_PARSLIB_PARSERS_H */ |