7 {****************************************************
9 This file was created automatically by '%fv'
14 ****************************************************}
17 Exec , Locale , Utility ;
20 %i = %d ;\n %i_STR = %s%[#0;\n
22 PROCEDURE CloseCatalog;
24 PROCEDURE OpenCatalog(loc : pLocale ; language : STRPTR ) ;
26 FUNCTION GetString(num : LONGINT) : STRPTR ;
28 FUNCTION GetPasString(num : LONGINT) : STRING;
33 builtinlanguage = %l%[#0;
35 catalog : pCatalog = NIL ;
39 OldExitProc : Pointer;
48 tAppStringArray = ARRAY [0..%n] OF tAppString ;
51 AppStrings : tAppStringArray = (( id : 0 ; str : NIL ));
53 FUNCTION CPtr( s : string ):pointer;INLINE
54 $201F, { move.l (a7)+,d0 ; get address string }
55 $5280, { addq.l #1,d0 ; ignore counter }
56 $2E80; { move.l d0,(a7) ; return "C-string" address }
58 PROCEDURE CloseCatalog;
60 IF catalog <> NIL THEN
62 Locale.CloseCatalog(catalog) ;
67 PROCEDURE InitAppStringsArray;
69 AppStrings[%d].id := %i;\n AppStrings[%d].str := CPtr(%i_STR);\n
72 PROCEDURE OpenCatalog(loc : pLocale ; language : STRPTR );
74 tags : ARRAY [0..7] OF LONGINT ;
77 IF (catalog = NIL) AND (LocaleBase <> NIL) THEN
79 IF language <> NIL THEN
81 tags[0] := OC_BuiltInLanguage; tags[1] := long(CPtr(builtinlanguage));
82 tags[2] := OC_Language ; tags[3] := long(language);
83 tags[4] := OC_Version ; tags[5] := version;
88 tags[0] := OC_BuiltInLanguage; tags[1] := long(CPtr(builtinlanguage));
89 tags[2] := OC_Version ; tags[3] := version;
92 catalog := Locale.OpenCatalogA(loc, CPtr('%b.catalog'#0), @tags) ;
96 FUNCTION GetString(num : LONGINT) : STRPTR ;
105 WHILE (i < %n) AND (AppStrings[i].id <> num) DO
111 default := AppStrings[i].str
115 IF catalog <> NIL THEN
116 GetString := Locale.GetCatalogStr(catalog, num, default)
121 FUNCTION GetPasString(num : LONGINT) : STRING;
124 ta = PACKED ARRAY [0..MAXINT] OF CHAR;
130 sptr := pa(GetString( num ));
133 WHILE sptr^[i] <> #0 DO
141 (***************************************************************************)
142 (* << INIT AND EXIT PROCEDURE >> *)
143 (***************************************************************************)
145 PROCEDURE InitFunction;
147 LocaleBase := OpenLibrary( 'locale.library' , 38 );
148 if LocaleBase = NIL then
150 WRITELN( '*** ERROR *** locale.library ' );
154 OpenCatalog( NIL , NIL );
157 PROCEDURE ExitFunction;
159 if LocaleBase <> NIL then CloseLibrary( LocaleBase );
163 PROCEDURE ExitHandler;
165 ExitProc := OldExitProc;
169 PROCEDURE Initialize;
171 OldExitProc := ExitProc;
172 ExitProc := @ExitHandler;