#include "riscos.h"
#include <locale.h>

class Territory : public Module
{
 private:
  unsigned int *pmem; // Pointer to base of private memory
  unsigned int table[9][9];
  unsigned char *ltrans, *utrans;
  void *misc; // Pointer to return misc information via pmem

  void TaskInfo (void);
  void Initialise (void);
  void BuildTable (int code, int (*proc) (int));

  // SWIs
  void Number (void);
  void NameToNumber (void);
  void NumberToName (void);
  void ReadCurrentTimeZone (void);
  void ReadTimeZones (void);
  void ConvertTimeToUTCOrdinals (void);
  void ConvertTimeToOrdinals (void);
  void ConvertOrdinalsToTime (void);
  void CharacterPropertyTable (void);
  void LowerCaseTable (void);
  void UpperCaseTable (void);
  void ReadSymbols (void);
  void Collate (void);

public:
  char *module_name;
  int version_major;
  int version_minor;
  int swi_chunk_begin;
  int swi_chunk_end;

  Territory (void) : Module ()
  {
    module_name = "Territory";
    version_major = 1;
    version_minor = 0;
    swi_chunk_begin = 0x43040;
    swi_chunk_end = 0x4307f;
    Initialise ();
  }
  virtual ~Territory () {}

  unsigned int SWIChunkBegin (void) { return swi_chunk_begin; }
  unsigned int SWIChunkEnd (void) { return swi_chunk_end; }
  bool SWI (unsigned int swinum, bool xbit);
};
