Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1538 → Rev 1539

/sved/trunk/deflang.c
8,8 → 8,8
0x53,0x41,0x56,0x45,0x44,0x00,
0x55,0x6e,0x73,0x61,0x76,0x65,0x64,0x20,0x63,0x68,0x61,0x6e,0x67,0x65,0x73,0x20,
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,
0x45,0x4e,0x54,0x45,0x52,0x20,0x3d,0x20,0x63,0x6f,0x6e,0x66,0x69,0x72,0x6d,0x20,
0x2f,0x20,0x53,0x50,0x41,0x43,0x45,0x20,0x3d,0x20,0x73,0x61,0x76,0x65,0x00,
0x53,0x61,0x76,0x65,0x20,0x61,0x73,0x3a,0x00,
0x4c,0x6f,0x61,0x64,0x3a,0x00,
0x50,0x72,0x65,0x73,0x73,0x20,0x45,0x53,0x43,0x20,0x74,0x6f,0x20,0x63,0x61,0x6e,
42,22 → 42,22
0x0002,0x0012,
0x0004,0x0018,
0x0005,0x0036,
0x0006,0x004e,
0x0007,0x0057,
0x0008,0x005d,
0x000a,0x0072,
0x000b,0x0078,
0x000c,0x0087,
0x0101,0x0096,
0x0102,0x00b3,
0x0103,0x00bb,
0x0104,0x00d4,
0x010a,0x00d8,
0x010b,0x00f2,
0x0801,0x0113,
0x0802,0x011d,
0x0803,0x0122,
0x0804,0x012d,
0x0805,0x0138,
0x0806,0x0143
0x0006,0x0055,
0x0007,0x005e,
0x0008,0x0064,
0x000a,0x0079,
0x000b,0x007f,
0x000c,0x008e,
0x0101,0x009d,
0x0102,0x00ba,
0x0103,0x00c2,
0x0104,0x00db,
0x010a,0x00df,
0x010b,0x00f9,
0x0801,0x011a,
0x0802,0x0124,
0x0803,0x0129,
0x0804,0x0134,
0x0805,0x013f,
0x0806,0x014a
};
/sved/trunk/nls/en_utf8.txt
19,7 → 19,7
0.1:UNTITLED
0.2:SAVED
0.4:Unsaved changes will be lost.
0.5:Press ENTER to confirm.
0.5:ENTER = confirm / SPACE = save
0.6:Save as:
0.7:Load:
0.8:Press ESC to cancel.
/sved/trunk/nls/fr_utf8.txt
12,7 → 12,7
0.1:SANS NOM
0.2:OK
0.4:Les données non enreg. seront perdues
0.5:ENTRÉE pour valider
0.5:ENTRÉE=valider / ESPACE=enregistrer
0.6:Enreg. sous:
0.7:Ouvrir:
0.8:ÉCHAP pour annuler
/sved/trunk/nls/pl_utf8.txt
12,7 → 12,7
0.1:BEZ NAZWY
0.2:ZAPISANO
0.4:Niezapisane zmiany zostaną utracone.
0.5:Potwierdź z ENTER.
0.5:ENTER = potwierdź / SPACJA = zapisz
0.6:Zapisz jako:
0.7:Otwórz:
0.8:Anuluj z ESC.
/sved/trunk/nls/ru_utf8.txt
12,7 → 12,7
0.1:БЕЗ ИМЕНИ
0.2:СОХРАНЕН
0.4:Вы потеряете несохраненные данные.
0.5:Подтвердите с ENTER.
0.5:ENTER=подтвердить / Пробел=сохранить
0.6:Сохранить как:
0.7:Загрузка:
0.8:Отмена с ESC.
/sved/trunk/sved.c
222,6 → 222,64
}
 
 
static int savefile(const struct file *db, const char *saveas) {
int fd = 0;
const struct line far *l;
unsigned int bytes;
unsigned char eollen = 2;
const unsigned char *eolbuf = "\r\n";
int errflag = 0;
 
/* if filename not overloaded then use the fname in db */
if (saveas == NULL) saveas = db->fname;
 
_asm {
push ax
push cx
push dx
 
mov ah, 0x3C /* create or truncate file */
xor cx, cx /* file attributes */
mov dx, saveas /* works only in SMALL/TINY mode */
int 0x21
jnc DONE
mov errflag, ax
DONE:
mov fd, ax
 
pop dx
pop cx
pop ax
}
 
if (errflag != 0) return(-1);
 
l = db->cursor;
while (l->prev) l = l->prev;
 
/* preset line terminators */
if (db->lfonly) {
eolbuf++;
eollen--;
}
 
while (l) {
/* do not write the last empty line, it is only useful for edition */
if (l->len != 0) {
errflag |= _dos_write(fd, l->payload, l->len, &bytes);
} else if (l->next == NULL) {
break;
}
errflag |= _dos_write(fd, eolbuf, eollen, &bytes);
l = l->next;
}
 
errflag |= _dos_close(fd);
 
return(errflag);
}
 
 
static void ui_statusbar(const struct file *db, unsigned char slotnum) {
const char *s = svarlang_strid(0); /* ESC=MENU */
unsigned short helpcol = screenw - strlen(s);
303,7 → 361,7
}
 
