Subversion Repositories SvarDOS

Rev

Rev 585 | Rev 591 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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