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

  1. #ifndef territory_H
  2. #define territory_H
  3.  
  4. /* C header file for Territory
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:19:00 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  Territory_Number
  27. #define Territory_Number                        0x43040
  28. #undef  XTerritory_Number
  29. #define XTerritory_Number                       0x63040
  30. #undef  Territory_Register
  31. #define Territory_Register                      0x43041
  32. #undef  XTerritory_Register
  33. #define XTerritory_Register                     0x63041
  34. #undef  Territory_Deregister
  35. #define Territory_Deregister                    0x43042
  36. #undef  XTerritory_Deregister
  37. #define XTerritory_Deregister                   0x63042
  38. #undef  Territory_NumberToName
  39. #define Territory_NumberToName                  0x43043
  40. #undef  XTerritory_NumberToName
  41. #define XTerritory_NumberToName                 0x63043
  42. #undef  Territory_Exists
  43. #define Territory_Exists                        0x43044
  44. #undef  XTerritory_Exists
  45. #define XTerritory_Exists                       0x63044
  46. #undef  Territory_AlphabetNumberToName
  47. #define Territory_AlphabetNumberToName          0x43045
  48. #undef  XTerritory_AlphabetNumberToName
  49. #define XTerritory_AlphabetNumberToName         0x63045
  50. #undef  Territory_SelectAlphabet
  51. #define Territory_SelectAlphabet                0x43046
  52. #undef  XTerritory_SelectAlphabet
  53. #define XTerritory_SelectAlphabet               0x63046
  54. #undef  Territory_SetTime
  55. #define Territory_SetTime                       0x43047
  56. #undef  XTerritory_SetTime
  57. #define XTerritory_SetTime                      0x63047
  58. #undef  Territory_ReadCurrentTimeZone
  59. #define Territory_ReadCurrentTimeZone           0x43048
  60. #undef  XTerritory_ReadCurrentTimeZone
  61. #define XTerritory_ReadCurrentTimeZone          0x63048
  62. #undef  Territory_ConvertTimeToUTCOrdinals
  63. #define Territory_ConvertTimeToUTCOrdinals      0x43049
  64. #undef  XTerritory_ConvertTimeToUTCOrdinals
  65. #define XTerritory_ConvertTimeToUTCOrdinals     0x63049
  66. #undef  Territory_ConvertTextToString
  67. #define Territory_ConvertTextToString           0x43075
  68. #undef  XTerritory_ConvertTextToString
  69. #define XTerritory_ConvertTextToString          0x63075
  70. #undef  Territory_ReadTimeZones
  71. #define Territory_ReadTimeZones                 0x4304A
  72. #undef  XTerritory_ReadTimeZones
  73. #define XTerritory_ReadTimeZones                0x6304A
  74. #undef  Territory_ConvertDateAndTime
  75. #define Territory_ConvertDateAndTime            0x4304B
  76. #undef  XTerritory_ConvertDateAndTime
  77. #define XTerritory_ConvertDateAndTime           0x6304B
  78. #undef  Territory_ConvertStandardDateAndTime
  79. #define Territory_ConvertStandardDateAndTime    0x4304C
  80. #undef  XTerritory_ConvertStandardDateAndTime
  81. #define XTerritory_ConvertStandardDateAndTime   0x6304C
  82. #undef  Territory_ConvertStandardDate
  83. #define Territory_ConvertStandardDate           0x4304D
  84. #undef  XTerritory_ConvertStandardDate
  85. #define XTerritory_ConvertStandardDate          0x6304D
  86. #undef  Territory_ConvertStandardTime
  87. #define Territory_ConvertStandardTime           0x4304E
  88. #undef  XTerritory_ConvertStandardTime
  89. #define XTerritory_ConvertStandardTime          0x6304E
  90. #undef  Territory_ConvertTimeToOrdinals
  91. #define Territory_ConvertTimeToOrdinals         0x4304F
  92. #undef  XTerritory_ConvertTimeToOrdinals
  93. #define XTerritory_ConvertTimeToOrdinals        0x6304F
  94. #undef  Territory_ConvertTimeStringToOrdinals
  95. #define Territory_ConvertTimeStringToOrdinals   0x43050
  96. #undef  XTerritory_ConvertTimeStringToOrdinals
  97. #define XTerritory_ConvertTimeStringToOrdinals  0x63050
  98. #undef  Territory_ConvertOrdinalsToTime
  99. #define Territory_ConvertOrdinalsToTime         0x43051
  100. #undef  XTerritory_ConvertOrdinalsToTime
  101. #define XTerritory_ConvertOrdinalsToTime        0x63051
  102. #undef  Territory_Alphabet
  103. #define Territory_Alphabet                      0x43052
  104. #undef  XTerritory_Alphabet
  105. #define XTerritory_Alphabet                     0x63052
  106. #undef  Territory_AlphabetIdentifier
  107. #define Territory_AlphabetIdentifier            0x43053
  108. #undef  XTerritory_AlphabetIdentifier
  109. #define XTerritory_AlphabetIdentifier           0x63053
  110. #undef  Territory_SelectKeyboardHandler
  111. #define Territory_SelectKeyboardHandler         0x43054
  112. #undef  XTerritory_SelectKeyboardHandler
  113. #define XTerritory_SelectKeyboardHandler        0x63054
  114. #undef  Territory_WriteDirection
  115. #define Territory_WriteDirection                0x43055
  116. #undef  XTerritory_WriteDirection
  117. #define XTerritory_WriteDirection               0x63055
  118. #undef  Territory_CharacterPropertyTable
  119. #define Territory_CharacterPropertyTable        0x43056
  120. #undef  XTerritory_CharacterPropertyTable
  121. #define XTerritory_CharacterPropertyTable       0x63056
  122. #undef  Territory_LowerCaseTable
  123. #define Territory_LowerCaseTable                0x43057
  124. #undef  XTerritory_LowerCaseTable
  125. #define XTerritory_LowerCaseTable               0x63057
  126. #undef  Territory_UpperCaseTable
  127. #define Territory_UpperCaseTable                0x43058
  128. #undef  XTerritory_UpperCaseTable
  129. #define XTerritory_UpperCaseTable               0x63058
  130. #undef  Territory_ControlTable
  131. #define Territory_ControlTable                  0x43059
  132. #undef  XTerritory_ControlTable
  133. #define XTerritory_ControlTable                 0x63059
  134. #undef  Territory_PlainTable
  135. #define Territory_PlainTable                    0x4305A
  136. #undef  XTerritory_PlainTable
  137. #define XTerritory_PlainTable                   0x6305A
  138. #undef  Territory_ValueTable
  139. #define Territory_ValueTable                    0x4305B
  140. #undef  XTerritory_ValueTable
  141. #define XTerritory_ValueTable                   0x6305B
  142. #undef  Territory_RepresentationTable
  143. #define Territory_RepresentationTable           0x4305C
  144. #undef  XTerritory_RepresentationTable
  145. #define XTerritory_RepresentationTable          0x6305C
  146. #undef  Territory_Collate
  147. #define Territory_Collate                       0x4305D
  148. #undef  XTerritory_Collate
  149. #define XTerritory_Collate                      0x6305D
  150. #undef  Territory_ReadSymbols
  151. #define Territory_ReadSymbols                   0x4305E
  152. #undef  XTerritory_ReadSymbols
  153. #define XTerritory_ReadSymbols                  0x6305E
  154. #undef  Territory_ReadBooleanSymbols
  155. #define Territory_ReadBooleanSymbols            0x4305E
  156. #undef  XTerritory_ReadBooleanSymbols
  157. #define XTerritory_ReadBooleanSymbols           0x6305E
  158. #undef  Territory_ReadIntegerSymbols
  159. #define Territory_ReadIntegerSymbols            0x4305E
  160. #undef  XTerritory_ReadIntegerSymbols
  161. #define XTerritory_ReadIntegerSymbols           0x6305E
  162. #undef  Territory_ReadStringSymbols
  163. #define Territory_ReadStringSymbols             0x4305E
  164. #undef  XTerritory_ReadStringSymbols
  165. #define XTerritory_ReadStringSymbols            0x6305E
  166. #undef  Territory_ReadCalendarInformation
  167. #define Territory_ReadCalendarInformation       0x4305F
  168. #undef  XTerritory_ReadCalendarInformation
  169. #define XTerritory_ReadCalendarInformation      0x6305F
  170. #undef  Territory_NameToNumber
  171. #define Territory_NameToNumber                  0x43060
  172. #undef  XTerritory_NameToNumber
  173. #define XTerritory_NameToNumber                 0x63060
  174. #undef  Territory_TransformString
  175. #define Territory_TransformString               0x43061
  176. #undef  XTerritory_TransformString
  177. #define XTerritory_TransformString              0x63061
  178. #undef  Service_TerritoryManagerLoaded
  179. #define Service_TerritoryManagerLoaded          0x64
  180. #undef  Service_TerritoryStarted
  181. #define Service_TerritoryStarted                0x75
  182.  
  183. /************************************
  184.  * Structure and union declarations *
  185.  ************************************/
  186. typedef struct territory_data                   territory_data;
  187. typedef struct territory_ordinals               territory_ordinals;
  188. typedef struct territory_property_table         territory_property_table;
  189. typedef struct territory_calendar               territory_calendar;
  190.  
  191. /********************
  192.  * Type definitions *
  193.  ********************/
  194. typedef int territory_t;
  195.  
  196. struct territory_data
  197.    {  void *e [43];
  198.    };
  199.  
  200. struct territory_ordinals
  201.    {  int centisecond;
  202.       int second;
  203.       int minute;
  204.       int hour;
  205.       int date;
  206.       int month;
  207.       int year;
  208.       int weekday;
  209.       int yearday;
  210.    };
  211.  
  212. struct territory_property_table
  213.    {  bits p [8];
  214.    };
  215.  
  216. struct territory_calendar
  217.    {  int first_working_day;
  218.       int last_working_day;
  219.       int month_count;
  220.       int day_count;
  221.       int pm_limit;
  222.       int we_limit;
  223.       int w3_limit;
  224.       int dy_limit;
  225.       int st_limit;
  226.       int mo_limit;
  227.       int m3_limit;
  228.       int tz_limit;
  229.    };
  230.  
  231. /************************
  232.  * Constant definitions *
  233.  ************************/
  234. #define territory_CURRENT                       ((territory_t) -1)
  235. #define territory_IGNORE_CASE                   0x1u
  236. #define territory_IGNORE_ACCENT                 0x2u
  237. #define error_TERRITORY_BAD_SWI                 0x43062u
  238. #define error_TERRITORY_UNKNOWN                 0x190u
  239. #define error_TERRITORY_UNKNOWN_ALPHABET        0x191u
  240. #define error_NO_TERRITORY                      0x192u
  241. #define territory_GIVEN_TIME                    1
  242. #define territory_GIVEN_DATE                    2
  243. #define territory_GIVEN_DATE_AND_TIME           3
  244. #define territory_WRITE_RIGHT_TO_LEFT           0x1u
  245. #define territory_WRITE_BOTTOM_TO_TOP           0x2u
  246. #define territory_WRITE_VERTICAL                0x4u
  247. #define territory_PROPERTY_CONTROL              0
  248. #define territory_PROPERTY_UPPERCASE            1
  249. #define territory_PROPERTY_LOWERCASE            2
  250. #define territory_PROPERTY_ALPHABETIC           3
  251. #define territory_PROPERTY_PUNCTUATION          4
  252. #define territory_PROPERTY_WHITESPACE           5
  253. #define territory_PROPERTY_DIGIT                6
  254. #define territory_PROPERTY_HEX_DIGIT            7
  255. #define territory_PROPERTY_ACCENTED             8
  256. #define territory_PROPERTY_FORWARD              9
  257. #define territory_PROPERTY_REVERSE              10
  258. #define territory_SYMBOL_DECIMAL_POINT          0
  259. #define territory_SYMBOL_GROUP_SEPARATOR        1
  260. #define territory_SYMBOL_GROUPING_LIST          2
  261. #define territory_SYMBOL_INTERNATIONAL_CURRENCY_SYMBOL 3
  262. #define territory_SYMBOL_CURRENCY_SYMBOL        4
  263. #define territory_SYMBOL_CURRENCY_POINT         5
  264. #define territory_SYMBOL_CURRENCY_GROUP_SEPARATOR 6
  265. #define territory_SYMBOL_CURRENCY_GROUP_LIST    7
  266. #define territory_SYMBOL_CURRENCY_PLUS_SIGN     8
  267. #define territory_SYMBOL_CURRENCY_MINUS_SIGN    9
  268. #define territory_SYMBOL_INTERNATIONAL_CURRENCY_PRECISION 10
  269. #define territory_SYMBOL_CURRENCY_PRECISION     11
  270. #define territory_SYMBOL_CURRENCY_SYMBOL_PRECEDES_NON_NEGATIVE_VALUE 12
  271. #define territory_SYMBOL_CURRENCY_SYMBOL_SEPARATED_FROM_NON_NEGATIVE_VALUE 13
  272. #define territory_SYMBOL_CURRENCY_SYMBOL_PRECEDES_NEGATIVE_VALUE 14
  273. #define territory_SYMBOL_CURRENCY_SYMBOL_SEPARATED_FROM_NEGATIVE_VALUE 15
  274. #define territory_SYMBOL_CURRENCY_NON_NEGATIVE_FORMAT 16
  275. #define territory_SYMBOL_CURRENCY_NEGATIVE_FORMAT 17
  276. #define territory_SYMBOL_LIST_SEPARATOR         18
  277. #define territory_SYMBOL_PARENTHESISED          0
  278. #define territory_SYMBOL_SIGN_PRECEDES          1
  279. #define territory_SYMBOL_SIGN_SUCCEEDS          2
  280. #define territory_SYMBOL_SIGN_IMMEDIATELY_PRECEDES 3
  281. #define territory_SYMBOL_SIGN_IMMEDIATELY_SUCCEEDS 4
  282.  
  283. /*************************
  284.  * Function declarations *
  285.  *************************/
  286.  
  287. #ifdef __cplusplus
  288.    extern "C" {
  289. #endif
  290.  
  291. /*************************************************************
  292.  * NOTE: The following functions provide direct access to    *
  293.  *       the SWI's noted in the function description.        *
  294.  *       Please read the relevant PRM section for more       *
  295.  *       information on their input/output parameters.       *
  296.  *************************************************************/
  297.  
  298. /* ------------------------------------------------------------------------
  299.  * Function:      territory_number()
  300.  *
  301.  * Description:   Returns the territory number of the current territory
  302.  *
  303.  * Output:        territory - value of R0 on exit (X version only)
  304.  *
  305.  * Returns:       R0 (non-X version only)
  306.  *
  307.  * Other notes:   Calls SWI 0x43040.
  308.  */
  309.  
  310. extern os_error *xterritory_number (territory_t *territory);
  311. extern territory_t territory_number (void);
  312.  
  313. /* ------------------------------------------------------------------------
  314.  * Function:      territory_register()
  315.  *
  316.  * Description:   Adds the given territory to the list of active
  317.  *                territories
  318.  *
  319.  * Input:         territory - value of R0 on entry
  320.  *                entries - value of R1 on entry
  321.  *                workspace - value of R2 on entry
  322.  *
  323.  * Other notes:   Calls SWI 0x43041.
  324.  */
  325.  
  326. extern os_error *xterritory_register (territory_t territory,
  327.       territory_data *entries,
  328.       void *workspace);
  329. extern void territory_register (territory_t territory,
  330.       territory_data *entries,
  331.       void *workspace);
  332.  
  333. /* ------------------------------------------------------------------------
  334.  * Function:      territory_deregister()
  335.  *
  336.  * Description:   Removes the given territory from the list of active
  337.  *                territories
  338.  *
  339.  * Input:         territory - value of R0 on entry
  340.  *
  341.  * Other notes:   Calls SWI 0x43042.
  342.  */
  343.  
  344. extern os_error *xterritory_deregister (territory_t territory);
  345. extern void territory_deregister (territory_t territory);
  346.  
  347. /* ------------------------------------------------------------------------
  348.  * Function:      territory_number_to_name()
  349.  *
  350.  * Description:   Returns the name of a given territory
  351.  *
  352.  * Input:         territory - value of R0 on entry
  353.  *                name - value of R1 on entry
  354.  *                size - value of R2 on entry
  355.  *
  356.  * Other notes:   Calls SWI 0x43043.
  357.  */
  358.  
  359. extern os_error *xterritory_number_to_name (territory_t territory,
  360.       char *name,
  361.       int size);
  362. extern void territory_number_to_name (territory_t territory,
  363.       char *name,
  364.       int size);
  365.  
  366. /* ------------------------------------------------------------------------
  367.  * Function:      territory_exists()
  368.  *
  369.  * Description:   Checks if the given territory is currently present in the
  370.  *                machine
  371.  *
  372.  * Input:         territory - value of R0 on entry
  373.  *
  374.  * Output:        psr - processor status register on exit (X version only)
  375.  *
  376.  * Returns:       psr (non-X version only)
  377.  *
  378.  * Other notes:   Calls SWI 0x43044.
  379.  */
  380.  
  381. extern os_error *xterritory_exists (territory_t territory,
  382.       bits *psr);
  383. extern bits territory_exists (territory_t territory);
  384.  
  385. /* ------------------------------------------------------------------------
  386.  * Function:      territory_alphabet_number_to_name()
  387.  *
  388.  * Description:   Returns the name of the given alphabet
  389.  *
  390.  * Input:         alphabet - value of R0 on entry
  391.  *                name - value of R1 on entry
  392.  *                size - value of R2 on entry
  393.  *
  394.  * Other notes:   Calls SWI 0x43045.
  395.  */
  396.  
  397. extern os_error *xterritory_alphabet_number_to_name (int alphabet,
  398.       char *name,
  399.       int size);
  400. extern void territory_alphabet_number_to_name (int alphabet,
  401.       char *name,
  402.       int size);
  403.  
  404. /* ------------------------------------------------------------------------
  405.  * Function:      territory_select_alphabet()
  406.  *
  407.  * Description:   Selects the correct alphabet for the given territory
  408.  *
  409.  * Input:         territory - value of R0 on entry
  410.  *
  411.  * Other notes:   Calls SWI 0x43046.
  412.  */
  413.  
  414. extern os_error *xterritory_select_alphabet (territory_t territory);
  415. extern void territory_select_alphabet (territory_t territory);
  416.  
  417. /* ------------------------------------------------------------------------
  418.  * Function:      territory_set_time()
  419.  *
  420.  * Description:   Sets the clock to a given 5-byte UTC time
  421.  *
  422.  * Input:         date_and_time - value of R0 on entry
  423.  *
  424.  * Other notes:   Calls SWI 0x43047.
  425.  */
  426.  
  427. extern os_error *xterritory_set_time (os_date_and_time *date_and_time);
  428. extern void territory_set_time (os_date_and_time *date_and_time);
  429.  
  430. /* ------------------------------------------------------------------------
  431.  * Function:      territory_read_current_time_zone()
  432.  *
  433.  * Description:   Returns information on the current time zone
  434.  *
  435.  * Output:        timezone - value of R0 on exit
  436.  *                offset - value of R1 on exit
  437.  *
  438.  * Other notes:   Calls SWI 0x43048.
  439.  */
  440.  
  441. extern os_error *xterritory_read_current_time_zone (char **timezone,
  442.       int *offset);
  443. extern void territory_read_current_time_zone (char **timezone,
  444.       int *offset);
  445.  
  446. /* ------------------------------------------------------------------------
  447.  * Function:      territory_convert_time_to_utc_ordinals()
  448.  *
  449.  * Description:   Converts a 5-byte UTC time to UTC time ordinals
  450.  *
  451.  * Input:         date_and_time - value of R1 on entry
  452.  *                ordinals - value of R2 on entry
  453.  *
  454.  * Other notes:   Calls SWI 0x43049.
  455.  */
  456.  
  457. extern os_error *xterritory_convert_time_to_utc_ordinals (os_date_and_time *date_and_time,
  458.       territory_ordinals *ordinals);
  459. extern void territory_convert_time_to_utc_ordinals (os_date_and_time *date_and_time,
  460.       territory_ordinals *ordinals);
  461.  
  462. /* ------------------------------------------------------------------------
  463.  * Function:      territory_read_time_zones()
  464.  *
  465.  * Description:   Returns information on the time zones for the given
  466.  *                territory
  467.  *
  468.  * Input:         territory - value of R0 on entry
  469.  *
  470.  * Output:        timezone - value of R0 on exit
  471.  *                dst_timezone - value of R1 on exit
  472.  *                offset - value of R2 on exit
  473.  *                dst_offset - value of R3 on exit
  474.  *
  475.  * Other notes:   Calls SWI 0x4304A.
  476.  */
  477.  
  478. extern os_error *xterritory_read_time_zones (territory_t territory,
  479.       char **timezone,
  480.       char **dst_timezone,
  481.       int *offset,
  482.       int *dst_offset);
  483. extern void territory_read_time_zones (territory_t territory,
  484.       char **timezone,
  485.       char **dst_timezone,
  486.       int *offset,
  487.       int *dst_offset);
  488.  
  489. /* ------------------------------------------------------------------------
  490.  * Function:      territory_convert_date_and_time()
  491.  *
  492.  * Description:   Converts a 5-byte UTC time into a string giving the date
  493.  *                and time using a supplied format string
  494.  *
  495.  * Input:         territory - value of R0 on entry
  496.  *                date_and_time - value of R1 on entry
  497.  *                buffer - value of R2 on entry
  498.  *                size - value of R3 on entry
  499.  *                format - value of R4 on entry
  500.  *
  501.  * Output:        end - value of R1 on exit
  502.  *
  503.  * Other notes:   Calls SWI 0x4304B.
  504.  */
  505.  
  506. extern os_error *xterritory_convert_date_and_time (territory_t territory,
  507.       os_date_and_time *date_and_time,
  508.       char *buffer,
  509.       int size,
  510.       char *format,
  511.       char **end);
  512. extern void territory_convert_date_and_time (territory_t territory,
  513.       os_date_and_time *date_and_time,
  514.       char *buffer,
  515.       int size,
  516.       char *format,
  517.       char **end);
  518.  
  519. /* ------------------------------------------------------------------------
  520.  * Function:      territory_convert_standard_date_and_time()
  521.  *
  522.  * Description:   Converts a 5-byte UTC time into a string giving the date
  523.  *                and time
  524.  *
  525.  * Input:         territory - value of R0 on entry
  526.  *                date_and_time - value of R1 on entry
  527.  *                buffer - value of R2 on entry
  528.  *                size - value of R3 on entry
  529.  *
  530.  * Output:        end - value of R1 on exit
  531.  *
  532.  * Other notes:   Calls SWI 0x4304C.
  533.  */
  534.  
  535. extern os_error *xterritory_convert_standard_date_and_time (territory_t territory,
  536.       os_date_and_time *date_and_time,
  537.       char *buffer,
  538.       int size,
  539.       char **end);
  540. extern void territory_convert_standard_date_and_time (territory_t territory,
  541.       os_date_and_time *date_and_time,
  542.       char *buffer,
  543.       int size,
  544.       char **end);
  545.  
  546. /* ------------------------------------------------------------------------
  547.  * Function:      territory_convert_standard_date()
  548.  *
  549.  * Description:   Converts a 5-byte UTC time into a string giving the date
  550.  *                only
  551.  *
  552.  * Input:         territory - value of R0 on entry
  553.  *                date - value of R1 on entry
  554.  *                buffer - value of R2 on entry
  555.  *                size - value of R3 on entry
  556.  *
  557.  * Output:        end - value of R1 on exit
  558.  *
  559.  * Other notes:   Calls SWI 0x4304D.
  560.  */
  561.  
  562. extern os_error *xterritory_convert_standard_date (territory_t territory,
  563.       os_date_and_time *date,
  564.       char *buffer,
  565.       int size,
  566.       char **end);
  567. extern void territory_convert_standard_date (territory_t territory,
  568.       os_date_and_time *date,
  569.       char *buffer,
  570.       int size,
  571.       char **end);
  572.  
  573. /* ------------------------------------------------------------------------
  574.  * Function:      territory_convert_standard_time()
  575.  *
  576.  * Description:   Converts a 5-byte UTC time into a string giving the time
  577.  *                only
  578.  *
  579.  * Input:         territory - value of R0 on entry
  580.  *                time - value of R1 on entry
  581.  *                buffer - value of R2 on entry
  582.  *                size - value of R3 on entry
  583.  *
  584.  * Output:        end - value of R1 on exit
  585.  *
  586.  * Other notes:   Calls SWI 0x4304E.
  587.  */
  588.  
  589. extern os_error *xterritory_convert_standard_time (territory_t territory,
  590.       os_date_and_time *time,
  591.       char *buffer,
  592.       int size,
  593.       char **end);
  594. extern void territory_convert_standard_time (territory_t territory,
  595.       os_date_and_time *time,
  596.       char *buffer,
  597.       int size,
  598.       char **end);
  599.  
  600. /* ------------------------------------------------------------------------
  601.  * Function:      territory_convert_time_to_ordinals()
  602.  *
  603.  * Description:   Converts a 5-byte UTC time to local time ordinals for the
  604.  *                given territory
  605.  *
  606.  * Input:         territory - value of R0 on entry
  607.  *                date_and_time - value of R1 on entry
  608.  *                ordinals - value of R2 on entry
  609.  *
  610.  * Other notes:   Calls SWI 0x4304F.
  611.  */
  612.  
  613. extern os_error *xterritory_convert_time_to_ordinals (territory_t territory,
  614.       os_date_and_time *date_and_time,
  615.       territory_ordinals *ordinals);
  616. extern void territory_convert_time_to_ordinals (territory_t territory,
  617.       os_date_and_time *date_and_time,
  618.       territory_ordinals *ordinals);
  619.  
  620. /* ------------------------------------------------------------------------
  621.  * Function:      territory_convert_time_string_to_ordinals()
  622.  *
  623.  * Description:   Converts a time string to time ordinals
  624.  *
  625.  * Input:         territory - value of R0 on entry
  626.  *                format - value of R1 on entry
  627.  *                t - value of R2 on entry
  628.  *                ordinals - value of R3 on entry
  629.  *
  630.  * Other notes:   Calls SWI 0x43050.
  631.  */
  632.  
  633. extern os_error *xterritory_convert_time_string_to_ordinals (territory_t territory,
  634.       int format,
  635.       char *t,
  636.       territory_ordinals *ordinals);
  637. extern void territory_convert_time_string_to_ordinals (territory_t territory,
  638.       int format,
  639.       char *t,
  640.       territory_ordinals *ordinals);
  641.  
  642. /* ------------------------------------------------------------------------
  643.  * Function:      territory_convert_ordinals_to_time()
  644.  *
  645.  * Description:   Converts local time ordinals for the given territory to a
  646.  *                5-byte UTC time
  647.  *
  648.  * Input:         territory - value of R0 on entry
  649.  *                buffer - value of R1 on entry
  650.  *                ordinals - value of R2 on entry
  651.  *
  652.  * Other notes:   Calls SWI 0x43051.
  653.  */
  654.  
  655. extern os_error *xterritory_convert_ordinals_to_time (territory_t territory,
  656.       os_date_and_time *buffer,
  657.       territory_ordinals *ordinals);
  658. extern void territory_convert_ordinals_to_time (territory_t territory,
  659.       os_date_and_time *buffer,
  660.       territory_ordinals *ordinals);
  661.  
  662. /* ------------------------------------------------------------------------
  663.  * Function:      territory_alphabet()
  664.  *
  665.  * Description:   Returns the alphabet number that should be selected for
  666.  *                the given territory
  667.  *
  668.  * Input:         territory - value of R0 on entry
  669.  *
  670.  * Output:        alphabet - value of R0 on exit (X version only)
  671.  *
  672.  * Returns:       R0 (non-X version only)
  673.  *
  674.  * Other notes:   Calls SWI 0x43052.
  675.  */
  676.  
  677. extern os_error *xterritory_alphabet (territory_t territory,
  678.       int *alphabet);
  679. extern int territory_alphabet (territory_t territory);
  680.  
  681. /* ------------------------------------------------------------------------
  682.  * Function:      territory_alphabet_identifier()
  683.  *
  684.  * Description:   Returns an identifier string for the alphabet that should
  685.  *                be used for the given territory
  686.  *
  687.  * Input:         territory - value of R0 on entry
  688.  *
  689.  * Output:        alphabet_name - value of R0 on exit (X version only)
  690.  *
  691.  * Returns:       R0 (non-X version only)
  692.  *
  693.  * Other notes:   Calls SWI 0x43053.
  694.  */
  695.  
  696. extern os_error *xterritory_alphabet_identifier (territory_t territory,
  697.       char **alphabet_name);
  698. extern char *territory_alphabet_identifier (territory_t territory);
  699.  
  700. /* ------------------------------------------------------------------------
  701.  * Function:      territory_select_keyboard_handler()
  702.  *
  703.  * Description:   Selects the keyboard handler for the given territory
  704.  *
  705.  * Input:         territory - value of R0 on entry
  706.  *
  707.  * Other notes:   Calls SWI 0x43054.
  708.  */
  709.  
  710. extern os_error *xterritory_select_keyboard_handler (territory_t territory);
  711. extern void territory_select_keyboard_handler (territory_t territory);
  712.  
  713. /* ------------------------------------------------------------------------
  714.  * Function:      territory_write_direction()
  715.  *
  716.  * Description:   Returns the direction of writing in the given territory
  717.  *
  718.  * Input:         territory - value of R0 on entry
  719.  *
  720.  * Output:        flags - value of R0 on exit (X version only)
  721.  *
  722.  * Returns:       R0 (non-X version only)
  723.  *
  724.  * Other notes:   Calls SWI 0x43055.
  725.  */
  726.  
  727. extern os_error *xterritory_write_direction (territory_t territory,
  728.       bits *flags);
  729. extern bits territory_write_direction (territory_t territory);
  730.  
  731. /* ------------------------------------------------------------------------
  732.  * Function:      territory_character_property_table()
  733.  *
  734.  * Description:   Returns a pointer to a character property table
  735.  *
  736.  * Input:         territory - value of R0 on entry
  737.  *                property - value of R1 on entry
  738.  *
  739.  * Output:        table - value of R0 on exit (X version only)
  740.  *
  741.  * Returns:       R0 (non-X version only)
  742.  *
  743.  * Other notes:   Calls SWI 0x43056.
  744.  */
  745.  
  746. extern os_error *xterritory_character_property_table (territory_t territory,
  747.       int property,
  748.       territory_property_table **table);
  749. extern territory_property_table *territory_character_property_table (territory_t territory,
  750.       int property);
  751.  
  752. /* ------------------------------------------------------------------------
  753.  * Function:      territory_lower_case_table()
  754.  *
  755.  * Description:   Returns a pointer to a lower case table
  756.  *
  757.  * Input:         territory - value of R0 on entry
  758.  *
  759.  * Output:        table - value of R0 on exit (X version only)
  760.  *
  761.  * Returns:       R0 (non-X version only)
  762.  *
  763.  * Other notes:   Calls SWI 0x43057.
  764.  */
  765.  
  766. extern os_error *xterritory_lower_case_table (territory_t territory,
  767.       char **table);
  768. extern char *territory_lower_case_table (territory_t territory);
  769.  
  770. /* ------------------------------------------------------------------------
  771.  * Function:      territory_upper_case_table()
  772.  *
  773.  * Description:   Returns a pointer to an upper case table
  774.  *
  775.  * Input:         territory - value of R0 on entry
  776.  *
  777.  * Output:        table - value of R0 on exit (X version only)
  778.  *
  779.  * Returns:       R0 (non-X version only)
  780.  *
  781.  * Other notes:   Calls SWI 0x43058.
  782.  */
  783.  
  784. extern os_error *xterritory_upper_case_table (territory_t territory,
  785.       char **table);
  786. extern char *territory_upper_case_table (territory_t territory);
  787.  
  788. /* ------------------------------------------------------------------------
  789.  * Function:      territory_control_table()
  790.  *
  791.  * Description:   Returns a pointer to a control character table
  792.  *
  793.  * Input:         territory - value of R0 on entry
  794.  *
  795.  * Output:        table - value of R0 on exit (X version only)
  796.  *
  797.  * Returns:       R0 (non-X version only)
  798.  *
  799.  * Other notes:   Calls SWI 0x43059.
  800.  */
  801.  
  802. extern os_error *xterritory_control_table (territory_t territory,
  803.       char **table);
  804. extern char *territory_control_table (territory_t territory);
  805.  
  806. /* ------------------------------------------------------------------------
  807.  * Function:      territory_plain_table()
  808.  *
  809.  * Description:   Returns a pointer to a an unaccented character table
  810.  *
  811.  * Input:         territory - value of R0 on entry
  812.  *
  813.  * Output:        table - value of R0 on exit (X version only)
  814.  *
  815.  * Returns:       R0 (non-X version only)
  816.  *
  817.  * Other notes:   Calls SWI 0x4305A.
  818.  */
  819.  
  820. extern os_error *xterritory_plain_table (territory_t territory,
  821.       char **table);
  822. extern char *territory_plain_table (territory_t territory);
  823.  
  824. /* ------------------------------------------------------------------------
  825.  * Function:      territory_value_table()
  826.  *
  827.  * Description:   Returns a pointer to a numeric value table
  828.  *
  829.  * Input:         territory - value of R0 on entry
  830.  *
  831.  * Output:        table - value of R0 on exit (X version only)
  832.  *
  833.  * Returns:       R0 (non-X version only)
  834.  *
  835.  * Other notes:   Calls SWI 0x4305B.
  836.  */
  837.  
  838. extern os_error *xterritory_value_table (territory_t territory,
  839.       char **table);
  840. extern char *territory_value_table (territory_t territory);
  841.  
  842. /* ------------------------------------------------------------------------
  843.  * Function:      territory_representation_table()
  844.  *
  845.  * Description:   Returns a pointer to a numeric representation table
  846.  *
  847.  * Input:         territory - value of R0 on entry
  848.  *
  849.  * Output:        table - value of R0 on exit (X version only)
  850.  *
  851.  * Returns:       R0 (non-X version only)
  852.  *
  853.  * Other notes:   Calls SWI 0x4305C.
  854.  */
  855.  
  856. extern os_error *xterritory_representation_table (territory_t territory,
  857.       char **table);
  858. extern char *territory_representation_table (territory_t territory);
  859.  
  860. /* ------------------------------------------------------------------------
  861.  * Function:      territory_collate()
  862.  *
  863.  * Description:   Compares two strings in the given territories alphabet
  864.  *
  865.  * Input:         territory - value of R0 on entry
  866.  *                s1 - value of R1 on entry
  867.  *                s2 - value of R2 on entry
  868.  *                flags - value of R3 on entry
  869.  *
  870.  * Output:        collate - value of R0 on exit (X version only)
  871.  *
  872.  * Returns:       R0 (non-X version only)
  873.  *
  874.  * Other notes:   Calls SWI 0x4305D.
  875.  */
  876.  
  877. extern os_error *xterritory_collate (territory_t territory,
  878.       char *s1,
  879.       char *s2,
  880.       bits flags,
  881.       int *collate);
  882. extern int territory_collate (territory_t territory,
  883.       char *s1,
  884.       char *s2,
  885.       bits flags);
  886.  
  887. /* ------------------------------------------------------------------------
  888.  * Function:      territory_read_boolean_symbols()
  889.  *
  890.  * Description:   Returns various boolean information telling you how to
  891.  *                format numbers
  892.  *
  893.  * Input:         territory - value of R0 on entry
  894.  *                symbol_no - value of R1 on entry
  895.  *
  896.  * Output:        symbol - value of R0 on exit (X version only)
  897.  *
  898.  * Returns:       R0 (non-X version only)
  899.  *
  900.  * Other notes:   Calls SWI 0x4305E.
  901.  */
  902.  
  903. extern os_error *xterritory_read_boolean_symbols (territory_t territory,
  904.       int symbol_no,
  905.       bool *symbol);
  906. extern bool territory_read_boolean_symbols (territory_t territory,
  907.       int symbol_no);
  908.  
  909. /* ------------------------------------------------------------------------
  910.  * Function:      territory_read_integer_symbols()
  911.  *
  912.  * Description:   Returns various integer information telling you how to
  913.  *                format numbers
  914.  *
  915.  * Input:         territory - value of R0 on entry
  916.  *                symbol_no - value of R1 on entry
  917.  *
  918.  * Output:        symbol - value of R0 on exit (X version only)
  919.  *
  920.  * Returns:       R0 (non-X version only)
  921.  *
  922.  * Other notes:   Calls SWI 0x4305E.
  923.  */
  924.  
  925. extern os_error *xterritory_read_integer_symbols (territory_t territory,
  926.       int symbol_no,
  927.       int *symbol);
  928. extern int territory_read_integer_symbols (territory_t territory,
  929.       int symbol_no);
  930.  
  931. /* ------------------------------------------------------------------------
  932.  * Function:      territory_read_string_symbols()
  933.  *
  934.  * Description:   Returns various string information telling you how to
  935.  *                format numbers
  936.  *
  937.  * Input:         territory - value of R0 on entry
  938.  *                symbol_no - value of R1 on entry
  939.  *
  940.  * Output:        symbol - value of R0 on exit (X version only)
  941.  *
  942.  * Returns:       R0 (non-X version only)
  943.  *
  944.  * Other notes:   Calls SWI 0x4305E.
  945.  */
  946.  
  947. extern os_error *xterritory_read_string_symbols (territory_t territory,
  948.       int symbol_no,
  949.       char **symbol);
  950. extern char *territory_read_string_symbols (territory_t territory,
  951.       int symbol_no);
  952.  
  953. /* ------------------------------------------------------------------------
  954.  * Function:      territory_read_calendar_information()
  955.  *
  956.  * Description:   Returns various information about the given territory's
  957.  *                calendar
  958.  *
  959.  * Input:         territory - value of R0 on entry
  960.  *                date_and_time - value of R1 on entry
  961.  *                calendar - value of R2 on entry
  962.  *
  963.  * Other notes:   Calls SWI 0x4305F.
  964.  */
  965.  
  966. extern os_error *xterritory_read_calendar_information (territory_t territory,
  967.       os_date_and_time *date_and_time,
  968.       territory_calendar *calendar);
  969. extern void territory_read_calendar_information (territory_t territory,
  970.       os_date_and_time *date_and_time,
  971.       territory_calendar *calendar);
  972.  
  973. /* ------------------------------------------------------------------------
  974.  * Function:      territory_name_to_number()
  975.  *
  976.  * Description:   Returns the number of the given territory
  977.  *
  978.  * Input:         territory - value of R0 on entry
  979.  *                name - value of R1 on entry
  980.  *
  981.  * Output:        territory_out - value of R0 on exit (X version only)
  982.  *
  983.  * Returns:       R0 (non-X version only)
  984.  *
  985.  * Other notes:   Calls SWI 0x43060.
  986.  */
  987.  
  988. extern os_error *xterritory_name_to_number (territory_t territory,
  989.       char *name,
  990.       territory_t *territory_out);
  991. extern territory_t territory_name_to_number (territory_t territory,
  992.       char *name);
  993.  
  994. /* ------------------------------------------------------------------------
  995.  * Function:      territory_transform_string()
  996.  *
  997.  * Description:   Transforms a string to allow direct territory-independent
  998.  *                string comparison
  999.  *
  1000.  * Input:         territory - value of R0 on entry
  1001.  *                buffer - value of R1 on entry
  1002.  *                s - value of R2 on entry
  1003.  *                size - value of R3 on entry
  1004.  *
  1005.  * Output:        used - value of R0 on exit
  1006.  *
  1007.  * Other notes:   Calls SWI 0x43061.
  1008.  */
  1009.  
  1010. extern os_error *xterritory_transform_string (territory_t territory,
  1011.       char *buffer,
  1012.       char *s,
  1013.       int size,
  1014.       int *used);
  1015. extern void territory_transform_string (territory_t territory,
  1016.       char *buffer,
  1017.       char *s,
  1018.       int size,
  1019.       int *used);
  1020.  
  1021. /* ------------------------------------------------------------------------
  1022.  * Function:      service_territory_manager_loaded()
  1023.  *
  1024.  * Description:   Tells territory modules to register themselves
  1025.  *
  1026.  * Other notes:   Calls SWI 0x30 with R1 = 0x64.
  1027.  */
  1028.  
  1029. extern os_error *xservice_territory_manager_loaded (void);
  1030. extern void service_territory_manager_loaded (void);
  1031.  
  1032. /* ------------------------------------------------------------------------
  1033.  * Function:      service_territory_started()
  1034.  *
  1035.  * Description:   New territory starting
  1036.  *
  1037.  * Other notes:   Calls SWI 0x30 with R1 = 0x75.
  1038.  */
  1039.  
  1040. extern os_error *xservice_territory_started (void);
  1041. extern void service_territory_started (void);
  1042.  
  1043. #ifdef __cplusplus
  1044.    }
  1045. #endif
  1046.  
  1047. #endif
  1048.