Porting per Win32

git-svn-id: svn://10.65.10.50/trunk@2811 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-05-14 10:16:31 +00:00
parent 8fbb2d13f5
commit 4796306755
8 changed files with 54 additions and 37 deletions

View File

@ -174,7 +174,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
fseek(_fp, 0, SEEK_END); fseek(_fp, 0, SEEK_END);
// lock file // lock file
#if XVT_OS == XVT_OS_WIN && XVT_CC == XVT_CC_MSV80 #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
_locking(_fileno(_fp), _LK_LOCK, MAX_SIZE); _locking(_fileno(_fp), _LK_LOCK, MAX_SIZE);
#else #else
locking(fileno(_fp), LK_LOCK, MAX_SIZE); locking(fileno(_fp), LK_LOCK, MAX_SIZE);
@ -212,7 +212,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
fseek(_fp, 0, SEEK_SET); fseek(_fp, 0, SEEK_SET);
fwrite(&_id_max, sizeof(long), 1, _fp); fwrite(&_id_max, sizeof(long), 1, _fp);
#if XVT_OS == XVT_OS_WIN && XVT_CC == XVT_CC_MSV80 #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
_locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE); _locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE);
#else #else
locking(fileno(_fp), LK_UNLCK, MAX_SIZE); locking(fileno(_fp), LK_UNLCK, MAX_SIZE);

View File

