* fixes for H+

This commit is contained in:
peter 1998-11-16 10:21:24 +00:00
parent 59c75c7410
commit dbbdb79dfe
8 changed files with 118 additions and 64 deletions

View File

@ -88,7 +88,9 @@ UNIT Objects;
{==== Compiler directives ===========================================} {==== Compiler directives ===========================================}
{$IFNDEF FPC} {$IFDEF FPC}
{$H-} { No ansistrings }
{$ELSE}
{ FPC doesn't support these switches in 0.99.5 } { FPC doesn't support these switches in 0.99.5 }
{$F+} { Force far calls } {$F+} { Force far calls }
{$A+} { Word Align Data } {$A+} { Word Align Data }
@ -2726,7 +2728,10 @@ END;
END. END.
{ {
$Log$ $Log$
Revision 1.12 1998-11-12 11:54:50 peter Revision 1.13 1998-11-16 10:21:24 peter
* fixes for H+
Revision 1.12 1998/11/12 11:54:50 peter
* fixed for 0.99.8 * fixed for 0.99.8
Revision 1.11 1998/11/12 11:45:09 peter Revision 1.11 1998/11/12 11:45:09 peter

View File

@ -256,6 +256,21 @@ End;
{$endif RTLLITE} {$endif RTLLITE}
{*****************************************************************************
Directory support.
*****************************************************************************}
Procedure getdir(drivenr:byte;Var dir:ansistring);
{ this is needed to also allow ansistrings, the shortstring version is
OS dependent }
var
s : shortstring;
begin
getdir(drivenr,s);
dir:=s;
end;
{***************************************************************************** {*****************************************************************************
Miscellaneous Miscellaneous
*****************************************************************************} *****************************************************************************}
@ -462,7 +477,10 @@ end;
{ {
$Log$ $Log$
Revision 1.41 1998-11-05 10:29:36 pierre Revision 1.42 1998-11-16 10:21:25 peter
* fixes for H+
Revision 1.41 1998/11/05 10:29:36 pierre
* fix for length(char) in const expressions * fix for length(char) in const expressions
Revision 1.40 1998/11/04 20:34:02 michael Revision 1.40 1998/11/04 20:34:02 michael

View File

@ -26,15 +26,23 @@
{$i version.inc} {$i version.inc}
{****************************************************************************
Needed switches
****************************************************************************}
{$I-,Q-,H-,R-}
{ Stack check gives a note under linux }
{$ifndef linux}
{$S-}
{$endif}
{**************************************************************************** {****************************************************************************
Global Types and Constants Global Types and Constants
****************************************************************************} ****************************************************************************}
Type Type
{$Q-} Longint = $80000000..$7fffffff; { $8000000 creates a longint overfow !! }
{ $8000000 creates a longint overfow !! }
Longint = $80000000..$7fffffff;
Integer = -32768..32767; Integer = -32768..32767;
shortint = -128..127; shortint = -128..127;
byte = 0..255; byte = 0..255;
@ -379,7 +387,8 @@ Procedure SetTextBuf(Var f:Text; Var Buf; Size:Word);
Procedure chdir(const s:string); Procedure chdir(const s:string);
Procedure mkdir(const s:string); Procedure mkdir(const s:string);
Procedure rmdir(const s:string); Procedure rmdir(const s:string);
Procedure getdir(drivenr:byte;Var dir:string); Procedure getdir(drivenr:byte;Var dir:shortstring);
Procedure getdir(drivenr:byte;Var dir:ansistring);
{***************************************************************************** {*****************************************************************************
Miscelleaous Miscelleaous
@ -430,7 +439,10 @@ const
{ {
$Log$ $Log$
Revision 1.40 1998-11-05 10:29:37 pierre Revision 1.41 1998-11-16 10:21:26 peter
* fixes for H+
Revision 1.40 1998/11/05 10:29:37 pierre
* fix for length(char) in const expressions * fix for length(char) in const expressions
Revision 1.39 1998/11/04 20:34:01 michael Revision 1.39 1998/11/04 20:34:01 michael

View File

@ -1082,7 +1082,7 @@ end;
var var
Lastansi : boolean; Lastansi : boolean;
AnsiCode : string[32]; AnsiCode : string;
Procedure DoWrite(const s:String); Procedure DoWrite(const s:String);
{ {
Write string to screen, parse most common AnsiCodes Write string to screen, parse most common AnsiCodes
@ -1231,7 +1231,7 @@ Var
Temp : String; Temp : String;
Begin Begin
Move(F.BufPTR^[0],Temp[1],F.BufPos); Move(F.BufPTR^[0],Temp[1],F.BufPos);
temp[0]:=chr(F.BufPos); setlength(temp,F.BufPos);
DoWrite(Temp); DoWrite(Temp);
F.BufPos:=0; F.BufPos:=0;
CrtWrite:=0; CrtWrite:=0;
@ -1492,7 +1492,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.12 1998-11-10 15:01:01 peter Revision 1.13 1998-11-16 10:21:27 peter
* fixes for H+
Revision 1.12 1998/11/10 15:01:01 peter
* fixed GetXY at startup * fixed GetXY at startup
Revision 1.11 1998/10/30 12:11:51 peter Revision 1.11 1998/10/30 12:11:51 peter

View File

@ -2946,7 +2946,9 @@ Function Dirname(Const path:pathstr):pathstr;
a slash. a slash.
} }
var var
Dir,Name,Ext : string; Dir : PathStr;
Name : NameStr;
Ext : ExtStr;
begin begin
FSplit(Path,Dir,Name,Ext); FSplit(Path,Dir,Name,Ext);
if length(Dir)>1 then if length(Dir)>1 then
@ -2962,7 +2964,9 @@ Function Basename(Const path:pathstr;Const suf:pathstr):pathstr;
supplied, it is cut off the filename. supplied, it is cut off the filename.
} }
var var
Dir,Name,Ext : string; Dir : PathStr;
Name : NameStr;
Ext : ExtStr;
begin begin
FSplit(Path,Dir,Name,Ext); FSplit(Path,Dir,Name,Ext);
if Suf<>Ext then if Suf<>Ext then
@ -3515,7 +3519,10 @@ End.
{ {
$Log$ $Log$
Revision 1.24 1998-11-10 14:57:53 peter Revision 1.25 1998-11-16 10:21:28 peter
* fixes for H+
Revision 1.24 1998/11/10 14:57:53 peter
* renamed rename -> FRename * renamed rename -> FRename
Revision 1.23 1998/10/30 15:47:11 peter Revision 1.23 1998/10/30 15:47:11 peter

View File

@ -15,19 +15,19 @@
{ Change Log { Change Log
---------- ----------
Started by Michael Van Canneyt, 1996 Started by Michael Van Canneyt, 1996
(michael@tfdec1.fys.kuleuven.ac.be) (michael@tfdec1.fys.kuleuven.ac.be)
Current version is 0.9 Current version is 0.9
Date Version Who Comments Date Version Who Comments
1996 0.8 Michael Initial implementation 1996 0.8 Michael Initial implementation
11/97 0.9 Peter Vreman <pfv@worldonline.nl> 11/97 0.9 Peter Vreman <pfv@worldonline.nl>
Unit now depends on the Unit now depends on the
linux unit only. linux unit only.
Cleaned up code. Cleaned up code.
---------------------------------------------------------------------} ---------------------------------------------------------------------}
Unit printer; Unit printer;
@ -42,7 +42,7 @@ Const
Var Var
Lst : Text; Lst : Text;
Procedure AssignLst ( Var F : text; ToFile : string[255]); Procedure AssignLst ( Var F : text; ToFile : string);
{ {
Assigns to F a printing device. ToFile is a string with the following form: Assigns to F a printing device. ToFile is a string with the following form:
'|filename options' : This sets up a pipe with the program filename, '|filename options' : This sets up a pipe with the program filename,
@ -51,12 +51,12 @@ Procedure AssignLst ( Var F : text; ToFile : string[255]);
(No Quotes), which will be replaced by the PID of your program. (No Quotes), which will be replaced by the PID of your program.
When closing lst, the file will be sent to lpr and deleted. When closing lst, the file will be sent to lpr and deleted.
(lpr should be in PATH) (lpr should be in PATH)
'filename|' Idem as previous, only the file is NOT sent to lpr, nor is it 'filename|' Idem as previous, only the file is NOT sent to lpr, nor is it
deleted. deleted.
(useful for opening /dev/printer or for later printing) (useful for opening /dev/printer or for later printing)
Lst is set up using '/tmp/PID.lst'. You can change this behaviour at Lst is set up using '/tmp/PID.lst'. You can change this behaviour at
compile time, setting the DefFile constant. compile time, setting the DefFile constant.
} }
@ -65,11 +65,11 @@ Uses Linux,Strings;
{ {
include definition of textrec include definition of textrec
} }
{$i textrec.inc} {$i textrec.inc}
Const
Const
P_TOF = 1; { Print to file } P_TOF = 1; { Print to file }
P_TOFNP = 2; { Print to File, don't spool } P_TOFNP = 2; { Print to File, don't spool }
P_TOP = 3; { Print to Pipe } P_TOP = 3; { Print to Pipe }
@ -77,8 +77,8 @@ Const
Var Var
Lpr : String[255]; { Contains path to lpr binary, including null char } Lpr : String[255]; { Contains path to lpr binary, including null char }
SaveExit : pointer; SaveExit : pointer;
Procedure PrintAndDelete (f:string); Procedure PrintAndDelete (f:string);
var var
i,j : longint; i,j : longint;
@ -88,20 +88,20 @@ begin
if lpr='' then if lpr='' then
exit; exit;
i:=Fork; i:=Fork;
if i<0 then if i<0 then
exit; { No printing was done. We leave the file where it is.} exit; { No printing was done. We leave the file where it is.}
if i=0 then if i=0 then
begin begin
{ We're in the child } { We're in the child }
getmem(p,12); getmem(p,12);
if p=nil then if p=nil then
halt(127); halt(127);
pp:=p; pp:=p;
pp^:=@lpr[1]; pp^:=@lpr[1];
pp:=pp+4; pp:=pp+4;
pp^:=@f[1]; pp^:=@f[1];
pp:=pp+4; pp:=pp+4;
pp^:=nil; pp^:=nil;
Execve(lpr,p,envp); Execve(lpr,p,envp);
{ In trouble here ! } { In trouble here ! }
halt(128) halt(128)
@ -110,7 +110,7 @@ begin
begin begin
{ We're in the parent. } { We're in the parent. }
waitpid (i,@j,0); waitpid (i,@j,0);
if j<>0 then if j<>0 then
exit; exit;
{ Erase the file } { Erase the file }
Unlink(f); Unlink(f);
@ -140,7 +140,7 @@ begin
if i<0 then if i<0 then
textrec(f).mode:=fmclosed textrec(f).mode:=fmclosed
else else
textrec(f).handle:=i; textrec(f).handle:=i;
end; end;
@ -157,8 +157,8 @@ begin
Unlink(StrPas(textrec(f).name)); Unlink(StrPas(textrec(f).name));
exit exit
end; end;
{ Non empty : needs printing ? } { Non empty : needs printing ? }
if (textrec(f).userdata[16]=P_TOF) then if (textrec(f).userdata[16]=P_TOF) then
PrintAndDelete (strpas(textrec(f).name)); PrintAndDelete (strpas(textrec(f).name));
textrec(f).mode:=fmclosed textrec(f).mode:=fmclosed
end; end;
@ -203,7 +203,7 @@ begin
{$IFDEF PRINTERDEBUG} {$IFDEF PRINTERDEBUG}
writeln ('Printer : In AssignLst'); writeln ('Printer : In AssignLst');
{$ENDIF} {$ENDIF}
If ToFile='' then If ToFile='' then
exit; exit;
textrec(f).bufptr:=@textrec(f).buffer; textrec(f).bufptr:=@textrec(f).buffer;
textrec(f).bufsize:=128; textrec(f).bufsize:=128;
@ -250,11 +250,14 @@ begin
rewrite(Lst); rewrite(Lst);
lpr:='/usr/bin/lpr'; lpr:='/usr/bin/lpr';
end. end.
{ {
$Log$ $Log$
Revision 1.2 1998-05-06 12:35:26 michael Revision 1.3 1998-11-16 10:21:29 peter
* fixes for H+
Revision 1.2 1998/05/06 12:35:26 michael
+ Removed log from before restored version. + Removed log from before restored version.
Revision 1.1.1.1 1998/03/25 11:18:43 root Revision 1.1.1.1 1998/03/25 11:18:43 root

View File

@ -36,9 +36,9 @@ Const
AF_X25 = 9; { Reserved for X.25 project } AF_X25 = 9; { Reserved for X.25 project }
AF_INET6 = 10; { IP version 6 } AF_INET6 = 10; { IP version 6 }
AF_MAX = 12; AF_MAX = 12;
{ Protocol Families } { Protocol Families }
PF_UNSPEC = AF_UNSPEC; PF_UNSPEC = AF_UNSPEC;
PF_UNIX = AF_UNIX; PF_UNIX = AF_UNIX;
PF_INET = AF_INET; PF_INET = AF_INET;
@ -51,13 +51,13 @@ Const
PF_X25 = AF_X25; PF_X25 = AF_X25;
PF_INET6 = AF_INET6; PF_INET6 = AF_INET6;
PF_MAX = AF_MAX; PF_MAX = AF_MAX;
const const
{ Two constants to determine whether part of soket is for in or output } { Two constants to determine whether part of soket is for in or output }
S_IN = 0; S_IN = 0;
S_OUT = 1; S_OUT = 1;
Type Type
TSockAddr = packed Record TSockAddr = packed Record
family:word; { was byte, fixed } family:word; { was byte, fixed }
@ -68,7 +68,7 @@ Type
family:word; { was byte, fixed } family:word; { was byte, fixed }
path:array[0..108] of char; path:array[0..108] of char;
end; end;
TInetSockAddr = packed Record TInetSockAddr = packed Record
family:Word; family:Word;
port :Word; port :Word;
@ -77,7 +77,7 @@ Type
end; end;
TSockArray = Array[1..2] of Longint; TSockArray = Array[1..2] of Longint;
Var Var
SocketError:Longint; SocketError:Longint;
@ -149,7 +149,7 @@ Const
Socket_Sys_GETSOCKOPT = 15; Socket_Sys_GETSOCKOPT = 15;
Socket_Sys_SENDMSG = 16; Socket_Sys_SENDMSG = 16;
Socket_Sys_RECVMSG = 17; Socket_Sys_RECVMSG = 17;
Function SocketCall(SockCallNr,a1,a2,a3,a4,a5,a6:longint):longint; Function SocketCall(SockCallNr,a1,a2,a3,a4,a5,a6:longint):longint;
var var
@ -167,7 +167,7 @@ begin
SocketCall:=Syscall(syscall_nr_socketcall,regs); SocketCall:=Syscall(syscall_nr_socketcall,regs);
If SocketCall<0 then If SocketCall<0 then
SocketError:=Errno SocketError:=Errno
else else
SocketError:=0; SocketError:=0;
end; end;
@ -178,11 +178,11 @@ begin
SocketCall:=SocketCall(SockCallNr,a1,a2,a3,0,0,0); SocketCall:=SocketCall(SockCallNr,a1,a2,a3,0,0,0);
end; end;
{****************************************************************************** {******************************************************************************
Basic Socket Functions Basic Socket Functions
******************************************************************************} ******************************************************************************}
Function socket(Domain,SocketType,Protocol:Longint):Longint; Function socket(Domain,SocketType,Protocol:Longint):Longint;
begin begin
Socket:=SocketCall(Socket_Sys_Socket,Domain,SocketType,ProtoCol); Socket:=SocketCall(Socket_Sys_Socket,Domain,SocketType,ProtoCol);
@ -282,23 +282,23 @@ Procedure OpenSock(var F:Text);
begin begin
if textrec(f).handle=UnusedHandle then if textrec(f).handle=UnusedHandle then
textrec(f).mode:=fmclosed textrec(f).mode:=fmclosed
else else
case textrec(f).userdata[1] of case textrec(f).userdata[1] of
S_OUT : textrec(f).mode:=fmoutput; S_OUT : textrec(f).mode:=fmoutput;
S_IN : textrec(f).mode:=fminput; S_IN : textrec(f).mode:=fminput;
else else
textrec(f).mode:=fmclosed; textrec(f).mode:=fmclosed;
end; end;
end; end;
Procedure IOSock(var F:text); Procedure IOSock(var F:text);
begin begin
case textrec(f).mode of case textrec(f).mode of
fmoutput : fdWrite(textrec(f).handle,textrec(f).bufptr^,textrec(f).bufpos); fmoutput : fdWrite(textrec(f).handle,textrec(f).bufptr^,textrec(f).bufpos);
fminput : textrec(f).BufEnd:=fdRead(textrec(f).handle,textrec(f).bufptr^,textrec(f).bufsize); fminput : textrec(f).BufEnd:=fdRead(textrec(f).handle,textrec(f).bufptr^,textrec(f).bufsize);
end; end;
textrec(f).bufpos:=0; textrec(f).bufpos:=0;
end; end;
@ -310,9 +310,9 @@ begin
IOSock(f); IOSock(f);
textrec(f).bufpos:=0; textrec(f).bufpos:=0;
end; end;
Procedure CloseSock(var F:text); Procedure CloseSock(var F:text);
begin begin
Close(f); Close(f);
@ -355,7 +355,7 @@ begin
FileRec(SockIn).Handle:=Sock; FileRec(SockIn).Handle:=Sock;
FileRec(SockIn).RecSize:=1; FileRec(SockIn).RecSize:=1;
FileRec(Sockin).userdata[1]:=S_IN; FileRec(Sockin).userdata[1]:=S_IN;
{Output} {Output}
Assign(SockOut,'.'); Assign(SockOut,'.');
FileRec(SockOut).Handle:=Sock; FileRec(SockOut).Handle:=Sock;
FileRec(SockOut).RecSize:=1; FileRec(SockOut).RecSize:=1;
@ -396,7 +396,7 @@ begin
AddrLen:=length(addr)+3; AddrLen:=length(addr)+3;
DoAccept:=Accept(Sock,UnixAddr,AddrLen); DoAccept:=Accept(Sock,UnixAddr,AddrLen);
Move(UnixAddr.Path,Addr[1],AddrLen); Move(UnixAddr.Path,Addr[1],AddrLen);
Addr[0]:=Chr(AddrLen); SetLength(Addr,AddrLen);
end; end;
@ -420,7 +420,7 @@ begin
Sock2Text(S,SockIn,SockOut); Sock2Text(S,SockIn,SockOut);
Accept:=true; Accept:=true;
end end
else else
Accept:=false; Accept:=false;
end; end;
@ -436,7 +436,7 @@ begin
Sock2File(S,SockIn,SockOut); Sock2File(S,SockIn,SockOut);
Accept:=true; Accept:=true;
end end
else else
Accept:=false; Accept:=false;
end; end;
@ -516,7 +516,7 @@ begin
end; end;
Function Accept(Sock:longint;var addr:TInetSockAddr;var SockIn,SockOut:text):Boolean; Function Accept(Sock:longint;var addr:TInetSockAddr;var SockIn,SockOut:text):Boolean;
var var
s : longint; s : longint;
@ -527,7 +527,7 @@ begin
Sock2Text(S,SockIn,SockOut); Sock2Text(S,SockIn,SockOut);
Accept:=true; Accept:=true;
end end
else else
Accept:=false; Accept:=false;
end; end;
@ -543,7 +543,7 @@ begin
Sock2File(S,SockIn,SockOut); Sock2File(S,SockIn,SockOut);
Accept:=true; Accept:=true;
end end
else else
Accept:=false; Accept:=false;
end; end;
@ -554,7 +554,10 @@ end.
{ {
$Log$ $Log$
Revision 1.2 1998-07-16 10:36:45 michael Revision 1.3 1998-11-16 10:21:30 peter
* fixes for H+
Revision 1.2 1998/07/16 10:36:45 michael
+ added connect call for inet sockets + added connect call for inet sockets
Revision 1.1.1.1 1998/03/25 11:18:43 root Revision 1.1.1.1 1998/03/25 11:18:43 root

View File

@ -615,7 +615,7 @@ Begin
End; End;
procedure getdir(drivenr : byte;var dir : string); procedure getdir(drivenr : byte;var dir : shortstring);
{$ifndef crtlib} {$ifndef crtlib}
var var
thisdir : stat; thisdir : stat;
@ -739,7 +739,10 @@ End.
{ {
$Log$ $Log$
Revision 1.17 1998-10-15 08:30:00 peter Revision 1.18 1998-11-16 10:21:32 peter
* fixes for H+
Revision 1.17 1998/10/15 08:30:00 peter
+ sigfpe -> runerror 200 + sigfpe -> runerror 200
Revision 1.16 1998/09/14 10:48:27 peter Revision 1.16 1998/09/14 10:48:27 peter