diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-11 15:08:46 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-11 15:08:46 +0000 |
commit | 0d244e11569291f8eec9c4268510f72ae3cbfc2a (patch) | |
tree | 4c9b3de512929a270b2336c486b271adb0c5c1f4 /module/header.h | |
parent | 3c9be46f96e2ce6bdca9d268f7d477704259fe95 (diff) | |
download | iconv-0d244e11569291f8eec9c4268510f72ae3cbfc2a.tar.gz iconv-0d244e11569291f8eec9c4268510f72ae3cbfc2a.tar.bz2 |
Various fixes to make compilation with GCCSDK4 work.
Add an Iconv command (currently no code support)
svn path=/trunk/iconv/; revision=5682
Diffstat (limited to 'module/header.h')
-rw-r--r-- | module/header.h | 242 |
1 files changed, 130 insertions, 112 deletions
diff --git a/module/header.h b/module/header.h index df5ff48..0678cd7 100644 --- a/module/header.h +++ b/module/header.h @@ -1,126 +1,144 @@ -/* - * Created by cmhg vsn 5.42 [01 Mar 2002] - */ +/* Generated by CMunge 0.76 (10 May 2006) + * CMunge Copyright (c) 1999-2006 Robin Watts/Justin Fletcher */ -#ifndef __cmhg_header_h -#define __cmhg_header_h +#ifndef _CMUNGE_Iconv_H_ +#define _CMUNGE_Iconv_H_ -#ifndef __kernel_h #include "kernel.h" -#endif -#define CMHG_VERSION 542 +#define CMUNGE_VERSION (76) +#define CMHG_VERSION (531) /* Nearest equivalent version */ -#define Module_Title "Iconv" -#define Module_Help "Iconv" -#define Module_VersionString "0.08" -#define Module_VersionNumber 8 +#define Module_Title "Iconv" +#define Module_Help "Iconv" +#define Module_VersionString "0.08" +#define Module_VersionNumber 8 #ifndef Module_Date -#define Module_Date "11 Mar 2007" +#define Module_Date "11 Nov 2008" #endif - -/* - * Initialisation code - * =================== - * - * Return NULL if your initialisation succeeds; otherwise return a pointer - * to an error block. cmd_tail points to the string of arguments with which - * the module is invoked (may be "", and is control-terminated, not zero - * terminated). - * podule_base is 0 unless the code has been invoked from a podule. - * pw is the 'R12' value established by module initialisation. You may - * assume nothing about its value (in fact it points to some RMA space - * claimed and used by the module veneers). All you may do is pass it back - * for your module veneers via an intermediary such as SWI OS_CallEvery - * (use _swix() to issue the SWI call). - */ -_kernel_oserror *mod_init(const char *cmd_tail, int podule_base, void *pw); - - -/* - * Finalisation code - * ================= - * - * Return NULL if your finalisation succeeds. Otherwise return a pointer to - * an error block if your finalisation handler does not wish to die (e.g. - * toolbox modules return a 'Task(s) active' error). - * fatal, podule and pw are the values of R10, R11 and R12 (respectively) - * on entry to the finalisation code. - */ -_kernel_oserror *mod_fini(int fatal, int podule, void *pw); - - -/* - * Command handler - * =============== - * - * If cmd_no identifies a command, then arg_string gives the command tail - * (which you may not overwrite), and argc is the number of parameters. - * NB. arg_string is control terminated so it may not be a C string. - * Return NULL if the command has been successfully handled; otherwise - * return a pointer to an error block describing the failure (in this - * case, the veneer code will set the 'V' bit). - * - * If cmd_no identifies a *Help entry, then arg_string denotes a buffer - * that you can assemble your output into. cmd_handler must return - * NULL, an error pointer or help_PRINT_BUFFER (if help_PRINT_BUFFER) - * is returned, the zero-terminated buffer will be printed). - * - * If cmd_no identifies a *Configure option, then arg_string gives the - * command tail, and argc the number of parameters. Return NULL, an error - * pointer, or one of the four special values defined below. If arg_string - * is set to arg_CONFIGURE_SYNTAX, the user has typed *Configure with no - * parameter; simply print your syntax string. If arg_string is set to - * arg_STATUS, print your current configured status. Otherwise use - * arg_string and argc to set the *Configure option. - * - * pw is the private word pointer ('R12') value passed into the entry - * veneer - */ -#define help_PRINT_BUFFER ((_kernel_oserror *) arg_string) -#define arg_CONFIGURE_SYNTAX ((char *) 0) -#define arg_STATUS ((char *) 1) -#define configure_BAD_OPTION ((_kernel_oserror *) -1) -#define configure_NUMBER_NEEDED ((_kernel_oserror *) 1) -#define configure_TOO_LARGE ((_kernel_oserror *) 2) -#define configure_TOO_MANY_PARAMS ((_kernel_oserror *) 3) - -#define CMD_ReadAliases 0 - -_kernel_oserror *command_handler(const char *arg_string, int argc, int cmd_no, void *pw); - - -/* - * SWI handler code - * ================ - * - * swi_offset contains the offset of the SWI into your SWI chunk. - * r points to the registers passed to the SWI. - * - * Return NULL if the SWI is handled successfully; otherwise return - * a pointer to an error block which describes the error. - * The veneer code sets the 'V' bit if the returned value is non-NULL. - * The special value error_BAD_SWI may be returned if you do not - * implement a SWI; the veneer will arrange for the appropriate - * standard internationalised error 'SWI value out of range for - * module Iconv' to be returned. - * The handler may update any of its input registers (R0-R9). - * pw is the private word pointer ('R12') value passed into the - * SWI handler entry veneer. - */ -#define Iconv_00 0x057540 -#ifndef Iconv_Open -#define Iconv_Open 0x057540 -#define Iconv_Iconv 0x057541 -#define Iconv_Close 0x057542 -#define Iconv_Convert 0x057543 -#define Iconv_CreateMenu 0x057544 -#define Iconv_DecodeMenu 0x057545 +#ifdef __cplusplus +extern "C" { #endif + +/*************************************************************************** + * Function: mod_init + * Description: Initialise the module, setting up vectors, callbacks and + * any other parts of the system necessary for the module to + * function. + * Parameters: tail = pointer to command line (control terminated) + * podule_base = address of podule module was started from, or + * NULL if none + * pw = private word for module + * On exit: Return NULL for successful initialisation, or a pointer to + * an error block if the module could not start properly. + **************************************************************************/ +_kernel_oserror *mod_init(const char *tail, int podule_base, void *pw); + + +/*************************************************************************** + * Function: mod_fini + * Description: Finalise the module, shutting down any systems necessary, + * freeing vectors and releasing workspace + * Parameters: fatal = fatality indicator; 1 if fatal, 0 if + * reinitialising + * podule_base = address of podule module was started from, or + * NULL if none + * pw = private word for module + * On exit: Return 0 for successful finalisation, or a pointer to an + * error block if module was not shutdown properly. + **************************************************************************/ +_kernel_oserror *mod_fini(int fatal, int podule_base, void *pw); + + +/*************************************************************************** + * Description: Star command and help request handler routines. + * Parameters: arg_string = pointer to argument string (control + * terminated), or output buffer + * argc = number of arguments passed + * number = command number (see CMD_* definitions below) + * pw = private word for module + * On exit: If number indicates a help entry: + * To output, assemble zero terminated output into + * arg_string, and return help_PRINT_BUFFER to print it. + * To stay silent, return NULL. + * To given an error, return an error pointer. + * [In this case, you need to cast the 'const' away] + * If number indicates a configure option: + * If arg_string is arg_STATUS, then print status, otherwise + * use argc and arg_string to set option. + * Return NULL for no error. + * Return one of the four error codes below (configure_*) + * for a generic error message. + * Return an error pointer for a custom error. + * If number indicates a command entry: + * Execute the command given by number, and arg_string. + * Return NULL on success, + * Return a pointer to an error block on failure. + **************************************************************************/ +_kernel_oserror *command_handler(const char *arg_string, int argc, + int number, void *pw); +#define help_PRINT_BUFFER ((_kernel_oserror *) arg_string) +#define arg_CONFIGURE_SYNTAX ((char *) 0) +#define arg_STATUS ((char *) 1) +#define configure_BAD_OPTION ((_kernel_oserror *) -1) +#define configure_NUMBER_NEEDED ((_kernel_oserror *) 1) +#define configure_TOO_LARGE ((_kernel_oserror *) 2) +#define configure_TOO_MANY_PARAMS ((_kernel_oserror *) 3) + +/* Command numbers, as passed to the command handler functions (see above) */ +#undef CMD_Iconv +#define CMD_Iconv (0) +#undef CMD_ReadAliases +#define CMD_ReadAliases (1) + + +/*************************************************************************** + * Description: SWI handler routine. All SWIs for this module will be + * passed to these routines. + * Parameters: number = SWI number within SWI chunk (i.e. 0 to 63) + * r = pointer to register block on entry + * pw = private word for module + * On exit: Return NULL if SWI handled sucessfully, setting return + * register values (r0-r9) in r. + * Return error_BAD_SWI for out of range SWIs. + * Return an error block for a custom error. + **************************************************************************/ +/* Function called to handle SWI calls */ +_kernel_oserror *swi_handler(int number, _kernel_swi_regs *r, void *pw); +/* SWI number definitions */ +#define Iconv_00 (0x00057540) +#undef Iconv_Open +#undef XIconv_Open +#define Iconv_Open (0x00057540) +#define XIconv_Open (0x00077540) +#undef Iconv_Iconv +#undef XIconv_Iconv +#define Iconv_Iconv (0x00057541) +#define XIconv_Iconv (0x00077541) +#undef Iconv_Close +#undef XIconv_Close +#define Iconv_Close (0x00057542) +#define XIconv_Close (0x00077542) +#undef Iconv_Convert +#undef XIconv_Convert +#define Iconv_Convert (0x00057543) +#define XIconv_Convert (0x00077543) +#undef Iconv_CreateMenu +#undef XIconv_CreateMenu +#define Iconv_CreateMenu (0x00057544) +#define XIconv_CreateMenu (0x00077544) +#undef Iconv_DecodeMenu +#undef XIconv_DecodeMenu +#define Iconv_DecodeMenu (0x00057545) +#define XIconv_DecodeMenu (0x00077545) + +/* Special error for 'SWI values out of range for this module' */ #define error_BAD_SWI ((_kernel_oserror *) -1) -_kernel_oserror *swi_handler(int swi_offset, _kernel_swi_regs *r, void *pw); +#ifdef __cplusplus +} +#endif #endif |