y = (screenh - 6) >> 1;
x = (screenw - msglen - 4) >> 1;
x = (screenw - msglen - 3) >> 1;
for (i = y+2+msg2flag; i >= y; i--) mdr_cout_char_rep(i, x, ' ', attr, msglen + 2);
x++;
 
315,19 → 373,31
}
 
 
/* returns 0 if operation may proceed, non-zero to cancel */
static unsigned char ui_confirm_if_unsaved(const struct file *db) {
unsigned char r = 0;
int k;
 
if (db->modflag == 0) return(0);
 
mdr_cout_cursor_hide();
 
/* if file has been modified then ask for confirmation */
/* if file has been modified then ask for confirmation:
* ENTER : agree to data loss
* SPACE : SAVE file before quit (only if valid filename present)
* anything else: ABORT */
ui_msg(svarlang_str(0,4), svarlang_str(0,5), SCHEME_MSG);
if (mdr_dos_getkey2() != '\r') r = 1;
 
k = mdr_dos_getkey2();
mdr_cout_cursor_show();
 
return(r);
/* ENTER = agree to loose unsaved data */
if (k == '\r') return(0);
 
/* SPACE = save file and continue */
if ((k == ' ') && (db->fname[0] != 0) && (savefile(db, NULL) == 0)) return(0);
 
/* any other key = cancel operation */
return(1);
}
 
 
759,64 → 829,6
}
 
 
static int savefile(const struct file *db, const char *saveas) {
int fd = 0;
const struct line far *l;
unsigned int bytes;
unsigned char eollen = 2;
const unsigned char *eolbuf = "\r\n";
int errflag = 0;
 
/* if filename not overloaded then use the fname in db */
if (saveas == NULL) saveas = db->fname;
 
_asm {
push ax
push cx
push dx
 
mov ah, 0x3C /* create or truncate file */
xor cx, cx /* file attributes */
mov dx, saveas /* works only in SMALL/TINY mode */
int 0x21
jnc DONE
mov errflag, ax
DONE:
mov fd, ax
 
pop dx
pop cx
pop ax
}
 
if (errflag != 0) return(-1);
 
l = db->cursor;
while (l->prev) l = l->prev;
 
/* preset line terminators */
if (db->lfonly) {
eolbuf++;
eollen--;
}
 
while (l) {
/* do not write the last empty line, it is only useful for edition */
if (l->len != 0) {
errflag |= _dos_write(fd, l->payload, l->len, &bytes);
} else if (l->next == NULL) {
break;
}
errflag |= _dos_write(fd, eolbuf, eollen, &bytes);
l = l->next;
}
 
errflag |= _dos_close(fd);
 
return(errflag);
}
 
 
static void insert_in_line(struct file *db, const char *databuf, unsigned short len) {
if (curline_resize(db, db->cursor->len + len) == 0) {
unsigned short off = db->xoffset + db->cursorposx;
/sved/trunk/sved.lng
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/sved/trunk/sved.txt
69,6 → 69,7
### CHANGELOG ################################################################
 
2023.5 [xx Nov 2023]
- modified files can be saved at exit time with the space key
- improved compatibility with DOS 2.x
 
2023.4 [27 Aug 2023]