Subversion Repositories SvarDOS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
585 mateuszvis 1
/*
2
 * functions that read/write from/to the localcfg country.sys-like file.
3
 * Copyright (C) Mateusz Viste 2015
4
 */
5
 
6
#ifndef country_h_sentinel
7
#define country_h_sentinel
8
 
9
enum COUNTRY_DATEFMT {
10
  COUNTRY_DATE_MDY = 0, /* Month, Day, Year */
11
  COUNTRY_DATE_DMY = 1, /* Day, Month, Year */
12
  COUNTRY_DATE_YMD = 2  /* Year, Month, Day */
13
};
14
 
15
enum COUNTRY_TIMEFMT {
16
  COUNTRY_TIME12 = 0, /* AM/PM format (like 6:32 PM) */
17
  COUNTRY_TIME24 = 1  /* 24h format   (like 18:32) */
18
};
19
 
20
 
21
struct country {
22
  char currency[5]; /* currency symbold, ASCIIZ, 4 letters max */
23
  enum COUNTRY_DATEFMT datefmt; /* date format */
24
  enum COUNTRY_TIMEFMT timefmt; /* time format */
25
  short id;         /* international ID */
26
  short codepage;   /* usual codepage */
27
  unsigned char currencyprec; /* currency precision (2 = 0.12) */
28
  unsigned char currencydecsym; /* set if the currency symbol should replace the decimal point */
29
  unsigned char currencyspace; /* set if the currency symbol should be one space away from the value */
30
  unsigned char currencypos; /* 0=currency symbol precedes the value, 1=follows it */
31
  char decimal;     /* decimal separator (like . or ,) */
32
  char thousands;   /* thousands separatot */
33
  char datesep;     /* date separator (usually '-', '.' or '/') */
34
  char timesep;     /* time separator (usually ':') */
35
  char yes;         /* the "yes" character (example: 'Y') */
36
  char no;          /* the "no" character (example: 'N') */
37
};
38
 
39
/* Loads data from a country.sys file into a country struct.
40
 * Returns 0 on success, non-zero otherwise. */
41
int country_read(struct country *countrydata, char *fname);
42
 
43
/* Computes a new country.sys file based on data from a country struct.
44
 * Returns 0 on success, non-zero otherwise. */
45
int country_write(char *fname, struct country *countrydata);
46
 
47
#endif