@ -180,7 +180,7 @@ void TPrintwin::paint_row(long j)
const char* cp; const char* cp;
while((cp = _txt.piece()) != NULL) while((cp = _txt.piece()) != NULL)
{ {
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
const int st = _txt.get_style(); const int st = _txt.get_style();
set_font(printer().fontname(), st, _char_size); set_font(printer().fontname(), st, _char_size);
@ -212,7 +212,7 @@ void TPrintwin::paint_row(long j)
{ {
set_font(printer().fontname(), XVT_FS_NONE, _char_size); set_font(printer().fontname(), XVT_FS_NONE, _char_size);
TString s(_txt.line(j)); TString s(_txt.line(j));
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if ((j % _realformlen) == 0 && (j != 0)) // Questo e' il patch per TTY.DRV. if ((j % _realformlen) == 0 && (j != 0)) // Questo e' il patch per TTY.DRV.
s.insert("\n"); // Quando uscira' un nuovo driver, si dovra' controllare s.insert("\n"); // Quando uscira' un nuovo driver, si dovra' controllare
#endif // se esiste ancora questo piccolo bigol. #endif // se esiste ancora questo piccolo bigol.
@ -290,7 +290,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
{ {
TPrinter& p = printer(); TPrinter& p = printer();
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
_printrcd = p.get_printrcd(); _printrcd = p.get_printrcd();
WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title()); WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title());
@ -306,7 +306,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
set_font(p.fontname(), XVT_FS_NONE, _char_size); set_font(p.fontname(), XVT_FS_NONE, _char_size);
LEN_SPACES(win(), -1); // force update LEN_SPACES(win(), -1); // force update
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
p.set_win_formlen(prwin); // Calcola offset e altre misure pagina p.set_win_formlen(prwin); // Calcola offset e altre misure pagina
int abs_column=p.get_column_offset(); int abs_column=p.get_column_offset();

View File

@ -7,7 +7,7 @@
#include <conf.h> #include <conf.h>
#include <modaut.h> #include <modaut.h>
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <dos.h> #include <dos.h>
#include <hlapi_c.h> #include <hlapi_c.h>
#endif #endif
@ -36,7 +36,7 @@ long get_std_level()
// @rdesc Numero di serie della chiave // @rdesc Numero di serie della chiave
int get_serial_number() int get_serial_number()
{ {
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY); const int status = HL_LOGIN(ModAd, DONT_CARE, REFKEY, VERKEY);
if (status != STATUS_OK) if (status != STATUS_OK)
return -1; return -1;
@ -85,7 +85,7 @@ void init_global_vars()
// @func Dealloca le variabili globali // @func Dealloca le variabili globali
void free_global_vars() void free_global_vars()
{ {
#if XVT_OS != XVT_OS_SCOUNIX #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
HL_LOGOUT(); HL_LOGOUT();
#endif #endif
if (openf != NULL) if (openf != NULL)

View File

@ -2,7 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#if XVT_OS==XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <strstrea.h> #include <strstrea.h>
#else #else
#include <strstream.h> #include <strstream.h>
@ -12,7 +12,7 @@
#include <prefix.h> #include <prefix.h>
#include <utility.h> #include <utility.h>
#if XVT_OS==XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <process.h> #include <process.h>
#else #else
#include <sys/types.h> #include <sys/types.h>
@ -321,7 +321,7 @@ int TString::find(
} }
#if XVT_OS != XVT_OS_WIN #if XVT_OS == XVT_OS_SCOUNIX
HIDDEN char* strstr(const char* string1, const char* string2) HIDDEN char* strstr(const char* string1, const char* string2)
{ {
const int len = strlen(string2); const int len = strlen(string2);
@ -879,7 +879,7 @@ TString& TFixed_string::format(
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
const char SLASH = const char SLASH =
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
'\\'; '\\';
#else #else
'/'; '/';
@ -958,7 +958,7 @@ bool TFilename::ok() const
{ {
switch(_str[c]) switch(_str[c])
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
case ':': case ':':
if (c != 1 || !isalpha(_str[0])) return FALSE; // Nome disco errato if (c != 1 || !isalpha(_str[0])) return FALSE; // Nome disco errato
len = 0; len = 0;
@ -1000,7 +1000,7 @@ const TFilename& TFilename::tempdir()
const char* dirpref = getenv("TEMP"); const char* dirpref = getenv("TEMP");
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP"); if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
if (dirpref == NULL || *dirpref == '\0') if (dirpref == NULL || *dirpref == '\0')
#if XVT_OS==XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
dirpref = "\\tmp"; dirpref = "\\tmp";
#else #else
dirpref = "/tmp"; dirpref = "/tmp";
@ -1060,7 +1060,7 @@ const TFilename& TFilename::temp(
strip("$#*?."); // ... toglie caratteri jolly strip("$#*?."); // ... toglie caratteri jolly
const TFixed_string f(prefix); const TFixed_string f(prefix);
#if XVT_OS==XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (f.find("$$") != -1) if (f.find("$$") != -1)
{ {
char pid[8]; char pid[8];

View File

@ -204,36 +204,49 @@ public:
// @cmember Concatena una stringa all'oggetto stringa (usato per aumentare l'efficienza) // @cmember Concatena una stringa all'oggetto stringa (usato per aumentare l'efficienza)
TString& operator <<(const TString& str); TString& operator <<(const TString& str);
// @cmember Controlla se due stringhe sono uguali // @cmember Controlla se due stringhe sono uguali
bool operator ==(const char* s) const bool operator ==(const char* s) const
{ return strcmp(_str, s) == 0; } { return strcmp(_str, s) == 0; }
// @cmember Controlla se due stringhe sono uguali // @cmember Controlla se due stringhe sono uguali
bool operator ==(char* s) const bool operator ==(char* s) const
{ return strcmp(_str, s) == 0; } { return strcmp(_str, s) == 0; }
// @cmember Controlla se due oggetti stringa sono uguali // @cmember Controlla se due stringe sono uguali
bool operator ==(const TString& s) const bool operator ==(const TString& s) const
{ return strcmp(_str, s._str) == 0; } { return strcmp(_str, s._str) == 0; }
// @cmember Controlla se due stringhe sono diversi // @cmember Controlla se due stringhe sono diverse
bool operator !=(const char* s) const bool operator !=(const char* s) const
{ return strcmp(_str, s) != 0; } { return strcmp(_str, s) != 0; }
// @cmember Controlla se due stringhe sono diversi // @cmember Controlla se due stringhe sono diverse
bool operator !=(char* s) const bool operator !=(char* s) const
{ return strcmp(_str, s) != 0; } { return strcmp(_str, s) != 0; }
// @cmember Controlla se due oggetti stringa sono diverse // @cmember Controlla se due stringhe sono diverse
bool operator !=(const TString& s) const bool operator !=(const TString& s) const
{ return strcmp(_str, s._str) != 0; } { return strcmp(_str, s._str) != 0; }
// @cmember Controlla se una stringa e piu' lunga di un'altra // @cmember Controlla se una stringa e' minore di un'altra
bool operator <(const char* s) const bool operator <(const char* s) const
{ return strcmp(_str, s) < 0; } { return strcmp(_str, s) < 0; }
// @cmember Controlla se una stringa e piu' corta di un'altra // @cmember Controlla se una stringa e' maggiore di un'altra
bool operator >(const char* s) const bool operator >(const char* s) const
{ return strcmp(_str, s) > 0; } { return strcmp(_str, s) > 0; }
// @cmember Controlla se una stringa e piu' lunga o uguale ad un'altra // @cmember Controlla se una stringa e' maggiore o uguale ad un'altra
bool operator >=(const char* s) const bool operator >=(const char* s) const
{ return strcmp(_str, s) >= 0; } { return strcmp(_str, s) >= 0; }
// @cmember Controlla se una stringa e piu' corta o uguale ad un'altra // @cmember Controlla se una stringa e' minore o uguale ad un'altra
bool operator <=(const char* s) const bool operator <=(const char* s) const
{ return strcmp(_str, s) <= 0; } { return strcmp(_str, s) <= 0; }
// @cmember Controlla se una stringa e' minore di un'altra
bool operator <(const TString & s) const
{ return strcmp(_str, s._str) < 0; }
// @cmember Controlla se una stringa e' maggiore di un'altra
bool operator >(const TString & s) const
{ return strcmp(_str, s._str) > 0; }
// @cmember Controlla se una stringa e' maggiore o uguale ad un'altra
bool operator >=(const TString & s) const
{ return strcmp(_str, s._str) >= 0; }
// @cmember Controlla se una stringa e' minore o uguale ad un'altra
bool operator <=(const TString & s) const
{ return strcmp(_str, s._str) <= 0; }
// @cmember Confronta usando le regular expression // @cmember Confronta usando le regular expression
bool match(const char* pat) const bool match(const char* pat) const
{ return ::match(pat, _str); } { return ::match(pat, _str); }

View File

@ -25,7 +25,7 @@
#define M_SHOW_RULERS (M_EDIT+20) #define M_SHOW_RULERS (M_EDIT+20)
#define M_SHOW_BUTTONS (M_EDIT+21) #define M_SHOW_BUTTONS (M_EDIT+21)
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define ICO_SEARCH 109 #define ICO_SEARCH 109
#define ICO_CHECK_ON 110 #define ICO_CHECK_ON 110

View File

@ -7,10 +7,11 @@
#include <xvt.h> #include <xvt.h>
#endif #endif
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#include <direct.h> #include <direct.h>
#include <io.h> #include <io.h>
#define F_OK 0 #define F_OK 0
#undef DIRECTORY
#else #else
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -52,7 +53,7 @@ bool fcopy(
// creati dei box di comunicazione che indicano la causa del problema // creati dei box di comunicazione che indicano la causa del problema
{ {
const char* wflag; const char* wflag;
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
const char* const rflag = "rb"; const char* const rflag = "rb";
if (append) if (append)
wflag = "ab"; wflag = "ab";
@ -117,7 +118,7 @@ bool make_dir(
const char* dir) // @parm Nome della directory da creare const char* dir) // @parm Nome della directory da creare
{ {
int res = int res =
#if XVT_OS==XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
mkdir(dir); mkdir(dir);
#else #else
mkdir(dir, 0777); mkdir(dir, 0777);
@ -414,7 +415,7 @@ const char * decode(
return __tmp_string; return __tmp_string;
} }
#if XVT_OS != XVT_OS_WIN #if XVT_OS == XVT_OS_SCOUNIX
// @doc EXTERNAL // @doc EXTERNAL

View File

@ -1,3 +1,5 @@
#define STRICT
#define XVT_INCL_NATIVE
#include <applicat.h> #include <applicat.h>
#include <checks.h> #include <checks.h>
#include <urldefid.h> #include <urldefid.h>
@ -7,7 +9,7 @@
#include <window.h> #include <window.h>
#include <colors.h> #include <colors.h>
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define STRICT #define STRICT
#include <windows.h> #include <windows.h>
#endif #endif
@ -180,6 +182,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
switch(m->tag) switch(m->tag)
{ {
case MENU_FILE: // Leave it as is case MENU_FILE: // Leave it as is
case M_FONT:
case -1: // Separator case -1: // Separator
break; break;
default: default:
@ -733,7 +736,7 @@ void TWindow::set_focus()
void TWindow::iconize() const void TWindow::iconize() const
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_MINIMIZE); ShowWindow(hwnd, SW_MINIMIZE);
#endif #endif
@ -741,7 +744,7 @@ void TWindow::iconize() const
void TWindow::maximize() const void TWindow::maximize() const
{ {
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW); HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_SHOWMAXIMIZED); ShowWindow(hwnd, SW_SHOWMAXIMIZED);
#else #else
@ -893,7 +896,7 @@ void TWindow::frame(
r.top = f.v; r.left = f.h; r.top = f.v; r.left = f.h;
r.bottom = t.v; r.right = t.h; r.bottom = t.v; r.right = t.h;
#if XVTWS != WMWS #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (flag & 2) if (flag & 2)
{ {
r.left += CHARX>>1; r.top += CHARY>>1; r.left += CHARX>>1; r.top += CHARY>>1;
@ -974,7 +977,7 @@ TPoint TWindow::dev2log(const PNT& p) const
void TWindow::stringat(short x, short y, const char* str) void TWindow::stringat(short x, short y, const char* str)
{ {
PNT pnt = log2dev(x,y); PNT pnt = log2dev(x,y);
#if XVTWS != WMWS #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
pnt.v += BASEY; pnt.v += BASEY;
#endif #endif
@ -1003,7 +1006,7 @@ void TWindow::line(short x0, short y0, short x1, short y1)
PNT f = log2dev(x0,y0); PNT f = log2dev(x0,y0);
PNT t = log2dev(x1,y1); PNT t = log2dev(x1,y1);
#if XVTWS != WMWS #if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1; if (f.h == 0) f.h = -CHARX; else f.h += CHARX>>1;
if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1; if (f.v == 0) f.v = -CHARY; else f.v += CHARY>>1;
if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1; if (t.h == 0) t.h = -CHARX; else t.h += CHARX>>1;
@ -1016,7 +1019,7 @@ void TWindow::line(short x0, short y0, short x1, short y1)
void TWindow::icon(short x0, short y0, int iconid) void TWindow::icon(short x0, short y0, int iconid)
{ {
#if XVTWS == WMWS #if XVT_OS == XVT_OS_SCOUNIX
bar(x0, y0, x0+1, y0+1); bar(x0, y0, x0+1, y0+1);
#else #else
PNT f = log2dev(x0,y0); PNT f = log2dev(x0,y0);