Subversion Repositories SvarDOS

Rev

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

Rev 1547 Rev 1548
Line 56... Line 56...
56
                     SCHEME_ERR    = 0x70;
56
                     SCHEME_ERR    = 0x70;
57
 
57
 
58
static unsigned char screenw, screenh, screenlastrow, screenlastcol;
58
static unsigned char screenw, screenh, screenlastrow, screenlastcol;
59
static unsigned char glob_monomode, glob_tablessmode;
59
static unsigned char glob_monomode, glob_tablessmode;
60
 
60
 
-
 
61
static char buff[512]; /* short lived buffer for whatever needed */
-
 
62
 
61
static struct {
63
static struct {
62
    unsigned char from;
64
    unsigned char from;
63
    unsigned char to;
65
    unsigned char to;
64
    unsigned char statusbar;
66
    unsigned char statusbar;
65
} uidirty = {0, 0xff, 1}; /* make sure to redraw entire UI at first run */
67
} uidirty = {0, 0xff, 1}; /* make sure to redraw entire UI at first run */
Line 635... Line 637...
635
 
637
 
636
#define LOADFILE_FILENOTFOUND 2
638
#define LOADFILE_FILENOTFOUND 2
637
 
639
 
638
/* returns 0 on success, 1 on file not found, 2 on other error */
640
/* returns 0 on success, 1 on file not found, 2 on other error */
639
static unsigned char loadfile(struct file *db, const char *fname) {
641
static unsigned char loadfile(struct file *db, const char *fname) {
640
  char buff[512]; /* read one entire sector at a time (faster) */
-
 
641
  char *buffptr;
642
  char *buffptr;
642
  unsigned int len, llen;
643
  unsigned int len, llen;
643
  int fd;
644
  int fd;
644
  unsigned char eolfound;
645
  unsigned char eolfound;
645
  unsigned char err = 0;
646
  unsigned char err = 0;
Line 960... Line 961...
960
 
961
 
961
/* main returns nothing, ie. sved always exits with a zero exit code
962
/* main returns nothing, ie. sved always exits with a zero exit code
962
 * (this saves 20 bytes of executable footprint) */
963
 * (this saves 20 bytes of executable footprint) */
963
void main(void) {
964
void main(void) {
964
  static struct file dbarr[10];
965
  static struct file dbarr[10];
965
  unsigned char curfile;
966
  unsigned short curfile;
966
  struct file *db = dbarr; /* visible file is the first slot by default */
967
  struct file *db = dbarr; /* visible file is the first slot by default */
967
  struct line far *clipboard = NULL;
968
  static struct line far *clipboard;
968
  static unsigned char original_breakflag;
969
  static unsigned char original_breakflag;
969
 
970
 
970
  { /* load NLS resource */
971
  { /* load NLS resource */
971
    unsigned short i = 0;
972
    unsigned short i = 0;
972
    const char far *selfptr;
973
    const char far *selfptr;
973
    char self[128], lang[8];
974
    char lang[8];
974
    selfptr = mdr_dos_selfexe();
975
    selfptr = mdr_dos_selfexe();
975
    if (selfptr != NULL) {
976
    if (selfptr != NULL) {
976
      do {
977
      do {
977
        self[i] = selfptr[i];
978
        buff[i] = selfptr[i];
978
      } while (self[i++] != 0);
979
      } while (buff[i++] != 0);
979
      svarlang_autoload_exepath(self, mdr_dos_getenv(lang, "LANG", sizeof(lang)));
980
      svarlang_autoload_exepath(buff, mdr_dos_getenv(lang, "LANG", sizeof(lang)));
980
    }
981
    }
981
  }
982
  }
982
 
983
 
983
  /* preload all slots with empty files */
984
  /* preload all slots with empty files */
984
  for (curfile = 9;; curfile--) {
985
  for (curfile = 9;; curfile--) {