Subversion Repositories SvarDOS

Rev

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

Rev 1290 Rev 1293
Line 68... Line 68...
68
      else right = x - 1;
68
      else right = x - 1;
69
   }
69
   }
70
   return "";
70
   return "";
71
}
71
}
72
 
72
 
-
 
73
 
73
/* routines below are simplified (dos-based) versions of the libc FILE-related
74
/* routines below are simplified (dos-based) versions of the libc FILE-related
74
 * functions. Using them avoids a dependency on FILE, hence makes the binary
75
 * functions. Using them avoids a dependency on FILE, hence makes the binary
75
 * smaller if the application does not need to pull fopen() and friends */
76
 * smaller if the application does not need to pull fopen() and friends */
76
#ifndef WITHSTDIO
77
#ifndef WITHSTDIO
77
static unsigned short FOPEN(const char *s) {
78
static unsigned short FOPEN(const char *s) {
Line 162... Line 163...
162
    pop bx
163
    pop bx
163
  }
164
  }
164
}
165
}
165
#endif
166
#endif
166
 
167
 
-
 
168
 
167
int svarlang_load(const char *fname, const char *lang) {
169
int svarlang_load(const char *fname, const char *lang) {
168
  unsigned short langid;
170
  unsigned short langid;
169
  char hdr[5];
171
  unsigned long hdr;
170
  unsigned short buff16[2];
172
  unsigned short buff16[2];
171
  FHANDLE fd;
173
  FHANDLE fd;
172
  unsigned short string_count;
174
  unsigned short string_count;
173
 
175
 
174
  langid = *((unsigned short *)lang);
176
  langid = *((unsigned short *)lang);
175
  langid &= 0xDFDF; /* make sure lang is upcase */
177
  langid &= 0xDFDF; /* make sure lang is upcase */
176
 
178
 
177
  fd = FOPEN(fname);
179
  fd = FOPEN(fname);
178
  if (!fd) return(-1);
180
  if (!fd) return(-1);
179
 
181
 
180
  /* read hdr, should be "SvL1\x1a" */
182
  /* read hdr, should be "SvL\x1a" */
181
  if ((FREAD(fd, hdr, 5) != 5) || (memcmp(hdr, "SvL1\x1a", 5) != 0)) {
183
  if ((FREAD(fd, &hdr, 4) != 4) || (hdr != 0x1a4c7653L)) { /* 0x1a4c7653 = 'SvL\x1a' */
182
    FCLOSE(fd);
184
    FCLOSE(fd);
183
    return(-3);
185
    return(-3);
184
  }
186
  }
185
 
187
 
186
  /* read string count */
188
  /* read string count */