1 ##rem $Id: AutoC_c.sd 253 2014-02-18 11:15:58Z damato $
5 /****************************************************************
7 This file was created automatically by `%fv'
12 ****************************************************************/
14 /****************************************************************
15 This file uses the auto initialization features of
16 Dice, gcc and SAS/C, respectively.
18 Dice does this by using the __autoinit and __autoexit
19 keywords, whereas SAS/C uses names beginning with _STI
20 or _STD, respectively. gcc uses the asm() instruction
21 to emulate C++ constructors and destructors.
23 Using this file you don't have *all* the benefits of
24 locale.library (no Locale or Language arguments are
25 supported when opening the catalog). However, these are
26 *very* rarely used, so this should be sufficient for most
29 If you really need all the bells and whistles or you
30 are using another compiler, you should use the source
31 description C_c_V21.sd instead.
32 ****************************************************************/
35 Include files and compiler specific stuff
38 #include <libraries/locale.h>
40 #if defined(__SASC) || defined(_DCC)
41 #include <proto/exec.h>
42 #include <proto/locale.h>
43 typedef struct Library LocaleBase_t;
44 #elif defined(__GNUC__)
45 #include <inline/exec.h>
46 #include <inline/locale.h>
47 typedef struct LocaleBase LocaleBase_t;
49 #error "I don't know how to handle your compiler."
58 #define __autoinit __attribute__ ((constructor))
59 #define __autoexit __attribute__ ((destructor))
70 const struct FC_Type _%i = { %d, (STRPTR) %s };
72 static struct Catalog *%b_Catalog = NULL;
74 LocaleBase_t *LocaleBase;
80 STATIC __autoinit VOID _STIOpenCatalog(VOID)
83 STATIC const struct TagItem tags[] =
85 { OC_BuiltInLanguage, (ULONG) %l },
89 if ((LocaleBase = (LocaleBase_t *)
90 OpenLibrary((STRPTR) "locale.library", 38)))
92 %b_Catalog = OpenCatalogA(NULL, (STRPTR) "%b.catalog",
93 (struct TagItem *) tags);
99 STATIC __autoexit VOID _STDCloseCatalog(VOID)
104 CloseCatalog(%b_Catalog);
106 CloseLibrary((struct Library *) LocaleBase);
112 STRPTR GetString(struct FC_Type *fcstr)
119 defaultstr = fcstr->Str;
121 return(%b_Catalog ? GetCatalogStr(%b_Catalog, strnum, defaultstr) :