Subversion Repositories SvarDOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1331 → Rev 1332

/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 = 275u;
const unsigned short svarlang_string_count = 14u;
const unsigned short svarlang_memsz = 284u;
const unsigned short svarlang_string_count = 15u;
 
char svarlang_mem[275] = {
char svarlang_mem[284] = {
0x48,0x45,0x4c,0x50,0x00,
0x4e,0x45,0x57,0x20,0x46,0x49,0x4c,0x45,0x00,
0x53,0x41,0x56,0x45,0x44,0x00,
11,6 → 11,7
0x77,0x69,0x6c,0x6c,0x20,0x62,0x65,0x20,0x6c,0x6f,0x73,0x74,0x2e,0x00,
0x50,0x72,0x65,0x73,0x73,0x20,0x45,0x4e,0x54,0x45,0x52,0x20,0x74,0x6f,0x20,0x63,
0x6f,0x6e,0x66,0x69,0x72,0x6d,0x2e,0x00,
0x53,0x61,0x76,0x65,0x20,0x61,0x73,0x3a,0x00,
0x75,0x73,0x61,0x67,0x65,0x3a,0x20,0x73,0x76,0x65,0x64,0x20,0x66,0x69,0x6c,0x65,
0x2e,0x74,0x78,0x74,0x00,
0x46,0x35,0x20,0x20,0x3d,0x20,0x73,0x61,0x76,0x65,0x20,0x66,0x69,0x6c,0x65,0x00,
26,7 → 27,7
0x50,0x72,0x65,0x73,0x73,0x20,0x61,0x6e,0x79,0x20,0x6b,0x65,0x79,0x00
};
 
unsigned short svarlang_dict[28] = {
unsigned short svarlang_dict[30] = {
0x0000,0x0000,
0x0001,0x0005,
0x0002,0x000e,
33,12 → 34,13
0x0003,0x0014,
0x0004,0x0022,
0x0005,0x0040,
0x0100,0x0058,
0x0800,0x006d,
0x0801,0x007d,
0x0802,0x008e,
0x0803,0x00a8,
0x0804,0x00c7,
0x080a,0x00e6,
0x080b,0x00f1
0x0006,0x0058,
0x0100,0x0061,
0x0800,0x0076,
0x0801,0x0086,
0x0802,0x0097,
0x0803,0x00b1,
0x0804,0x00d0,
0x080a,0x00ef,
0x080b,0x00fa
};
/sved/trunk/nls/en_utf8.txt
10,6 → 10,7
0.3:SAVING FAILED
0.4:Unsaved changes will be lost.
0.5:Press ENTER to confirm.
0.6:Save as:
 
################
# USAGE SCREEN #
/sved/trunk/sved.c
43,12 → 43,13
#define COL_TXT 0
#define COL_STATUSBAR1 1
#define COL_STATUSBAR2 2
#define COL_SCROLLBAR 3
#define COL_MSG 4
#define COL_ERR 5
#define COL_STATUSBAR3 3
#define COL_SCROLLBAR 4
#define COL_MSG 5
#define COL_ERR 6
 
/* preload the mono scheme (to be overloaded at runtime if color adapter present) */
static unsigned char scheme[] = {0x07, 0x70, 0x70, 0x70, 0x70, 0xf0};
static unsigned char scheme[] = {0x07, 0x70, 0x70, 0xf0, 0x70, 0x70, 0xf0};
 
static unsigned char screenw, screenh;
 
76,7 → 77,7
unsigned short curline;
char lfonly; /* set if line endings are LF (CR/LF otherwise) */
char modflag; /* non-zero if file has been modified since last save */
char fname[1]; /* dynamically sized */
char fname[128];
};
 
 
109,6 → 110,45
}
 
 
static void ui_getstring(const char *query, char *s, unsigned char maxlen) {
unsigned char len = 0, y, x;
int k;
 
if (maxlen == 0) return;
maxlen--; /* make room for the nul terminator */
 
y = screenh - 1;
 
/* print query string */
x = mdr_cout_str(y, 0, query, scheme[COL_STATUSBAR3], 40);
mdr_cout_char_rep(y, x++, ' ', scheme[COL_STATUSBAR3], screenw - x);
 
for (;;) {
mdr_cout_locate(y, x + len);
k = keyb_getkey();
 
if (k == 0x1b) return; /* ESC */
 
if (k == '\r') {
s[len] = 0;
return;
}
 
if ((k == 0x08) && (len > 0)) { /* BKSPC */
len--;
mdr_cout_char(y, x + len, ' ', scheme[COL_STATUSBAR3]);
continue;
}
 
if ((k <= 0xff) && (k >= ' ') && (len < maxlen)) {
mdr_cout_char(y, x + len, k, scheme[COL_STATUSBAR3]);
s[len++] = k;
}
 
}
}
 
 
/* append a nul-terminated string to line at cursor position */
static int line_append(struct file *f, const char far *buf, unsigned short len) {
struct line far *n;
138,6 → 178,7
scheme[COL_TXT] = 0x17;
scheme[COL_STATUSBAR1] = 0x70;
scheme[COL_STATUSBAR2] = 0x78;
scheme[COL_STATUSBAR3] = 0xf0;
scheme[COL_SCROLLBAR] = 0x70;
scheme[COL_MSG] = 0xf0;
scheme[COL_ERR] = 0x4f;
473,7 → 514,7
struct file *db;
 
len = strlen(fname) + 1;
db = calloc(1, sizeof(struct file) + len);
db = calloc(1, sizeof(struct file));
if (db == NULL) return(NULL);
memcpy(db->fname, fname, len);
 
567,15 → 608,19
}
 
 
static int savefile(const struct file *db) {
static int savefile(const struct file *db, const char *newfname) {
int fd;
const struct line far *l;
unsigned bytes;
unsigned char eollen;
unsigned char eolbuf[2];
int errflag = 0;
 
if (_dos_open(db->fname, O_WRONLY, &fd) != 0) {
return(-1);
/* either create a new file if newfname provided, or... */
if (newfname) {
if (_dos_creatnew(newfname, _A_NORMAL, &fd) != 0) return(-1);
} else { /* ...open db->fname */
if (_dos_open(db->fname, O_WRONLY, &fd) != 0) return(-1);
}
 
l = db->cursor;
594,17 → 639,17
while (l) {
/* do not write the last empty line, it is only useful for edition */
if (l->len != 0) {
_dos_write(fd, l->payload, l->len, &bytes);
errflag |= _dos_write(fd, l->payload, l->len, &bytes);
} else if (l->next == NULL) {
break;
}
_dos_write(fd, eolbuf, eollen, &bytes);
errflag |= _dos_write(fd, eolbuf, eollen, &bytes);
l = l->next;
}
 
_dos_close(fd);
errflag |= _dos_close(fd);
 
return(0);
return(errflag);
}
 
 
749,8 → 794,20
uidirty.from = 0;
uidirty.to = 0xff;
 
} else if (k == 0x13f) { /* F5 */
if (savefile(db) == 0) {
} else if ((k == 0x13f) || (k == 0x140)) { /* F5 or F6 */
int saveres;
 
if ((k == 0x140) || (db->fname[0] == 0)) { /* save as... */
char fname[25];
ui_getstring(svarlang_str(0,6), fname, sizeof(fname));
if (*fname == 0) continue;
saveres = savefile(db, fname);
if (saveres == 0) memcpy(db->fname, fname, sizeof(fname));
} else {
saveres = savefile(db, NULL);
}
 
if (saveres == 0) {
db->modflag = 0;
ui_msg(svarlang_str(0, 2), NULL, scheme[COL_MSG]);
mdr_bios_tickswait(11); /* 11 ticks is about 600 ms */
759,6 → 816,9
mdr_bios_tickswait(36); /* 2s */
}
 
ui_basic(db);
ui_refresh(db);
 
} else if (k == 0x144) { /* F10 */
db->modflag = 1;
db->lfonly ^= 1;
/sved/trunk/sved.lng
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream