Subversion Repositories SvarDOS

Rev

Rev 1908 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1908 Rev 1921
Line 19... Line 19...
19
 
19
 
20
#include <stdio.h>
20
#include <stdio.h>
21
#include <string.h>
21
#include <string.h>
22
 
22
 
23
 
23
 
-
 
24
static unsigned char EGAFILES_USED[20];
-
 
25
 
24
/* global file pointers */
26
/* global file pointers */
25
FILE *fdkeyb, *fdoff;
27
FILE *fdkeyb, *fdoff;
26
 
28
 
27
 
29
 
28
/* Converts a positive base_10 into base_8 */
30
/* Converts a positive base_10 into base_8 */
Line 38... Line 40...
38
 
40
 
39
 
41
 
40
static void addnew(char *countrycode, unsigned short countryid, char *humanlang, char *keybcode, unsigned short cp, unsigned char egafile, unsigned char keybfile, unsigned int subid) {
42
static void addnew(char *countrycode, unsigned short countryid, char *humanlang, char *keybcode, unsigned short cp, unsigned char egafile, unsigned char keybfile, unsigned int subid) {
41
  static char lastcountry[4] = {0};
43
  static char lastcountry[4] = {0};
42
  static int curoffset = 0, curcountryoffset = 0;
44
  static int curoffset = 0, curcountryoffset = 0;
-
 
45
  int i;
-
 
46
 
-
 
47
  /* remember the EGA file */
-
 
48
  for (i = 0; (EGAFILES_USED[i] != egafile) && (EGAFILES_USED[i] != 0xff); i++);
-
 
49
  EGAFILES_USED[i] = egafile;
-
 
50
 
43
  /* if new country, declare an offset */
51
  /* if new country, declare an offset */
44
  if (strcmp(countrycode, lastcountry) != 0) {
52
  if (strcmp(countrycode, lastcountry) != 0) {
45
    /* close previous one, if any */
53
    /* close previous one, if any */
46
    if (lastcountry[0] != 0) {
54
    if (lastcountry[0] != 0) {
47
      fprintf(fdoff, "#define OFFLEN_%s %d\r\n", lastcountry, curoffset - curcountryoffset);
55
      fprintf(fdoff, "#define OFFLEN_%s %d\r\n", lastcountry, curoffset - curcountryoffset);
Line 68... Line 76...
68
}
76
}
69
 
77
 
70
 
78
 
71
int main(void) {
79
int main(void) {
72
 
80
 
-
 
81
  /* reset EGAFILES_USED, it will be used to remember which EGA*.CPX files are
-
 
82
   * required by the SvarDOS installer */
-
 
83
  memset(EGAFILES_USED, 0xff, sizeof(EGAFILES_USED));
-
 
84
 
73
  /*** open files ***/
85
  /*** open files ***/
74
  fdkeyb = fopen("keylay.h", "wb");
86
  fdkeyb = fopen("keylay.h", "wb");
75
  fdoff = fopen("keyoff.h", "wb");
87
  fdoff = fopen("keyoff.h", "wb");
76
  fprintf(fdkeyb, "/* DO NOT EDIT THIS FILE, IT IS AUTO-GENERATED BY LOCALES.EXE */\r\n");
88
  fprintf(fdkeyb, "/* DO NOT EDIT THIS FILE, IT IS AUTO-GENERATED BY LOCALES.EXE */\r\n");
77
  fprintf(fdoff, "/* DO NOT EDIT THIS FILE, IT IS AUTO-GENERATED BY LOCALES.EXE */\r\n");
89
  fprintf(fdoff, "/* DO NOT EDIT THIS FILE, IT IS AUTO-GENERATED BY LOCALES.EXE */\r\n");
Line 142... Line 154...
142
 
154
 
143
  /* close files */
155
  /* close files */
144
  fclose(fdoff);
156
  fclose(fdoff);
145
  fclose(fdkeyb);
157
  fclose(fdkeyb);
146
 
158
 
-
 
159
  /* report what ega files are needed */
-
 
160
  {
-
 
161
    int i, ii;
-
 
162
    puts("Required EGA files:");
-
 
163
    for (ii = 0; ii < 20; ii++) {
-
 
164
      for (i = 0; EGAFILES_USED[i] != 0xff; i++) {
-
 
165
        if (EGAFILES_USED[i] != ii) continue;
-
 
166
        if (EGAFILES_USED[i] == 0) {
-
 
167
          printf("EGA.CPX\r\n");
-
 
168
        } else {
-
 
169
          printf("EGA%u.CPX\r\n", EGAFILES_USED[i]);
-
 
170
        }
-
 
171
        break;
-
 
172
      }
-
 
173
    }
-
 
174
  }
-
 
175
 
147
  return(0);
176
  return(0);
148
}
177
}