/* THIS FILE WAS AUTOMATICALLY GENERATED BY Makefile.PL */
/*                  DO NOT EDIT                         */


/*
$Header: /cvsroot/arsperl/ARSperl/support-h.template,v 1.36 2009/03/31 17:41:17 tstapff Exp $

    ARSperl - An ARS v2 - v5 / Perl5 Integration Kit

    Copyright (C) 1995-2003
	Joel Murphy, jmurphy@acsu.buffalo.edu
        Jeff Murphy, jcmurphy@acsu.buffalo.edu

    This program is free software; you can redistribute it and/or modify
    it under the terms as Perl itself. 
    
    Refer to the file called "Artistic" that accompanies the source distribution 
    of ARSperl (or the one that accompanies the source distribution of Perl
    itself) for a full description.
 
    Comments to:  arsperl@arsperl.org
                  (this is a *mailing list* and you must be
                   a subscriber before posting)

    Home Page: http://www.arsperl.org
 

*/

#ifndef __support_h_
#define __support_h_

#if (PERL_BASEREV_IS == 50) && (PERL_PATCHLEVEL_IS < 5)
 #define PL_na na
 #define PL_sv_undef sv_undef
#endif

#undef EXTERN
#ifndef __support_c_
# define EXTERN extern
#else
# define EXTERN 
#endif

#include "ar.h"
#include "arerrno.h"
#include "arextern.h"
#include "arstruct.h"
#include "arfree.h"

#if AR_EXPORT_VERSION < 6
# include "nt.h"
# include "nterrno.h"
# include "ntfree.h"
# include "ntsextrn.h"
#endif

/* the following are defined because we use them as default values in ARS.xs */

#if AR_EXPORT_VERSION < 3
# define AR_FIELD_TYPE_ALL 0
# include "ntcextrn.h"
#endif
#if AR_EXPORT_VERSION < 5
# define AR_IMPORT_OPT_CREATE 0
# define AR_IMPORT_OPT_OVERWRITE 1
#endif

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <stdio.h>
#include <string.h>
#include <limits.h>

#ifdef PROFILE
# include <sys/time.h>
#endif

#define SAFEPRT(X) (X && *X)? X : "[null]"
#ifdef ARSPERL_DEBUG
# define DBG(X) printf("[%s %d] %s : ", __FILE__, __LINE__, __FUNCTION__); printf X
#else
# define DBG(X)
#endif

typedef struct {
  unsigned int numItems;
  void *array;
} ARList;

typedef struct {
  ARControlStruct ctrl;
  int queries;
  long startTime;
  long endTime;
} ars_ctrl;

#define TYPEMAP_LAST 0xFFFFFFFFL

typedef struct {
  unsigned int  number;
  char         *name;
} TypeMapStruct;


