home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / TFF-AOC.DMS / in.adf / Release3.1 / AutoDocs3.1.lha / doc / locale.doc < prev    next >
Encoding:
Text File  |  1993-08-12  |  32.9 KB  |  967 lines

  1. TABLE OF CONTENTS
  2.  
  3. locale.library/--environment_vars--
  4. locale.library/--rexxhost--
  5. locale.library/--structures--
  6. locale.library/CloseCatalog
  7. locale.library/CloseLocale
  8. locale.library/ConvToLower
  9. locale.library/ConvToUpper
  10. locale.library/FormatDate
  11. locale.library/FormatString
  12. locale.library/GetCatalogStr
  13. locale.library/GetLocaleStr
  14. locale.library/IsXXXX
  15. locale.library/OpenCatalog
  16. locale.library/OpenLocale
  17. locale.library/ParseDate
  18. locale.library/StrConvert
  19. locale.library/StrnCmp
  20. locale.library/--environment_vars--       locale.library/--environment_vars--
  21.  
  22.     Starting with V40, locale.library maintains a global environment
  23.     variable called "Language" which contains the name of the current
  24.     default language as used in the system. This is the name of the
  25.     language associated with the Locale structure returned by
  26.     OpenLocale(NULL).
  27.  
  28.    EXAMPLE
  29.     From a shell:
  30.  
  31.         Echo "The system language currently is: $Language"
  32.  
  33.     will print the name of the current system language ("english",
  34.     "français", etc)
  35.  
  36. locale.library/--rexxhost--                       locale.library/--rexxhost--
  37.  
  38.    HOST INTERFACE
  39.     locale.library provides an ARexx function host interface that enables
  40.     ARexx programs to take advantage of system localization. The
  41.     functions provided by the interface are directly related to the
  42.     functions described herein, with the differences mostly being
  43.     in the way they are called.
  44.  
  45.     The function host library vector is located at offset -30 from the
  46.     library. This is the value you provide to ARexx in the AddLib()
  47.     function call.
  48.  
  49.    FUNCTIONS
  50.     CloseCatalog (CATALOG/N/A)
  51.     ConvToLower (CHARACTER/A)
  52.     ConvToUpper (CHARACTER/A)
  53.     GetCatalogStr (CATALOG/A,STRING/N/A,DEFAULT/A)
  54.     IsAlNum (CHARACTER/A)
  55.     IsAlpha (CHARACTER/A)
  56.     IsCntrl (CHARACTER/A)
  57.     IsDigit (CHARACTER/A)
  58.     IsGraph (CHARACTER/A)
  59.     IsLower (CHARACTER/A)
  60.     IsPrint (CHARACTER/A)
  61.     IsPunct (CHARACTER/A)
  62.     IsSpace (CHARACTER/A)
  63.     IsUpper (CHARACTER/A)
  64.     IsXDigit (CHARACTER/A)
  65.     OpenCatalog (NAME/A,BUILTINLANGUAGE/A,VERSION/N/A)
  66.     Strncmp (STRING1/A,STRING2/A,TYPE/N/A)
  67.  
  68.    EXAMPLE
  69.     /* localetest.rexx */
  70.  
  71.     /* Make sure locale is loaded as a function host */
  72.     IF ~SHOW(L,'locale.library') THEN DO
  73.       CALL ADDLIB('locale.library',0,-30)
  74.     END;
  75.  
  76.     say ConvToLower("A");
  77.     say ConvToUpper("b");
  78.     say IsAlpha("1");
  79.  
  80.     catalog = OpenCatalog("sys/workbench.catalog","english",0);
  81.     say GetCatalogStr(catalog,34,"default");
  82.     say CloseCatalog(catalog);
  83.     say StrnCmp("test","test",2);
  84.  
  85. locale.library/--structures--                   locale.library/--structures--
  86.  
  87.     The Locale structure is the main public structure provided by
  88.     locale.library. The structure is defined in <libraries/locale.h>
  89.     and consists of the following fields:
  90.  
  91.     STRPTR loc_LocaleName
  92.         Locale's name.
  93.  
  94.     STRPTR loc_LanguageName
  95.         The language of the driver bound to this locale.
  96.  
  97.     STRPTR loc_PrefLanguages[10]
  98.         The ordered list of preferred languages for this locale.
  99.  
  100.     ULONG loc_Flags
  101.         Locale flags. Currently always 0.
  102.  
  103.     ULONG loc_CodeSet
  104.         Specifies the code set required by this locale. Currently, this
  105.         value is always 0.
  106.  
  107.     ULONG loc_CountryCode
  108.         The international country code.
  109.  
  110.     ULONG loc_TelephoneCode
  111.         The international telephone code for the country.
  112.  
  113.     LONG loc_GMTOffset
  114.         The offset in minutes of the current location from GMT.
  115.         Positive indicates a Westerly direction from GMT,
  116.         negative Easterly.
  117.  
  118.     UBYTE loc_MeasuringSystem
  119.         The measuring system being used.
  120.  
  121.     STRPTR loc_DateTimeFormat
  122.         The date and time format string, ready to pass to FormatDate()
  123.  
  124.     STRPTR loc_DateFormat
  125.         The date format string.
  126.  
  127.     STRPTR loc_TimeFormat
  128.         The time format string.
  129.  
  130.     STRPTR loc_ShortDateTimeFormat
  131.         The short date and time format string, ready to pass to
  132.         FormatDate()
  133.  
  134.     STRPTR loc_ShortDateFormat
  135.         The short date format string.
  136.  
  137.     STRPTR loc_ShortTimeFormat
  138.         The short time format string.
  139.  
  140.     STRPTR loc_DecimalPoint
  141.         The decimal point character used to format non-monetary quantities.
  142.  
  143.     STRPTR loc_GroupSeparator
  144.         The characters used to separate groups of digits before the
  145.         decimal-point character in formatted non-monetary quantities.
  146.  
  147.     STRPTR loc_FracGroupSeparator
  148.         The characters used to separate groups of digits after the
  149.         decimal-point character in formatted non-monetary quantities.
  150.  
  151.     STRPTR loc_Grouping
  152.         A string whose elements indicate the size of each group of digits
  153.         before the decimal-point character in formatted non-monetary
  154.         quantities.
  155.  
  156.     STRPTR loc_FracGrouping
  157.         A string whose elements indicate the size of each group of digits
  158.         after the decimal-point character in formatted non-monetary
  159.         quantities.
  160.  
  161.     STRPTR loc_MonDecimalPoint
  162.         The decimal-point used to format monetary quantities.
  163.  
  164.     STRPTR loc_MonGroupSeparator
  165.         The separator for groups of digits before the decimal-point in
  166.         monetary quantities.
  167.  
  168.     STRPTR loc_MonFracGroupSeparator
  169.         The separator for groups of digits after the decimal-point in
  170.         monetary quantities.
  171.  
  172.     STRPTR loc_MonGrouping
  173.         A string whose elements indicate the size of each group of digits
  174.         before the decimal-point character in monetary quantities.
  175.  
  176.     STRPTR loc_MonFracGrouping
  177.         A string whose elements indicate the size of each group of digits
  178.         after the decimal-point character in monetary quantities.
  179.  
  180.     UBYTE loc_MonFracDigits
  181.         The number of fractional digits (those after the decimal-point)
  182.         to be displayed in a formatted monetary quantity.
  183.  
  184.     UBYTE loc_MonIntFracDigits
  185.         The number of fractional digits (those after the decimal-point)
  186.         to be displayed in an internationally formatted monetary quantity.
  187.  
  188.     STRPTR loc_MonCS
  189.         The local currency symbol applicable to the current locale.
  190.  
  191.     STRPTR loc_MonSmallCS
  192.         The currency symbol for small amounts.
  193.  
  194.     STRPTR loc_MonIntCS
  195.         The international currency symbol applicable to the current
  196.         locale. The first three characters contain the alphabetic
  197.         international currency symbol in accordance with those specified
  198.         in ISO 4217 Codes for the Representation of Currency and Funds.
  199.         The fourth character (immediately preceding the NULL) is the
  200.         character used to separate the international currency symbol from
  201.         the monetary quantity.
  202.  
  203.     STRPTR loc_MonPositiveSign
  204.         The string used to indicate a non-negative monetary quantity.
  205.  
  206.     UBYTE loc_MonPositiveSpaceSep
  207.         Specifies the number of spaces separating the currency symbol from
  208.         the non-negative monetary quantity.
  209.  
  210.     UBYTE loc_MonPositiveSignPos
  211.         Set to a value indicating the positioning of loc_MonPositiveSign
  212.         for a non-negative monetary quantity.
  213.  
  214.     UBYTE loc_MonPositiveCSPos
  215.         Set to 1 or 0 if loc_MonCS respectively precedes or succeeds
  216.         the value for a non-negative monetary quantity.
  217.  
  218.     STRPTR loc_MonNegativeSign
  219.         The string used to indicate a negative monetary quantity.
  220.  
  221.     UBYTE loc_MonNegativeSpaceSep
  222.         Specifies the number of spaces separating the currency symbol from
  223.         the negative monetary quantity.
  224.  
  225.     UBYTE loc_MonNegativeSignPos
  226.         Set to a value indicating the positioning of loc_MonNegativeSign
  227.         for a negative monetary quantity.
  228.  
  229.     UBYTE loc_MonNegativeCSPos
  230.         Set to 1 or 0 if loc_MonCS respectively precedes or succeeds
  231.         the value for a negative monetary quantity.
  232.  
  233.  
  234.     The grouping tables pointed to by loc_Grouping, loc_FracGrounping,
  235.     loc_MonGrouping, and loc_MonFracGrouping contain a stream of bytes
  236.     with the following values:
  237.  
  238.         255        No further grouping is to be performed.
  239.  
  240.         0        The previous element is to be repeatedly used for the
  241.             remainder of the digits.
  242.  
  243.         1..254    The integer value is the number of digits that comprise
  244.             the current group. The next element is examined to
  245.             determine the size of the next group of digits before
  246.             the current group.
  247.  
  248.     The values of loc_MonPositiveSignPos and loc_MonNegativeSignPos are
  249.     interpreted according to the following:
  250.  
  251.         0        Parentheses surround the quantity and currency symbol
  252.  
  253.         1        The sign string precedes the quantity and
  254.             currency symbol
  255.  
  256.         2        The sign string succeeds the quantity and
  257.             currency symbol
  258.  
  259.         3        The sign string immediately precedes the
  260.             currency symbol
  261.  
  262.         4        The sign string immediately succeeds the
  263.             currency symbol.
  264.  
  265. locale.library/CloseCatalog                       locale.library/CloseCatalog
  266.  
  267.    NAME
  268.     CloseCatalog -- close a message catalog. (V38)
  269.  
  270.    SYNOPSIS
  271.     CloseCatalog(catalog);
  272.                  A0
  273.  
  274.     VOID CloseCatalog(struct Catalog *);
  275.  
  276.    FUNCTION
  277.     Concludes access to a message catalog. The usage count of the
  278.     catalog is decremented. When this count reaches 0, the catalog
  279.     can be expunged from system memory whenever a memory panic occurs.
  280.  
  281.    INPUTS
  282.     catalog - the message catalog to close. A NULL catalog is a valid
  283.           parameter and is simply ignored.
  284.  
  285.    SEE ALSO
  286.     OpenCatalog(), GetCatalogStr()
  287.  
  288. locale.library/CloseLocale                         locale.library/CloseLocale
  289.  
  290.    NAME
  291.     CloseLocale -- close a locale. (V38)
  292.  
  293.    SYNOPSIS
  294.     CloseLocale(locale);
  295.                 A0
  296.  
  297.     VOID CloseLocale(struct Locale *);
  298.  
  299.    FUNCTION
  300.     Concludes access to a locale.
  301.  
  302.    INPUTS
  303.     locale - an opened locale. A NULL locale is a valid
  304.          parameter and is simply ignored.
  305.  
  306.    SEE ALSO
  307.     OpenLocale(), <libraries/locale.h>
  308.  
  309. locale.library/ConvToLower                         locale.library/ConvToLower
  310.  
  311.    NAME
  312.     ConvToLower -- convert a character to lower case. (V38)
  313.  
  314.    SYNOPSIS
  315.     char = ConvToLower(locale,character);
  316.     D0               A0     D0
  317.  
  318.     ULONG ConvToLower(struct Locale *,ULONG);
  319.  
  320.    FUNCTION
  321.     This function tests if the character specified is upper case. If it is
  322.     then the lower case version of that character is returned, and if it
  323.     isn't then the original character is returned.
  324.  
  325.    INPUTS
  326.     locale - the locale to use for the conversion
  327.     character - the character to convert
  328.  
  329.    RESULT
  330.     char - a (possibly) converted character
  331.  
  332.    NOTE
  333.     This function requires a full 32-bit character be passed-in in order
  334.     to support multi-byte character sets.
  335.  
  336. locale.library/ConvToUpper                         locale.library/ConvToUpper
  337.  
  338.    NAME
  339.     ConvToUpper -- convert a character to upper case. (V38)
  340.  
  341.    SYNOPSIS
  342.     char = ConvToUpper(locale,character);
  343.     D0               A0     D0
  344.  
  345.     ULONG ConvToUpper(struct Locale *,ULONG);
  346.  
  347.    FUNCTION
  348.     This function tests if the character specified is lower case. If it is
  349.     then the upper case version of that character is returned, and if it
  350.     isn't then the original character is returned.
  351.  
  352.    INPUTS
  353.     locale - the locale to use for the conversion
  354.     character - the character to convert
  355.  
  356.    RESULT
  357.     char - a (possibly) converted character
  358.  
  359.    NOTE
  360.     This function requires a full 32-bit character be passed-in in order
  361.     to support multi-byte character sets.
  362.  
  363. locale.library/FormatDate                           locale.library/FormatDate
  364.  
  365.    NAME
  366.     FormatDate -- generate a date string based on a date formatting
  367.               template. (V38)
  368.  
  369.    SYNOPSIS
  370.     FormatDate(locale,fmtTemplate,date,putCharFunc);
  371.                A0     A1          A2   A3
  372.  
  373.     VOID FormatDate(struct Locale *,STRPTR,struct DateStamp *,
  374.                     struct Hook *);
  375.  
  376.    FUNCTION
  377.     This function processes a formatting template and generates
  378.     a stream of bytes that's sent one character at a time to the
  379.     putCharFunc callback hook.
  380.  
  381.    INPUTS
  382.     locale - the locale to use for the formatting
  383.     fmtTemplate - the NULL-terminated template describing the desired
  384.               format for the date. This is constructed just like
  385.               C-language printf() statements, except that different
  386.               formatting codes are used. Just like in C, formatting
  387.               codes start with a % followed by the formatting command.
  388.               The following commands are accepted by this function:
  389.  
  390.                     %a - abbreviated weekday name
  391.                     %A - weekday name
  392.                     %b - abbreviated month name
  393.                     %B - month name
  394.                     %c - same as "%a %b %d %H:%M:%S %Y"
  395.                     %C - same as "%a %b %e %T %Z %Y"
  396.                     %d - day number with leading 0s
  397.                     %D - same as "%m/%d/%y"
  398.                     %e - day number with leading spaces
  399.                     %h - abbreviated month name
  400.                     %H - hour using 24-hour style with leading 0s
  401.                     %I - hour using 12-hour style with leading 0s
  402.                     %j - julian date
  403.                     %m - month number with leading 0s
  404.                     %M - the number of minutes with leading 0s
  405.                     %n - insert a linefeed
  406.                     %p - AM or PM strings
  407.                     %q - hour using 24-hour style
  408.                     %Q - hour using 12-hour style
  409.                     %r - same as "%I:%M:%S %p"
  410.                     %R - same as "%H:%M"
  411.                     %S - number of seconds with leadings 0s
  412.                     %t - insert a tab character
  413.                     %T - same as "%H:%M:%S"
  414.                     %U - week number, taking Sunday as first day of week
  415.                     %w - weekday number
  416.                     %W - week number, taking Monday as first day of week
  417.                     %x - same as "%m/%d/%y"
  418.                     %X - same as "%H:%M:%S"
  419.                     %y - year using two digits with leading 0s
  420.                     %Y - year using four digits with leading 0s
  421.  
  422.                   If the template parameter is NULL, a single NULL byte
  423.               is sent to putCharFunc.
  424.     date - the date to format into a string
  425.     putCharFunc - a callback hook invoked for every character generated,
  426.               including for the terminating NULL character. The hook
  427.               is called with:
  428.  
  429.              A0 - address of Hook structure
  430.             A1 - character for hook to process (not a pointer!)
  431.                     A2 - locale pointer
  432.  
  433.    SEE ALSO
  434.     ParseDate(), <libraries/locale.h>, <dos/dos.h>
  435.  
  436. locale.library/FormatString                       locale.library/FormatString
  437.  
  438.    NAME
  439.     FormatString -- format data into a character stream. (V38)
  440.  
  441.    SYNOPSIS
  442.     next = FormatString(locale,fmtTemplate,dataStream,putCharFunc);
  443.     D0                  A0     A1          A2         A3
  444.  
  445.     APTR FormatString(struct Locale *,STRPTR,APTR,struct Hook *);
  446.  
  447.    FUNCTION
  448.     This function performs C-language-like formatting of a data stream,
  449.     outputting the result a character at a time. Where % formatting
  450.     commands are found in the formatting template, they are replaced with
  451.     the corresponding elements in 'dataStream'. %% must be used in the
  452.     string if a % is desired in the output.
  453.  
  454.     An extension to the standard C-language printf() conventions used
  455.     by FormatString() is argument position specification. Specifying the
  456.     argument position lets the order of the % commands change while the
  457.     arguments provided remain the same. Using the C printf() call as an
  458.     example:
  459.         printf("%d eyes, %d feet and %d ears",eyes,feet,ears);
  460.         printf("%3$d ears, %1$d eyes and %2$d feet",eyes,feet,ears);
  461.     These two statements would produce the following output:
  462.         "2 eyes, 3 feet and 4 ears" for the first
  463.         "4 ears, 2 eyes and 3 feet" for the second
  464.  
  465.     The argument positioning feature lets you change the format string
  466.     being processed while keeping the data stream the same. This is
  467.     an invaluable tool when translating strings to different languages.
  468.  
  469.    INPUTS
  470.     locale - the locale to use for the formatting
  471.     fmtTemplate - a C-language-like NULL-terminated format string,
  472.               with the following supported % options:
  473.  
  474.       %[arg_pos$][flags][width][.limit][length]type
  475.  
  476.       arg_pos - ordinal position of the argument for this command within
  477.             the array of arguments pointed to by 'dataStream'
  478.         $     - must follow the arg_pos value, if specified
  479.       flags   - only one allowed. '-' specifies left justification.
  480.       width   - field width. If the first character is a '0', the
  481.                 field is padded with leading 0s.
  482.         .     - must precede the field limit value, if specified
  483.       limit   - maximum number of characters to output from a string.
  484.                 (only valid for %s or %b).
  485.       length  - size of input data defaults to word (16-bit) for types c,
  486.             d, u and x, 'l' changes this to long (32-bit).
  487.       type    - supported types are:
  488.                       b - BSTR, data is 32-bit BPTR to byte count followed
  489.                           by a byte string. A NULL BPTR is treated as an
  490.                   empty string.
  491.                       d - signed decimal
  492.               D - signed decimal using the locale's formatting
  493.                   conventions
  494.               u - unsigned decimal
  495.               U - unsigned decimal using the locale's formatting
  496.                   conventions
  497.                       x - hexadecimal with hex digits in uppercase
  498.               X - hexadecimal with hex digits in lowercase
  499.                       s - string, a 32-bit pointer to a NULL-terminated
  500.                           byte string. A NULL pointer is treated
  501.                           as an empty string.
  502.                       c - character
  503.  
  504.                   If the formatting template parameter is NULL, the
  505.               function returns without outputting anything. Note the
  506.               meaning of %x and %X are swapped with respect to
  507.               standard C conventions. This is for compatibility with
  508.               exec.library/RawDoFmt().
  509.  
  510.     dataStream - a stream of data that is interpreted according to
  511.              the format string. Often this is a pointer into
  512.              the task's stack.
  513.     putCharFunc - a callback hook invoked for every character generated,
  514.               including for the terminating NULL character. The hook
  515.               is called with:
  516.  
  517.              A0 - address of Hook structure
  518.             A1 - character for hook to process (not a pointer!)
  519.                     A2 - locale pointer
  520.  
  521.              the function is called with a NULL char at the end of
  522.              the format string.
  523.  
  524.    RESULT
  525.     next - A pointer to beyond the last data element used in 'dataStream'
  526.            (the next argument that would have been processed).
  527.            This allows multiple formatting passes to be made using the
  528.            same data.
  529.  
  530.    WARNING
  531.     This function formats word values in the data stream. If your compiler
  532.     defaults to longs, you must add an "l" to your specifications. This
  533.     can get strange for characters, which might look like "%lc".
  534.  
  535.    SEE ALSO
  536.     exec.library/RawDoFmt()
  537.  
  538. locale.library/GetCatalogStr                     locale.library/GetCatalogStr
  539.  
  540.    NAME
  541.     GetCatalogStr -- get a string from a message catalog. (V38)
  542.  
  543.    SYNOPSIS
  544.     string = GetCatalogStr(catalog,stringNum,defaultString);
  545.     D0                     A0      D0        A1
  546.  
  547.     STRPTR GetCatalogStr(struct Catalog *,LONG,STRPTR);
  548.  
  549.    FUNCTION
  550.     This function returns a specific string within a message catalog.
  551.     If the catalog parameter is NULL, or the requested message does not
  552.     exist, then defaultString is returned.
  553.  
  554.    INPUTS
  555.     catalog - a message catalog as obtained from OpenCatalog(), or NULL
  556.     stringNum - a message number within the catalog
  557.     defaultString - string to return in case "catalog" is NULL or
  558.                     "stringNum" can't be found
  559.  
  560.    RESULT
  561.     string - a pointer to a NULL-terminated string. The returned string
  562.          is READ-ONLY, do NOT modify! This string pointer is valid
  563.          only as long as the catalog remains open.
  564.  
  565.    SEE ALSO
  566.     OpenCatalog(), CloseCatalog()
  567.  
  568. locale.library/GetLocaleStr                       locale.library/GetLocaleStr
  569.  
  570.    NAME
  571.     GetLocaleStr -- get a standard string from a locale. (V38)
  572.  
  573.    SYNOPSIS
  574.     string = GetLocaleStr(locale,stringNum);
  575.     D0                    A0     D0
  576.  
  577.     STRPTR GetLocaleStr(struct Locale *,ULONG);
  578.  
  579.    FUNCTION
  580.     This function returns a specific string associated with the given
  581.     locale.
  582.  
  583.    INPUTS
  584.     locale - a valid locale
  585.     stringNum - the number of the string to get a pointer to. See the
  586.             constants defined in <libraries/locale.h> for the
  587.             possible values.
  588.  
  589.    RESULT
  590.     string - a pointer to a NULL-terminated string, or NULL if the
  591.          requested string number was out of bounds. The returned
  592.          string is READ-ONLY, do NOT modify! This string pointer
  593.          is valid only as long as the locale remains open.
  594.  
  595.    SEE ALSO
  596.     OpenLocale(), CloseLocale(), <libraries/locale.h>
  597.  
  598. locale.library/IsXXXX                                   locale.library/IsXXXX
  599.  
  600.    NAME
  601.     IsXXXX -- determine whether a character is of a certain type. (V38)
  602.  
  603.    SYNOPSIS
  604.     state = IsXXXX(locale,character);
  605.     D0           A0     D0
  606.  
  607.     BOOL IsXXXX(struct Locale *,ULONG);
  608.  
  609.    FUNCTION
  610.     These functions determine whether the character specified is of a
  611.     certain type, according to the supplied locale.
  612.  
  613.     IsAlNum() - test if alphanumeric character
  614.     IsAlpha() - test if alphabetical character
  615.     IsCntrl() - test if control character
  616.     IsDigit() - test if decimal digit character
  617.     IsGraph() - test if visible character
  618.     IsLower() - test if lower case character
  619.     IsPrint() - test if blank
  620.     IsPunct() - test if punctuation character
  621.     IsSpace() - test if white space character
  622.     IsUpper() - test if upper case character
  623.     IsXDigit() - test if hexadecimal digit
  624.  
  625.    INPUTS
  626.     locale - the locale to use for the test
  627.     character - the character to test
  628.  
  629.    RESULT
  630.     state - TRUE if the character is of the required type, FALSE otherwise
  631.  
  632.    NOTE
  633.     These functions require full 32-bit characters be passed-in in order
  634.     to support multi-byte character sets.
  635.  
  636. locale.library/OpenCatalog                         locale.library/OpenCatalog
  637.  
  638.    NAME
  639.     OpenCatalogA -- open a message catalog. (V38)
  640.     OpenCatalog -- varargs stub for OpenCatalogA(). (V38)
  641.  
  642.    SYNOPSIS
  643.     catalog = OpenCatalogA(locale,name,tagList);
  644.     D0                     A0     A1   A2
  645.  
  646.     struct Catalog *OpenCatalogA(struct Locale *,STRPTR,struct TagItem *);
  647.  
  648.     catalog = OpenCatalog(locale,name,firstTag, ...);
  649.  
  650.     struct Catalog *OpenCatalog(struct Locale *,STRPTR,Tag, ...);
  651.  
  652.    FUNCTION
  653.     This function opens a message catalog. Catalogs contain all the
  654.     text strings that an application uses. These strings can easily
  655.     be replaced by strings in a different language, which causes the
  656.     application to magically start operating in that new language.
  657.  
  658.     Catalogs originally come from disk files. This function searches for
  659.     them in the following places:
  660.  
  661.         PROGDIR:Catalogs/languageName/name
  662.         LOCALE:Catalogs/languageName/name
  663.  
  664.     where languageName is the name of the language associated with the
  665.     locale parameter. So assuming an application called WizPaint:
  666.  
  667.         catalog = OpenCatalog(NULL,
  668.                       "WizPaint.catalog",
  669.                       OC_BuiltInLanguage,"english",
  670.                       TAG_DONE);
  671.  
  672.     Passing NULL as first parameter to OpenCatalog() indicates you
  673.     wish to use the system's default locale. Assuming the default locale
  674.     specifies "deutsch" as language, OpenCatalog() tries to open the
  675.     catalog as:
  676.  
  677.         PROGDIR:Catalogs/deutsch/WizPaint.catalog
  678.  
  679.     and if that file is not found, then OpenCatalog() tries to open it
  680.     as:
  681.  
  682.         LOCALE:Catalogs/deutsch/WizPaint.catalog
  683.  
  684.     PROGDIR: is not always checked before LOCALE: is. If the volume which
  685.     PROGDIR: is assigned to is NOT currently mounted, and if the one
  686.     which LOCALE: is assigned to IS mounted, then LOCALE: is checked
  687.     first, followed by PROGDIR: if needed. This is done in order to
  688.     minimize the number of disk swaps on floppy systems.
  689.  
  690.     The OC_BuiltInLanguage tag specifies the language of the strings
  691.     that are built into the application. If the language of the
  692.     built-in strings matches that of the locale, then no catalog
  693.     need be loaded from disk and the built-in strings can be used
  694.     directly.
  695.  
  696.     locale.library caches text catalogs in order to minimize disk
  697.     access. As such, OpenCatalog() may or may not cause disk access.
  698.     This fact should be taken into consideration. Unused catalogs are
  699.     automatically flushed from the system when there is not enough
  700.     memory. When there is disk access, it is possible a DOS requester
  701.     may be opened asking for a volume to be inserted. You can avoid this
  702.     requester opening by setting your process' pr_WindowPtr field to -1.
  703.  
  704.    INPUTS
  705.     locale - the locale for which the catalog should be opened, or NULL.
  706.          When NULL, then the system's default locale is used. This
  707.          should generally be NULL
  708.     name - the NULL-terminated name of the catalog to open, typically
  709.            the application name with a ".catalog" extension
  710.     tagList - pointer to an array of tags providing optional extra
  711.           parameters, or NULL
  712.  
  713.    TAGS
  714.     OC_BuiltInLanguage (STRPTR) - language of built-in strings of the
  715.                       application. That is, this tag identifies
  716.                       the language used for the "defaultString"
  717.                       parameter used in the GetCatalogStr()
  718.                       function. Default is "english". Providing
  719.                       this tag and setting its value to NULL
  720.                       indicates that there are no built-in
  721.                       strings.
  722.  
  723.     OC_BuiltInCodeSet (ULONG) - code set of built-in strings. Default is 0.
  724.                     THIS TAG SHOULD ALWAYS BE SET TO 0 FOR NOW.
  725.  
  726.     OC_Language (STRPTR) - language explicitly requested for the catalog.
  727.                    A catalog of this language will be returned if
  728.                    possible, otherwise a catalog in one of the
  729.                    user's preferred languages. This tag should
  730.                    normally not be provided as it overrides the
  731.                    user's preferences.
  732.  
  733.     OC_Version (UWORD) - catalog version number required. Default is 0
  734.                  which means to accept any version of the catalog
  735.                  that is found. Note that if a version is
  736.                  specified, the catalog's version much match it
  737.                  exactly. This is different from version numbers
  738.                  used by OpenLibrary().
  739.  
  740.    RESULT
  741.     catalog - a message catalog to use with GetCatalogStr() or NULL.
  742.           A NULL result does not necessarily indicate an error.
  743.           If OpenCatalog() determines that the built-in strings of
  744.           the application can be used instead of an external catalog
  745.           from disk, then NULL is returned. To determine whether
  746.           a NULL result actually indicates an error, look at the
  747.           return value of dos.library/IoErr(). 0 means no error.
  748.  
  749.           GetCatalogStr() interprets a NULL catalog as meaning to use
  750.           the built-in strings.
  751.  
  752.    NOTE
  753.     In most cases, failing to open a catalog should not be considered a
  754.     fatal error, and the application should continue operating and
  755.     simply use the built-in set of strings instead of the disk-based
  756.     catalog. Note that GetCatalogStr() accepts a NULL catalog pointer for
  757.     this very reason.
  758.  
  759.     Also note that displaying an error message when a catalog fails to
  760.     open can be a meaningless endeavor as the message is likely in a
  761.     language the user does not understand.
  762.  
  763.    SEE ALSO
  764.     CloseCatalog(), GetCatalogStr()
  765.  
  766. locale.library/OpenLocale                           locale.library/OpenLocale
  767.  
  768.    NAME
  769.     OpenLocale -- open a locale. (V38)
  770.  
  771.    SYNOPSIS
  772.     locale = OpenLocale(name);
  773.     D0                  A0
  774.  
  775.     struct Locale *OpenLocale(STRPTR);
  776.  
  777.    FUNCTION
  778.     This function opens a named locale. Locales contain many parameters
  779.     that an application needs to consider when being integrated into
  780.     different languages, territories and customs. Using the information
  781.     stored in a locale instead of hard-coding it into an application,
  782.     lets the application dynamically adapt to the user's environment.
  783.  
  784.     Locales originally come from disk files which are created by the
  785.     user using the Locale preferences editor. Passing a NULL instead of
  786.     a name causes this function to return the current default locale.
  787.     This is what most applications will do.
  788.  
  789.     Every locale specifies a language, and special language drivers
  790.     must be loaded from disk depending on which language is being used.
  791.     These files include for example:
  792.  
  793.         LOCALE:Languages/français.language
  794.         LOCALE:Languages/dansk.language
  795.         LOCALE:Languages/italiano.language
  796.  
  797.    INPUTS
  798.     name - the NULL-terminated name of the locale to open, or NULL to open
  799.            the current default locale. This should generally be NULL.
  800.  
  801.    RESULT
  802.     locale - a pointer to an initialized Locale structure, or NULL if the
  803.          locale could not be loaded. In the case of a NULL return, the
  804.          DOS IoErr() function can be called to obtain more information
  805.          on the failure.
  806.  
  807.          When passing a NULL name parameter to this function, you are
  808.          guaranteed a valid return.
  809.  
  810.    SEE ALSO
  811.     CloseLocale(), <libraries/locale.h>
  812.  
  813. locale.library/ParseDate                             locale.library/ParseDate
  814.  
  815.    NAME
  816.     ParseDate -- interpret a string according to the date formatting
  817.              template and convert it into a DateStamp. (V38)
  818.  
  819.    SYNOPSIS
  820.     state = ParseDate(locale,date,fmtTemplate,getCharFunc);
  821.     D0              A0     A1   A2          A3
  822.  
  823.     BOOL ParseDate(struct Locale *,struct DateStamp *,STRPTR,struct Hook *);
  824.  
  825.    FUNCTION
  826.     This function converts a stream of characters into an AmigaDOS
  827.     DateStamp structure. The characters are obtained from the
  828.     getCharFunc callback hook and the formatting template is used
  829.     to direct the parse.
  830.  
  831.    INPUTS
  832.     locale - the locale to use for the formatting
  833.     date - place to put the converted date, this may be NULL in which
  834.            case this routine can be used to simply validate a date
  835.     fmtTemplate - the date template describing the expected format of the
  836.               data. See FormatDate() documentation for a description of
  837.               date templates. The following formatting controls from
  838.               FormatDate() can be used in ParseDate():
  839.                     %a %A %b %B %d %e %h %H %I %m %M %p %S %y %Y
  840.     getCharFunc - a callback hook invoked whenever a character is required.
  841.               The hook should return the next character to process,
  842.               with a NULL character to indicate the end of the string.
  843.               The hook is called with:
  844.  
  845.              A0 - address of Hook structure
  846.                     A1 - locale pointer
  847.             A2 - NULL
  848.  
  849.                   The hook returns the character to process in D0. Note
  850.               that a complete 32-bit result is expected in D0, not
  851.               just 8 bits.
  852.  
  853.    RESULT
  854.     state - TRUE if the parsing went OK, or FALSE if the input did not
  855.         match the template
  856.  
  857.    SEE ALSO
  858.     FormatDate(), <dos/dos.h>
  859.  
  860. locale.library/StrConvert                           locale.library/StrConvert
  861.  
  862.    NAME
  863.     StrConvert -- transform a string according to collation information.
  864.               (V38)
  865.  
  866.    SYNOPSIS
  867.     length = StrConvert(locale,string,buffer,bufferSize,type);
  868.     D0                  A0     A1     A2     D0         D1
  869.  
  870.     ULONG StrConvert(struct Locale *,STRPTR,APTR,ULONG,ULONG);
  871.  
  872.    FUNCTION
  873.     This function transforms the passed string and places the resulting
  874.     into the supplied buffer. No more than bufferSize bytes are copied
  875.     into the buffer.
  876.  
  877.     The transformation is such that if the C strcmp() function is applied
  878.     to two transformed strings, it returns a value corresponding to
  879.     the result returned by the StrnCmp() function applied to the two
  880.     original strings.
  881.  
  882.    INPUTS
  883.     locale - the locale to use for the transformation
  884.     string - NULL-terminated string to transform
  885.     buffer - buffer where to put the transformed string
  886.     bufferSize - maximum number of bytes to deposit in the buffer
  887.                  StrConvert() may require more storage than
  888.              the unconverted string does
  889.     type - describes how the transformation is to be performed. See
  890.            the documentation on StrnCmp() for more information on the
  891.            comparison types available
  892.  
  893.    RESULT
  894.     length - length of the transformed string which is the number of bytes
  895.          deposited in the buffer minus 1 (since strings are NULL-
  896.          terminated)
  897.  
  898.    SEE ALSO
  899.     StrnCmp(), <libraries/locale.h>
  900.  
  901. locale.library/StrnCmp                                 locale.library/StrnCmp
  902.  
  903.    NAME
  904.     StrnCmp -- localized string comparison. (V38)
  905.  
  906.    SYNOPSIS
  907.     result = StrnCmp(locale,string1,string2,length,type);
  908.     D0               A0     A1      A2      D0     D1
  909.  
  910.     LONG StrnCmp(struct Locale *,STRPTR,STRPTR,LONG,ULONG);
  911.  
  912.    FUNCTION
  913.     Compares string1 to string2 according to the collation information
  914.     provided by the locale and returns an integer greater than,
  915.     equal to, or less than zero, accordingly as the string pointed to
  916.     by string1 is greater than, equal to, or less than the string
  917.     pointed to by string2.
  918.  
  919.     The length parameter specifies how many characters to compare, or if
  920.     the length is specified as -1 then the strings are compared until
  921.     a NULL is encountered.
  922.  
  923.     The type parameter dictates how the comparison is to be performed.
  924.  
  925.    INPUTS
  926.     locale - the locale to use for this comparison
  927.     string1    - NULL-terminated string
  928.     string2    - NULL-terminated string
  929.     length - the maximum number of characters to be compared, or -1 to
  930.          compare all characters until a NULL is encountered
  931.     type - describes how the comparison is to be performed. The following
  932.            values can be passed:
  933.          SC_ASCII causes an ASCII-based case-insensitive comparison
  934.          to be performed. SC_ASCII is the fastest of the comparison
  935.          types, but it uses ASCII ordering and considers accented
  936.          characters different than their non-accented counterparts.
  937.  
  938.          SC_COLLATE1 causes the characters to be compared using their
  939.          primary sorting order. This effectively produces a comparison
  940.          that ignores letter case and diacritical marks. That is,
  941.          letters such as "e" and "é" are treated as if they were both
  942.          "e".
  943.  
  944.          SC_COLLATE2 causes the characters to be compared using both
  945.          their primary and secondary sorting order. SC_COLLATE2 is
  946.          slower than SC_COLLATE1. This is the type of comparison to
  947.          use when sorting data to be presented to the user. It operates
  948.          in two passes. First it performs a comparison equivalent to
  949.          SC_COLLATE1. If both strings compare the same, then a second
  950.          pass is made using the secondary sorting order, which gives
  951.          finer resolution to the comparison. For example, SC_COLLATE1
  952.          would return the following strings as identical:
  953.             "père"  and  "pere"
  954.          since SC_COLLATE1 ignores diacritical marks. SC_COLLATE2
  955.          would make a second pass over the string comparing
  956.          diacritical marks instead of actual characters.
  957.  
  958.    RESULT
  959.     result - relationship between string1 and string2
  960.             <0 means string1 < string2
  961.             =0 means string1 = string2
  962.             >0 means string1 > string2
  963.  
  964.    SEE ALSO
  965.     OpenLocale(), CloseLocale(), StrConvert()
  966.  
  967.