home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / messagetra < prev    next >
Encoding:
Text File  |  1994-09-07  |  11.2 KB  |  368 lines

  1. #ifndef messagetrans_H
  2. #define messagetrans_H
  3.  
  4. /* C header file for MessageTrans
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:23:23 1994
  6.  * Copyright © Acorn Computers Ltd, 1994
  7.  */
  8.  
  9. /*************************************************************************
  10.  * This source file was written by Acorn Computers Limited. It is part   *
  11.  * of the OSLib library for writing applications for RISC OS. It may be  *
  12.  * used freely in the creation of programs for RISC OS.                  *
  13.  *************************************************************************/
  14.  
  15. #ifndef types_H
  16.    #include "types.h"
  17. #endif
  18.  
  19. #ifndef os_H
  20.    #include "os.h"
  21. #endif
  22.  
  23. /**********************************
  24.  * SWI names and SWI reason codes *
  25.  **********************************/
  26. #undef  MessageTrans_FileInfo
  27. #define MessageTrans_FileInfo                   0x41500
  28. #undef  XMessageTrans_FileInfo
  29. #define XMessageTrans_FileInfo                  0x61500
  30. #undef  MessageTrans_OpenFile
  31. #define MessageTrans_OpenFile                   0x41501
  32. #undef  XMessageTrans_OpenFile
  33. #define XMessageTrans_OpenFile                  0x61501
  34. #undef  MessageTrans_Lookup
  35. #define MessageTrans_Lookup                     0x41502
  36. #undef  XMessageTrans_Lookup
  37. #define XMessageTrans_Lookup                    0x61502
  38. #undef  MessageTrans_MakeMenus
  39. #define MessageTrans_MakeMenus                  0x41503
  40. #undef  XMessageTrans_MakeMenus
  41. #define XMessageTrans_MakeMenus                 0x61503
  42. #undef  MessageTrans_CloseFile
  43. #define MessageTrans_CloseFile                  0x41504
  44. #undef  XMessageTrans_CloseFile
  45. #define XMessageTrans_CloseFile                 0x61504
  46. #undef  MessageTrans_EnumerateTokens
  47. #define MessageTrans_EnumerateTokens            0x41505
  48. #undef  XMessageTrans_EnumerateTokens
  49. #define XMessageTrans_EnumerateTokens           0x61505
  50. #undef  MessageTrans_ErrorLookup
  51. #define MessageTrans_ErrorLookup                0x41506
  52. #undef  XMessageTrans_ErrorLookup
  53. #define XMessageTrans_ErrorLookup               0x61506
  54. #undef  MessageTrans_GSLookup
  55. #define MessageTrans_GSLookup                   0x41507
  56. #undef  XMessageTrans_GSLookup
  57. #define XMessageTrans_GSLookup                  0x61507
  58. #undef  MessageTrans_CopyError
  59. #define MessageTrans_CopyError                  0x41508
  60. #undef  XMessageTrans_CopyError
  61. #define XMessageTrans_CopyError                 0x61508
  62. #undef  Service_MessageFileClosed
  63. #define Service_MessageFileClosed               0x5E
  64.  
  65. /************************************
  66.  * Structure and union declarations *
  67.  ************************************/
  68. typedef struct messagetrans_control_block       messagetrans_control_block;
  69.  
  70. /********************
  71.  * Type definitions *
  72.  ********************/
  73. struct messagetrans_control_block
  74.    {  int cb [4];
  75.    };
  76.  
  77. /************************
  78.  * Constant definitions *
  79.  ************************/
  80. #define messagetrans_DIRECT_ACCESS              0x1u
  81. #define error_MESSAGE_TRANS_SYNTAX              0xAC0u
  82. #define error_MESSAGE_TRANS_FILE_OPEN           0xAC1u
  83. #define error_MESSAGE_TRANS_TOKEN_NOT_FOUND     0xAC2u
  84. #define error_MESSAGE_TRANS_RECURSE             0xAC3u
  85.  
  86. /*************************
  87.  * Function declarations *
  88.  *************************/
  89.  
  90. #ifdef __cplusplus
  91.    extern "C" {
  92. #endif
  93.  
  94. /*************************************************************
  95.  * NOTE: The following functions provide direct access to    *
  96.  *       the SWI's noted in the function description.        *
  97.  *       Please read the relevant PRM section for more       *
  98.  *       information on their input/output parameters.       *
  99.  *************************************************************/
  100.  
  101. /* ------------------------------------------------------------------------
  102.  * Function:      messagetrans_file_info()
  103.  *
  104.  * Description:   Gives information about a message file
  105.  *
  106.  * Input:         file_name - value of R1 on entry
  107.  *
  108.  * Output:        flags - value of R0 on exit
  109.  *                size - value of R2 on exit
  110.  *
  111.  * Other notes:   Calls SWI 0x41500.
  112.  */
  113.  
  114. extern os_error *xmessagetrans_file_info (char *file_name,
  115.       bits *flags,
  116.       int *size);
  117. extern void messagetrans_file_info (char *file_name,
  118.       bits *flags,
  119.       int *size);
  120.  
  121. /* ------------------------------------------------------------------------
  122.  * Function:      messagetrans_open_file()
  123.  *
  124.  * Description:   Opens a message file
  125.  *
  126.  * Input:         cb - value of R0 on entry
  127.  *                file_name - value of R1 on entry
  128.  *                buffer - value of R2 on entry
  129.  *
  130.  * Other notes:   Calls SWI 0x41501.
  131.  */
  132.  
  133. extern os_error *xmessagetrans_open_file (messagetrans_control_block *cb,
  134.       char *file_name,
  135.       char *buffer);
  136. extern void messagetrans_open_file (messagetrans_control_block *cb,
  137.       char *file_name,
  138.       char *buffer);
  139.  
  140. /* ------------------------------------------------------------------------
  141.  * Function:      messagetrans_lookup()
  142.  *
  143.  * Description:   Translates a message token into a string
  144.  *
  145.  * Input:         cb - value of R0 on entry
  146.  *                token - value of R1 on entry
  147.  *                buffer - value of R2 on entry
  148.  *                size - value of R3 on entry
  149.  *                arg0 - value of R4 on entry
  150.  *                arg1 - value of R5 on entry
  151.  *                arg2 - value of R6 on entry
  152.  *                arg3 - value of R7 on entry
  153.  *
  154.  * Output:        result - value of R2 on exit (X version only)
  155.  *                used - value of R3 on exit
  156.  *
  157.  * Returns:       R2 (non-X version only)
  158.  *
  159.  * Other notes:   Calls SWI 0x41502.
  160.  */
  161.  
  162. extern os_error *xmessagetrans_lookup (messagetrans_control_block *cb,
  163.       char *token,
  164.       char *buffer,
  165.       int size,
  166.       char *arg0,
  167.       char *arg1,
  168.       char *arg2,
  169.       char *arg3,
  170.       char **result,
  171.       int *used);
  172. extern char *messagetrans_lookup (messagetrans_control_block *cb,
  173.       char *token,
  174.       char *buffer,
  175.       int size,
  176.       char *arg0,
  177.       char *arg1,
  178.       char *arg2,
  179.       char *arg3,
  180.       int *used);
  181.  
  182. /* ------------------------------------------------------------------------
  183.  * Function:      messagetrans_make_menus()
  184.  *
  185.  * Description:   Sets up a menu structure from a definition containing
  186.  *                references to tokens
  187.  *
  188.  * Input:         cb - value of R0 on entry
  189.  *                menus - value of R1 on entry
  190.  *                buffer - value of R2 on entry
  191.  *                size - value of R3 on entry
  192.  *
  193.  * Output:        used - value of R3 on exit
  194.  *
  195.  * Other notes:   Calls SWI 0x41503.
  196.  */
  197.  
  198. extern os_error *xmessagetrans_make_menus (messagetrans_control_block *cb,
  199.       byte *menus,
  200.       char *buffer,
  201.       int size,
  202.       int *used);
  203. extern void messagetrans_make_menus (messagetrans_control_block *cb,
  204.       byte *menus,
  205.       char *buffer,
  206.       int size,
  207.       int *used);
  208.  
  209. /* ------------------------------------------------------------------------
  210.  * Function:      messagetrans_close_file()
  211.  *
  212.  * Description:   Closes a message file
  213.  *
  214.  * Input:         cb - value of R0 on entry
  215.  *
  216.  * Other notes:   Calls SWI 0x41504.
  217.  */
  218.  
  219. extern os_error *xmessagetrans_close_file (messagetrans_control_block *cb);
  220. extern void messagetrans_close_file (messagetrans_control_block *cb);
  221.  
  222. /* ------------------------------------------------------------------------
  223.  * Function:      messagetrans_enumerate_tokens()
  224.  *
  225.  * Description:   Enumerates tokens that match a wildcarded token
  226.  *
  227.  * Input:         cb - value of R0 on entry
  228.  *                token - value of R1 on entry
  229.  *                buffer - value of R2 on entry
  230.  *                size - value of R3 on entry
  231.  *                context - value of R4 on entry
  232.  *
  233.  * Output:        more - value of R2 on exit (X version only)
  234.  *                used - value of R3 on exit
  235.  *                context_out - value of R4 on exit
  236.  *
  237.  * Returns:       R2 (non-X version only)
  238.  *
  239.  * Other notes:   Calls SWI 0x41505.
  240.  */
  241.  
  242. extern os_error *xmessagetrans_enumerate_tokens (messagetrans_control_block *cb,
  243.       char *token,
  244.       char *buffer,
  245.       int size,
  246.       int context,
  247.       bool *more,
  248.       int *used,
  249.       int *context_out);
  250. extern bool messagetrans_enumerate_tokens (messagetrans_control_block *cb,
  251.       char *token,
  252.       char *buffer,
  253.       int size,
  254.       int context,
  255.       int *used,
  256.       int *context_out);
  257.  
  258. /* ------------------------------------------------------------------------
  259.  * Function:      messagetrans_error_lookup()
  260.  *
  261.  * Description:   Translates a message token within an error block
  262.  *
  263.  * Input:         error - value of R0 on entry
  264.  *                cb - value of R1 on entry
  265.  *                buffer - value of R2 on entry
  266.  *                size - value of R3 on entry
  267.  *                arg0 - value of R4 on entry
  268.  *                arg1 - value of R5 on entry
  269.  *                arg2 - value of R6 on entry
  270.  *                arg3 - value of R7 on entry
  271.  *
  272.  * Other notes:   Calls SWI 0x41506.
  273.  */
  274.  
  275. extern os_error *xmessagetrans_error_lookup (os_error *error,
  276.       messagetrans_control_block *cb,
  277.       char *buffer,
  278.       int size,
  279.       char *arg0,
  280.       char *arg1,
  281.       char *arg2,
  282.       char *arg3);
  283. extern void messagetrans_error_lookup (os_error *error,
  284.       messagetrans_control_block *cb,
  285.       char *buffer,
  286.       int size,
  287.       char *arg0,
  288.       char *arg1,
  289.       char *arg2,
  290.       char *arg3);
  291.  
  292. /* ------------------------------------------------------------------------
  293.  * Function:      messagetrans_gs_lookup()
  294.  *
  295.  * Description:   Translates a message token into a string and calls
  296.  *                OS_GSTrans
  297.  *
  298.  * Input:         cb - value of R0 on entry
  299.  *                token - value of R1 on entry
  300.  *                buffer - value of R2 on entry
  301.  *                size - value of R3 on entry
  302.  *                arg0 - value of R4 on entry
  303.  *                arg1 - value of R5 on entry
  304.  *                arg2 - value of R6 on entry
  305.  *                arg3 - value of R7 on entry
  306.  *
  307.  * Output:        used - value of R3 on exit
  308.  *
  309.  * Other notes:   Calls SWI 0x41507.
  310.  */
  311.  
  312. extern os_error *xmessagetrans_gs_lookup (messagetrans_control_block *cb,
  313.       char *token,
  314.       char *buffer,
  315.       int size,
  316.       char *arg0,
  317.       char *arg1,
  318.       char *arg2,
  319.       char *arg3,
  320.       int *used);
  321. extern void messagetrans_gs_lookup (messagetrans_control_block *cb,
  322.       char *token,
  323.       char *buffer,
  324.       int size,
  325.       char *arg0,
  326.       char *arg1,
  327.       char *arg2,
  328.       char *arg3,
  329.       int *used);
  330.  
  331. /* ------------------------------------------------------------------------
  332.  * Function:      messagetrans_copy_error()
  333.  *
  334.  * Description:   Copies an error into one of the MessageTrans internal
  335.  *                buffers
  336.  *
  337.  * Input:         error - value of R0 on entry
  338.  *
  339.  * Output:        copy - value of R0 on exit (X version only)
  340.  *
  341.  * Returns:       R0 (non-X version only)
  342.  *
  343.  * Other notes:   Calls SWI 0x41508.
  344.  */
  345.  
  346. extern os_error *xmessagetrans_copy_error (os_error *error,
  347.       os_error **copy);
  348. extern os_error *messagetrans_copy_error (os_error *error);
  349.  
  350. /* ------------------------------------------------------------------------
  351.  * Function:      service_message_file_closed()
  352.  *
  353.  * Description:   Message files have been closed
  354.  *
  355.  * Input:         cb - value of R0 on entry
  356.  *
  357.  * Other notes:   Calls SWI 0x30 with R1 = 0x5E.
  358.  */
  359.  
  360. extern os_error *xservice_message_file_closed (messagetrans_control_block *cb);
  361. extern void service_message_file_closed (messagetrans_control_block *cb);
  362.  
  363. #ifdef __cplusplus
  364.    }
  365. #endif
  366.  
  367. #endif
  368.