##stringtype C
##shortstrings
/****************************************************************
   This file was created automatically by `FlexCat V1.4'
   from "%f0.ct".

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

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

    Dice does this by using the keywords __autoinit and
    __autoexit, SAS uses names beginning with _STI or
    _STD, respectively.

    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.
****************************************************************/


/*
    Include files and compiler specific stuff
*/
#include <clib/exec_protos.h>
#include <clib/locale_protos.h>

#if defined(__SASC)  ||  defined(_DCC)
#include <pragmas/exec_pragmas.h>
#include <pragmas/locale_pragmas.h>
#else
#error "Don't know how to handle your compiler."
#endif

#ifdef __SASC
#define __autoinit
#define __autoexit
#endif


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

static struct Catalog *%b_Catalog = NULL;

extern struct ExecBase *SysBase;
STATIC struct Library *LocaleBase;





STATIC __autoinit VOID _STIOpenCatalog(VOID)

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



STATIC __autoexit VOID _STDCloseCatalog(VOID)

  {
    if (LocaleBase)
      {
	CloseCatalog(%b_Catalog);
	%b_Catalog = NULL;
	CloseLibrary(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);
  }
