Proting a 32Bit

git-svn-id: svn://10.65.10.50/trunk@4489 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-06-02 10:16:10 +00:00
parent 797062113f
commit 684d7bc7db
10 changed files with 119 additions and 114 deletions

View File

@ -726,7 +726,7 @@ bool TMask::on_key(
next_page(+1);
break;
case K_F1:
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (fexist("prassi.hlp"))
{
struct MULTIGUY

View File

@ -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_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_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_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_locking(_fileno(_fp), _LK_UNLCK, MAX_SIZE);
#else
locking(fileno(_fp), LK_UNLCK, MAX_SIZE);

View File

@ -4,7 +4,7 @@
#define XVT_INCL_NATIVE
#include <xvt.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <strstrea.h>
#else
#include <strstream.h>
@ -227,7 +227,7 @@ struct PrDesc
}
PrintWhat;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
void TPrinter::_get_windows_printer_names (TToken_string & t)
{
@ -893,7 +893,7 @@ PRINT_RCD* TPrinter::get_printrcd(int *size)
return _print_rcd;
}
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @doc EXTERNAL
@ -1045,7 +1045,7 @@ TPrinter::TPrinter()
: _date (TODAY), _multiple_link (FALSE), _frozen (FALSE), _isgraphics (TRUE),
_lines_per_inch (6), _ch_size (12), _ncopies(1), _export_header(FALSE),
_export_header_len(0), _vf(NULL), _l_offset(0), _c_offset(0)
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
, _print_rcd(NULL)
#endif
@ -1071,7 +1071,7 @@ TPrinter::TPrinter()
// read configuration file
read_configuration ();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// xvt_print_open ();
set_win_formlen ();
@ -1134,7 +1134,7 @@ bool TPrinter::isfax() const
TToken_string& TPrinter::getprinternames ()
{
// per ora va solo in windows
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_printer_names.empty())
_get_windows_printer_names(_printer_names);
#endif
@ -1243,7 +1243,7 @@ void TPrinter::read_configuration(
{
case 0:
case 5:
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_printertype = winprinter;
#else
PrinterDef & def = (PrinterDef &) get_description (_curprn);
@ -1320,7 +1320,7 @@ void TPrinter::save_configuration()
TPrinter::~TPrinter ()
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_print_rcd != NULL)
{
xvt_print_destroy(_print_rcd);
@ -1480,7 +1480,7 @@ bool TPrinter::printrow(
return TRUE;
}
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (_printertype == fileprinter)
{
@ -1752,7 +1752,7 @@ bool TPrinter::open()
_vf->open_modal ();
}
else if (_printertype == winprinter || _printertype == export
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
|| _printertype == fileprinter
#endif
)
@ -1811,7 +1811,7 @@ bool TPrinter::set()
mask.enable(DLG_OK, can_save);
// mask.enable(DLG_SAVEREC, can_save);
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
pn2 = getprinternames();
char old_default[80];
@ -1856,7 +1856,7 @@ bool TPrinter::set()
if (k == DLG_SETPRINT)
{
// l'handler setta default di windows a quella nel listbox e ribecca l'rcd
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (xvt_dm_post_page_setup(get_printrcd()))
{
// see if user has changed printer
@ -1984,7 +1984,7 @@ int TPrinter::set_bookmark(
void TPrinter::print_txt(TTextfile& txt)
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (txt.lines() > 0)
{
PrintWhat._prcd = _print_rcd;
@ -2041,7 +2041,7 @@ void TPrinter::close ()
txt.close();
}
}
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
else if (_printertype == winprinter && _txt.lines() > 0L)
{
print_txt(_txt);
@ -2094,7 +2094,7 @@ void TPrinter::close ()
#include <bagn004.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const char* const FORMAT_COMMAND = "FORMAT";
#else
const char* const FORMAT_COMMAND = "dosformat -fq";

View File

@ -390,7 +390,7 @@ public:
virtual ~TPrinter();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @cmember Inizia una nuova sessione di stampa. Viene passata alla <mf TPrintwin::do_print>
static BOOLEAN XVT_CALLCONV1 start_winprint(long);
#endif
@ -630,7 +630,7 @@ public:
void set_printrcd();
// @cmember Ritorna il record per la descrizione dello stato dell stampante
PRINT_RCD* get_printrcd(int* size = NULL);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// @cmember Setta le caratteristiche della stampante leggendole da <p _print_rcd>
void set_win_formlen(WINDOW prwin = NULL_WIN);
#endif

View File

@ -183,7 +183,7 @@ void TPrintwin::paint_row(long j)
const char* cp;
while((cp = _txt.piece()) != NULL)
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const int st = _txt.get_style();
set_font(printer().fontname(), st, _char_size);
@ -215,7 +215,7 @@ void TPrintwin::paint_row(long j)
else
{
set_font(printer().fontname(), XVT_FS_NONE, _char_size);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
// Questa e' la patch per TTY.DRV.
const TString s(_txt.line(j - _frlc));
if (j > 0 && (j % _realformlen) == 0 || _blank_lines_to_print > 0)
@ -358,7 +358,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
{
TPrinter& p = printer();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
_printrcd = p.get_printrcd();
WINDOW prwin = xvt_print_create_win(_printrcd, (char*)(const char*)main_app().title());
@ -375,7 +375,7 @@ TPrintwin::TPrintwin(TTextfile& txt)
LEN_SPACES(win(), -1); // force update
_pagelen = p.formlen();
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
p.set_win_formlen(prwin); // Calcola offset e altre misure pagina
int abs_column=p.get_column_offset();

View File

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

View File

@ -2,7 +2,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <strstrea.h>
#else
#include <strstream.h>
@ -12,7 +12,7 @@
#include <prefix.h>
#include <utility.h>
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <process.h>
#else
#include <sys/types.h>
@ -455,9 +455,9 @@ TString& TString::rpad(const int n,const char c)
if (n>l)
{
if (n > size()) resize(n, TRUE);
memset(_str+l, c, n-l);
_str[n] = '\0';
if (n > size()) resize(n, TRUE);
memset(_str+l, c, n-l);
_str[n] = '\0';
}
return *this;
}
@ -470,11 +470,11 @@ TString& TString::lpad(const int n,const char c)
const int nsp=n-l;
if (n>l)
{
if (n > size()) resize(n, TRUE);
for (l--; l>=0; l--)
*(_str+l+nsp)=*(_str+l);
memset(_str, c, nsp);
_str[n] = '\0';
if (n > size()) resize(n, TRUE);
for (l--; l>=0; l--)
*(_str+l+nsp)=*(_str+l);
memset(_str, c, nsp);
_str[n] = '\0';
}
return *this;
}
@ -925,7 +925,7 @@ TString& TFixed_string::format(
///////////////////////////////////////////////////////////
const char SLASH =
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
'\\';
#else
'/';
@ -1004,7 +1004,7 @@ bool TFilename::ok() const
{
switch(_str[c])
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
case ':':
if (c != 1 || !isalpha(_str[0])) return FALSE; // Nome disco errato
len = 0;
@ -1046,7 +1046,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 || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
dirpref = "\\tmp";
#else
dirpref = "/tmp";
@ -1106,7 +1106,7 @@ const TFilename& TFilename::temp(
strip("$#*?."); // ... toglie caratteri jolly
const TFixed_string f(prefix);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (f.find("$$") != -1)
{
char pid[8];

View File

@ -9,7 +9,7 @@
#include <xvt.h>
#endif
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#include <direct.h>
#include <io.h>
#define F_OK 0
@ -55,7 +55,7 @@ bool fcopy(
// creati dei box di comunicazione che indicano la causa del problema
{
const char* wflag;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const char* const rflag = "rb";
if (append)
wflag = "ab";
@ -120,7 +120,7 @@ bool make_dir(
const char* dir) // @parm Nome della directory da creare
{
int res =
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
mkdir(dir);
#else
mkdir(dir, 0777);
@ -431,7 +431,8 @@ os_type get_os_type()
return os_WindowsNT;
return os_Windows;
#else
#error Ricordati di Win32
// #error Ricordati di Win32
return os_WindowsNT;
#endif
}

View File

@ -763,7 +763,7 @@ void TWindow::set_focus()
void TWindow::iconize() const
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_MINIMIZE);
#endif
@ -771,7 +771,7 @@ void TWindow::iconize() const
void TWindow::maximize() const
{
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
HWND hwnd = (HWND)xvt_vobj_get_attr(win(), ATTR_NATIVE_WINDOW);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
#else
@ -931,7 +931,7 @@ void TWindow::frame(
r.top = f.v; r.left = f.h;
r.bottom = t.v; r.right = t.h;
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
if (flag & 2)
{
r.left += CHARX>>1; r.top += CHARY>>1;
@ -1012,7 +1012,7 @@ TPoint TWindow::dev2log(const PNT& p) const
void TWindow::stringat(short x, short y, const char* str)
{
PNT pnt = log2dev(x,y);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
pnt.v += BASEY;
#endif
@ -1041,7 +1041,7 @@ void TWindow::line(short x0, short y0, short x1, short y1)
PNT f = log2dev(x0,y0);
PNT t = log2dev(x1,y1);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
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;

View File

@ -27,12 +27,72 @@ BOOLEAN error_hook(XVT_ERRMSG err, DATA_PTR)
#endif
}
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#ifndef ATTR_WIN_USE_CTL3D
#include <ctl3d.h>
#endif
#endif
HIDDEN HINSTANCE HInstance;
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
static BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
#ifndef ATTR_WIN_USE_CTL3D
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
#endif
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
// TWindow* w = (TWindow*)xvt_vobj_get_data(win);
const KEY key = toupper(wparam)+K_CTRL;
// w->on_key(key);
dispatch_e_char(win, key);
*ret = 2 << 8;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 1) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 1) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
default:
if (msg == WM_WAKEUP && wparam == main_app().waiting())
main_app().wake_up();
break;
}
return TRUE; // Continua col processo normale
}
#if XVT_OS == XVT_OS_WIN
#include <string.h>
#include <ctype.h>
#pragma hdrstop
@ -47,8 +107,6 @@ short ROWY = -GetSystemMetrics(SM_CYSCREEN) / 25; // Not so good!
short CHARY = 14;
short BASEY = 12;
const word WM_WAKEUP = RegisterWindowMessage("WAKEUP");
// By Matt Pietrek
//########################################################################
// Code that does the real work
@ -126,7 +184,6 @@ int MungeModuleHeader( HINSTANCE hInstance, BOOL fMunge )
HIDDEN NPHOOKCHILD npHookLoadModule = 0;
HIDDEN char szOurFileName[MAX_PATH];
HIDDEN HINSTANCE HInstance;
HINSTANCE
WINAPI
@ -206,60 +263,6 @@ BOOL allow_another_instance()
return (BOOL)npHookLoadModule;
}
static BOOLEAN event_hook(HWND hwnd,
UINT msg,
UINT wparam,
ULONG lparam,
long* ret)
{
switch(msg)
{
#ifndef ATTR_WIN_USE_CTL3D
case WM_SYSCOLORCHANGE:
Ctl3dColorChange();
break;
#endif
case WM_MENUCHAR:
if (wparam > ' ' && wparam <= 'z')
{
WINDOW win = cur_win();
if (win != NULL_WIN)
{
// TWindow* w = (TWindow*)xvt_vobj_get_data(win);
const KEY key = toupper(wparam)+K_CTRL;
// w->on_key(key);
dispatch_e_char(win, key);
*ret = 2 << 8;
}
}
break;
case WM_KEYDOWN:
if (wparam == VK_F1)
{
if ((lparam & (1<<29)) == 0) // Il tasto alt non e' premuto
{
KEY k = K_F1;
int sc = GetAsyncKeyState(VK_CONTROL); // Stato del tasto control
if (sc & 1) k += K_CTRL;
int ss = GetAsyncKeyState(VK_SHIFT); // Stato del tasto shift
if (ss & 1) k += K_SHIFT;
WINDOW win = cur_win();
if (win != NULL_WIN)
dispatch_e_char(win, k);
}
}
break;
default:
if (msg == WM_WAKEUP && wparam == main_app().waiting())
main_app().wake_up();
break;
}
return TRUE; // Continua col processo normale
}
#endif
// @doc INTERNAL
@ -600,8 +603,8 @@ void set_xvt_hooks()
xvt_vobj_set_attr(NULL_WIN,ATTR_ERRMSG_HANDLER, (long)error_hook);
xvt_vobj_set_attr(NULL_WIN,ATTR_WIN_PM_DRAWABLE_TWIN, TRUE);
#if XVT_OS == XVT_OS_WIN
xvt_vobj_set_attr(NULL_WIN,ATTR_EVENT_HOOK, (long)event_hook);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
xvt_vobj_set_attr(NULL_WIN, ATTR_EVENT_HOOK, (long)event_hook);
#ifdef ATTR_WIN_USE_CTL3D
xvt_vobj_set_attr(NULL_WIN, ATTR_WIN_USE_CTL3D, TRUE);
@ -637,9 +640,10 @@ void customize_controls(
{
if (on)
{
#if XVT_OS == XVT_OS_WIN
HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#ifndef ATTR_WIN_USE_CTL3D
HInstance = (HINSTANCE)xvt_vobj_get_attr(NULL_WIN, ATTR_WIN_INSTANCE);
Ctl3dRegister(HInstance);
Ctl3dAutoSubclass(HInstance);
#endif
@ -651,7 +655,7 @@ void customize_controls(
}
else
{
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
#ifndef ATTR_WIN_USE_CTL3D
Ctl3dUnregister(HInstance);
#endif
@ -953,7 +957,7 @@ WINDOW xvt_create_statbar()
{
CHECK(_statbar == NULL_WIN, "Onli uan statbar, plis");
#if XVT_OS == XVT_OS_WIN
#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_WIN32
const int prop_count = 4;
char* prop_list[prop_count+1] =
{