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

@ -174,7 +174,7 @@ long TMemo_file::set_field(TTextfile& t, long id)
fseek(_fp, 0, SEEK_END);
// 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);
#else
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);
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);
#else
locking(fileno(_fp), LK_UNLCK, MAX_SIZE);

@ -180,7 +180,7 @@ void TPrintwin::paint_row(long j)
const char* cp;
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();
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);
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.
s.insert("\n"); // Quando uscira' un nuovo driver, si dovra' controllare
#endif // se esiste ancora questo piccolo bigol.
@ -290,7 +290,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
{
TPrinter& p = printer();
#if XVT_OS != XVT_OS_SCOUNIX
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
_printrcd = p.get_printrcd();
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);
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
int abs_column=p.get_column_offset();

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

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

@ -204,36 +204,49 @@ public:
// @cmember Concatena una stringa all'oggetto stringa (usato per aumentare l'efficienza)
TString& operator <<(const TString& str);
// @cmember Controlla se due stringhe sono uguali
bool operator ==(const char* s) const
{ return strcmp(_str, s) == 0; }
// @cmember Controlla se due stringhe sono uguali
bool operator ==(char* s) const
{ 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
{ 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
{ return strcmp(_str, s) != 0; }
// @cmember Controlla se due stringhe sono diversi
// @cmember Controlla se due stringhe sono diverse
bool operator !=(char* s) const
{ 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
{ 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
{ 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
{ 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
{ 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
{ 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
bool match(const char* pat) const
{ return ::match(pat, _str); }

@ -25,7 +25,7 @@
#define M_SHOW_RULERS (M_EDIT+20)
#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_CHECK_ON 110

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

@ -1,3 +1,5 @@
#define STRICT
#define XVT_INCL_NATIVE
#include <applicat.h>
#include <checks.h>
#include <urldefid.h>
@ -7,7 +9,7 @@
#include <window.h>
#include <colors.h>
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#define STRICT
#include <windows.h>
#endif
@ -180,6 +182,7 @@ HIDDEN void xvt_menu_enable(MENU_ITEM* m, bool on)
switch(m->tag)
{
case MENU_FILE: // Leave it as is
case M_FONT:
case -1: // Separator
break;
default:
@ -733,7 +736,7 @@ void TWindow::set_focus()
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);
ShowWindow(hwnd, SW_MINIMIZE);
#endif
@ -741,7 +744,7 @@ void TWindow::iconize() 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);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
#else
@ -893,7 +896,7 @@ void TWindow::frame(
r.top = f.v; r.left = f.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)
{
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)
{
PNT pnt = log2dev(x,y);
#if XVTWS != WMWS
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
pnt.v += BASEY;
#endif
@ -1003,7 +1006,7 @@ void TWindow::line(short x0, short y0, short x1, short y1)
PNT f = log2dev(x0,y0);
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.v == 0) f.v = -CHARY; else f.v += CHARY>>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)
{
#if XVTWS == WMWS
#if XVT_OS == XVT_OS_SCOUNIX
bar(x0, y0, x0+1, y0+1);
#else
PNT f = log2dev(x0,y0);