+ Added moucalls and viocalls written by Tomas Hajny.

+ Final routines in doscalls implemented.
* Fixed bugs in dos.pas.
* Changed some old $ifdef FPK into $ifdef FPC.
- Removed go32 stuff from dos.pas.
- Removed '/' to '\' translation from system unit - EMX does this
automatically.
This commit is contained in:
daniel 1998-07-08 14:44:08 +00:00
parent b5f4535ec1
commit bcb942b1dc
8 changed files with 3865 additions and 1355 deletions

View File

@ -1,27 +1,26 @@
/ code2.s (emx+fpk) -- Copyright (c) 1992-1996 by Eberhard Mattes
/ Changed for FPK-Pascal in 1998 by Danil Mantione.
/ This code is _not_ under the Library GNU Public
/ License, because the original is not. See copying.emx
/ for details. You should have received it with this
/ product, write the author if you haven't.
/ code2.as (emx+fpk) -- Copyright (c) 1992-1996 by Eberhard Mattes
/ Changed for FPK-Pascal in 1998 by Danil Mantione.
/ This code is _not_ under the Library GNU Public
/ License, because the original is not. See copying.emx
/ for details. You should have received it with this
/ product, write the author if you haven't.
.globl DosGetMessage
.globl _msgseg32
.globl DosGetMessage
.globl _msgseg32
_msgseg32:
.byte 0xff
.asciz "MSGSEG32"
.byte 0x01, 0x80, 0x00, 0x00
.long L_tab
.byte 0xff
.asciz "MSGSEG32"
.byte 0x01, 0x80, 0x00, 0x00
.long L_tab
.align 2, 0x90
.align 2, 0x90
DosGetMessage:
PROFILE_NOFRAME
popl %ecx /* return address */
pushl $_msgseg32
pushl %ecx
jmp _DOSCALLS$$_DOSTRUEGETMESSAGE$POINTER$PINSERTTABLE$LONGINT$PCHAR$LONGINT$LONGINT$PCHAR$LONGINT
popl %ecx /* return address */
pushl $_msgseg32
pushl %ecx
jmp _DOSCALLS$$_DOSTRUEGETMESSAGE$POINTER$PINSERTTABLE$LONGINT$PCHAR$LONGINT$LONGINT$PCHAR$LONGINT
L_tab: .short 0x0000
.short 0xffff

View File

@ -1,16 +1,18 @@
/ code3.s (emx+gcc) -- Copyright (c) 1992-1996 by Eberhard Mattes
/ code2.as (emx+fpk) -- Copyright (c) 1992-1996 by Eberhard Mattes
/ Changed for FPK-Pascal in 1998 by Danil Mantione.
/ This code is _not_ under the Library GNU Public
/ License, because the original is not. See copying.emx
/ for details. You should have received it with this
/ product, write the author if you haven't.
#include <emx/asm386.h>
.globl DosQueryMessageCP
.globl _DosQueryMessageCP
_DosQueryMessageCP:
PROFILE_NOFRAME
DosQueryMessageCP:
pushl 0(%esp)
movl $__msgseg32, %eax
movl $_msgseg32, %eax
xchgl 20(%esp), %eax
xchgl 16(%esp), %eax
xchgl 12(%esp), %eax
xchgl 8(%esp), %eax
movl %eax, 4(%esp)
jmp _DosIQueryMessageCP
jmp _DOSCALLS$$_DOSIQUERYMESSAGECP$$$$$LONGINT$PCHAR$LONGINT$POINTER

File diff suppressed because it is too large Load Diff

View File

