diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-11 05:09:51 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-11 05:09:51 +0000 |
commit | 42de9db2762a63f69321fc4e89ea81e16a5a206a (patch) | |
tree | fbff2a9f70f8a2792d134f5a9dc60d11b2ee0a08 /module/header.h | |
parent | b5aa13a47b66955a5198da1f88e1f93f09306a84 (diff) | |
download | iconv-42de9db2762a63f69321fc4e89ea81e16a5a206a.tar.gz iconv-42de9db2762a63f69321fc4e89ea81e16a5a206a.tar.bz2 |
Integrate module sources into build system.
Various hackery to get it to build for non-RO platforms.
A bunch of const-correctness fixes.
Hack around strict aliasing warning.
Don't expect the menu code to work on 64bit platforms. Sprinkling a bit of intptr_t around may well be some kind of solution.
svn path=/trunk/iconv/; revision=5680
Diffstat (limited to 'module/header.h')
-rw-r--r-- | module/header.h | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/module/header.h b/module/header.h new file mode 100644 index 0000000..df5ff48 --- /dev/null +++ b/module/header.h @@ -0,0 +1,126 @@ +/* + * Created by cmhg vsn 5.42 [01 Mar 2002] + */ + +#ifndef __cmhg_header_h +#define __cmhg_header_h + +#ifndef __kernel_h +#include "kernel.h" +#endif + +#define CMHG_VERSION 542 + +#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" +#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 +#endif + +#define error_BAD_SWI ((_kernel_oserror *) -1) + +_kernel_oserror *swi_handler(int swi_offset, _kernel_swi_regs *r, void *pw); + +#endif |