##stringtype C
##shortstrings
/* $Id: C_c_AHI.sd,v 4.2 1999/01/15 22:40:25 lcs Exp $
* $Log: C_c_AHI.sd,v $
* Revision 4.2  1999/01/15 22:40:25  lcs
* Fixed a couple of warnings.
*
* Revision 4.1  1997/04/02 22:29:53  lcs
* Bumped to version 4
*
* Revision 1.1  1997/02/03 16:22:45  lcs
* Initial revision
*
*/
/****************************************************************
   This file was created automatically by `%fv'
   from "%f0".

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

#include "ahi_def.h"

#include <libraries/locale.h>
#include <proto/locale.h>


static LONG %b_Version = %v;
static const STRPTR %b_BuiltInLanguage = (STRPTR) %l;

struct FC_Type
{   LONG   ID;
    STRPTR Str;
};


const struct FC_Type _%i = { %d, %s };


static struct Catalog *%b_Catalog = NULL;

void Open%bCatalog(struct Locale *loc, STRPTR language)
{
  LONG tag, tagarg;

  if(LocaleBase != NULL  &&  %b_Catalog == NULL)
  {
    if(language == NULL)
    {
      tag = TAG_IGNORE;
    }
    else
    {
      tag = OC_Language;
      tagarg = (LONG) language;
    }

    %b_Catalog = OpenCatalog(loc, (STRPTR) "%b.catalog",
        OC_BuiltInLanguage, (ULONG) %b_BuiltInLanguage,
        tag, tagarg,
        OC_Version, %b_Version,
        TAG_DONE);
  }
}

struct Catalog *ExtOpenCatalog(struct Locale *loc, STRPTR language)
{
  LONG tag, tagarg;

  if(LocaleBase != NULL)
  {
    if(language == NULL)
    {
      tag = TAG_IGNORE;
    }
    else
    {
      tag = OC_Language;
      tagarg = (LONG) language;
    }

    return OpenCatalog(loc, (STRPTR) "%b.catalog",
        OC_BuiltInLanguage, (ULONG) %b_BuiltInLanguage,
        tag, tagarg,
        OC_Version, %b_Version,
        TAG_DONE);
  }
  return NULL;
}

void Close%bCatalog(void)
{
  if (LocaleBase != NULL)
  {
    CloseCatalog(%b_Catalog);
  }
  %b_Catalog = NULL;
}

void ExtCloseCatalog(struct Catalog *catalog)
{
  if (LocaleBase != NULL)
  {
    CloseCatalog(catalog);
  }
}

STRPTR Get%bString(APTR fcstr)
{
  STRPTR defaultstr;
  LONG strnum;

  strnum = ((struct FC_Type *) fcstr)->ID;
  defaultstr = ((struct FC_Type *) fcstr)->Str;

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

STRPTR GetString(APTR fcstr, struct Catalog *catalog)
{
  STRPTR defaultstr;
  LONG strnum;

  strnum = ((struct FC_Type *) fcstr)->ID;
  defaultstr = ((struct FC_Type *) fcstr)->Str;

  return(catalog ? GetCatalogStr(catalog, strnum, defaultstr) :
		      defaultstr);
}
