##stringtype C
##shortstrings
/****************************************************************
   This file was created automatically by `%fv'
   from "%f0".

   Do NOT edit by hand!
****************************************************************/

/****************************************************************
    This file uses the auto initialization possibilities of
    Dice, gcc and SAS/C, respectively.

    Dice does this by using the keywords __autoinit and
    __autoexit, SAS uses names beginning with _STI or
    _STD, respectively. gcc uses the asm() instruction,
    to emulate C++ constructors and destructors.

    Using this file you don't have *all* possibilities of
    the locale.library. (No Locale or Language arguments are
    supported when opening the catalog. However, these are
    *very* rarely used, so this should be sufficient for most
    applications.

    If you really need all possibilities or you have another
    compiler, you should use the source description C_c_V21.sd
    instead.
****************************************************************/


/*
    Include files and compiler specific stuff
*/
#include <libraries/locale.h>

#if defined(__SASC)  ||  defined(_DCC)
#include <proto/exec.h>
#include <proto/locale.h>
typedef struct Library LocaleBase_t;
#elif defined(__GNUC__)
#include <inline/exec.h>
#include <inline/locale.h>
typedef struct LocaleBase LocaleBase_t;
#else
#error "Don't know how to handle your compiler."
#endif

#if defined(__SASC) || defined(__GNUC__)
#define __autoinit
#define __autoexit
#endif


/*
    Variables
*/
struct FC_Type
{   LONG   ID;
    STRPTR Str;
};
const struct FC_Type _%i = { %d, (STRPTR) %s };

static struct Catalog *%b_Catalog = NULL;

LocaleBase_t *LocaleBase;





STATIC __autoinit VOID _STIOpenCatalog(VOID)

  {
    STATIC const struct TagItem tags[] =
      {
	{ OC_BuiltInLanguage, (ULONG) %l },
	{ OC_Version, %v },
	{ TAG_DONE, 0 }
      };
    if ((LocaleBase = (LocaleBase_t *)
		      OpenLibrary((STRPTR) "locale.library", 38)))
    {
      %b_Catalog = OpenCatalogA(NULL, (STRPTR) "%b.catalog",
				(struct TagItem *) tags);
    }
  }



STATIC __autoexit VOID _STDCloseCatalog(VOID)

  {
    if (LocaleBase)
      {
	CloseCatalog(%b_Catalog);
	%b_Catalog = NULL;
	CloseLibrary((struct Library *) LocaleBase);
      }
  }



STRPTR GetString(struct FC_Type *fcstr)

  {
    STRPTR defaultstr;
    LONG strnum;

    strnum = fcstr->ID;
    defaultstr = fcstr->Str;

    return(%b_Catalog ? GetCatalogStr(%b_Catalog, strnum, defaultstr) :
			defaultstr);
  }

#if defined(__GNUC__)
asm ("  .text;  .stabs \\\"___CTOR_LIST__\\\",22,0,0,__STIOpenCatalog");
asm ("  .text;  .stabs \\\"___DTOR_LIST__\\\",22,0,0,__STDCloseCatalog");
#endif
