/******************************************************************** * Job Ticket API (JTAPI) fsgjt.h * * Copyright (c) 2004 High North Inc. * Copyright (c) 2004 International Business Machines Corp. * Copyright (c) 2004 Seiko-Epson, Inc. * Copyright (c) 2004 Till Kamppeter. * Copyright (c) 2004 Free Standards Group. * * Common Public License - v 1.0 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS * COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR * DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE * OF THIS AGREEMENT. * * The Common Public License in its entirety is located in * fsgjt_cpl.h and applies to the contents of this file. *******************************************************************/ #ifndef FSGJT_H #define FSGJT_H #include /************************************************************ * Types used by the JTAPI ***********************************************************/ /* The externally available JTAPI object is a pointer to the */ /* internal (hidden) object structure */ typedef struct fsgjt_internal_object_s* fsgjt_object_t; /* The externally available JTAPI attribute is a pointer to */ /* the internal (hidden) attribute structure */ typedef struct fsgjt_internal_attr_s* fsgjt_attribute_t; /* Charset - Charset type that is registered with IANA and must */ /* conform to RFC 2798 */ /* see 'http://www.iana.org/assignments/character-sets' */ typedef char* fsgjt_charset_t; /* Integer - Integer type with a minimum: -2147483648 and */ /* a maximum: 2147483647 */ typedef int fsgjt_int32_t; /* MimeType - MIME type that is registered with IANA and must */ /* conform to RFC 2046 */ typedef char* fsgjt_mime_type_t; /* MediaSizeName - Media size name that must be a self-describing */ /* name and conforms to IEEE/ISTO PWG 5101.1-2002 */ typedef char* fsgjt_media_size_name_t; /* NaturalLanguage - Natural language tag that may be registered */ /* with IANA and must conform to RFC 3066 */ typedef char* fsgjt_natural_language_t; /* Text - Text type, with charset and language tags using */ /* Charset type - see 'jt-api-charset' and 'jt-charset' */ /* NaturalLanguage type - see 'job-document-natural-language' */ typedef char* fsgjt_text_t; /* URI - URI that must be well-formed and conform to RFC2396 */ typedef char* fsgjt_uri_t; /************************************************************ * Constants used by the JTAPI ***********************************************************/ /* The jt-api-version attribute is set to the following value. */ #define FSGJT_API_VERSION "1.0" /* Date of this version of the JTAPI */ /* Note: The following must be updated for each release. */ #define FSGJT_API_VERSION_DATE "yyyymmdd" /************************************************************ * Boolean * * Boolean true or false (for _internal_ library use ONLY). * Boolean must not be used for values of attributes. * Use fsgjt_present_t (PresentEnum) for attribute values. * * ***********************************************************/ typedef enum { FSGJT_BL_FALSE = 0, FSGJT_BL_TRUE } fsgjt_boolean_t; /************************************************************ * Error codes produced by the JTAPI ***********************************************************/ typedef enum { FSGJT_OK = 0, FSGJT_INTERNAL_ERROR, /* Unexpected error occurred, such as a memory allocation failure. */ FSGJT_INVALID_REQUEST, /* Request is not valid. */ FSGJT_NOT_SUPPORTED, /* Operation is not supported by the JTAPI. */ FSGJT_IO_ERROR, /* I/O Error occurred while attempting to read/write a job ticket. */ FSGJT_EMPTY_JT, /* The provided job ticket contains no data. */ FSGJT_ERROR_AT_LINE, /* Parser error at a specific line in the job ticket file. If a line number is available, the error will be reported instead of one of the other more general error codes. */ FSGJT_PARSE_FAILED, /* Parsing the job ticket failed for an unknown reason. */ FSGJT_PARSE_INIT_ERROR, /* Error occurred during parser initialization */ FSGJT_INVALID_PARAM, /* A function parameter to the parser code was not as expected. */ FSGJT_MISSING_INFO, /* Information required to complete a parser function was not provided by the caller. */ FSGJT_MISSING_PARAM, /* A parameter that is required was not provided by the caller. */ FSGJT_ATTRIBUTE_NOT_SET, /* No attribute with the provide name has been set. */ FSGJT_UNSUPPORTED_JT_VERSION, /* Job ticket version is not supported. */ FSGJT_UNSUPPORTED_XML_VERSION, /* Unsupported XML version. */ FSGJT_UNSUPPORTED_XML_ENCODING,/* Unsupported XML encoding. */ FSGJT_WRITE_FAILED, /* Error occurred while attempting to write job ticket file. */ } fsgjt_return_code_t; /****************************************************************** * Structure that contains the status and additional information if * a parser error occured. ******************************************************************/ typedef struct fsgjt_status_s { fsgjt_return_code_t returnCode; /* Return code */ fsgjt_int32_t lineNumber; /* Line number where error occurred or 0 if unavailable. */ fsgjt_int32_t columnNumber; /* Column number where error occured or 0 if unavailable. */ } fsgjt_status_t; /************************************************************ * The following functions support the JTAPI interface ***********************************************************/ /************************************************************ * fsgjtOpenJTAPI - Initializes the JTAPI library and may * return context structure used by the specific JTAPI * library instance - must be called before calling * any other JTAPI library methods. * * param (output) void** context - Pointer to opaque JTAPI * interface context structure * * return fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtOpenJTAPI( void** context); /************************************************************ * fsgjtFlushJTAPI - Releases all objects and dynamic memory * and closes any I/O channels that are associated with * this specific JTAPI library instance. * * param (input) void* context - Opaque JTAPI interface * context structure * * return fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtFlushJTAPI( void* context); /************************************************************ * fsgjtCloseJTAPI - Releases this specific JTAPI library * instance (and internally calls fsgjtFlushJTAPI). * * param (input) void* context - Opaque JTAPI interface * context structure * * return fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtCloseJTAPI( void* context); /************************************************************ * The following functions apply to all of the JTAPI objects ***********************************************************/ /************************************************************ * fsgjtDestroy - Free the memory used by the provided * object. * * param (input) object - Object to free * * return fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtDestroy(fsgjt_object_t object); /************************************************************ * fsgjtGet - Gets the Attribute having the provided name. * * param (input) fsgjt_object_t object - Object from which * to get the Attribute * param (input) fsgjt_text_t attributeName - Name of the * Attribute to get * param (output) fsgjt_attribute_t* attribute - Pointer to * Attribute having provided name * * return fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtGet( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_attribute_t* attribute); /************************************************************ * fsgjtSet - Sets the provided attribute for the provided * object. * * param (input) fsgjt_object_t object - Object in which to * set the Attribute * param (input) fsgjt_attribute_t attribute - Attribute to * set * * return - fsgjt_return_code_t ***********************************************************/ fsgjt_return_code_t fsgjtSet( fsgjt_object_t object, fsgjt_attribute_t attribute); /************************************************************ * fsgjtSetIntegerAttribute - Convenience function for * setting an integer Attribute to the provided value. This * function creates a fsgjt_attribute_t and calls fsgjtSet() * function and then destroys the temporary Attribute. * * param (input) fsgjt_object_t object - Set the Attribute * in this object * param (input) fsgjt_text_t attributeName - Name of * Attribute to set * param (input) fsgjt_int32_t value - New value for the * Attribute * * return fsgjt_return_code_t ************************************************************/ fsgjt_return_code_t fsgjtSetIntegerAttribute( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_int32_t value); /************************************************************ * fsgjtSetObjectAttribute - Convenience function for setting * an object Attribute to the provided value. This function * creates a fsgjt_attribute_t and calls fsgjtSet() function * and then destroys the temporary Attribute. * * param (input) fsgjt_object_t object - Set the Attribute * in this object * param (input) fsgjt_text_t attributeName - Name of * Attribute to set * param (input) fsgjt_object_t value - New value for the * Attribute * * return fsgjt_return_code_t ************************************************************/ fsgjt_return_code_t fsgjtSetObjectAttribute( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_object_t value); /************************************************************ * fsgjtSetObjectAttributeList - Convenience function for * setting an object Attribute to the provided list of * values. This function creates a fsgjt_attribute_t, adds * the values and calls fsgjtSet() function, and then * destroys the temporary Attribute. * * param (input) fsgjt_object_t object - Set the Attribute * in this object * param (input) fsgjt_text_t attributeName - Name of * Attribute to set * param (input) fsgjt_object_t* value - List of new values * for the Attribute * * return fsgjt_return_code_t ************************************************************/ fsgjt_return_code_t fsgjtSetObjectAttributeList( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_object_t* list); /************************************************************ * fsgjtSetTextAttribute - Convenience function for setting * a text Attribute to the provided value. This function * creates a fsgjt_attribute_t, calls fsgjtSet() function, * and then destroys the temporary Attribute. * * param (input) fsgjt_object_t object - Set the Attribute * in this object * param (input) fsgjt_text_t attributeName - Name of * Attribute to set * param (input) fsgjt_text_t value - New value for the * Attribute * * return fsgjt_return_code_t ************************************************************/ fsgjt_return_code_t fsgjtSetTextAttribute( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_text_t value); /************************************************************ * fsgjtSetTextAttributeList - Convenience function for * setting a text Attribute to the provided values. This * function creates a fsgjt_attribute_t, calls fsgjtSet() * function, and then destroys the temporary Attribute. * * param (input) fsgjt_object_t object - Set the Attribute * in this object * param (input) fsgjt_text_t attributeName - Name of * Attribute to set * param (input) fsgjt_text_t* values - List of new values * for the Attribute * * return fsgjt_return_code_t ************************************************************/ fsgjt_return_code_t fsgjtSetTextAttributeList( fsgjt_object_t object, fsgjt_text_t attributeName, fsgjt_text_t* values); #endif /* FSGJT_H */