/sved/trunk/deflang.c |
---|
1,8 → 1,8 |
/* THIS FILE HAS BEEN GENERATED BY TLUMACZ (PART OF THE SVARLANG LIBRARY) */ |
const unsigned short svarlang_memsz = 232u; |
const unsigned short svarlang_string_count = 18u; |
const unsigned short svarlang_memsz = 267u; |
const unsigned short svarlang_string_count = 19u; |
char svarlang_mem[232] = { |
char svarlang_mem[267] = { |
0x45,0x53,0x43,0x3d,0x4d,0x45,0x4e,0x55,0x00, |
0x4e,0x45,0x57,0x20,0x46,0x49,0x4c,0x45,0x00, |
0x53,0x41,0x56,0x45,0x44,0x00, |
17,8 → 17,10 |
0x63,0x65,0x6c,0x2e,0x00, |
0x45,0x52,0x52,0x4f,0x52,0x00, |
0x46,0x49,0x4c,0x45,0x20,0x4e,0x4f,0x54,0x20,0x46,0x4f,0x55,0x4e,0x44,0x00, |
0x54,0x6f,0x6f,0x20,0x6d,0x61,0x6e,0x79,0x20,0x66,0x69,0x6c,0x65,0x73,0x00, |
0x75,0x73,0x61,0x67,0x65,0x3a,0x20,0x73,0x76,0x65,0x64,0x20,0x5b,0x66,0x69,0x6c, |
0x65,0x2e,0x74,0x78,0x74,0x5d,0x00, |
0x65,0x31,0x2e,0x74,0x78,0x74,0x5d,0x20,0x5b,0x2e,0x2e,0x2e,0x5d,0x20,0x5b,0x66, |
0x69,0x6c,0x65,0x31,0x30,0x2e,0x74,0x78,0x74,0x5d,0x00, |
0x4f,0x70,0x65,0x6e,0x20,0x66,0x69,0x6c,0x65,0x00, |
0x53,0x61,0x76,0x65,0x00, |
0x53,0x61,0x76,0x65,0x20,0x61,0x73,0x2e,0x2e,0x2e,0x00, |
27,7 → 29,7 |
0x51,0x75,0x69,0x74,0x00 |
}; |
unsigned short svarlang_dict[36] = { |
unsigned short svarlang_dict[38] = { |
0x0000,0x0000, |
0x0001,0x0009, |
0x0002,0x0012, |
39,11 → 41,12 |
0x0008,0x006b, |
0x000a,0x0080, |
0x000b,0x0086, |
0x0100,0x0095, |
0x0801,0x00ac, |
0x0802,0x00b6, |
0x0803,0x00bb, |
0x0804,0x00c6, |
0x0805,0x00cc, |
0x0806,0x00d7 |
0x000c,0x0095, |
0x0100,0x00a4, |
0x0801,0x00cf, |
0x0802,0x00d9, |
0x0803,0x00de, |
0x0804,0x00e9, |
0x0805,0x00ef, |
0x0806,0x00fa |
}; |
/sved/trunk/nls/en_utf8.txt |
---|
15,18 → 15,18 |
0.8:Press ESC to cancel. |
0.10:ERROR |
0.11:FILE NOT FOUND |
0.12:Too many files |
################ |
# USAGE SCREEN # |
################ |
1.0:usage: sved [file.txt] |
1.0:usage: sved [file1.txt] [...] [file10.txt] |
############### |
# HELP SCREEN # |
############### |
######## |
# MENU # |
######## |
8.1:Open file |
8.2:Save |
/sved/trunk/sved.c |
---|
35,6 → 35,9 |
#include "svarlang\svarlang.h" |
#define PVER "2023.0" |
#define PDATE "2023" |
/***************************************************************************** |
* global variables and definitions * |
*****************************************************************************/ |
210,7 → 213,7 |
static void ui_basic(const struct file *db, unsigned short slotnum) { |
const char *s = svarlang_strid(0); /* HELP */ |
const char *s = svarlang_strid(0); /* ESC=MENU */ |
unsigned short helpcol = screenw - strlen(s); |
/* slot number */ |
492,39 → 495,6 |
} |
/* a custom argv-parsing routine that looks directly inside the PSP, avoids the need |
* of argc and argv, saves some 330 bytes of binary size */ |
static const char *parseargv(void) { |
char *tail = (void *)0x81; /* THIS WORKS ONLY IN SMALL MEMORY MODEL */ |
unsigned short count = 0; |
char *argv[2]; |
while (count < 2) { |
/* jump to nearest arg */ |
while (*tail == ' ') { |
*tail = 0; |
tail++; |
} |
if (*tail == '\r') { |
*tail = 0; |
break; |
} |
argv[count++] = tail; |
/* jump to next delimiter */ |
while ((*tail != ' ') && (*tail != '\r')) tail++; |
} |
/* check args now */ |
if (count == 0) return(""); |
if (count == 1) return(argv[0]); |
return(NULL); |
} |
/* returns 0 on success, 1 on file not found, 2 on other error */ |
static unsigned char loadfile(struct file *db, const char *fname) { |
char buff[512]; /* read one entire sector at a time (faster) */ |
629,6 → 599,72 |
} |
/* a custom argv-parsing routine that looks directly inside the PSP, avoids the need |
* of argc and argv, saves some 330 bytes of binary size |
* returns non-zero on error */ |
static int parseargv(struct file *dbarr) { |
char *tail = (void *)0x81; /* THIS WORKS ONLY IN SMALL MEMORY MODEL */ |
unsigned short count = 0; |
char *arg; |
unsigned short lastarg = 0; |
unsigned short err; |
while (!lastarg) { |
/* jump to nearest arg */ |
while (*tail == ' ') { |
*tail = 0; |
tail++; |
} |
if (*tail == '\r') { |
*tail = 0; |
break; |
} |
arg = tail; |
/* jump to next delimiter */ |
while ((*tail != ' ') && (*tail != '\r')) tail++; |
/* if \r then remember this is the last arg */ |
if (*tail == '\r') lastarg = 1; |
*tail = 0; |
tail++; |
/* look at the arg now */ |
if (*arg == '/') { |
mdr_coutraw_puts("Sved ver " PVER " Copyright (C) " PDATE " Mateusz Viste"); |
mdr_coutraw_puts(""); |
mdr_coutraw_puts(svarlang_str(1,0)); /* usage: sved file.txt */ |
return(-1); |
} |
/* looks to be a filename */ |
if (count == 10) { |
mdr_coutraw_puts(svarlang_str(0,12)); |
return(-1); /* too many files */ |
} |
/* try loading it */ |
mdr_coutraw_puts(arg); |
err = loadfile(&(dbarr[count]), arg); |
if (err) { |
if (err == 1) { /* file not found */ |
err = 11; |
} else { /* general error */ |
err = 10; |
} |
mdr_coutraw_puts(svarlang_str(0,err)); |
return(-1); |
} |
count++; |
} |
return(0); |
} |
static int savefile(const struct file *db, const char *newfname) { |
int fd; |
const struct line far *l; |
782,7 → 818,6 |
* (this saves 20 bytes of executable footprint) */ |
void main(void) { |
static struct file dbarr[10]; |
const char *fname; |
unsigned short curfile; |
struct file *db = dbarr; /* visible file is the first slot by default */ |
791,13 → 826,6 |
svarlang_autoload_pathlist("sved", mdr_dos_getenv(nlspath, "NLSPATH", sizeof(nlspath)), mdr_dos_getenv(lang, "LANG", sizeof(lang))); |
} |
fname = parseargv(); |
if ((fname == NULL) || (*fname == '/')) { |
mdr_coutraw_puts(svarlang_str(1,0)); /* usage: sved file.txt */ |
return; |
} |
/* preload all slots with empty files */ |
for (curfile = 9;; curfile--) { |
loadfile(&(dbarr[curfile]), ""); |
804,17 → 832,8 |
if (curfile == 0) break; |
} |
/* load file, if any given */ |
if (*fname != 0) { |
unsigned char err = loadfile(db, fname); |
if (err == 1) { |
mdr_coutraw_puts(svarlang_str(0,11)); /* file not found */ |
return; |
} else if (err != 0) { |
mdr_coutraw_puts(svarlang_str(0,10)); /* ERROR */ |
return; |
} |
} |
/* parse argv (and load files, if any passed on) */ |
if (parseargv(dbarr) != 0) return; |
if (mdr_cout_init(&screenw, &screenh)) { |
/* load color scheme if mdr_cout_init returns a color flag */ |
/sved/trunk/sved.lng |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/sved/trunk/sved.txt |
---|
24,7 → 24,7 |
What Sved does NOT have: |
- mouse support |
- any integrated file browser |
- an integrated file browser |
- copy/paste support |
- undo |
- search |