static struct {
	unsigned int  number;
	char	     *name;
} StructItemTypeMap[] = {
  { AR_STRUCT_ITEM_SCHEMA, 		"schema" },
  { AR_STRUCT_ITEM_SCHEMA_DEFN, 		"schema_defn" },
  { AR_STRUCT_ITEM_SCHEMA_VIEW, 		"schema_view" },
  { AR_STRUCT_ITEM_SCHEMA_MAIL, 		"schema_mail" },
  { AR_STRUCT_ITEM_FILTER, 		"filter" },
  { AR_STRUCT_ITEM_ACTIVE_LINK, 		"active_link" },
  { AR_STRUCT_ITEM_ADMIN_EXT, 		"admin_ext" },
  { AR_STRUCT_ITEM_CHAR_MENU, 		"char_menu" },
  { AR_STRUCT_ITEM_ESCALATION, 		"escalation" },
  { AR_STRUCT_ITEM_DIST_MAP, 		"dist_map" },
  { AR_STRUCT_ITEM_SCHEMA_VIEW_MIN, 		"schema_view_min" },
  { AR_STRUCT_ITEM_CONTAINER, 		"container" },
  { AR_STRUCT_ITEM_DIST_POOL, 		"dist_pool" },
  { AR_STRUCT_ITEM_VUI, 		"vui" },
  { AR_STRUCT_ITEM_FIELD, 		"field" },
  { AR_STRUCT_ITEM_APP, 		"app" },
  { AR_STRUCT_ITEM_SCHEMA_DATA, 		"schema_data" },
  { AR_STRUCT_ITEM_LOCK_BLOCK, 		"lock_block" },
  { AR_STRUCT_ITEM_SCHEMA_VIEW_2, 		"schema_view_2" },
  { AR_STRUCT_ITEM_XML_NONE, 		"xml_none" },
  { AR_STRUCT_ITEM_XML_SCHEMA, 		"xml_schema" },
  { AR_STRUCT_ITEM_XML_FILTER, 		"xml_filter" },
  { AR_STRUCT_ITEM_XML_ACTIVE_LINK, 		"xml_active_link" },
  { AR_STRUCT_ITEM_XML_CHAR_MENU, 		"xml_char_menu" },
  { AR_STRUCT_ITEM_XML_ESCALATION, 		"xml_escalation" },
  { AR_STRUCT_ITEM_XML_DIST_MAP, 		"xml_dist_map" },
  { AR_STRUCT_ITEM_XML_CONTAINER, 		"xml_container" },
  { AR_STRUCT_ITEM_XML_DIST_POOL, 		"xml_dist_pool" },
  { AR_STRUCT_ITEM_XML_VUI, 		"xml_vui" },
  { AR_STRUCT_ITEM_XML_FIELD, 		"xml_field" },
  { AR_STRUCT_ITEM_XML_APP, 		"xml_app" },
  { AR_STRUCT_ITEM_XML_SCHEMA_DATA, 		"xml_schema_data" },
  { AR_STRUCT_ITEM_XML_LOCK_BLOCK, 		"xml_lock_block" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char	     *name;
} ServerStatTypeMap[] = {
  { AR_SERVER_STAT_START_TIME, 		"start_time" },
  { AR_SERVER_STAT_BAD_PASSWORD, 		"bad_password" },
  { AR_SERVER_STAT_NO_WRITE_TOKEN, 		"no_write_token" },
  { AR_SERVER_STAT_NO_FULL_TOKEN, 		"no_full_token" },
  { AR_SERVER_STAT_CURRENT_USERS, 		"current_users" },
  { AR_SERVER_STAT_WRITE_FIXED, 		"write_fixed" },
  { AR_SERVER_STAT_WRITE_FLOATING, 		"write_floating" },
  { AR_SERVER_STAT_WRITE_READ, 		"write_read" },
  { AR_SERVER_STAT_FULL_FIXED, 		"full_fixed" },
  { AR_SERVER_STAT_FULL_FLOATING, 		"full_floating" },
  { AR_SERVER_STAT_FULL_NONE, 		"full_none" },
  { AR_SERVER_STAT_API_REQUESTS, 		"api_requests" },
  { AR_SERVER_STAT_API_TIME, 		"api_time" },
  { AR_SERVER_STAT_ENTRY_TIME, 		"entry_time" },
  { AR_SERVER_STAT_RESTRUCT_TIME, 		"restruct_time" },
  { AR_SERVER_STAT_OTHER_TIME, 		"other_time" },
  { AR_SERVER_STAT_CACHE_TIME, 		"cache_time" },
  { AR_SERVER_STAT_GET_E_COUNT, 		"get_e_count" },
  { AR_SERVER_STAT_GET_E_TIME, 		"get_e_time" },
  { AR_SERVER_STAT_SET_E_COUNT, 		"set_e_count" },
  { AR_SERVER_STAT_SET_E_TIME, 		"set_e_time" },
  { AR_SERVER_STAT_CREATE_E_COUNT, 		"create_e_count" },
  { AR_SERVER_STAT_CREATE_E_TIME, 		"create_e_time" },
  { AR_SERVER_STAT_DELETE_E_COUNT, 		"delete_e_count" },
  { AR_SERVER_STAT_DELETE_E_TIME, 		"delete_e_time" },
  { AR_SERVER_STAT_MERGE_E_COUNT, 		"merge_e_count" },
  { AR_SERVER_STAT_MERGE_E_TIME, 		"merge_e_time" },
  { AR_SERVER_STAT_GETLIST_E_COUNT, 		"getlist_e_count" },
  { AR_SERVER_STAT_GETLIST_E_TIME, 		"getlist_e_time" },
  { AR_SERVER_STAT_E_STATS_COUNT, 		"e_stats_count" },
  { AR_SERVER_STAT_E_STATS_TIME, 		"e_stats_time" },
  { AR_SERVER_STAT_FILTER_PASSED, 		"filter_passed" },
  { AR_SERVER_STAT_FILTER_FAILED, 		"filter_failed" },
  { AR_SERVER_STAT_FILTER_DISABLE, 		"filter_disable" },
  { AR_SERVER_STAT_FILTER_NOTIFY, 		"filter_notify" },
  { AR_SERVER_STAT_FILTER_MESSAGE, 		"filter_message" },
  { AR_SERVER_STAT_FILTER_LOG, 		"filter_log" },
  { AR_SERVER_STAT_FILTER_FIELDS, 		"filter_fields" },
  { AR_SERVER_STAT_FILTER_PROCESS, 		"filter_process" },
  { AR_SERVER_STAT_FILTER_TIME, 		"filter_time" },
  { AR_SERVER_STAT_ESCL_PASSED, 		"escl_passed" },
  { AR_SERVER_STAT_ESCL_FAILED, 		"escl_failed" },
  { AR_SERVER_STAT_ESCL_DISABLE, 		"escl_disable" },
  { AR_SERVER_STAT_ESCL_NOTIFY, 		"escl_notify" },
  { AR_SERVER_STAT_ESCL_LOG, 		"escl_log" },
  { AR_SERVER_STAT_ESCL_FIELDS, 		"escl_fields" },
  { AR_SERVER_STAT_ESCL_PROCESS, 		"escl_process" },
  { AR_SERVER_STAT_ESCL_TIME, 		"escl_time" },
  { AR_SERVER_STAT_TIMES_BLOCKED, 		"times_blocked" },
  { AR_SERVER_STAT_NUMBER_BLOCKED, 		"number_blocked" },
  { AR_SERVER_STAT_CPU, 		"cpu" },
  { AR_SERVER_STAT_SQL_DB_COUNT, 		"sql_db_count" },
  { AR_SERVER_STAT_SQL_DB_TIME, 		"sql_db_time" },
  { AR_SERVER_STAT_FTS_SRCH_COUNT, 		"fts_srch_count" },
  { AR_SERVER_STAT_FTS_SRCH_TIME, 		"fts_srch_time" },
  { AR_SERVER_STAT_SINCE_START, 		"since_start" },
  { AR_SERVER_STAT_IDLE_TIME, 		"idle_time" },
  { AR_SERVER_STAT_NET_RESP_TIME, 		"net_resp_time" },
  { AR_SERVER_STAT_FILTER_FIELDP, 		"filter_fieldp" },
  { AR_SERVER_STAT_ESCL_FIELDP, 		"escl_fieldp" },
  { AR_SERVER_STAT_FILTER_SQL, 		"filter_sql" },
  { AR_SERVER_STAT_ESCL_SQL, 		"escl_sql" },
  { AR_SERVER_STAT_NUM_THREADS, 		"num_threads" },
  { AR_SERVER_STAT_FILTER_GOTO_ACTION, 		"filter_goto_action" },
  { AR_SERVER_STAT_FILTER_CALL_GUIDE, 		"filter_call_guide" },
  { AR_SERVER_STAT_FILTER_EXIT_GUIDE, 		"filter_exit_guide" },
  { AR_SERVER_STAT_FILTER_GOTO_GUIDE_LB, 		"filter_goto_guide_lb" },
  { AR_SERVER_STAT_FILTER_FIELDS_SQL, 		"filter_fields_sql" },
  { AR_SERVER_STAT_FILTER_FIELDS_PROCESS, 		"filter_fields_process" },
  { AR_SERVER_STAT_FILTER_FIELDS_FLTAPI, 		"filter_fields_fltapi" },
  { AR_SERVER_STAT_ESCL_FIELDS_SQL, 		"escl_fields_sql" },
  { AR_SERVER_STAT_ESCL_FIELDS_PROCESS, 		"escl_fields_process" },
  { AR_SERVER_STAT_ESCL_FIELDS_FLTAPI, 		"escl_fields_fltapi" },
  { AR_SERVER_STAT_WRITE_RESTRICTED_READ, 		"write_restricted_read" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char	     *name;
} SchemaTypeMap[] = {
  { AR_SCHEMA_NONE, 		"none" },
  { AR_SCHEMA_REGULAR, 		"regular" },
  { AR_SCHEMA_JOIN, 		"join" },
  { AR_SCHEMA_VIEW, 		"view" },
  { AR_SCHEMA_DIALOG, 		"dialog" },
  { AR_SCHEMA_VENDOR, 		"vendor" },
  { AR_SCHEMA_MAX_SCHEMA_TYPE, 		"max_schema_type" },
  { AR_SCHEMA_SET_NONE, 		"set_none" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} ComParmTypeMap[] = {
  { AR_COM_PARM_NULL, 	"null" },
  { AR_COM_PARM_FIELDID, 	"fieldid" },
  { AR_COM_PARM_VALUE, 	"value" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} ComMethodTypeMap[] = {
  { AR_COM_METHOD_NULL, 	"null" },
  { AR_COM_METHOD_FIELDID, 	"fieldid" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} DDEActionMap[] = {
  { AR_DDE_EXECUTE, 	"execute" },
  { AR_DDE_POKE, 	"poke" },
  { AR_DDE_REQUEST, 	"request" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} ActiveLinkActionTypeMap[] = {
  { AR_ACTIVE_LINK_ACTION_NONE, 	"none" },
  { AR_ACTIVE_LINK_ACTION_MACRO, 	"macro" },
  { AR_ACTIVE_LINK_ACTION_FIELDS, 	"fields" },
  { AR_ACTIVE_LINK_ACTION_PROCESS, 	"process" },
  { AR_ACTIVE_LINK_ACTION_MESSAGE, 	"message" },
  { AR_ACTIVE_LINK_ACTION_SET_CHAR, 	"set_char" },
  { AR_ACTIVE_LINK_ACTION_DDE, 	"dde" },
  { AR_ACTIVE_LINK_ACTION_FIELDP, 	"fieldp" },
  { AR_ACTIVE_LINK_ACTION_SQL, 	"sql" },
  { AR_ACTIVE_LINK_ACTION_AUTO, 	"auto" },
  { AR_ACTIVE_LINK_ACTION_OPENDLG, 	"opendlg" },
  { AR_ACTIVE_LINK_ACTION_COMMITC, 	"commitc" },
  { AR_ACTIVE_LINK_ACTION_CLOSEWND, 	"closewnd" },
  { AR_ACTIVE_LINK_ACTION_CALLGUIDE, 	"callguide" },
  { AR_ACTIVE_LINK_ACTION_EXITGUIDE, 	"exitguide" },
  { AR_ACTIVE_LINK_ACTION_GOTOGUIDELABEL, 	"gotoguidelabel" },
  { AR_ACTIVE_LINK_ACTION_WAIT, 	"wait" },
  { AR_ACTIVE_LINK_ACTION_GOTOACTION, 	"gotoaction" },
  { AR_ACTIVE_LINK_ACTION_SERVICE, 	"service" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} OpenWindowModeMap[] = {
  { AR_ACTIVE_LINK_ACTION_OPEN_DLG, 	"open_dlg" },
  { AR_ACTIVE_LINK_ACTION_OPEN_SEARCH, 	"open_search" },
  { AR_ACTIVE_LINK_ACTION_OPEN_SUBMIT, 	"open_submit" },
  { AR_ACTIVE_LINK_ACTION_OPEN_MODIFY_LST, 	"open_modify_lst" },
  { AR_ACTIVE_LINK_ACTION_OPEN_MODIFY_DETAIL, 	"open_modify_detail" },
  { AR_ACTIVE_LINK_ACTION_OPEN_MODIFY_SPLIT, 	"open_modify_split" },
  { AR_ACTIVE_LINK_ACTION_OPEN_DSPLY_LST, 	"open_dsply_lst" },
  { AR_ACTIVE_LINK_ACTION_OPEN_DSPLY_DETAIL, 	"open_dsply_detail" },
  { AR_ACTIVE_LINK_ACTION_OPEN_DSPLY_SPLIT, 	"open_dsply_split" },
  { AR_ACTIVE_LINK_ACTION_OPEN_REPORT, 	"open_report" },
  { AR_ACTIVE_LINK_ACTION_OPEN_MODIFY, 	"open_modify" },
  { AR_ACTIVE_LINK_ACTION_OPEN_DSPLY, 	"open_dsply" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} CharMenuDDTypeMap[] = {
  { AR_CHAR_MENU_DD_NONE, 		"dd_none" },
  { AR_CHAR_MENU_DD_FORM, 		"dd_form" },
  { AR_CHAR_MENU_DD_FIELD, 		"dd_field" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} CharMenuDDNameMap[] = {
  { AR_CHAR_MENU_DD_DB_NAME, 		"dd_db_name" },
  { AR_CHAR_MENU_DD_LOCAL_NAME, 		"dd_local_name" },
  { AR_CHAR_MENU_DD_ID, 		"dd_id" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} CharMenuDDValueMap[] = {
  { AR_CHAR_MENU_DD_FORMAT_NONE, 		"dd_format_none" },
  { AR_CHAR_MENU_DD_FORMAT_ID, 		"dd_format_id" },
  { AR_CHAR_MENU_DD_FORMAT_NAME, 		"dd_format_name" },
  { AR_CHAR_MENU_DD_FORMAT_QUOTES, 		"dd_format_quotes" },
  { AR_CHAR_MENU_DD_FORMAT_DOLLARS, 		"dd_format_dollars" },
  { AR_CHAR_MENU_DD_FORMAT_ID_NAME, 		"dd_format_id_name" },
  { AR_CHAR_MENU_DD_FORMAT_NAMEL, 		"dd_format_namel" },
  { AR_CHAR_MENU_DD_FORMAT_QUOTESL, 		"dd_format_quotesl" },
  { AR_CHAR_MENU_DD_FORMAT_DOLLARSL, 		"dd_format_dollarsl" },
  { AR_CHAR_MENU_DD_FORMAT_ID_L, 		"dd_format_id_l" },
  { AR_CHAR_MENU_DD_FORMAT_NAME_L, 		"dd_format_name_l" },
  { AR_CHAR_MENU_DD_FORMAT_L_NAME, 		"dd_format_l_name" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} CharMenuTypeMap[] = {
  { AR_CHAR_MENU_NONE, 		"none" },
  { AR_CHAR_MENU_LIST, 		"list" },
  { AR_CHAR_MENU_QUERY, 		"query" },
  { AR_CHAR_MENU_FILE, 		"file" },
  { AR_CHAR_MENU_SQL, 		"sql" },
  { AR_CHAR_MENU_SS, 		"ss" },
  { AR_CHAR_MENU_DATA_DICTIONARY, 		"data_dictionary" },
	{ TYPEMAP_LAST, "" }
};

static struct {
	unsigned int  number;
	char         *name;
} FilterActionTypeMap[] = {
  { AR_FILTER_ACTION_NONE, 	"none" },
  { AR_FILTER_ACTION_NOTIFY, 	"notify" },
  { AR_FILTER_ACTION_MESSAGE, 	"message" },
  { AR_FILTER_ACTION_LOG, 	"log" },
  { AR_FILTER_ACTION_FIELDS, 	"fields" },
  { AR_FILTER_ACTION_PROCESS, 	"process" },
  { AR_FILTER_ACTION_FIELDP, 	"fieldp" },
  { AR_FILTER_ACTION_SQL, 	"sql" },
  { AR_FILTER_ACTION_GOTOACTION, 	"gotoaction" },
  { AR_FILTER_ACTION_CALLGUIDE, 	"callguide" },
  { AR_FILTER_ACTION_EXITGUIDE, 	"exitguide" },
  { AR_FILTER_ACTION_GOTOGUIDELABEL, 	"gotoguidelabel" },
	{ TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} CharMenuRefreshCodeTypeMap[] = {
  { AR_MENU_REFRESH_CONNECT, 		"connect" },
  { AR_MENU_REFRESH_OPEN, 		"open" },
  { AR_MENU_REFRESH_INTERVAL, 		"interval" },
  { TYPEMAP_LAST, "" }
};

#define PERMTYPE_SCHEMA 0
#define PERMTYPE_FIELD  1

static struct {
  unsigned int  number;
  char         *name;
} SchemaPermissionTypeMap[] = {
  { AR_PERMISSIONS_NONE, 		"none" },
  { AR_PERMISSIONS_VISIBLE, 		"visible" },
  { AR_PERMISSIONS_HIDDEN, 		"hidden" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} FieldPermissionTypeMap[] = {
  { AR_PERMISSIONS_NONE, 		"none" },
  { AR_PERMISSIONS_VIEW, 		"view" },
  { AR_PERMISSIONS_CHANGE, 		"change" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} DataTypeMap[] = {
  { AR_DATA_TYPE_NULL, 		"null" },
  { AR_DATA_TYPE_KEYWORD, 		"keyword" },
  { AR_DATA_TYPE_INTEGER, 		"integer" },
  { AR_DATA_TYPE_REAL, 		"real" },
  { AR_DATA_TYPE_CHAR, 		"char" },
  { AR_DATA_TYPE_DIARY, 		"diary" },
  { AR_DATA_TYPE_ENUM, 		"enum" },
  { AR_DATA_TYPE_TIME, 		"time" },
  { AR_DATA_TYPE_BITMASK, 		"bitmask" },
  { AR_DATA_TYPE_BYTES, 		"bytes" },
  { AR_DATA_TYPE_DECIMAL, 		"decimal" },
  { AR_DATA_TYPE_ATTACH, 		"attach" },
  { AR_DATA_TYPE_CURRENCY, 		"currency" },
  { AR_DATA_TYPE_DATE, 		"date" },
  { AR_DATA_TYPE_TIME_OF_DAY, 		"time_of_day" },
  { AR_DATA_TYPE_JOIN, 		"join" },
  { AR_DATA_TYPE_TRIM, 		"trim" },
  { AR_DATA_TYPE_CONTROL, 		"control" },
  { AR_DATA_TYPE_TABLE, 		"table" },
  { AR_DATA_TYPE_COLUMN, 		"column" },
  { AR_DATA_TYPE_PAGE, 		"page" },
  { AR_DATA_TYPE_PAGE_HOLDER, 		"page_holder" },
  { AR_DATA_TYPE_ATTACH_POOL, 		"attach_pool" },
  { AR_DATA_TYPE_ULONG, 		"ulong" },
  { AR_DATA_TYPE_COORDS, 		"coords" },
  { AR_DATA_TYPE_VIEW, 		"view" },
  { AR_DATA_TYPE_DISPLAY, 		"display" },
  { AR_DATA_TYPE_MAX_TYPE, 		"max_type" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned long  number;
  char          *name;
} ByteListTypeMap[] = {
  { AR_BYTE_LIST_SELF_DEFINED, 		"self_defined" },
  { AR_BYTE_LIST_WIN30_BITMAP, 		"win30_bitmap" },
  { AR_BYTE_LIST_JPEG, 		"jpeg" },
  { AR_BYTE_LIST_TIFF, 		"tiff" },
  { AR_BYTE_LIST_TARGA, 		"targa" },
  { AR_BYTE_LIST_PCX, 		"pcx" },
  { AR_BYTE_LIST_LOCALIZED_FILE, 		"localized_file" },
  { AR_BYTE_LIST_AUTH_STRING, 		"auth_string" },
  { AR_BYTE_LIST_FUNC_PTR, 		"func_ptr" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} NoMatchOptionMap[] = {
  { AR_NO_MATCH_ERROR, 		"error" },
  { AR_NO_MATCH_SET_NULL, 		"set_null" },
  { AR_NO_MATCH_NO_ACTION, 		"no_action" },
  { AR_NO_MATCH_SUBMIT, 		"submit" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} MultiMatchOptionMap[] = {
  { AR_MULTI_MATCH_ERROR, 		"error" },
  { AR_MULTI_MATCH_SET_NULL, 		"set_null" },
  { AR_MULTI_MATCH_USE_FIRST, 		"use_first" },
  { AR_MULTI_MATCH_PICKLIST, 		"picklist" },
  { AR_MULTI_MATCH_MODIFY_ALL, 		"modify_all" },
  { AR_MULTI_MATCH_NO_ACTION, 		"no_action" },
  { AR_MULTI_MATCH_USE_LOCALE, 		"use_locale" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} StatusReturnTypeMap[] = {
  { AR_RETURN_OK, 		"ok" },
  { AR_RETURN_WARNING, 		"warning" },
  { AR_RETURN_ERROR, 		"error" },
  { AR_RETURN_FATAL, 		"fatal" },
  { AR_RETURN_BAD_STATUS, 		"bad_status" },
  { AR_RETURN_PROMPT, 		"prompt" },
  { AR_RETURN_ACCESSIBLE, 		"accessible" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} ArithOpMap[] = {
  { AR_ARITH_OP_ADD,      "+" },
  { AR_ARITH_OP_SUBTRACT, "-" },
  { AR_ARITH_OP_MULTIPLY, "*" },
  { AR_ARITH_OP_DIVIDE,   "/" },
  { AR_ARITH_OP_MODULO,   "%" },
  { AR_ARITH_OP_NEGATE,   "-" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} FunctionMap[] = {
  { AR_FUNCTION_DATE, 		"date" },
  { AR_FUNCTION_TIME, 		"time" },
  { AR_FUNCTION_MONTH, 		"month" },
  { AR_FUNCTION_DAY, 		"day" },
  { AR_FUNCTION_YEAR, 		"year" },
  { AR_FUNCTION_WEEKDAY, 		"weekday" },
  { AR_FUNCTION_HOUR, 		"hour" },
  { AR_FUNCTION_MINUTE, 		"minute" },
  { AR_FUNCTION_SECOND, 		"second" },
  { AR_FUNCTION_TRUNC, 		"trunc" },
  { AR_FUNCTION_ROUND, 		"round" },
  { AR_FUNCTION_CONVERT, 		"convert" },
  { AR_FUNCTION_LENGTH, 		"length" },
  { AR_FUNCTION_UPPER, 		"upper" },
  { AR_FUNCTION_LOWER, 		"lower" },
  { AR_FUNCTION_SUBSTR, 		"substr" },
  { AR_FUNCTION_LEFT, 		"left" },
  { AR_FUNCTION_RIGHT, 		"right" },
  { AR_FUNCTION_LTRIM, 		"ltrim" },
  { AR_FUNCTION_RTRIM, 		"rtrim" },
  { AR_FUNCTION_LPAD, 		"lpad" },
  { AR_FUNCTION_RPAD, 		"rpad" },
  { AR_FUNCTION_REPLACE, 		"replace" },
  { AR_FUNCTION_STRSTR, 		"strstr" },
  { AR_FUNCTION_MIN, 		"min" },
  { AR_FUNCTION_MAX, 		"max" },
  { AR_FUNCTION_COLSUM, 		"colsum" },
  { AR_FUNCTION_COLCOUNT, 		"colcount" },
  { AR_FUNCTION_COLAVG, 		"colavg" },
  { AR_FUNCTION_COLMIN, 		"colmin" },
  { AR_FUNCTION_COLMAX, 		"colmax" },
  { AR_FUNCTION_DATEADD, 		"dateadd" },
  { AR_FUNCTION_DATEDIFF, 		"datediff" },
  { AR_FUNCTION_DATENAME, 		"datename" },
  { AR_FUNCTION_DATENUM, 		"datenum" },
  { AR_FUNCTION_CURRCONVERT, 		"currconvert" },
  { AR_FUNCTION_CURRSETDATE, 		"currsetdate" },
  { AR_FUNCTION_CURRSETTYPE, 		"currsettype" },
  { AR_FUNCTION_CURRSETVALUE, 		"currsetvalue" },
  { AR_FUNCTION_LENGTHC, 		"lengthc" },
  { AR_FUNCTION_LEFTC, 		"leftc" },
  { AR_FUNCTION_RIGHTC, 		"rightc" },
  { AR_FUNCTION_LPADC, 		"lpadc" },
  { AR_FUNCTION_RPADC, 		"rpadc" },
  { AR_FUNCTION_STRSTRC, 		"strstrc" },
  { AR_FUNCTION_SUBSTRC, 		"substrc" },
  { AR_FUNCTION_ENCRYPT, 		"encrypt" },
  { AR_FUNCTION_DECRYPT, 		"decrypt" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} ContainerTypeMap[] = {
  { ARCON_ALL, 		"all" },
  { ARCON_GUIDE, 		"guide" },
  { ARCON_APP, 		"app" },
  { ARCON_PACK, 		"pack" },
  { ARCON_FILTER_GUIDE, 		"filter_guide" },
  { ARCON_WEBSERVICE, 		"webservice" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} ContainerOwnerMap[] = {
  { ARCONOWNER_NONE, 		"none" },
  { ARCONOWNER_ALL, 		"all" },
  { ARCONOWNER_SCHEMA, 		"schema" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
} ReferenceTypeMap[] = {
  { ARREF_NONE, 		"none" },
  { ARREF_ALL, 		"all" },
  { ARREF_SCHEMA, 		"schema" },
  { ARREF_FILTER, 		"filter" },
  { ARREF_ESCALATION, 		"escalation" },
  { ARREF_ACTLINK, 		"actlink" },
  { ARREF_CONTAINER, 		"container" },
  { ARREF_CHAR_MENU, 		"char_menu" },
  { ARREF_ICON, 		"icon" },
  { ARREF_SMALL_ICON, 		"small_icon" },
  { ARREF_MAXIMIZE_FORMS, 		"maximize_forms" },
  { ARREF_APPLICATION_FORMS, 		"application_forms" },
  { ARREF_ABOUT_BOX_IMAGE, 		"about_box_image" },
  { ARREF_ABOUT_BOX_FORM, 		"about_box_form" },
  { ARREF_NULL_STRING, 		"null_string" },
  { ARREF_APPLICATION_HELP_EXT, 		"application_help_ext" },
  { ARREF_APPLICATION_HELP_FILE, 		"application_help_file" },
  { ARREF_APPLICATION_PRIMARY_FORM, 		"application_primary_form" },
  { ARREF_APPLICATION_FORM_VUI, 		"application_form_vui" },
  { ARREF_APPLICATION_DISABLE_BEGIN_TASK, 		"application_disable_begin_task" },
  { ARREF_APPLICATION_HELP_INDEX_EXT, 		"application_help_index_ext" },
  { ARREF_APPLICATION_HELP_INDEX_FILE, 		"application_help_index_file" },
  { ARREF_APPLICATION_HELP_FILE_NAME, 		"application_help_file_name" },
  { ARREF_PACKINGLIST_GUIDE, 		"packinglist_guide" },
  { ARREF_PACKINGLIST_APP, 		"packinglist_app" },
  { ARREF_PACKINGLIST_PACK, 		"packinglist_pack" },
  { ARREF_GROUP_DATA, 		"group_data" },
  { ARREF_DISTMAPPING_DATA, 		"distmapping_data" },
  { ARREF_APPLICATION_HAS_EXT_HELP, 		"application_has_ext_help" },
  { ARREF_APPLICATION_SUPPORT_FILES, 		"application_support_files" },
  { ARREF_PACKINGLIST_DSOPOOL, 		"packinglist_dsopool" },
  { ARREF_PACKINGLIST_FILTER_GUIDE, 		"packinglist_filter_guide" },
  { ARREF_FLASH_BOARD_DEF, 		"flash_board_def" },
  { ARREF_FLASH_DATA_SOURCE_DEF, 		"flash_data_source_def" },
  { ARREF_FLASH_VARIABLE_DEF, 		"flash_variable_def" },
  { ARREF_WS_PROPERTIES, 		"ws_properties" },
  { ARREF_WS_OPERATION, 		"ws_operation" },
  { ARREF_WS_ARXML_MAPPING, 		"ws_arxml_mapping" },
  { ARREF_WS_WSDL, 		"ws_wsdl" },
  { ARREF_PACKINGLIST_WEBSERVICE, 		"packinglist_webservice" },
  { ARREF_WS_PUBLISHING_LOC, 		"ws_publishing_loc" },
  { ARREF_APPLICATION_HELP_FILE_NAME2, 		"application_help_file_name2" },
  { ARREF_APPLICATION_HELP_EXT2, 		"application_help_ext2" },
  { ARREF_APPLICATION_HELP_FILE2, 		"application_help_file2" },
  { ARREF_APPLICATION_HELP_INDEX_EXT2, 		"application_help_index_ext2" },
  { ARREF_APPLICATION_HELP_INDEX_FILE2, 		"application_help_index_file2" },
  { ARREF_APPLICATION_HELP_FILE_NAME3, 		"application_help_file_name3" },
  { ARREF_APPLICATION_HELP_EXT3, 		"application_help_ext3" },
  { ARREF_APPLICATION_HELP_FILE3, 		"application_help_file3" },
  { ARREF_APPLICATION_HELP_INDEX_EXT3, 		"application_help_index_ext3" },
  { ARREF_APPLICATION_HELP_INDEX_FILE3, 		"application_help_index_file3" },
  { ARREF_APPLICATION_HELP_FILE_NAME4, 		"application_help_file_name4" },
  { ARREF_APPLICATION_HELP_EXT4, 		"application_help_ext4" },
  { ARREF_APPLICATION_HELP_FILE4, 		"application_help_file4" },
  { ARREF_APPLICATION_HELP_INDEX_EXT4, 		"application_help_index_ext4" },
  { ARREF_APPLICATION_HELP_INDEX_FILE4, 		"application_help_index_file4" },
  { ARREF_APPLICATION_HELP_FILE_NAME5, 		"application_help_file_name5" },
  { ARREF_APPLICATION_HELP_EXT5, 		"application_help_ext5" },
  { ARREF_APPLICATION_HELP_FILE5, 		"application_help_file5" },
  { ARREF_APPLICATION_HELP_INDEX_EXT5, 		"application_help_index_ext5" },
  { ARREF_APPLICATION_HELP_INDEX_FILE5, 		"application_help_index_file5" },
  { ARREF_APPLICATION_HELP_LABEL, 		"application_help_label" },
  { ARREF_APPLICATION_HELP_LABEL2, 		"application_help_label2" },
  { ARREF_APPLICATION_HELP_LABEL3, 		"application_help_label3" },
  { ARREF_APPLICATION_HELP_LABEL4, 		"application_help_label4" },
  { ARREF_APPLICATION_HELP_LABEL5, 		"application_help_label5" },
  { ARREF_WS_XML_SCHEMA_LOC, 		"ws_xml_schema_loc" },
  { ARREF_ENTRYPOINT_ORDER, 		"entrypoint_order" },
  { ARREF_ENTRYPOINT_START_ACTLINK, 		"entrypoint_start_actlink" },
  { ARREF_APP_AUTOLAYOUT_SS, 		"app_autolayout_ss" },
  { ARREF_APP_FORMACTION_FIELDS, 		"app_formaction_fields" },
  { ARREF_ENCAPSULATED_APP_DATA, 		"encapsulated_app_data" },
  { ARREF_APP_DEFAULT_OBJ_PERMS, 		"app_default_obj_perms" },
  { ARREF_APP_ADD_FORMACTION_FIELDS, 		"app_add_formaction_fields" },
  { ARREF_APP_FORMACTION_RESULTS_LIST_FIXED_HEADER, 		"app_formaction_results_list_fixed_header" },
  { ARREF_APP_FORMACTION_PAGE_PROPERTIES, 		"app_formaction_page_properties" },
  { ARREF_APP_OBJECT_VERSION, 		"app_object_version" },
  { ARREF_APP_PACKING_LISTS, 		"app_packing_lists" },
  { ARREF_APP_DATA_MERGE_IMP_QUAL, 		"app_data_merge_imp_qual" },
  { ARREF_APP_DATA_MERGE_IMP_OPTION, 		"app_data_merge_imp_option" },
  { TYPEMAP_LAST, "" }
};

static struct {
  unsigned int  number;
  char         *name;
  int           len;
} KeyWordMap[] = {
  { AR_KEYWORD_DEFAULT, 		"\0DEFAULT\0", 		9 },
  { AR_KEYWORD_USER, 		"\0USER\0", 		6 },
  { AR_KEYWORD_TIMESTAMP, 		"\0TIMESTAMP\0", 		11 },
  { AR_KEYWORD_TIME_ONLY, 		"\0TIME_ONLY\0", 		11 },
  { AR_KEYWORD_DATE_ONLY, 		"\0DATE_ONLY\0", 		11 },
  { AR_KEYWORD_SCHEMA, 		"\0SCHEMA\0", 		8 },
  { AR_KEYWORD_SERVER, 		"\0SERVER\0", 		8 },
  { AR_KEYWORD_WEEKDAY, 		"\0WEEKDAY\0", 		9 },
  { AR_KEYWORD_GROUPS, 		"\0GROUPS\0", 		8 },
  { AR_KEYWORD_OPERATION, 		"\0OPERATION\0", 		11 },
  { AR_KEYWORD_HARDWARE, 		"\0HARDWARE\0", 		10 },
  { AR_KEYWORD_OS, 		"\0OS\0", 		4 },
  { AR_KEYWORD_DATABASE, 		"\0DATABASE\0", 		10 },
  { AR_KEYWORD_LASTID, 		"\0LASTID\0", 		8 },
  { AR_KEYWORD_LASTCOUNT, 		"\0LASTCOUNT\0", 		11 },
  { AR_KEYWORD_VERSION, 		"\0VERSION\0", 		9 },
  { AR_KEYWORD_VUI, 		"\0VUI\0", 		5 },
  { AR_KEYWORD_GUIDETEXT, 		"\0GUIDETEXT\0", 		11 },
  { AR_KEYWORD_FIELDHELP, 		"\0FIELDHELP\0", 		11 },
  { AR_KEYWORD_GUIDE, 		"\0GUIDE\0", 		7 },
  { AR_KEYWORD_APPLICATION, 		"\0APPLICATION\0", 		13 },
  { AR_KEYWORD_LOCALE, 		"\0LOCALE\0", 		8 },
  { AR_KEYWORD_CLIENT_TYPE, 		"\0CLIENT_TYPE\0", 		13 },
  { AR_KEYWORD_SCHEMA_ALIAS, 		"\0SCHEMA_ALIAS\0", 		14 },
  { AR_KEYWORD_ROWSELECTED, 		"\0ROWSELECTED\0", 		13 },
  { AR_KEYWORD_ROWCHANGED, 		"\0ROWCHANGED\0", 		12 },
  { AR_KEYWORD_BROWSER, 		"\0BROWSER\0", 		9 },
  { AR_KEYWORD_VUI_TYPE, 		"\0VUI_TYPE\0", 		10 },
  { AR_KEYWORD_TCPPORT, 		"\0TCPPORT\0", 		9 },
  { AR_KEYWORD_HOMEURL, 		"\0HOMEURL\0", 		9 },
  { AR_KEYWORD_ROLES, 		"\0ROLES\0", 		7 },
  { AR_KEYWORD_EVENTTYPE, 		"\0EVENTTYPE\0", 		11 },
  { AR_KEYWORD_EVENTSRCWINID, 		"\0EVENTSRCWINID\0", 		15 },
  { AR_KEYWORD_CURRENTWINID, 		"\0CURRENTWINID\0", 		14 },
  { AR_KEYWORD_LASTOPENEDWINID, 		"\0LASTOPENEDWINID\0", 		17 },
  { AR_KEYWORD_INBULKTRANS, 		"\0INBULKTRANS\0", 		13 },
  { AR_KEYWORD_FIELDID, 		"\0FIELDID\0", 		9 },
  { AR_KEYWORD_FIELDNAME, 		"\0FIELDNAME\0", 		11 },
  { AR_KEYWORD_FIELDLABEL, 		"\0FIELDLABEL\0", 		12 },
  { AR_KEYWORD_SERVERTIMESTAMP, 		"\0SERVERTIMESTAMP\0", 		17 },
  { AR_KEYWORD_GROUPIDS, 		"\0GROUPIDS\0", 		10 },
  { AR_KEYWORD_EVENTDATA, 		"\0EVENTDATA\0", 		11 },
  { AR_KEYWORD_FILTER_ERRNO, 		"\0FILTER_ERRNO\0", 		14 },
  { AR_KEYWORD_FILTER_ERRMSG, 		"\0FILTER_ERRMSG\0", 		15 },
  { AR_KEYWORD_FILTER_ERRAPPENDMSG, 		"\0FILTER_ERRAPPENDMSG\0", 		21 },
  { AR_KEYWORD_NO, 		"\0NO\0", 		4 },
  { TYPEMAP_LAST, "", 0 }
};

static struct {
  unsigned int number;
  char *name;
} ServerInfoMap[] = {
  { 0, NULL },
  { AR_SERVER_INFO_DB_TYPE, 	"DB_TYPE" },
  { AR_SERVER_INFO_SERVER_LICENSE, 	"SERVER_LICENSE" },
  { AR_SERVER_INFO_FIXED_LICENSE, 	"FIXED_LICENSE" },
  { AR_SERVER_INFO_VERSION, 	"VERSION" },
  { AR_SERVER_INFO_ALLOW_GUESTS, 	"ALLOW_GUESTS" },
  { AR_SERVER_INFO_USE_ETC_PASSWD, 	"USE_ETC_PASSWD" },
  { AR_SERVER_INFO_XREF_PASSWORDS, 	"XREF_PASSWORDS" },
  { AR_SERVER_INFO_DEBUG_MODE, 	"DEBUG_MODE" },
  { AR_SERVER_INFO_DB_NAME, 	"DB_NAME" },
  { AR_SERVER_INFO_DB_PASSWORD, 	"DB_PASSWORD" },
  { AR_SERVER_INFO_HARDWARE, 	"HARDWARE" },
  { AR_SERVER_INFO_OS, 	"OS" },
  { AR_SERVER_INFO_SERVER_DIR, 	"SERVER_DIR" },
  { AR_SERVER_INFO_DBHOME_DIR, 	"DBHOME_DIR" },
  { AR_SERVER_INFO_SET_PROC_TIME, 	"SET_PROC_TIME" },
  { AR_SERVER_INFO_EMAIL_FROM, 	"EMAIL_FROM" },
  { AR_SERVER_INFO_SQL_LOG_FILE, 	"SQL_LOG_FILE" },
  { AR_SERVER_INFO_FLOAT_LICENSE, 	"FLOAT_LICENSE" },
  { AR_SERVER_INFO_FLOAT_TIMEOUT, 	"FLOAT_TIMEOUT" },
  { AR_SERVER_INFO_UNQUAL_QUERIES, 	"UNQUAL_QUERIES" },
  { AR_SERVER_INFO_FILTER_LOG_FILE, 	"FILTER_LOG_FILE" },
  { AR_SERVER_INFO_USER_LOG_FILE, 	"USER_LOG_FILE" },
  { AR_SERVER_INFO_REM_SERV_ID, 	"REM_SERV_ID" },
  { AR_SERVER_INFO_MULTI_SERVER, 	"MULTI_SERVER" },
  { AR_SERVER_INFO_EMBEDDED_SQL, 	"EMBEDDED_SQL" },
  { AR_SERVER_INFO_MAX_SCHEMAS, 	"MAX_SCHEMAS" },
  { AR_SERVER_INFO_DB_VERSION, 	"DB_VERSION" },
  { AR_SERVER_INFO_MAX_ENTRIES, 	"MAX_ENTRIES" },
  { AR_SERVER_INFO_MAX_F_DAEMONS, 	"MAX_F_DAEMONS" },
  { AR_SERVER_INFO_MAX_L_DAEMONS, 	"MAX_L_DAEMONS" },
  { AR_SERVER_INFO_ESCALATION_LOG_FILE, 	"ESCALATION_LOG_FILE" },
  { AR_SERVER_INFO_ESCL_DAEMON, 	"ESCL_DAEMON" },
  { AR_SERVER_INFO_SUBMITTER_MODE, 	"SUBMITTER_MODE" },
  { AR_SERVER_INFO_API_LOG_FILE, 	"API_LOG_FILE" },
  { AR_SERVER_INFO_FTEXT_FIXED, 	"FTEXT_FIXED" },
  { AR_SERVER_INFO_FTEXT_FLOAT, 	"FTEXT_FLOAT" },
  { AR_SERVER_INFO_FTEXT_TIMEOUT, 	"FTEXT_TIMEOUT" },
  { AR_SERVER_INFO_RESERV1_A, 	"RESERV1_A" },
  { AR_SERVER_INFO_RESERV1_B, 	"RESERV1_B" },
  { AR_SERVER_INFO_RESERV1_C, 	"RESERV1_C" },
  { AR_SERVER_INFO_SERVER_IDENT, 	"SERVER_IDENT" },
  { AR_SERVER_INFO_DS_SVR_LICENSE, 	"DS_SVR_LICENSE" },
  { AR_SERVER_INFO_DS_MAPPING, 	"DS_MAPPING" },
  { AR_SERVER_INFO_DS_PENDING, 	"DS_PENDING" },
  { AR_SERVER_INFO_DS_RPC_SOCKET, 	"DS_RPC_SOCKET" },
  { AR_SERVER_INFO_DS_LOG_FILE, 	"DS_LOG_FILE" },
  { AR_SERVER_INFO_SUPPRESS_WARN, 	"SUPPRESS_WARN" },
  { AR_SERVER_INFO_HOSTNAME, 	"HOSTNAME" },
  { AR_SERVER_INFO_FULL_HOSTNAME, 	"FULL_HOSTNAME" },
  { AR_SERVER_INFO_SAVE_LOGIN, 	"SAVE_LOGIN" },
  { AR_SERVER_INFO_U_CACHE_CHANGE, 	"U_CACHE_CHANGE" },
  { AR_SERVER_INFO_G_CACHE_CHANGE, 	"G_CACHE_CHANGE" },
  { AR_SERVER_INFO_STRUCT_CHANGE, 	"STRUCT_CHANGE" },
  { AR_SERVER_INFO_CASE_SENSITIVE, 	"CASE_SENSITIVE" },
  { AR_SERVER_INFO_SERVER_LANG, 	"SERVER_LANG" },
  { AR_SERVER_INFO_ADMIN_ONLY, 	"ADMIN_ONLY" },
  { AR_SERVER_INFO_CACHE_LOG_FILE, 	"CACHE_LOG_FILE" },
  { AR_SERVER_INFO_FLASH_DAEMON, 	"FLASH_DAEMON" },
  { AR_SERVER_INFO_THREAD_LOG_FILE, 	"THREAD_LOG_FILE" },
  { AR_SERVER_INFO_ADMIN_TCP_PORT, 	"ADMIN_TCP_PORT" },
  { AR_SERVER_INFO_ESCL_TCP_PORT, 	"ESCL_TCP_PORT" },
  { AR_SERVER_INFO_FAST_TCP_PORT, 	"FAST_TCP_PORT" },
  { AR_SERVER_INFO_LIST_TCP_PORT, 	"LIST_TCP_PORT" },
  { AR_SERVER_INFO_FLASH_TCP_PORT, 	"FLASH_TCP_PORT" },
  { AR_SERVER_INFO_TCD_TCP_PORT, 	"TCD_TCP_PORT" },
  { AR_SERVER_INFO_DSO_DEST_PORT, 	"DSO_DEST_PORT" },
  { AR_SERVER_INFO_INFORMIX_DBN, 	"INFORMIX_DBN" },
  { AR_SERVER_INFO_INFORMIX_TBC, 	"INFORMIX_TBC" },
  { AR_SERVER_INFO_INGRES_VNODE, 	"INGRES_VNODE" },
  { AR_SERVER_INFO_ORACLE_SID, 	"ORACLE_SID" },
  { AR_SERVER_INFO_ORACLE_TWO_T, 	"ORACLE_TWO_T" },
  { AR_SERVER_INFO_SYBASE_CHARSET, 	"SYBASE_CHARSET" },
  { AR_SERVER_INFO_SYBASE_SERV, 	"SYBASE_SERV" },
  { AR_SERVER_INFO_SHARED_MEM, 	"SHARED_MEM" },
  { AR_SERVER_INFO_SHARED_CACHE, 	"SHARED_CACHE" },
  { AR_SERVER_INFO_CACHE_SEG_SIZE, 	"CACHE_SEG_SIZE" },
  { AR_SERVER_INFO_DB_USER, 	"DB_USER" },
  { AR_SERVER_INFO_NFY_TCP_PORT, 	"NFY_TCP_PORT" },
  { AR_SERVER_INFO_FILT_MAX_TOTAL, 	"FILT_MAX_TOTAL" },
  { AR_SERVER_INFO_FILT_MAX_STACK, 	"FILT_MAX_STACK" },
  { AR_SERVER_INFO_DEFAULT_ORDER_BY, 	"DEFAULT_ORDER_BY" },
  { AR_SERVER_INFO_DELAYED_CACHE, 	"DELAYED_CACHE" },
  { AR_SERVER_INFO_DSO_MERGE_STYLE, 	"DSO_MERGE_STYLE" },
  { AR_SERVER_INFO_EMAIL_LINE_LEN, 	"EMAIL_LINE_LEN" },
  { AR_SERVER_INFO_EMAIL_SYSTEM, 	"EMAIL_SYSTEM" },
  { AR_SERVER_INFO_INFORMIX_RELAY_MOD, 	"INFORMIX_RELAY_MOD" },
  { AR_SERVER_INFO_PS_RPC_SOCKET, 	"PS_RPC_SOCKET" },
  { AR_SERVER_INFO_REGISTER_PORTMAPPER, 	"REGISTER_PORTMAPPER" },
  { AR_SERVER_INFO_SERVER_NAME, 	"SERVER_NAME" },
  { AR_SERVER_INFO_DBCONF, 	"DBCONF" },
  { AR_SERVER_INFO_APPL_PENDING, 	"APPL_PENDING" },
  { AR_SERVER_INFO_AP_RPC_SOCKET, 	"AP_RPC_SOCKET" },
  { AR_SERVER_INFO_AP_LOG_FILE, 	"AP_LOG_FILE" },
  { AR_SERVER_INFO_AP_DEFN_CHECK, 	"AP_DEFN_CHECK" },
  { AR_SERVER_INFO_MAX_LOG_FILE_SIZE, 	"MAX_LOG_FILE_SIZE" },
  { AR_SERVER_INFO_CLUSTERED_INDEX, 	"CLUSTERED_INDEX" },
  { AR_SERVER_INFO_ACTLINK_DIR, 	"ACTLINK_DIR" },
  { AR_SERVER_INFO_ACTLINK_SHELL, 	"ACTLINK_SHELL" },
  { AR_SERVER_INFO_USER_CACHE_UTILS, 	"USER_CACHE_UTILS" },
  { AR_SERVER_INFO_EMAIL_TIMEOUT, 	"EMAIL_TIMEOUT" },
  { AR_SERVER_INFO_EXPORT_VERSION, 	"EXPORT_VERSION" },
  { AR_SERVER_INFO_ENCRYPT_AL_SQL, 	"ENCRYPT_AL_SQL" },
  { AR_SERVER_INFO_SCC_ENABLED, 	"SCC_ENABLED" },
  { AR_SERVER_INFO_SCC_PROVIDER_NAME, 	"SCC_PROVIDER_NAME" },
  { AR_SERVER_INFO_SCC_TARGET_DIR, 	"SCC_TARGET_DIR" },
  { AR_SERVER_INFO_SCC_COMMENT_CHECKIN, 	"SCC_COMMENT_CHECKIN" },
  { AR_SERVER_INFO_SCC_COMMENT_CHECKOUT, 	"SCC_COMMENT_CHECKOUT" },
  { AR_SERVER_INFO_SCC_INTEGRATION_MODE, 	"SCC_INTEGRATION_MODE" },
  { AR_SERVER_INFO_EA_RPC_SOCKET, 	"EA_RPC_SOCKET" },
  { AR_SERVER_INFO_EA_RPC_TIMEOUT, 	"EA_RPC_TIMEOUT" },
  { AR_SERVER_INFO_USER_INFO_LISTS, 	"USER_INFO_LISTS" },
  { AR_SERVER_INFO_USER_INST_TIMEOUT, 	"USER_INST_TIMEOUT" },
  { AR_SERVER_INFO_DEBUG_GROUPID, 	"DEBUG_GROUPID" },
  { AR_SERVER_INFO_APPLICATION_AUDIT, 	"APPLICATION_AUDIT" },
  { AR_SERVER_INFO_EA_SYNC_TIMEOUT, 	"EA_SYNC_TIMEOUT" },
  { AR_SERVER_INFO_SERVER_TIME, 	"SERVER_TIME" },
  { AR_SERVER_INFO_SVR_SEC_CACHE, 	"SVR_SEC_CACHE" },
  { AR_SERVER_INFO_LOGFILE_APPEND, 	"LOGFILE_APPEND" },
  { AR_SERVER_INFO_MINIMUM_API_VER, 	"MINIMUM_API_VER" },
  { AR_SERVER_INFO_MAX_AUDIT_LOG_FILE_SIZE, 	"MAX_AUDIT_LOG_FILE_SIZE" },
  { AR_SERVER_INFO_CANCEL_QUERY, 	"CANCEL_QUERY" },
  { AR_SERVER_INFO_MULT_ASSIGN_GROUPS, 	"MULT_ASSIGN_GROUPS" },
  { AR_SERVER_INFO_ARFORK_LOG_FILE, 	"ARFORK_LOG_FILE" },
  { AR_SERVER_INFO_DSO_PLACEHOLDER_MODE, 	"DSO_PLACEHOLDER_MODE" },
  { AR_SERVER_INFO_DSO_POLLING_INTERVAL, 	"DSO_POLLING_INTERVAL" },
  { AR_SERVER_INFO_DSO_SOURCE_SERVER, 	"DSO_SOURCE_SERVER" },
  { AR_SERVER_INFO_DS_POOL, 	"DS_POOL" },
  { AR_SERVER_INFO_DSO_TIMEOUT_NORMAL, 	"DSO_TIMEOUT_NORMAL" },
  { AR_SERVER_INFO_ENC_PUB_KEY, 	"ENC_PUB_KEY" },
  { AR_SERVER_INFO_ENC_PUB_KEY_EXP, 	"ENC_PUB_KEY_EXP" },
  { AR_SERVER_INFO_ENC_DATA_KEY_EXP, 	"ENC_DATA_KEY_EXP" },
  { AR_SERVER_INFO_ENC_DATA_ENCR_ALG, 	"ENC_DATA_ENCR_ALG" },
  { AR_SERVER_INFO_ENC_SEC_POLICY, 	"ENC_SEC_POLICY" },
  { AR_SERVER_INFO_ENC_SESS_H_ENTRIES, 	"ENC_SESS_H_ENTRIES" },
  { AR_SERVER_INFO_DSO_TARGET_CONNECTION, 	"DSO_TARGET_CONNECTION" },
  { AR_SERVER_INFO_PREFERENCE_PRIORITY, 	"PREFERENCE_PRIORITY" },
  { AR_SERVER_INFO_ORACLE_QUERY_ON_CLOB, 	"ORACLE_QUERY_ON_CLOB" },
  { AR_SERVER_INFO_MESSAGE_CAT_SCHEMA, 	"MESSAGE_CAT_SCHEMA" },
  { AR_SERVER_INFO_ALERT_SCHEMA, 	"ALERT_SCHEMA" },
  { AR_SERVER_INFO_LOCALIZED_SERVER, 	"LOCALIZED_SERVER" },
  { AR_SERVER_INFO_SVR_EVENT_LIST, 	"SVR_EVENT_LIST" },
  { AR_SERVER_INFO_DISABLE_ADMIN_OPERATIONS, 	"DISABLE_ADMIN_OPERATIONS" },
  { AR_SERVER_INFO_DISABLE_ESCALATIONS, 	"DISABLE_ESCALATIONS" },
  { AR_SERVER_INFO_ALERT_LOG_FILE, 	"ALERT_LOG_FILE" },
  { AR_SERVER_INFO_DISABLE_ALERTS, 	"DISABLE_ALERTS" },
  { AR_SERVER_INFO_CHECK_ALERT_USERS, 	"CHECK_ALERT_USERS" },
  { AR_SERVER_INFO_ALERT_SEND_TIMEOUT, 	"ALERT_SEND_TIMEOUT" },
  { AR_SERVER_INFO_ALERT_OUTBOUND_PORT, 	"ALERT_OUTBOUND_PORT" },
  { AR_SERVER_INFO_ALERT_SOURCE_AR, 	"ALERT_SOURCE_AR" },
  { AR_SERVER_INFO_ALERT_SOURCE_FB, 	"ALERT_SOURCE_FB" },
  { AR_SERVER_INFO_DSO_USER_PASSWD, 	"DSO_USER_PASSWD" },
  { AR_SERVER_INFO_DSO_TARGET_PASSWD, 	"DSO_TARGET_PASSWD" },
  { AR_SERVER_INFO_APP_SERVICE_PASSWD, 	"APP_SERVICE_PASSWD" },
  { AR_SERVER_INFO_MID_TIER_PASSWD, 	"MID_TIER_PASSWD" },
  { AR_SERVER_INFO_PLUGIN_LOG_FILE, 	"PLUGIN_LOG_FILE" },
  { AR_SERVER_INFO_SVR_STATS_REC_MODE, 	"SVR_STATS_REC_MODE" },
  { AR_SERVER_INFO_SVR_STATS_REC_INTERVAL, 	"SVR_STATS_REC_INTERVAL" },
  { AR_SERVER_INFO_DEFAULT_WEB_PATH, 	"DEFAULT_WEB_PATH" },
  { AR_SERVER_INFO_FILTER_API_RPC_TIMEOUT, 	"FILTER_API_RPC_TIMEOUT" },
  { AR_SERVER_INFO_DISABLED_CLIENT, 	"DISABLED_CLIENT" },
  { AR_SERVER_INFO_PLUGIN_PASSWD, 	"PLUGIN_PASSWD" },
  { AR_SERVER_INFO_PLUGIN_ALIAS, 	"PLUGIN_ALIAS" },
  { AR_SERVER_INFO_PLUGIN_TARGET_PASSWD, 	"PLUGIN_TARGET_PASSWD" },
  { AR_SERVER_INFO_REM_WKFLW_PASSWD, 	"REM_WKFLW_PASSWD" },
  { AR_SERVER_INFO_REM_WKFLW_TARGET_PASSWD, 	"REM_WKFLW_TARGET_PASSWD" },
  { AR_SERVER_INFO_EXPORT_SVR_OPS, 	"EXPORT_SVR_OPS" },
  { AR_SERVER_INFO_INIT_FORM, 	"INIT_FORM" },
  { AR_SERVER_INFO_ENC_PUB_KEY_ALG, 	"ENC_PUB_KEY_ALG" },
  { AR_SERVER_INFO_IP_NAMES, 	"IP_NAMES" },
  { AR_SERVER_INFO_DSO_CACHE_CHK_INTERVAL, 	"DSO_CACHE_CHK_INTERVAL" },
  { AR_SERVER_INFO_DSO_MARK_PENDING_RETRY, 	"DSO_MARK_PENDING_RETRY" },
  { AR_SERVER_INFO_DSO_RPCPROG_NUM, 	"DSO_RPCPROG_NUM" },
  { AR_SERVER_INFO_DELAY_RECACHE_TIME, 	"DELAY_RECACHE_TIME" },
  { AR_SERVER_INFO_DFLT_ALLOW_CURRENCIES, 	"DFLT_ALLOW_CURRENCIES" },
  { AR_SERVER_INFO_CURRENCY_INTERVAL, 	"CURRENCY_INTERVAL" },
  { AR_SERVER_INFO_ORACLE_CURSOR_SHARE, 	"ORACLE_CURSOR_SHARE" },
  { AR_SERVER_INFO_DB2_DB_ALIAS, 	"DB2_DB_ALIAS" },
  { AR_SERVER_INFO_DB2_SERVER, 	"DB2_SERVER" },
  { AR_SERVER_INFO_DFLT_FUNC_CURRENCIES, 	"DFLT_FUNC_CURRENCIES" },
  { AR_SERVER_INFO_EMAIL_IMPORT_FORM, 	"EMAIL_IMPORT_FORM" },
  { AR_SERVER_INFO_EMAIL_AIX_USE_OLD_EMAIL, 	"EMAIL_AIX_USE_OLD_EMAIL" },
  { AR_SERVER_INFO_TWO_DIGIT_YEAR_CUTOFF, 	"TWO_DIGIT_YEAR_CUTOFF" },
  { AR_SERVER_INFO_ALLOW_BACKQUOTE_IN_PROCESS, 	"ALLOW_BACKQUOTE_IN_PROCESS" },
  { AR_SERVER_INFO_DB_CONNECTION_RETRIES, 	"DB_CONNECTION_RETRIES" },
  { AR_SERVER_INFO_DB_CHAR_SET, 	"DB_CHAR_SET" },
  { AR_SERVER_INFO_CURR_PART_VALUE_STR, 	"CURR_PART_VALUE_STR" },
  { AR_SERVER_INFO_CURR_PART_TYPE_STR, 	"CURR_PART_TYPE_STR" },
  { AR_SERVER_INFO_CURR_PART_DATE_STR, 	"CURR_PART_DATE_STR" },
  { AR_SERVER_INFO_HOMEPAGE_FORM, 	"HOMEPAGE_FORM" },
  { AR_SERVER_INFO_DISABLE_FTS_INDEXER, 	"DISABLE_FTS_INDEXER" },
  { AR_SERVER_INFO_DISABLE_ARCHIVE, 	"DISABLE_ARCHIVE" },
  { AR_SERVER_INFO_SERVERGROUP_MEMBER, 	"SERVERGROUP_MEMBER" },
  { AR_SERVER_INFO_SERVERGROUP_LOG_FILE, 	"SERVERGROUP_LOG_FILE" },
  { AR_SERVER_INFO_FLUSH_LOG_LINES, 	"FLUSH_LOG_LINES" },
  { AR_SERVER_INFO_SERVERGROUP_INTERVAL, 	"SERVERGROUP_INTERVAL" },
  { AR_SERVER_INFO_JAVA_VM_OPTIONS, 	"JAVA_VM_OPTIONS" },
  { AR_SERVER_INFO_PER_THREAD_LOGS, 	"PER_THREAD_LOGS" },
  { AR_SERVER_INFO_CONFIG_FILE, 	"CONFIG_FILE" },
  { AR_SERVER_INFO_SSTABLE_CHUNK_SIZE, 	"SSTABLE_CHUNK_SIZE" },
  { AR_SERVER_INFO_SG_EMAIL_STATE, 	"SG_EMAIL_STATE" },
  { AR_SERVER_INFO_SG_FLASHBOARDS_STATE, 	"SG_FLASHBOARDS_STATE" },
  { AR_SERVER_INFO_SERVERGROUP_NAME, 	"SERVERGROUP_NAME" },
  { AR_SERVER_INFO_SG_ADMIN_SERVER_NAME, 	"SG_ADMIN_SERVER_NAME" },
  { AR_SERVER_INFO_LOCKED_WKFLW_LOG_MODE, 	"LOCKED_WKFLW_LOG_MODE" },
  { AR_SERVER_INFO_ROLE_CHANGE, 	"ROLE_CHANGE" },
  { AR_SERVER_INFO_SG_ADMIN_SERVER_PORT, 	"SG_ADMIN_SERVER_PORT" },
  { AR_SERVER_INFO_PLUGIN_LOOPBACK_RPC, 	"PLUGIN_LOOPBACK_RPC" },
  { AR_SERVER_INFO_CACHE_MODE, 	"CACHE_MODE" },
  { AR_SERVER_INFO_DB_FREESPACE, 	"DB_FREESPACE" },
  { AR_SERVER_INFO_GENERAL_AUTH_ERR, 	"GENERAL_AUTH_ERR" },
  { AR_SERVER_INFO_AUTH_CHAINING_MODE, 	"AUTH_CHAINING_MODE" },
  { AR_SERVER_INFO_RPC_NON_BLOCKING_IO, 	"RPC_NON_BLOCKING_IO" },
  { AR_SERVER_INFO_SYS_LOGGING_OPTIONS, 	"SYS_LOGGING_OPTIONS" },
  { AR_SERVER_INFO_EXT_AUTH_CAPABILITIES, 	"EXT_AUTH_CAPABILITIES" },
  { AR_SERVER_INFO_DSO_ERROR_RETRY, 	"DSO_ERROR_RETRY" },
  { AR_SERVER_INFO_PREF_SERVER_OPTION, 	"PREF_SERVER_OPTION" },
  { AR_SERVER_INFO_FTINDEXER_LOG_FILE, 	"FTINDEXER_LOG_FILE" },
  { AR_SERVER_INFO_EXCEPTION_OPTION, 	"EXCEPTION_OPTION" },
  { AR_SERVER_INFO_ERROR_EXCEPTION_LIST, 	"ERROR_EXCEPTION_LIST" },
  { AR_SERVER_INFO_DSO_MAX_QUERY_SIZE, 	"DSO_MAX_QUERY_SIZE" },
  { AR_SERVER_INFO_ADMIN_OP_TRACKING, 	"ADMIN_OP_TRACKING" },
  { AR_SERVER_INFO_ADMIN_OP_PROGRESS, 	"ADMIN_OP_PROGRESS" },
  { AR_SERVER_INFO_PLUGIN_DEFAULT_TIMEOUT, 	"PLUGIN_DEFAULT_TIMEOUT" },
  { AR_SERVER_INFO_EA_IGNORE_EXCESS_GROUPS, 	"EA_IGNORE_EXCESS_GROUPS" },
  { AR_SERVER_INFO_EA_GROUP_MAPPING, 	"EA_GROUP_MAPPING" },
  { AR_SERVER_INFO_PLUGIN_LOG_LEVEL, 	"PLUGIN_LOG_LEVEL" },
  { AR_SERVER_INFO_FT_THRESHOLD_LOW, 	"FT_THRESHOLD_LOW" },
  { AR_SERVER_INFO_FT_THRESHOLD_HIGH, 	"FT_THRESHOLD_HIGH" },
  { AR_SERVER_INFO_NOTIFY_WEB_PATH, 	"NOTIFY_WEB_PATH" },
  { AR_SERVER_INFO_DISABLE_NON_UNICODE_CLIENTS, 	"DISABLE_NON_UNICODE_CLIENTS" },
  { AR_SERVER_INFO_FT_COLLECTION_DIR, 	"FT_COLLECTION_DIR" },
  { AR_SERVER_INFO_FT_CONFIGURATION_DIR, 	"FT_CONFIGURATION_DIR" },
  { AR_SERVER_INFO_FT_TEMP_DIR, 	"FT_TEMP_DIR" },
  { AR_SERVER_INFO_FT_REINDEX, 	"FT_REINDEX" },
  { AR_SERVER_INFO_FT_DISABLE_SEARCH, 	"FT_DISABLE_SEARCH" },
  { AR_SERVER_INFO_FT_CASE_SENSITIVITY, 	"FT_CASE_SENSITIVITY" },
  { AR_SERVER_INFO_FT_SEARCH_MATCH_OP, 	"FT_SEARCH_MATCH_OP" },
  { AR_SERVER_INFO_FT_STOP_WORDS, 	"FT_STOP_WORDS" },
  { AR_SERVER_INFO_FT_RECOVERY_INTERVAL, 	"FT_RECOVERY_INTERVAL" },
  { AR_SERVER_INFO_FT_OPTIMIZE_THRESHOLD, 	"FT_OPTIMIZE_THRESHOLD" },
  { AR_SERVER_INFO_MAX_PASSWORD_ATTEMPTS, 	"MAX_PASSWORD_ATTEMPTS" },
  { AR_SERVER_INFO_GUESTS_RESTRICT_READ, 	"GUESTS_RESTRICT_READ" },
  { AR_SERVER_INFO_ORACLE_CLOB_STORE_INROW, 	"ORACLE_CLOB_STORE_INROW" },
  { AR_SERVER_INFO_NEXT_ID_BLOCK_SIZE, 	"NEXT_ID_BLOCK_SIZE" },
  { AR_SERVER_INFO_NEXT_ID_COMMIT, 	"NEXT_ID_COMMIT" },
  { AR_SERVER_INFO_RPC_CLIENT_XDR_LIMIT, 	"RPC_CLIENT_XDR_LIMIT" },
  { AR_SERVER_INFO_CACHE_DISP_PROP, 	"CACHE_DISP_PROP" },
  { AR_SERVER_INFO_USE_CON_NAME_IN_STATS, 	"USE_CON_NAME_IN_STATS" },
  { AR_SERVER_INFO_DB_MAX_ATTACH_SIZE, 	"DB_MAX_ATTACH_SIZE" },
  { AR_SERVER_INFO_DB_MAX_TEXT_SIZE, 	"DB_MAX_TEXT_SIZE" },
  { AR_SERVER_INFO_GUID_PREFIX, 	"GUID_PREFIX" },
  { AR_SERVER_INFO_MULTIPLE_ARSYSTEM_SERVERS, 	"MULTIPLE_ARSYSTEM_SERVERS" },
  { AR_SERVER_INFO_ORACLE_BULK_FETCH_COUNT, 	"ORACLE_BULK_FETCH_COUNT" },
  { AR_SERVER_INFO_MINIMUM_CMDB_API_VER, 	"MINIMUM_CMDB_API_VER" },
  { AR_SERVER_INFO_PLUGIN_PORT, 	"PLUGIN_PORT" },
  { TYPEMAP_LAST, NULL }
};

static struct {
  unsigned int number;
  char *name;
} SignalTypeMap[] = {
  { 0, NULL },
  { AR_SIGNAL_CONFIG_CHANGED, 	"config_changed" },
  { AR_SIGNAL_GROUP_CACHE_CHANGED, 	"group_cache_changed" },
  { AR_SIGNAL_LICENSE_CHANGED, 	"license_changed" },
  { AR_SIGNAL_ALERT_USER_CHANGED, 	"alert_user_changed" },
  { AR_SIGNAL_DSO_SIGNAL, 	"dso_signal" },
  { AR_SIGNAL_USER_CACHE_CHANGED, 	"user_cache_changed" },
  { AR_SIGNAL_APPLICATION_SIGNAL, 	"application_signal" },
  { AR_SIGNAL_ARCHIVE_CHANGED, 	"archive_changed" },
  { AR_SIGNAL_ESCALATION_CHANGED, 	"escalation_changed" },
  { AR_SIGNAL_RECACHE, 	"recache" },
  { AR_SIGNAL_COMPUTED_GROUP_CHANGED, 	"computed_group_changed" },
  { TYPEMAP_LAST, NULL }
};

/*SERVERINFOTYPEHINTS*/
#include "serverTypeInfoHints.h"


EXTERN char *lookUpTypeName(TypeMapStruct *t, unsigned int v);
EXTERN unsigned int  lookUpServerInfoTypeHint(unsigned int itn);
EXTERN unsigned int  caseLookUpTypeNumber(TypeMapStruct *t, char *s);

/* typedef SV* (*ARS_fn)(void *); */
typedef void *(*ARS_fn)(ARControlStruct *ctrl, void *b);

EXTERN FILE* get_logging_file_ptr();
EXTERN void  set_logging_file_ptr( FILE* );

EXTERN void        *mallocnn(int s);
EXTERN void        *debug_mallocnn(int s, char *file, char *func, int line);
EXTERN void         debug_free(void *p, char *file, char *func, int line);
EXTERN unsigned int strsrch(register char *s, register char c);
EXTERN char        *strappend(char *b, char *a);

EXTERN int          ARError_reset();
EXTERN int          ARError_add( unsigned int type, long num, char *text);
EXTERN int          ARError( int returncode, ARStatusList status);
#if AR_EXPORT_VERSION < 6
EXTERN int          NTError( int returncode, NTStatusList status);
#endif

EXTERN SV *perl_diary(ARControlStruct *ctrl, ARDiaryStruct *in);
EXTERN SV *perl_MenuRefreshCode2Str(ARControlStruct *ctrl,  unsigned int rc);
EXTERN SV *perl_ARPermissionList(ARControlStruct *ctrl,  ARPermissionList *in, int);
#ifdef ARS452
EXTERN SV *perl_ARFilterStatusStruct(ARControlStruct *ctrl,  ARFilterStatusStruct *);
#endif
EXTERN SV *perl_ARStatusStruct(ARControlStruct *ctrl,  ARStatusStruct *);
#if AR_EXPORT_VERSION >= 4
EXTERN SV *perl_ARMessageStruct(ARControlStruct *ctrl,  ARMessageStruct *);
#endif
#if AR_EXPORT_VERSION >= 5
EXTERN SV *perl_ARWorkflowConnectStruct(ARControlStruct * ctrl, ARWorkflowConnectStruct * in);
EXTERN SV *perl_ARNameList(ARControlStruct * ctrl, ARNameList * in);
#endif
EXTERN SV *perl_ARInternalId(ARControlStruct *ctrl,  ARInternalId *);
EXTERN SV *perl_ARNameType(ARControlStruct *ctrl,  ARNameType *);
EXTERN SV *perl_ARList(ARControlStruct *ctrl,  ARList *, ARS_fn, int);
EXTERN SV *perl_ARValueStruct(ARControlStruct *ctrl, ARValueStruct *);
EXTERN SV *perl_ARValueStructType(ARControlStruct *ctrl,  ARValueStruct *in);
EXTERN SV *perl_dataType_names(ARControlStruct *ctrl,  unsigned int *);
EXTERN SV *perl_ARStatHistoryValue(ARControlStruct *ctrl,  ARStatHistoryValue *);
EXTERN ARByteList *dup_ARByteList(ARControlStruct * ctrl, ARByteList * in); 
EXTERN ARCoordList *dup_ARCoordList(ARControlStruct * ctrl, ARCoordList * in); 
#if AR_EXPORT_VERSION >= 6L
EXTERN SV *perl_AREnumItemStruct(ARControlStruct * ctrl, AREnumItemStruct * in);
EXTERN SV *perl_AREnumQueryStruct(ARControlStruct * ctrl, AREnumQueryStruct * in);
EXTERN SV *perl_AREnumLimitsStruct(ARControlStruct * ctrl, AREnumLimitsStruct * in);
#endif
#if AR_EXPORT_VERSION >= 7L
EXTERN void dup_ARFuncCurrencyList(ARFuncCurrencyList *dst, ARFuncCurrencyList *src);
EXTERN ARCurrencyStruct *dup_ARCurrencyStruct(ARControlStruct * ctrl, ARCurrencyStruct * in);
EXTERN SV *perl_ARFuncCurrencyStruct(ARControlStruct * ctrl, ARFuncCurrencyStruct * in);
EXTERN SV *perl_ARCurrencyPartStruct(ARControlStruct *ctrl, ARCurrencyPartStruct *);
#endif
EXTERN SV *perl_ARAssignFieldStruct(ARControlStruct *ctrl,  ARAssignFieldStruct *);
EXTERN SV *perl_ARAssignStruct(ARControlStruct *ctrl,  ARAssignStruct *);
EXTERN SV *perl_ARFieldAssignStruct(ARControlStruct *ctrl,  ARFieldAssignStruct *);
EXTERN SV *perl_ARDisplayStruct(ARControlStruct *ctrl,  ARDisplayStruct *);
EXTERN SV *perl_ARMacroParmStruct(ARControlStruct *ctrl, ARMacroParmStruct *);
EXTERN SV *perl_ARActiveLinkMacroStruct(ARControlStruct *ctrl, 
					ARActiveLinkMacroStruct *);
EXTERN SV *perl_ARFieldCharacteristics(ARControlStruct *ctrl, 
					ARFieldCharacteristics *);
EXTERN SV *perl_ARDDEStruct(ARControlStruct *ctrl,  ARDDEStruct *);
EXTERN SV *perl_ARActiveLinkActionStruct(ARControlStruct *ctrl, 
					 ARActiveLinkActionStruct *);
EXTERN SV *perl_ARFilterActionNotify(ARControlStruct * ctrl, ARFilterActionNotify *);
#if AR_EXPORT_VERSION >= 7L
EXTERN SV *perl_ARFilterActionNotifyAdvanced(ARControlStruct * ctrl, ARFilterActionNotifyAdvanced *);
#endif
#if AR_EXPORT_VERSION >= 8L
EXTERN SV *perl_ARSetFieldsActionStruct( ARControlStruct *ctrl, ARSetFieldsActionStruct *p );
EXTERN SV *perl_ARPushFieldsActionStruct( ARControlStruct *ctrl, ARPushFieldsActionStruct *p );
#endif
EXTERN SV *perl_ARFilterActionStruct(ARControlStruct *ctrl,  ARFilterActionStruct *);
EXTERN SV *perl_AROwnerObj(ARControlStruct *ctrl,  ARContainerOwnerObj *);
#if AR_EXPORT_VERSION >= 6L
EXTERN SV *perl_AROwnerObjList(ARControlStruct *ctrl,  ARContainerOwnerObjList *);
#endif
EXTERN SV *perl_ARReferenceStruct(ARControlStruct *ctrl,  ARReferenceStruct *);
EXTERN SV *perl_ARReferenceList(ARControlStruct *ctrl,  ARReferenceList *);
EXTERN SV *perl_expandARCharMenuStruct( ARControlStruct *, ARCharMenuStruct *);
EXTERN SV *perl_AREntryListFieldStruct(ARControlStruct *ctrl, 
					AREntryListFieldStruct *);
EXTERN SV *perl_ARIndexStruct(ARControlStruct *ctrl,  ARIndexStruct *);
EXTERN SV *perl_ARFieldLimitStruct(ARControlStruct *ctrl,  ARFieldLimitStruct *);
EXTERN SV *perl_ARFunctionAssignStruct(ARControlStruct *ctrl, 
					 ARFunctionAssignStruct *);
EXTERN SV *perl_ARArithOpAssignStruct(ARControlStruct *ctrl,  ARArithOpAssignStruct *);
EXTERN void dup_Value(ARControlStruct *ctrl,  ARValueStruct *, ARValueStruct *);
EXTERN ARArithOpStruct *dup_ArithOp(ARControlStruct *ctrl,  ARArithOpStruct *);
EXTERN void dup_ValueList(ARControlStruct *ctrl,  ARValueList *, ARValueList *);
EXTERN ARQueryValueStruct *dup_QueryValue(ARControlStruct *ctrl, 
					 ARQueryValueStruct *);
EXTERN void dup_FieldValueOrArith(ARControlStruct *ctrl, 
				  ARFieldValueOrArithStruct *,
				  ARFieldValueOrArithStruct *);
EXTERN ARRelOpStruct *dup_RelOp(ARControlStruct *ctrl,  ARRelOpStruct *);
EXTERN ARQualifierStruct *dup_qualifier(ARControlStruct *ctrl,  ARQualifierStruct *);
EXTERN ARQualifierStruct *dup_qualifier2(ARControlStruct *ctrl, 
					 ARQualifierStruct *in, 
					 ARQualifierStruct *out, int level);
EXTERN SV *perl_ARArithOpStruct(ARControlStruct *ctrl,  ARArithOpStruct *);
EXTERN SV *perl_ARQueryValueStruct(ARControlStruct *ctrl,  ARQueryValueStruct *);
EXTERN SV *perl_ARFieldValueOrArithStruct( ARControlStruct *ctrl,
					   ARFieldValueOrArithStruct *);
EXTERN SV *perl_relOp(ARControlStruct *ctrl, ARRelOpStruct *);
EXTERN HV *perl_qualifier(ARControlStruct *ctrl,  ARQualifierStruct *);
EXTERN int ARGetFieldCached( ARControlStruct *, ARNameType, ARInternalId,
		     ARNameType, ARFieldMappingStruct *,
		     unsigned int *, unsigned int *,
		     unsigned int *, 
#if AR_CURRENT_API_VERSION >= 12
		     unsigned int *, 
#endif
		     ARValueStruct *,
		     ARPermissionList *, ARFieldLimitStruct *,
		     ARDisplayInstanceList *,
		     char **, ARTimestamp *,
		     ARNameType, ARNameType, char **,
		     ARStatusList *);

EXTERN HV *fieldcache_get_schema_fields( ARControlStruct *ctrl, char *form_name, int load_if_incomplete );
EXTERN int fieldcache_store_field_info( HV *fields, ARInternalId fieldId, ARNameType fieldName, unsigned int dataType, char ** attrs );
EXTERN int fieldcache_load_schema( ARControlStruct *ctrl, char *schema, ARInternalIdList *fieldIds, char **attrs );
EXTERN unsigned int fieldcache_get_data_type( HV *fields, ARInternalId fieldId );

EXTERN int sv_to_ARValue(ARControlStruct *ctrl, 
			 SV *in, unsigned int dataType, ARValueStruct *out);
#if AR_EXPORT_VERSION >= 7
EXTERN int sv_to_ARCurrencyStruct(ARControlStruct *ctrl, 
			 SV *in, ARCurrencyStruct *out);
#endif
#if AR_EXPORT_VERSION >= 3
EXTERN SV *perl_ARPropStruct(ARControlStruct *ctrl,  ARPropStruct *in);
EXTERN SV *perl_ARPropList(ARControlStruct *ctrl, ARPropList *in);
EXTERN SV *perl_ARDisplayInstanceStruct(ARControlStruct *ctrl,
				  ARDisplayInstanceStruct *);
EXTERN SV *perl_ARDisplayInstanceList(ARControlStruct *ctrl,  ARDisplayInstanceList *);
EXTERN SV *perl_ARFieldMappingStruct(ARControlStruct *ctrl,  ARFieldMappingStruct *);
EXTERN SV *perl_ARJoinMappingStruct(ARControlStruct *ctrl,  ARJoinMappingStruct *);
EXTERN SV *perl_ARViewMappingStruct(ARControlStruct *ctrl,  ARViewMappingStruct *);
EXTERN SV *perl_ARJoinSchema(ARControlStruct *ctrl,  ARJoinSchema *);
EXTERN SV *perl_ARViewSchema(ARControlStruct *ctrl,  ARViewSchema *);
EXTERN SV *perl_ARCompoundSchema(ARControlStruct *ctrl,  ARCompoundSchema *);
EXTERN SV *perl_ARSortList(ARControlStruct *ctrl,  ARSortList *);
#if AR_CURRENT_API_VERSION >= 14
EXTERN SV *perl_ARImageDataStruct(ARControlStruct * ctrl, ARImageDataStruct * in);
#endif
EXTERN SV *perl_ARByteList(ARControlStruct *ctrl,  ARByteList *);
EXTERN SV *perl_ARCoordStruct(ARControlStruct *ctrl,  ARCoordStruct *);
EXTERN int perl_BuildEntryList(ARControlStruct *ctrl,  AREntryIdList *entryList, 
				char *entry_id);
EXTERN SV *perl_ARAssignSQLStruct(ARControlStruct *ctrl,  ARAssignSQLStruct *in);
#endif
#if AR_EXPORT_VERSION >= 6L
EXTERN SV *perl_ARVendorMappingStruct(ARControlStruct *ctrl,  ARVendorMappingStruct *);
EXTERN SV *perl_ARVendorSchema(ARControlStruct *ctrl,  ARVendorSchema *);
EXTERN SV *perl_ARAssignFilterApiStruct(ARControlStruct *ctrl,  ARAssignFilterApiStruct *in);
#endif

#if AR_EXPORT_VERSION >= 4
EXTERN SV *perl_ARSQLStruct(ARControlStruct *ctrl, ARSQLStruct *in);
EXTERN SV *perl_ARAttach(ARControlStruct *ctrl,  ARAttachStruct *in);
EXTERN SV *perl_ARPushFieldsStruct(ARControlStruct *ctrl, 
				   ARPushFieldsStruct *in);
EXTERN SV *perl_ARAutomationStruct(ARControlStruct *ctrl,
				   ARAutomationStruct *in);
EXTERN SV *perl_ARCOMMethodStruct(ARControlStruct *ctrl,
				  ARCOMMethodStruct *in);
EXTERN SV *perl_ARCOMMethodParmStruct(ARControlStruct *ctrl,
				      ARCOMMethodParmStruct *in);
EXTERN SV *perl_ARCOMValueStruct(ARControlStruct * ctrl,
				 ARCOMValueStruct * in);
EXTERN SV *perl_AROpenDlgStruct(ARControlStruct * ctrl,
				AROpenDlgStruct * in);
EXTERN SV *perl_ARCallGuideStruct(ARControlStruct * ctrl,
				ARCallGuideStruct * in);
EXTERN SV *perl_ARExitGuideStruct(ARControlStruct * ctrl,
				ARExitGuideStruct * in);
EXTERN SV *perl_ARGotoActionStruct(ARControlStruct * ctrl,
				ARGotoActionStruct * in);
EXTERN SV *perl_ARCommitChangesStruct(ARControlStruct * ctrl,
				ARCommitChangesStruct * in);
EXTERN SV *perl_ARCloseWndStruct(ARControlStruct * ctrl,
				ARCloseWndStruct * in);
EXTERN SV *perl_ARWaitStruct(ARControlStruct * ctrl,
				ARWaitStruct * in);
#endif


#if AR_EXPORT_VERSION >= 7L
EXTERN SV *perl_ARCurrencyDetailList(ARControlStruct * ctrl,
				ARCurrencyDetailList * in);
#endif


#if AR_EXPORT_VERSION >= 8L
EXTERN SV *perl_ARArchiveInfoStruct(ARControlStruct *ctrl,  ARArchiveInfoStruct *);
#endif
#if AR_CURRENT_API_VERSION >= 12
EXTERN SV *perl_ARAuditInfoStruct( ARControlStruct *ctrl, ARAuditInfoStruct *);
#endif
#if AR_CURRENT_API_VERSION >= 11
EXTERN SV *perl_ARBulkEntryReturn( ARControlStruct *ctrl, ARBulkEntryReturn *);
EXTERN SV *perl_AREntryReturn( ARControlStruct *ctrl, AREntryReturn *);
EXTERN SV *perl_ARXMLEntryReturn( ARControlStruct *ctrl, ARXMLEntryReturn *);
EXTERN SV *perl_ARStatusList( ARControlStruct *ctrl, ARStatusList *);
#endif

EXTERN SV *perl_AREntryListFieldList( ARControlStruct *ctrl, AREntryListFieldList *p );
EXTERN SV *perl_ARInternalIdList( ARControlStruct *ctrl, ARInternalIdList *p );
EXTERN SV *perl_ARFieldValueList( ARControlStruct *ctrl, ARFieldValueList *p );
EXTERN SV *perl_ARFieldValueStruct( ARControlStruct *ctrl, ARFieldValueStruct *p );

EXTERN SV *perl_ARCharMenuList( ARControlStruct *ctrl, ARCharMenuList *p );
EXTERN SV *perl_ARCharMenuItemStruct( ARControlStruct *ctrl, ARCharMenuItemStruct *p );
EXTERN SV *perl_ARCharMenuStruct( ARControlStruct *ctrl, ARCharMenuStruct *p );

#if AR_CURRENT_API_VERSION >= 13
EXTERN SV *perl_ARActiveLinkSvcActionStruct( ARControlStruct *ctrl, ARActiveLinkSvcActionStruct *p );
#endif

EXTERN SV *perl_ARLicenseDateStruct( ARControlStruct *ctrl, ARLicenseDateStruct *p );
EXTERN SV *perl_ARLicenseValidStruct( ARControlStruct *ctrl, ARLicenseValidStruct *p );


#ifndef BSD
# define MEMCAST void
#else
# define MEMCAST char
#endif

int  compmem(MEMCAST *m1, MEMCAST *m2, int size);
int  copymem(MEMCAST *m1, MEMCAST *m2, int size);


#ifndef ARSPERL_MALLOCDEBUG
# define AMALLOCNN(DST,SIZE,TYPE) { DST = (TYPE *)mallocnn(SIZE * sizeof(TYPE)); }
# define MALLOCNN(X) mallocnn(X) 
#else /* we want to debug memory allocations */
# define MALLOCNN(X) debug_mallocnn(X, __FILE__, __FUNCTION__, __LINE__) 
#endif /* malloc debugging */

#ifndef ARSPERL_FREEDEBUG
# ifdef _WIN32
#  define AP_FREE(X) win32_free(X)
# else
#  define AP_FREE(X) free(X)
# endif
#else
# define AP_FREE(X) debug_free(X, __FILE__, __FUNCTION__, __LINE__)
#endif /* free debugging */

#define CPNULL (char *)NULL

/* some useful macros: CharVaLiD and IntVaLiD .. 
 * for checking validity of paramters
 * VNAME() for all of those perl functions that want a string and
 * it's length as the next parameter.
 */

#define CVLD(X) (X && *X)
#define IVLD(X, L, H) ((L <= X) && (X <= H))

#define VNAME(X) X, strlen(X)

/* defines used by the ARError* functions */

#define ERRHASH  "ARS::ars_errhash"
#define EH_COUNT "numItems"
#define EH_TYPE  "messageType"
#define EH_NUM   "messageNum"
#define EH_TEXT  "messageText"

#define ARSPERL_TRACEBACK -1

#define AP_ERR_BAD_ARGS     80000, "Invalid number of arguments"
#define AP_ERR_BAD_EID      80001, "Invalid entry-id argument"
#define AP_ERR_EID_TYPE     80002, "Entry-id should be an array or a single scalar"
#define AP_ERR_EID_LEN      80003, "Invalid Entry-id length"
#define AP_ERR_BAD_LFLDS    80004, "Bad GetListFields"
#define AP_ERR_LFLDS_TYPE   80005, "GetListFields must be an ARRAY reference"
#define AP_ERR_USAGE        80006  /* roll your own text */
#define AP_ERR_MALLOC       80007, "mallocnn() failed to allocate space"
#define AP_ERR_BAD_EXP      80009, "Unknown export type"
#define AP_ERR_BAD_IMP      80010, "Unknown import type"
#define AP_ERR_DEPRECATED   80011  /* roll your own text */
#define AP_ERR_NO_SERVERS   80012, "No servers available"
#define AP_ERR_FIELD_TYPE   80013, "Unknown field type"
#define AP_ERR_COORD_LIST   80014, "Bad coord list"
#define AP_ERR_COORD_STRUCT 80015, "Bad coord struct"
#define AP_ERR_BYTE_LIST    80016, "Bad byte list"
#define AP_ERR_EID_SEP      80017, "Expected EID to contain a separator"
#define AP_ERR_OPT_NA       80018 /* roll your own text - option not available */
#define AP_ERR_EXPECT_PVHV  80019, "Expected argument to contain a HASH reference"
#define AP_ERR_GENERAL      80020 /* roll your own text */
#define AP_ERR_CONTINUE     80021 /* roll your own continuation text */
#define AP_ERR_NEEDKEYS     80022, "Required hash keys do not exists"
#define AP_ERR_NEEDKEYSKEYS 80023 /* specify what keys */
#define AP_ERR_PREREVFAIL   80024, "Failed to convert some perl structures to ars structures. Create/Set operation aborted."
#define AP_ERR_ATTACH       80025  /* roll your own text */
#define AP_ERR_INV_ARGS     80026 /* roll your own - invalid argument(s) */
#define AP_ERR_INV_ARITH    80027 /*, "Unknown arith operation in ARArithOpStruct" */
#define AP_ERR_ENUM_LISTSTYLE 80028, "Unknown EnumLimits listStyle"
#define AP_ERR_CURRENCY_STRUCT 80029, "Bad currency struct hash (missing a key or a key had an unexpected value)"
#define AP_ERR_TYPEMAP      80030, "Cannot resolve typemap value"
#define AP_ERR_INV_RETURN   80031, "Invalid return data"
#define AP_ERR_DATATYPE     80032, "Unsupported data type"

#endif /* __support_h_ */
