home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
-
- Adhesive (C) 1994 George Taylor
- -------------------------------
-
- Title: adhesiveRS.h
-
- Purpose: Access to object resources
-
- Author: George Taylor
-
- Version: 1.00
-
- ***************************************************************************/
-
- #pragma include_only_once
-
- #ifndef __ADHESIVERS
- #define __ADHESIVERS
-
- #include "kernel.h" /* for oserror */
-
- /* Nice and simple interface to SWIs which can be called from objects.
- The corresponding object file o.AdhesiveRS imports the symbol
- |!!!AdhesiveHeader| to find out where your object is in memory.
- */
-
- /* Procedure: adhesive_Resource
- *
- * Description: Get a pointer to the directory name of your object.
- *
- * Parameters: none
- *
- * Returns: const char *dirname
- * Pointer to read-only directory name or 0 if error.
- *
- * Other Info: This call can be done from interrupts as it is reentrant.
- * This call must only be made from within an object.
- */
- const char *adhesive_Resource(void);
-
-
-
-
- /* Interface to Adhesive_Resource SWI.
- */
-
-
- /* Message parameters used for parameter substitution.
- */
- typedef struct {
- const char *p[4]; /* %0..%3, use NULL to avoid substitution */
- /* if a % parameter is not in the message then
- the corresponding parameter given here is ignored
- */
- } MessageParams;
-
-
-
- /* Procedure: adhesive_Messages
- *
- * Description: Lookup a message from your object's messages file if it
- * has one.
- *
- * Parameters: const char *tag - message tag to lookup
- * *may contain default message i.e. tag:default)
- *
- * char *buf - buffer for resulting message
- * 0=>no buffer, return read-only copy with no
- * parameter substitution
- *
- * unsigned int buflen - length of buffer in bytes
- * (ignored if buf==0)
- *
- * MessageParams *params - message parameters
- * (ignored if buf==0)
- * - parameters not referred to in the message are not used
- * - pass NULL for a parameter to avoid substitution
- * - pass NULL for params if you wish no substituion
- *
- * Returns: char * - pointer to message, this is either in your
- * buffer or a read-only copy if buf==0 on entry.
- * 0=> the message tag could not be found and the message
- * does not have a default (or if the object has
- * no messages file)
- *
- * Other Info: The read-only message returned exists until your object
- * is removed from memory.
- *
- * This call can be done from interrupts as it is reentrant.
- * This call must only be made from within an object.
- *
- * IMPORTANT:
- * If buf=0 on entry then the message is terminated
- * with a ctrl character (not necessarily 0).
- * MessageTrans is to blame for this.
- * The string is always terminated by a zero if you specify
- * a buffer.
- *
- * You could try solving the above problem by placing
- * a 0 byte in the original messages file. The PRM defines
- * that any character apart from \n can appear in a message.
- * Tests of mine leave me doubting this.
- *
- */
- char *adhesive_Messages(const char *tag, char *buf, unsigned int buflen,
- const MessageParams *params);
-
-
- /* Procedure: adhesive_Error
- *
- * Description: Given a _kernel_oserror block containing a message number
- * and a message token, return a new _kernel_oserror block
- * containing the message string instead of the token.
- *
- * Parameters: const _kernel_oserror * - input error block
- * (token must be zero terminated)
- *
- * MessageParams *params - message parameters
- * - parameters not referred to in the message are not used
- * - pass NULL for a parameter to avoid substitution
- * - pass NULL for params if you wish no substituion
- *
- * Returns: _kernel_oserror * - pointer to readonly error block
- * (this an internal MessageTrans error block)
- *
- * Other Info: If the message token could not be found or if the object
- * has no messages file then the passed error block is
- * returned.
- *
- * SWI MessageTrans_ErrorLookup is used, see the PRM for
- * details of internal error buffers
- */
- _kernel_oserror *adhesive_Error(_kernel_oserror block,
- const MessageParams *params);
-
-
- #endif
-