Subversion Repositories SvarDOS

Rev

Rev 586 | Go to most recent revision | Details | Compare with Previous | 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.
591 mateuszvis 3
 * Copyright (C) Mateusz Viste 2015-2022
585 mateuszvis 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
 
591 mateuszvis 21
 
585 mateuszvis 22
struct country {
591 mateuszvis 23
 
24
  struct {
25
    unsigned short id;          /* international id (48=PL, 33=FR, 01=US...) */
26
    unsigned short codepage;    /* usual codepage */
27
    unsigned short datefmt;     /* date format */
28
    char currsym[5];            /* currency symbol */
29
    char thousands[2];          /* thousands separator */
30
    char decimal[2];            /* decimal separator (like . or ,) */
31
    char datesep[2];            /* date separator (usually '-', '.' or '/') */
32
    char timesep[2];            /* time separator (usually ':') */
33
    unsigned char currpos:1;    /* 0=currency precedes the value, 1=follows it */
34
    unsigned char currspace:1;  /* set if the currency symbol should be one space away from the value */
35
    unsigned char currdecsym:1; /* set if the currency symbol should replace the decimal point */
36
    unsigned char ZEROED:5;
37
    unsigned char currprec;     /* currency precision (2 = 0.12) */
38
    unsigned char timefmt;      /* time format */
39
  } CTYINFO;
40
 
41
  struct {
42
    char yes[2];
43
    char no[2];
44
  } YESNO;
45
 
585 mateuszvis 46
};
47
 
48
/* Loads data from a country.sys file into a country struct.
49
 * Returns 0 on success, non-zero otherwise. */
591 mateuszvis 50
int country_read(struct country *countrydata, const char *fname);
585 mateuszvis 51
 
52
/* Computes a new country.sys file based on data from a country struct.
53
 * Returns 0 on success, non-zero otherwise. */
591 mateuszvis 54
int country_write(const char *fname, struct country *countrydata);
585 mateuszvis 55
 
56
#endif