@ -91,19 +91,21 @@ interface
uses strings;
type Pstring=^string;
{$ELSE} {$IFDEF FVISION_PSTRING}
uses strings,objects;
{$ELSE}
{$IFDEF FVISION_PSTRING}
uses strings,objects;
{$ELSE}
{$ERROR Pstring source unknown.}
{$ENDIF}
{$ENDIF}
{$ifdef FPK}
{$ifdef FPC}
{$packrecords 1}
{$endif FPK}
{$endif FPC}
type Tbytearray=array[0..$fff0] of byte;
Pbytearray=^Tbytearray;
Tchararray=array[0..$fff0] of byte;
Tchararray=array[0..$fff0] of char;
Pchararray=^Tchararray;
Twordarray=array[0..$7ff8] of word;
Pwordarray=^Twordarray;
@ -594,7 +596,7 @@ The filename must consist of the driveletter followed by a semicolon.}
function dosopen(filenaam:Pchar;var handle,action:longint;
initsize:longint;attrib,openflags,filemode:longint;
ea:PEAop2):word;
{This variant of dosOpen always creates or overwrites a file.}
{This variant of dosopen always creates or overwrites a file.}
function doscreate(filenaam:Pchar;var handle:longint;
attrib,openmode:longint):word;
{This variant of dosOpen always opens an existing file.}
@ -643,7 +645,7 @@ function dossetfileptr(handle:word;pos:longint;method:longint;
actual position.}
function dossetfileptr(handle:word;pos:longint):word;
{This variant returns the current filepointer.}
function dosgetfileptr(handle:word;posactual:longint):word;
function dosgetfileptr(handle:word;var posactual:longint):word;
{Use dosqueryfileinfo or dosquerypathinfo to get the size of a file.}
@ -1588,9 +1590,9 @@ const pt16bit=0;
naam = Must be nil for Pchar or '' for string variant if ordinal
is zero. Otherwise it contains the procname.
proctype = One of the ptxxxx constants.}
function dosqueryproctype(handle:longint;ordinal:longint;naam:Pchar;
function dosqueryproctype(handle,ordinal:longint;naam:Pchar;
var proctype:longint):word;
function dosqueryproctype(handle:longint;ordinal:longint;naam:string;
function dosqueryproctype(handle,ordinal:longint;const naam:string;
var proctype:longint):word;
{****************************************************************************
@ -2034,15 +2036,15 @@ type Pinserttable=^Tinserttable;
function dosgetmessage(table:Pinserttable;tablesize:longint;buf:Pchar;
bufsize,msgnumber:longint;filenaam:Pchar;
var msgsize:longint):word;
{And a variant using strings and open arrays.}
{And a variant using strings and open arrays.
function dosgetmessage(const table:array of Pstring;var buf:string;
bufsize,msgnumber:longint;const filenaam:Pchar):word;
bufsize,msgnumber:longint;const filenaam:Pchar):word;}
{And a variant using strings, but with a Pchar buffer, because of long
messages, and open arrays.}
messages, and open arrays.
function dosgetmessage(const table:array of Pstring;buf:Pchar;
bufsize,msgnumber:longint;const filenaam:string;
msgsize:longint):word;
msgsize:longint):word;}
{Insert textstrings into a message. The message must be loaded before with
dosGetMessage. This function is used when the insert strings are not yet
@ -2058,17 +2060,17 @@ function dosinsertmessage(table:Pinserttable;tablesize:longint;
message:Pchar;srcmessagesize:longint;
buf:Pchar;bufsize:longint;
var dstmessagesize:longint):word;
{And a variant using strings and open arrays.}
{And a variant using strings and open arrays.
function dosinsertmessage(table:array of Pstring;
const message:string;
var buf:openstring):word;
var buf:openstring):word;}
{And a variant using strings, but with a Pchar buffer, because of long
messages, and open arrays.}
messages, and open arrays.
function dosinsertmessage(table:array of Pstring;
message:Pchar;srcmessagesize:longint;
buf:Pchar;bufsize:longint;
var dstmessagesize:longint):word;
var dstmessagesize:longint):word;}
{Write a message to a file.
handle = Handle of file.
@ -2388,6 +2390,9 @@ procedure flattosel;
implementation
{***************************************************************************}
{$l code2.oo2}
{$l code3.oo2}
function doscreatethread(var tid:longint;address:Tthreadentry;
Aparam:pointer;flags:longint;
stacksize:longint):word;
@ -2457,16 +2462,16 @@ var t,t2:array[0..255] of char;
begin
strPcopy(@t,filenaam);
dosexecpgm:=dosexecpgm(@t2,execflag,args,env,res,@t);;
dosexecpgm:=dosexecpgm(@t2,sizeof(t2),execflag,args,env,res,@t);;
objnaam:=strpas(@t2);
end;
function doswaitchild(action:longint;option:longint;var res:resultcodes;
function doswaitchild(action:longint;option:longint;var res:Tresultcodes;
var termpid:longint;pid:longint):word;
external 'DOSCALLS' index 280;
function dossetpriority(scope,class,delta,portid:longint):word;
function dossetpriority(scope,trclass,delta,portid:longint):word;
external 'DOSCALLS' index 236;
@ -2530,10 +2535,11 @@ function doscreate(const filenaam:string;var handle:longint;
attrib,openmode:longint):word;
var t:array[0..255] of char;
action:longint;
begin
strPcopy(@t,filenaam);
doscreate:=dosopen(t,handle,action,0,attrib,18,openmode,nil);
doscreate:=dosopen(@t,handle,action,0,attrib,18,openmode,nil);
end;
function dosopen(const filenaam:string;var handle:longint;
@ -2618,7 +2624,7 @@ var t,t2,t3:array[0..255] of char;
begin
strPcopy(@t,source);
strPcopy(@t2,edit);
doseditname:=doseditname(metalevel,@t,@t2,@t3);
doseditname:=doseditname(metalevel,@t,@t2,@t3,sizeof(t3));
target:=strpas(@t3);
end;
@ -2647,7 +2653,7 @@ var t,t2:array[0..255] of char;
begin
strPcopy(@t,oud);
strPcopy(@t2,nieuw);
doscopy:=doscopy(@t,@t2);
doscopy:=doscopy(@t,@t2,option);
end;
function dosdelete(filenaam:Pchar):word;
@ -2659,7 +2665,7 @@ function dosdelete(const filenaam:string):word;
var t:array[0..255] of char;
begin
strPcopy(@t,filanaam);
strPcopy(@t,filenaam);
dosdelete:=dosdelete(@t);
end;
@ -2777,7 +2783,7 @@ begin
count,infolevel);
end;
function dosfindnext(handle:longint;Afilestatus:Pfilefindbuf;
function dosfindnext(handle:longint;Afilestatus:Pfilestatus;
cbfilestatus:longint;var count:longint):word;
external 'DOSCALLS' index 265;
@ -2829,7 +2835,7 @@ function dosenumattribute(handle:longint;
var count:longint;infolevel:longint):word;
begin
dosenumatrribute:=dosenumattribute(0,@handle,entry,buf,bufsize,count,
dosenumattribute:=dosenumattribute(0,@handle,entry,buf,bufsize,count,
infolevel);
end;
@ -2852,10 +2858,12 @@ external 'DOSCALLS' index 227;
function dosscanenv(const naam:string;var value:string):word;
var t:array[0..255] of char;
p:Pchar;
begin
strPcopy(@t,naam);
dosscanenv:=dosscanenv(@t,value);
dosscanenv:=dosscanenv(@t,p);
value:=strpas(p);
end;
function dossearchpath(flag:longint;dirlist,filenaam:Pchar;
@ -2871,7 +2879,7 @@ var t1,t2,t3:array[0..255] of char;
begin
strPcopy(@t1,dirlist);
strPcopy(@t2,filenaam);
dossearchpath:=dossearchpath(flag,@t1,@t2,@t3);
dossearchpath:=dossearchpath(flag,@t1,@t2,@t3,sizeof(t3));
fullname:=strpas(@t3);
end;
@ -2996,7 +3004,7 @@ var t:array[0..255] of char;
begin
strPcopy(@t,naam);
getnamedsharedmem:=getnamedsharedmem(p,@t,flag);
dosgetnamedsharedmem:=dosgetnamedsharedmem(p,@t,flag);
end;
function dosallocsharedmem(var p:pointer;naam:Pchar;size,flag:longint):word;
@ -3012,10 +3020,10 @@ begin
if naam<>'' then
begin
strPcopy(@t,naam);
dosallocsharedmem:=dosallocsharedmem(p,naam,cb,flag);
dosallocsharedmem:=dosallocsharedmem(p,naam,size,flag);
end
else
dosallocsharedmem:=dosallocsharedmem(p,nil,flag);
dosallocsharedmem:=dosallocsharedmem(p,nil,size,flag);
end;
function dosquerymem(p:pointer;var size,flag:longint):word;
@ -3064,7 +3072,7 @@ external 'DOSCALLS' index 325;
function dosopeneventsem(const naam:string;var handle:longint):word;
var t:array[0...255] of char;
var t:array[0..255] of char;
begin
strPcopy(@t,naam);
@ -3105,7 +3113,7 @@ begin
if naam<>'' then
begin
strPcopy(@t,naam);
doscreatemutextsem:=doscreatemutexsem(@t,handle,attr,state);
doscreatemutexsem:=doscreatemutexsem(@t,handle,attr,state);
end
else
doscreatemutexsem:=doscreatemutexsem(nil,handle,attr,state);
@ -3121,7 +3129,7 @@ var t:array[0..255] of char;
begin
strPcopy(@t,naam);
dosopenmutex:=dosmutexsem(@t,handle);
dosopenmutexsem:=dosopenmutexsem(@t,handle);
end;
function dosclosemutexsem(handle:longint):word;
@ -3205,12 +3213,12 @@ function dossetdatetime(var buf:Tdatetime):word;
external 'DOSCALLS' index 292;
function dosasynctimer(msec:longint;hsem:SEMhandle;
function dosasynctimer(msec:longint;hsem:longint;
var TIMhandle:longint):word;
external 'DOSCALLS' index 350;
function dosstarttimer(msec:longint;hsem:SEMhandle;
function dosstarttimer(msec:longint;hsem:longint;
var TIMhandle:longint):word;
external 'DOSCALLS' index 351;
@ -3232,14 +3240,14 @@ function dosloadmodule(objnaam:Pchar;objlen:longint;DLLnaam:Pchar;
external 'DOSCALLS' index 318;
function dosloadmodule(var objnaam:string;objlen:lognint;
function dosloadmodule(var objnaam:string;objlen:longint;
const DLLnaam:string;var handle:longint):word;
var t1,t2:array[0..255] of char;
begin
strPcopy(@t2,DLLnaam);
dosloadmodule:=dosloadmodule(@t1,objlen,DLLnaam,handle);
dosloadmodule:=dosloadmodule(@t1,objlen,@t2,handle);
objnaam:=strpas(@t1);
end;
@ -3307,10 +3315,10 @@ begin
if naam<>'' then
begin
strPcopy(@t1,naam);
dosqueryproctype(handle,ordinal,@t1,proctype);
dosqueryproctype:=dosqueryproctype(handle,ordinal,@t1,proctype);
end
else
dosqueryproctype(handle,ordinal,nil,proctype);
dosqueryproctype:=dosqueryproctype(handle,ordinal,nil,proctype);
end;
function dosgetresource(handle,restype,resnaam:longint;var p:pointer):word;
@ -3330,7 +3338,7 @@ function dosqueryctryinfo(cb:longint;var country:Tcountrycode;
external 'NLS' index 5;
function dosqueryDBCSenv(cb:longint;var country:Pcountrycode;buf:Pchar):word;
function dosqueryDBCSenv(cb:longint;var country:Tcountrycode;buf:Pchar):word;
external 'NLS' index 6;
@ -3372,7 +3380,7 @@ function dosunsetexceptionhandler(var regrec:Texceptionregistrationrecord
external 'DOSCALLS' index 355;
function dosraiseexception(var except:Texceptionreportrecord):word;
function dosraiseexception(var excpt:Texceptionreportrecord):word;
external 'DOSCALLS' index 356;
@ -3429,7 +3437,7 @@ external 'QUECALLS' index 15;
function dosopenqueue(var parent_pid:longint;var handle:longint;
const naam:string):word;
var strPcopy(@t1,naam);
var t1:array[0..255] of char;
begin
strPcopy(@t1,naam);
@ -3439,7 +3447,7 @@ end;
function dospeekqueue(handle:longint;var reqbuffer:Trequestdata;
var datalen:longint;var dataptr:pointer;
var element:longint;wait:longint;
var priority:byte;Asem:SEMhandle):word;
var priority:byte;Asem:longint):word;
external 'QUECALLS' index 13;
@ -3454,7 +3462,7 @@ external 'QUECALLS' index 12;
function dosreadqueue(handle:longint;var reqbuffer:Trequestdata;
var datalen:longint;var dataptr:pointer;
element,wait:longint;var priority:byte;
Asem:semhandle):word;
Asem:longint):word;
external 'QUECALLS' index 9;
@ -3467,7 +3475,7 @@ function doserror(error:longint):word;
external 'DOSCALLS' index 212;
procedure doserrclass(code:longint;var class,action,locus:longint);
procedure doserrclass(code:longint;var _class,action,locus:longint);
external 'DOSCALLS' index 211;
@ -3484,8 +3492,8 @@ function dosgetmessage(table:Pinserttable;tablesize:longint;buf:Pchar;
external name 'DosGetMessage'; {Procedure is in code2.so2.}
function dosgetmessage(const table:array of Pstring;var buf:openstring;
msgnumber:longint;const filenaam:string):word;
(*function dosgetmessage(const table:array of Pstring;var buf:openstring;
msgnumber:longint;const filenaam:string):word;
{Hmm. This takes too much stackspace. Let's use the
heap instead.}
@ -3537,94 +3545,189 @@ begin
{Step 7: Free the memory.}
freemem(buffer,s);
end;
end;
end;*)
function dosgetmessage(const table:array of Pstring;buf:Pchar;
{function dosgetmessage(const table:array of Pstring;buf:Pchar;
bufsize,msgnumber:longint;const filenaam:string;
msgsize:longint):word;
msgsize:longint):word;}
function dosinsertmessage(table:Pinserttable;tablesize:longint;
message:Pchar;srcmessagesize:longint;
buf:Pchar;bufsize:longint;
var dstmessagesize:longint):word;
function dosinsertmessage(table:array of Pstring;
external 'MSG' index 4;
{function dosinsertmessage(table:array of Pstring;
const message:string;
var buf:openstring):word;
function dosinsertmessage(table:array of Pstring;
message:Pchar;srcmessagesize:longint;
buf:Pchar;bufsize:longint;
var dstmessagesize:longint):word;
var dstmessagesize:longint):word;}
function dosputmessage(handle,size:longint;buf:Pchar):word;
external 'MSG' index 5;
function dosputmessage(handle:longint;const buf:string):word;
begin
dosputmessage:=dosputmessage(handle,length(buf),@buf[1]);
end;
function dosIquerymessageCP(var buf;bufsize:longint;filenaam:Pchar;
var infosize:longint;messeg:pointer):word;
external 'MSG' index 8;
function dosquerymessageCP(var buf;bufsize:longint;filenaam:Pchar;
var infosize:longint):word;
external name 'DosQueryMessageCP';
function dosquerymessageCP(var buf;bufsize:longint;const filenaam:string;
var infosize:longint):word;
var t:array[0..255] of char;
begin
strPcopy(@t,filenaam);
dosquerymessageCP:=dosquerymessageCP(buf,bufsize,@t,infosize);
end;
function dosstartsession(const Astartdata:Tstartdata;
var sesid,pid:longint):word;
external 'SESMGR' index 37;
function dossetsession(sesid:longint;const Astatus:Tstatusdata):word;
external 'SESMGR' index 39;
function dosselectsession(sesid:longint):word;
external 'SESMGR' index 38;
function dosstopsession(scope,sesid:longint):word;
external 'SESMGR' index 40;
function doscreatepipe(var readhandle,writehandle:longint;
size:longint):word;
external 'DOSCALLS' index 239;
function doscreatenpipe(naam:Pchar;var handle:longint;openmode,pipemode,
outbufsize,inbufsize,msec:longint):word;
external 'DOSCALLS' index 243;
function doscreatenpipe(const naam:string;var handle:longint;openmode,
pipemode,outbufsize,inbufsize,msec:longint):word;
var t:array[0..255] of char;
begin
strPcopy(@t,naam);
doscreatenpipe:=doscreatenpipe(@t,handle,openmode,pipemode,outbufsize,
inbufsize,msec);
end;
function doscallnpipe(naam:Pchar;var input;inputsize:longint;
var output;outputsize:longint;var readbytes:longint;
msec:longint):word;
external 'DOSCALLS' index 240;
function doscallnpipe(const naam:string;var input;inputsize:longint;
var output;outputsize:longint;var readbytes:longint;
msec:longint):word;
var t:array[0..255] of char;
begin
strPcopy(@t,naam);
doscallnpipe:=doscallnpipe(@t,input,inputsize,output,outputsize,
readbytes,msec);
end;
function dosconnectnpipe(handle:longint):word;
external 'DOSCALLS' index 241;
function dosdisconnectnpipe(handle:longint):word;
external 'DOSCALLS' index 242;
function dospeeknpipe(handle:longint;var buffer;bufsize:longint;
var readbytes:longint;var avail:Tavaildata;
var state:longint):word;
external 'DOSCALLS' index 244;
function dosquerynphstate(handle:longint;var state:longint):word;
external 'DOSCALLS' index 245;
function dosquerynpipeinfo(handle,infolevel:longint;var buffer;
bufsize:longint):word;
external 'DOSCALLS' index 248;
function dosquerynpipesemstate(semhandle:longint;var semarray;
bufsize:longint):word;
external 'DOSCALLS' index 249;
function dossetnphstate(handle,state:longint):word;
external 'DOSCALLS' index 250;
function dossetnpipesem(pipehandle,semhandle,key:longint):word;
external 'DOSCALLS' index 251;
function dostransactnpipe(handle:longint;var outbuf;outsize:longint;
var inbuf;insize:longint;
var readbytes:longint):word;
external 'DOSCALLS' index 252;
function doswaitnpipe(naam:Pchar;msec:longint):word;
external 'DOSCALLS' index 253;
function doswaitnpipe(const naam:string;msec:longint):word;
var t:array[0..255] of char;
begin
strPcopy(@t,naam);
doswaitnpipe:=doswaitnpipe(@t,msec);
end;
function dosopenVDD(naam:Pchar;var handle:longint):word;
external 'DOSCALLS' index 308;
function dosrequestVDD(handle,sgroup,cmd:longint;
insize:longint;var inbuffer;
outsize:longint;var outbuffer):word;
external 'DOSCALLS' index 309;
function doscloseVDD(handle:longint):word;
external 'DOSCALLS' index 310;
procedure seltoflat;
external 'DOSCALLS' index 425;
procedure flattosel;
external 'DOSCALLS' index 426;
end.

File diff suppressed because it is too large Load Diff

467
rtl/os2/moucalls.pas Normal file
View File

@ -0,0 +1,467 @@
{Set tabsize to 4.}
{****************************************************************************
MOUCALLS interface unit
FPK-Pascal Runtime Library for OS/2
Copyright (c) 1993,94 by Florian Kl„mpfl
Copyright (c) 1997 by Dani‰l Mantione
Copyright (c) 1998 by Tomas Hajny
The FPK-Pascal runtime library is distributed under the Library GNU Public
License v2. So is this unit. The Library GNU Public License requires you to
distribute the source code of this unit with any product that uses it.
Because the EMX library isn't under the LGPL, we grant you an exception to
this, and that is, when you compile a program with the FPK Pascal compiler,
you do not need to ship source code with that program, AS LONG AS YOU ARE
USING UNMODIFIED CODE! If you modify this code, you MUST change the next
line:
<This is an official, unmodified FPK Pascal source code file.>
Send us your modified files, we can work together if you want!
FPK-Pascal is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Library GNU General Public License for more details.
You should have received a copy of the Library GNU General Public License
along with FPK-Pascal; see the file COPYING.LIB. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
****************************************************************************}
unit MouCalls;
{ Interface library to MOUCALLS.DLL (through EMXWRAP.DLL)
Changelog:
People:
TH - Tomas Hajny
Date: Description of change: Changed by:
- First released version 0.50 TH
Coding style:
I have tried to use the same coding style as Dani‰l Mantione in unit
DOSCALLS, although I can't say I would write it the same way otherwise
(I would write much more spaces myself, at least). Try to use it as well,
please. Original note by Dani‰l Mantione follows:
It may be well possible that coding style feels a bit strange to you.
Nevertheless I friendly ask you to try to make your changes not look all
to different. To make life easier, set your IDE to use tab characters,
turn optimal fill, autoindent and backspace unindents on and set a
tabsize of 4.}
{***************************************************************************}
interface
{***************************************************************************}
uses strings;
{$ifdef FPK}
{$packrecords 1}
{$endif FPK}
const
{return codes / error constants}
ERROR_MOUSE_NO_DEVICE =385;
ERROR_MOUSE_INV_HANDLE =386;
ERROR_MOUSE_INV_PARMS =387;
ERROR_MOUSE_CANT_RESET =388;
ERROR_MOUSE_DISPLAY_PARMS =389;
ERROR_MOUSE_INV_MODULE =390;
ERROR_MOUSE_INV_ENTRY_PT =391;
ERROR_MOUSE_INV_MASK =392;
NO_ERROR_MOUSE_NO_DATA =393;
NO_ERROR_MOUSE_PTR_DRAWN =394;
ERROR_MOUSE_SMG_ONLY =412;
ERROR_MOUSE_INVALID_ASCIIZ =413;
ERROR_MOUSE_INVALID_MASK =414;
ERROR_MOUSE_REGISTER =415;
ERROR_MOUSE_DEREGISTER =416;
ERROR_MOUSE_INVALID_IOWAIT =435;
ERROR_MOU_DETACHED =466;
ERROR_MOUSE_NO_CONSOLE =501;
ERROR_MOUSE_INVALID_HANDLE =502;
ERROR_MOU_EXTENDED_SG =505;
ERROR_MOU_NOT_INITIALIZED =530;
ERROR_MOUINITREAL_DONE =531;
ERROR_MOUSE_CALLER_NOT_SUBSYS =533;
{constants for FnMask in MouRegister}
MR_MOUGETNUMBUTTONS =$00000001;
MR_MOUGETNUMMICKEYS =$00000002;
MR_MOUGETDEVSTATUS =$00000004;
MR_MOUGETNUMQUEEL =$00000008;
MR_MOUREADEVENTQUE =$00000010;
MR_MOUGETSCALEFACT =$00000020;
MR_MOUGETEVENTMASK =$00000040;
MR_MOUSETSCALEFACT =$00000080;
MR_MOUSETEVENTMASK =$00000100;
MR_MOUOPEN =$00000800;
MR_MOUCLOSE =$00001000;
MR_MOUGETPTRSHAPE =$00002000;
MR_MOUSETPTRSHAPE =$00004000;
MR_MOUDRAWPTR =$00008000;
MR_MOUREMOVEPTR =$00010000;
MR_MOUGETPTRPOS =$00020000;
MR_MOUSETPTRPOS =$00040000;
MR_MOUINITREAL =$00080000;
MR_MOUSETDEVSTATUS =$00100000;
{constants for mouse hot key bits in MouGetHotKey/MouSetHotKey}
MHK_BUTTON1 =1;
MHK_BUTTON2 =2;
MHK_BUTTON3 =4;
{MouGetDevStatus/MouSetDevStatus device status constants}
MOUSE_QUEUEBUSY =$0001;
MOUSE_BLOCKREAD =$0002;
MOUSE_FLUSH =$0004;
MOUSE_UNSUPPORTED_MODE =$0008;
MOUSE_DISABLED =$0100;
MOUSE_MICKEYS =$0200;
{constants for WaitFlag in MouReadEventQue}
MOU_NOWAIT =$0000;
MOU_WAIT =$0001;
{constants for MouGetEventMask/MouSetEventMask events}
MOUSE_MOTION =$0001;
MOUSE_MOTION_WITH_BN1_DOWN =$0002;
MOUSE_BN1_DOWN =$0004;
MOUSE_MOTION_WITH_BN2_DOWN =$0008;
MOUSE_BN2_DOWN =$0010;
MOUSE_MOTION_WITH_BN3_DOWN =$0020;
MOUSE_BN3_DOWN =$0040;
{constants for Status in MouSetDevStatus}
MOU_DRAW =0;
MOU_NODRAW =1;
MOU_PELS =0;
MOU_MICKEYS =2;
type
(*This should be removed as soon as cardinal arithmetic in FPC works OK.*)
cardinal=longint;
{unnecessary, just FYI}
THMOU=word;
PHMOU=^THMOU;
{record type for MouGetPos/SetPtrPos}
TPtrLoc=record
Row:word;
Col:word;
end;
PPtrLoc=^TPtrLoc;
{record type for MouGetShape/SetPtrShape}
TPtrShape=record
cb:word; {length of image buffer in bytes}
Col:word; {pointer width in characters or pixels}
Row:word; {pointer height in characters or pixels}
ColHot:word; {hotspot offset from the left side}
RowHot:word; {hotspot offset from the top}
end;
PPtrShape=^TPtrShape;
{record type for MouReadEventQue}
(* #pragma pack(2) ??? *)
TMouEventInfo=record
fs:word; {event bits}
Time:cardinal; {event timestamp - unique number of milliseconds}
Row:integer; {pointer current row position}
Col:integer; {pointer current column position}
end;
PMouEventInfo=^TMouEventInfo;
{record type for MouGetNumQueEl}
TMouQueInfo=record
cEvents:word; {number of elements in event queue}
cmaxEvents:word; {maximum queue size in elements}
end;
PMouQueInfo=^TMouQueInfo;
{record type for MouGetScaleFact/MouSetScaleFact}
TScaleFact=record
RowScale:word; {scaling factor of current row}
ColScale:word; {scaling factor of current column}
end;
PScaleFact=^TScaleFact;
{record type for MouRemovePtr}
TNoPtrRect=record
Row:word; {row of the top of the rectangle}
Col:word; {column of the left edge}
cRow:word; {row of the bottom}
cCol:word; {column of the right edge}
end;
PNoPtrRect=^TNoPtrRect;
TThreshold=record
Length:word;
Level1:word; {first movement level}
Lev1Mult:word; {first level multiplier}
Level2:word; {second movement level}
Lev2Mult:word; {second level multiplier}
end;
PThreshold=^TThreshold;
function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word;
function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
function MouDeRegister:word;
function MouFlushQue(MouHandle:word):word;
function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
function MouSetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
MouHandle:word):word;
function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
MouHandle:word):word;
function MouGetDevStatus(var Status:word;MouHandle:word):word;
function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word;
function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word;
function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
MouHandle:word):word;
function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word;
function MouGetEventMask(var EventMask:word;MouHandle:word):word;
function MouSetEventMask(var EventMask:word;MouHandle:word):word;
function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
function MouSetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
function MouOpen(DriverName:PChar;var MouHandle:word):word;
function MouOpen(DriverName:string;var MouHandle:word):word;
function MouClose(MouHandle:word):word;
function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word;
function MouDrawPtr(MouHandle:word):word;
function MouSetDevStatus(var Status:word;MouHandle:word):word;
function MouInitReal(DriverName:PChar):word;
function MouInitReal(DriverName:string):word;
function MouSynch(WaitFlag:word):word;
function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
(*
following two functions are undocumented and not present within C header files:
function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
*)
(* Following routines are not supported
(just have a look in some C header
file - you probably won't find it there either).
MouFree (index 4)
MouShellInit (index 12)
*)
{***************************************************************************}
implementation
{***************************************************************************}
function MouRegister(ModuleName,ProcName:PChar;FnMask:cardinal):word;
external 'EMXWRAP' index 324;
{external 'MOUCALLS' index 24;}
function MouRegister(ModuleName,ProcName:string;FnMask:cardinal):word;
begin
if byte(ModuleName[0])>8 then byte(ModuleName[0]):=8;
ModuleName[Succ(byte(ModuleName[0]))]:=#0;
if byte(ProcName[0])>32 then byte(ProcName[0]):=32;
ProcName[Succ(byte(ProcName[0]))]:=#0;
MouRegister:=MouRegister(@ModuleName[1],@ProcName[1],FnMask);
end;
function MouDeRegister:word;
external 'EMXWRAP' index 314;
{external 'MOUCALLS' index 14;}
function MouFlushQue(MouHandle:word):word;
external 'EMXWRAP' index 307;
{external 'MOUCALLS' index 7;}
function MouGetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
external 'EMXWRAP' index 319;
{external 'MOUCALLS' index 19;}
function MouSetPtrPos(var MouPtr:TPtrLoc;MouHandle:word):word;
external 'EMXWRAP' index 321;
{external 'MOUCALLS' index 21;}
function MouSetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
MouHandle:word):word;
external 'EMXWRAP' index 302;
{external 'MOUCALLS' index 2;}
function MouGetPtrShape(ImageBuf:pointer;var ImageInfo:TPtrShape;
MouHandle:word):word;
external 'EMXWRAP' index 301;
{external 'MOUCALLS' index 1;}
function MouGetDevStatus(var Status:word;MouHandle:word):word;
external 'EMXWRAP' index 322;
{external 'MOUCALLS' index 22;}
function MouGetNumButtons(var ButtonCount:word;MouHandle:word):word;
external 'EMXWRAP' index 308;
{external 'MOUCALLS' index 8;}
function MouGetNumMickeys(var MickeyCnt:word;MouHandle:word):word;
external 'EMXWRAP' index 303;
{external 'MOUCALLS' index 3;}
function MouReadEventQue(var Event:TMouEventInfo;var WaitFlag:word;
MouHandle:word):word;
external 'EMXWRAP' index 320;
{external 'MOUCALLS' index 20;}
function MouGetNumQueEl(var MouseQInfo:TMouQueInfo;MouHandle:word):word;
external 'EMXWRAP' index 313;
{external 'MOUCALLS' index 13;}
function MouGetEventMask(var EventMask:word;MouHandle:word):word;
external 'EMXWRAP' index 315;
{external 'MOUCALLS' index 15;}
function MouSetEventMask(var EventMask:word;MouHandle:word):word;
external 'EMXWRAP' index 316;
{external 'MOUCALLS' index 16;}
function MouGetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
external 'EMXWRAP' index 306;
{external 'MOUCALLS' index 6;}
function MouSetScaleFact(var Scale:TScaleFact;MouHandle:word):word;
external 'EMXWRAP' index 311;
{external 'MOUCALLS' index 11;}
function MouOpen(DriverName:PChar;var MouHandle:word):word;
external 'EMXWRAP' index 317;
{external 'MOUCALLS' index 17;}
function MouOpen(DriverName:string;var MouHandle:word):word;
var B:byte;
begin
B:=byte(DriverName[0]);
if B=0 then MouOpen:=MouOpen(nil,MouHandle) else
begin
if B<>255 then
begin
DriverName[Succ(B)]:=#0;
MouOpen:=MouOpen(@DriverName[1],MouHandle);
end else
begin
Move(DriverName[1],DriverName[0],B);
DriverName[B]:=#0;
MouOpen:=MouOpen(@DriverName,MouHandle);
end;
end;
end;
function MouClose(MouHandle:word):word;
external 'EMXWRAP' index 309;
{external 'MOUCALLS' index 9;}
function MouRemovePtr(var ProtectArea:TNoPtrRect;MouHandle:word):word;
external 'EMXWRAP' index 318;
{external 'MOUCALLS' index 18;}
function MouDrawPtr(MouHandle:word):word;
external 'EMXWRAP' index 326;
{external 'MOUCALLS' index 26;}
function MouSetDevStatus(var Status:word;MouHandle:word):word;
external 'EMXWRAP' index 326;
{external 'MOUCALLS' index 26;}
function MouInitReal(DriverName:PChar):word;
external 'EMXWRAP' index 327;
{external 'MOUCALLS' index 27;}
function MouInitReal(DriverName:string):word;
var B:byte;
begin
B:=byte(DriverName[0]);
if B=0 then MouInitReal:=MouInitReal(nil) else
begin
if B<>255 then
begin
DriverName[Succ(B)]:=#0;
MouInitReal:=MouInitReal(@DriverName[1]);
end else
begin
Move(DriverName[1],DriverName[0],B);
DriverName[B]:=#0;
MouInitReal:=MouInitReal(@DriverName);
end;
end;
end;
function MouSynch(WaitFlag:word):word;
external 'EMXWRAP' index 323;
{external 'MOUCALLS' index 23;}
function MouGetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
external 'EMXWRAP' index 329;
{external 'MOUCALLS' index 29;}
function MouSetThreshold(var MouThreshold:TThreshold;MouHandle:word):word;
external 'EMXWRAP' index 330;
{external 'MOUCALLS' index 30;}
(*
following two functions are undocumented and not present within C header files:
function MouGetHotKey(var ButtonBits:word;MouHandle:word):word;
external 'MOUCALLS' index 4;
function MouSetHotKey(var ButtonBits:word;MouHandle:word):word;
external 'MOUCALLS' index 10;
*)
end.

View File

@ -264,16 +264,6 @@ begin
if p[i]='/' then p[i]:='\';
end;
function do_isdevice(handle:longint):boolean;
begin
if (handle=stdoutputhandle) or (handle=stdinputhandle) or
(handle=stderrorhandle) then
do_isdevice:=FALSE;
else
do_isdevice:=TRUE;
end;
procedure do_close(h:longint);
begin
@ -575,25 +565,22 @@ begin
end;
procedure mkdir(const s : string);[IOCheck];
procedure mkdir(const s : string);
begin
If InOutRes <> 0 then exit;
DosDir($39,s);
end;
procedure rmdir(const s : string);[IOCheck];
procedure rmdir(const s : string);
begin
If InOutRes <> 0 then exit;
DosDir($3a,s);
end;
procedure chdir(const s : string);[IOCheck];
procedure chdir(const s : string);
begin
If InOutRes <> 0 then exit;
DosDir($3b,s);
end;

1060
rtl/os2/viocalls.pas Normal file

File diff suppressed because it is too large Load Diff