mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 20:06:35 +02:00
* BeOS/Haiku updates from Olivier Coursière
git-svn-id: trunk@9880 -
This commit is contained in:
parent
801837f60d
commit
73871b64ce
4
Makefile
4
Makefile
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/12/01]
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/22]
|
||||
#
|
||||
default: help
|
||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
|
||||
@ -338,7 +338,7 @@ BUILDOPTS=FPC=$(PPNEW) RELEASE=1
|
||||
INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR) FPCMAKE=$(FPCMAKENEW)
|
||||
ifndef CROSSCOMPILE
|
||||
ifneq ($(wildcard ide),)
|
||||
IDETARGETS=go32v2 win32 linux freebsd os2 emx
|
||||
IDETARGETS=go32v2 win32 linux freebsd os2 emx beos
|
||||
ifneq ($(findstring $(OS_TARGET),$(IDETARGETS)),)
|
||||
IDE=1
|
||||
endif
|
||||
|
@ -147,7 +147,7 @@ INSTALLOPTS=FPC=$(PPNEW) ZIPDESTDIR=$(BASEDIR) FPCMAKE=$(FPCMAKENEW)
|
||||
# Skipped by default for cross compiles, because it depends on libc
|
||||
ifndef CROSSCOMPILE
|
||||
ifneq ($(wildcard ide),)
|
||||
IDETARGETS=go32v2 win32 linux freebsd os2 emx
|
||||
IDETARGETS=go32v2 win32 linux freebsd os2 emx beos
|
||||
ifneq ($(findstring $(OS_TARGET),$(IDETARGETS)),)
|
||||
IDE=1
|
||||
endif
|
||||
|
@ -250,17 +250,17 @@ interface
|
||||
{$LINKLIB bfd}
|
||||
{$LINKLIB readline}
|
||||
{$LINKLIB opcodes}
|
||||
{$LINKLIB history}
|
||||
{ $ LINKLIB history}
|
||||
{$LINKLIB iberty}
|
||||
{$LINKLIB ncurses}
|
||||
{$LINKLIB m}
|
||||
{$LINKLIB iberty}
|
||||
{ $ LINKLIB m} // include in libroot under BeOS
|
||||
{$LINKLIB intl}
|
||||
{$ifdef GDB_USES_EXPAT_LIB}
|
||||
{$LINKLIB expat}
|
||||
{$endif GDB_USES_EXPAT_LIB}
|
||||
{ does not seem to exist on netbsd LINKLIB dl}
|
||||
{$LINKLIB c}
|
||||
{ $ LINKLIB c} // This is libroot under BeOS, and always linked
|
||||
{$LINKLIB debug}
|
||||
{$LINKLIB gcc}
|
||||
{$endif beos}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/11/08]
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2008/01/22]
|
||||
#
|
||||
default: all
|
||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
|
||||
@ -1648,7 +1648,7 @@ endif
|
||||
endif
|
||||
endif
|
||||
.PHONY: fpc_units
|
||||
ifneq ($(TARGET_UNITS),)
|
||||
ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
|
||||
override ALLTARGET+=fpc_units
|
||||
override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
|
||||
override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
|
||||
|
@ -139,9 +139,16 @@ begin
|
||||
{$warning TODO BeOS fpFlock implementation}
|
||||
end;
|
||||
|
||||
function snooze(microseconds : bigtime_t) : status_t; cdecl; external 'root' name 'snooze';
|
||||
|
||||
Function FpNanoSleep (req : ptimespec;rem : ptimespec):cint;
|
||||
begin
|
||||
{$warning TODO BeOS FpNanoSleep implementation}
|
||||
case snooze((req^.tv_nsec div 1000) + (req^.tv_sec * 1000 * 1000)) of
|
||||
B_OK : FpNanoSleep := 0;
|
||||
B_INTERRUPTED : FpNanoSleep := - 1;
|
||||
else
|
||||
FpNanoSleep := - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -90,10 +90,10 @@ CONST
|
||||
INLCR = $40; { map NL into CR }
|
||||
IGNCR = $80; { ignore CR }
|
||||
ICRNL = $100; { map CR to NL (ala CRMOD) }
|
||||
IUCLC = $200; { maps all upper case to lower }
|
||||
IUCLC = $200; { maps all upper case to lower }
|
||||
IXON = $400; { enable output flow control }
|
||||
IXANY = $800; { enable input flow control }
|
||||
IXOFF = $1000; { any char will restart after stop }
|
||||
IXOFF = $1000; { any char will restart after stop }
|
||||
|
||||
{
|
||||
* Output flags - software output processing
|
||||
@ -188,7 +188,7 @@ CRTSCTS = RTSFLOW or CTSFLOW;
|
||||
}
|
||||
|
||||
ISIG = $01; { enable signals }
|
||||
ICANON = $02; { Canonical input }
|
||||
ICANON = $02; { Canonical input }
|
||||
XCASE = $04; { Canonical u/l case }
|
||||
ECHO = $08; { Enable echo }
|
||||
ECHOE = $10; { Echo erase as bs-sp-bs }
|
||||
@ -212,19 +212,21 @@ EV_CARRIERLOST = $0008;
|
||||
|
||||
CONST
|
||||
|
||||
TCSANOW =0; { make change immediate }
|
||||
TCSADRAIN =1; { drain output, then change }
|
||||
TCSAFLUSH =2; { drain output, flush input }
|
||||
TCSASOFT =$10; { flag - don't alter h.w. state }
|
||||
TCSANOW = $01; { make change immediate }
|
||||
TCSADRAIN = $02; { drain output, then change }
|
||||
TCSAFLUSH = $04; { drain output, flush input }
|
||||
|
||||
// TCASOFT undefined under BeOS
|
||||
TCSASOFT = $10; { flag - don't alter h.w. state }
|
||||
|
||||
|
||||
TCIFLUSH =1;
|
||||
TCOFLUSH =2;
|
||||
TCIOFLUSH =3;
|
||||
TCOOFF =1;
|
||||
TCOON =2;
|
||||
TCIOFF =3;
|
||||
TCION =4;
|
||||
TCIFLUSH = $01;
|
||||
TCOFLUSH = $02;
|
||||
TCIOFLUSH = (TCIFLUSH or TCOFLUSH);
|
||||
TCOOFF = $01;
|
||||
TCOON = $02;
|
||||
TCIOFF = $04;
|
||||
TCION = $08;
|
||||
|
||||
{
|
||||
#include <sys/cdefs.h>
|
||||
@ -259,7 +261,7 @@ struct winsize {
|
||||
};
|
||||
|
||||
}
|
||||
IOCTLREAD = $40000000;
|
||||
(* IOCTLREAD = $40000000;
|
||||
IOCTLWRITE = $80000000;
|
||||
IOCTLVOID = $20000000;
|
||||
|
||||
@ -279,19 +281,41 @@ struct winsize {
|
||||
{ 8-10 compat }
|
||||
TIOCEXCL =IOCTLVOID+$7400+ 13; { set exclusive use of tty }
|
||||
TIOCNXCL =IOCTLVOID+$7400+ 14; { reset exclusive use of tty }
|
||||
{ 15 unused }
|
||||
TIOCFLUSH =IOCTLWRITE+$47400+ 16; { flush buffers }
|
||||
*) { 15 unused }
|
||||
// TIOCFLUSH =IOCTLWRITE+$47400+ 16; { flush buffers }
|
||||
{ 17-18 compat }
|
||||
TIOCGETA =IOCTLREAD+$2C7400+ 19; { get termios struct }
|
||||
TIOCSETA =IOCTLWRITE+$2C7400+ 20; { set termios struct }
|
||||
TIOCSETAW =IOCTLWRITE+$2C7400+ 21; { drain output, set }
|
||||
TIOCSETAF =IOCTLWRITE+$2C7400+ 22; { drn out, fls in, set }
|
||||
TIOCGETD =IOCTLREAD+$47400+ 26; { get line discipline }
|
||||
TIOCSETD =IOCTLWRITE+$47400+ 27; { set line discipline }
|
||||
{ 127-124 compat }
|
||||
TIOCSBRK =IOCTLVOID+$7400+ 123; { set break bit }
|
||||
// TIOCGETA =IOCTLREAD+$2C7400+ 19; { get termios struct }
|
||||
// TIOCSETA =IOCTLWRITE+$2C7400+ 20; { set termios struct }
|
||||
// TIOCSETAW =IOCTLWRITE+$2C7400+ 21; { drain output, set }
|
||||
// TIOCSETAF =IOCTLWRITE+$2C7400+ 22; { drn out, fls in, set }
|
||||
// TIOCGETD =IOCTLREAD+$47400+ 26; { get line discipline }
|
||||
// TIOCSETD =IOCTLWRITE+$47400+ 27; { set line discipline }
|
||||
{ 127-124 compat }
|
||||
|
||||
// BeOS values
|
||||
TIOCGETA = $8000;
|
||||
TIOCSETA = TIOCGETA + 1;
|
||||
TIOCSETAF = TIOCGETA + 2;
|
||||
TIOCSETAW = TIOCGETA + 3;
|
||||
TCWAITEVENT = TIOCGETA + 4;
|
||||
TIOCSBRK = TIOCGETA + 5;
|
||||
TIOCFLUSH = TIOCGETA + 6;
|
||||
TCXONC = TIOCGETA + 7;
|
||||
TCQUERYCONNECTED= TIOCGETA + 8;
|
||||
TCGETBITS = TIOCGETA + 9;
|
||||
TIOCSDTR = TIOCGETA + 10;
|
||||
TCSETRTS = TIOCGETA + 11;
|
||||
TIOCGWINSZ = TIOCGETA + 12;
|
||||
TIOCSWINSZ = TIOCGETA + 13;
|
||||
TCVTIME = TIOCGETA + 14;
|
||||
|
||||
|
||||
// TIOCTIMESTAMP = TCVTIME;
|
||||
// end BeOS values
|
||||
(*
|
||||
// TIOCSBRK =IOCTLVOID+$7400+ 123; { set break bit }
|
||||
TIOCCBRK =IOCTLVOID+$7400+ 122; { clear break bit }
|
||||
TIOCSDTR =IOCTLVOID+$7400+ 121; { set data terminal ready }
|
||||
// TIOCSDTR =IOCTLVOID+$7400+ 121; { set data terminal ready }
|
||||
TIOCCDTR =IOCTLVOID+$7400+ 120; { clear data terminal ready }
|
||||
TIOCGPGRP =IOCTLREAD+$47400+ 119; { get pgrp of tty }
|
||||
TIOCSPGRP =IOCTLWRITE+$47400+ 118; { set pgrp of tty }
|
||||
@ -315,8 +339,8 @@ struct winsize {
|
||||
TIOCMBIC =IOCTLWRITE+$47400+ 107; { bic modem bits }
|
||||
TIOCMGET =IOCTLREAD+$47400+ 106; { get all modem bits }
|
||||
TIOCREMOTE =IOCTLWRITE+$47400+ 105; { remote input editing }
|
||||
TIOCGWINSZ =IOCTLREAD+$87400+ 104; { get window size }
|
||||
TIOCSWINSZ =IOCTLWRITE+$87400+ 103; { set window size }
|
||||
// TIOCGWINSZ =IOCTLREAD+$87400+ 104; { get window size }
|
||||
// TIOCSWINSZ =IOCTLWRITE+$87400+ 103; { set window size }
|
||||
TIOCUCNTL =IOCTLWRITE+$47400+ 102; { pty: set/clr usr cntl mode }
|
||||
TIOCSTAT =IOCTLVOID+$7400+ 101; { simulate ^T status message }
|
||||
// UIOCCMD(n) _IO('u', n) { usr cntl op "n" }
|
||||
@ -327,8 +351,8 @@ struct winsize {
|
||||
TIOCDRAIN =IOCTLVOID+$7400+ 94; { wait till output drained }
|
||||
TIOCMSDTRWAIT =IOCTLWRITE+$47400+ 91; { modem: set wait on close }
|
||||
TIOCMGDTRWAIT =IOCTLREAD+$47400+ 90; { modem: get wait on close }
|
||||
TIOCTIMESTAMP =IOCTLREAD+$87400+ 89; { enable/get timestamp
|
||||
* of last input event }
|
||||
// TIOCTIMESTAMP =IOCTLREAD+$87400+ 89; { enable/get timestamp
|
||||
// * of last input event }
|
||||
TIOCDCDTIMESTAMP =IOCTLREAD+$87400+ 88; { enable/get timestamp
|
||||
* of last DCd rise }
|
||||
TIOCSDRAINWAIT =IOCTLWRITE+$47400+ 87; { set ttywait timeout }
|
||||
@ -344,7 +368,7 @@ struct winsize {
|
||||
// Maybe, it should not work but it compile at least...
|
||||
TIOCLINUX = $541C;
|
||||
|
||||
|
||||
*)
|
||||
{
|
||||
* Defaults on "first" open.
|
||||
}
|
||||
@ -359,7 +383,7 @@ struct winsize {
|
||||
{
|
||||
* Control Character Defaults
|
||||
}
|
||||
CtrlMask = $1f; {\037}
|
||||
(* CtrlMask = $1f; {\037}
|
||||
CEOF =chr( ORD('d') and CtrlMask);
|
||||
CEOL =chr( $ff and CtrlMask);{ XXX avoid _POSIX_VDISABLE }
|
||||
CERASE =chr( $7F and CtrlMask);
|
||||
@ -382,14 +406,11 @@ struct winsize {
|
||||
CBRK =CEOL;
|
||||
CRPRNT =CREPRINT;
|
||||
CFLUSH =CDISCARD;
|
||||
|
||||
*)
|
||||
|
||||
{
|
||||
* TTYDEFCHARS to include an array of default control characters.
|
||||
}
|
||||
{ ttydefchars : array[0..NCCS-1] OF char =(
|
||||
Chr(VINTR), Chr(VQUIT), Chr(VERASE), Chr(VKILL), Chr(VEOF), Chr(VEOL),
|
||||
Chr(VEOL2), Chr(VSWTCH), Chr(VSTART), Chr(VSTOP), Chr(VSUSP));}
|
||||
ttydefchars : array[0..NCCS-1] OF char =(
|
||||
Chr(VINTR), Chr(VQUIT), Chr(VERASE), Chr(VKILL), Chr(VEOF), Chr(VEOL),
|
||||
Chr(VEOL2), Chr(VSWTCH), Chr(VSTART), Chr(VSTOP), Chr(VSUSP));
|
||||
|
@ -45,13 +45,15 @@ end;
|
||||
|
||||
Procedure CFSetISpeed(var tios:TermIOS;speed:Cardinal);
|
||||
begin
|
||||
// BeOS tios.c_ispeed:=speed; {Probably the Bxxxx speed constants}
|
||||
// field unused under BeOS
|
||||
tios.c_ixxxxx:=speed;
|
||||
end;
|
||||
|
||||
|
||||
Procedure CFSetOSpeed(var tios:TermIOS;speed:Cardinal);
|
||||
begin
|
||||
// BeOS tios.c_ospeed:=speed;
|
||||
// field unused under BeOS
|
||||
tios.c_oxxxxx:=speed;
|
||||
end;
|
||||
|
||||
|
||||
@ -78,36 +80,38 @@ begin
|
||||
TCSendBreak:=fpIOCtl(fd,TIOCSBRK,nil);
|
||||
end;
|
||||
|
||||
Function be_tcsetpgrp(fd, pgrpid : pid_t) : cint; cdecl; external 'root' name 'tcsetpgrp';
|
||||
Function be_tcgetpgrp(fd : cint) : pid_t; cdecl; external 'root' name 'tcgetpgrp';
|
||||
Function be_tcdrain(fd : cint) : cint; cdecl; external 'root' name 'tcdrain';
|
||||
Function be_tcflow(fd, action : cint) : cint; cdecl; external 'root' name 'tcflow';
|
||||
Function be_tcflush(fd, queue_selector : cint) : cint; cdecl; external 'root' name 'tcflush';
|
||||
|
||||
|
||||
Function TCSetPGrp(fd,id:cint):cint;
|
||||
begin
|
||||
TCSetPGrp:=fpIOCtl(fd,TIOCSPGRP,pointer(id));
|
||||
TCSetPGrp := be_tcsetpgrp(fd, id);
|
||||
end;
|
||||
|
||||
|
||||
Function TCGetPGrp(fd:cint;var id:cint):cint;
|
||||
begin
|
||||
TCGetPGrp:=fpIOCtl(fd,TIOCGPGRP,@id);
|
||||
id := be_tcgetpgrp(fd);
|
||||
end;
|
||||
|
||||
Function TCDrain(fd:cint):cint;
|
||||
begin
|
||||
TCDrain:=fpIOCtl(fd,TIOCDRAIN,nil); {Should set timeout to 1 first?}
|
||||
TCDrain := be_tcdrain(fd);
|
||||
end;
|
||||
|
||||
|
||||
Function TCFlow(fd,act:cint):cint;
|
||||
begin
|
||||
case act OF
|
||||
TCOOFF : TCFlow:=fpIoctl(fd,TIOCSTOP,nil);
|
||||
TCOOn : TCFlow:=fpIOctl(Fd,TIOCStart,nil);
|
||||
TCIOFF : {N/I}
|
||||
end;
|
||||
TCFlow := be_tcflow(fd, act);
|
||||
end;
|
||||
|
||||
Function TCFlush(fd,qsel:cint):cint;
|
||||
begin
|
||||
TCFlush:=fpIOCtl(fd,TIOCFLUSH,pointer(qsel));
|
||||
TCFlush := be_tcflush(fd, qsel);
|
||||
end;
|
||||
|
||||
Function BeOSIsATTY (Handle:cint):cint; cdecl; external 'root' name 'isatty';
|
||||
|
@ -662,9 +662,8 @@ end;
|
||||
{$ENDIF EMX}
|
||||
|
||||
|
||||
{$if defined(ELF32) or defined(ELF64)}
|
||||
{$if defined(ELF32) or defined(BEOS)}
|
||||
type
|
||||
{$ifdef ELF32}
|
||||
telfheader=packed record
|
||||
magic0123 : longint;
|
||||
file_class : byte;
|
||||
@ -697,8 +696,9 @@ type
|
||||
sh_addralign : longword;
|
||||
sh_entsize : longword;
|
||||
end;
|
||||
{$endif ELF32}
|
||||
{$endif ELF32 or BEOS}
|
||||
{$ifdef ELF64}
|
||||
type
|
||||
telfheader=packed record
|
||||
magic0123 : longint;
|
||||
file_class : byte;
|
||||
@ -719,6 +719,7 @@ type
|
||||
e_shnum : word; // 0..e_shnum-1 of entrys
|
||||
e_shstrndx : word; // index of string section header
|
||||
end;
|
||||
type
|
||||
telfsechdr=packed record
|
||||
sh_name : longword;
|
||||
sh_type : longword;
|
||||
@ -733,6 +734,8 @@ type
|
||||
end;
|
||||
{$endif ELF64}
|
||||
|
||||
|
||||
{$if defined(ELF32) or defined(ELF64) or defined(BEOS)}
|
||||
function OpenElf(var e:TExeFile):boolean;
|
||||
var
|
||||
elfheader : telfheader;
|
||||
@ -756,6 +759,7 @@ begin
|
||||
result:=true;
|
||||
end;
|
||||
|
||||
|
||||
function FindSectionElf(var e:TExeFile;const asecname:string;out secofs,seclen:longint):boolean;
|
||||
var
|
||||
elfsec : telfsechdr;
|
||||
@ -784,16 +788,13 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
{$endif ELF32}
|
||||
|
||||
{$endif ELF32 or ELF64 or BEOS}
|
||||
|
||||
|
||||
{$ifdef beos}
|
||||
|
||||
{$i ptypes.inc}
|
||||
|
||||
{ ------------------------- Images --------------------------- }
|
||||
|
||||
type
|
||||
// Descriptive formats
|
||||
status_t = Longint;
|
||||
@ -832,103 +833,24 @@ type
|
||||
|
||||
function get_next_image_info(team: team_id; var cookie:longint; var info:image_info; size: size_t) : status_t;cdecl; external 'root' name '_get_next_image_info';
|
||||
|
||||
function LoadElf32Beos:boolean;
|
||||
type
|
||||
telf32header=packed record
|
||||
magic0123 : longint;
|
||||
file_class : byte;
|
||||
data_encoding : byte;
|
||||
file_version : byte;
|
||||
padding : array[$07..$0f] of byte;
|
||||
e_type : word;
|
||||
e_machine : word;
|
||||
e_version : longword;
|
||||
e_entry : longword; // entrypoint
|
||||
e_phoff : longword; // program header offset
|
||||
e_shoff : longword; // sections header offset
|
||||
e_flags : longword;
|
||||
e_ehsize : word; // elf header size in bytes
|
||||
e_phentsize : word; // size of an entry in the program header array
|
||||
e_phnum : word; // 0..e_phnum-1 of entrys
|
||||
e_shentsize : word; // size of an entry in sections header array
|
||||
e_shnum : word; // 0..e_shnum-1 of entrys
|
||||
e_shstrndx : word; // index of string section header
|
||||
end;
|
||||
telf32sechdr=packed record
|
||||
sh_name : longword;
|
||||
sh_type : longword;
|
||||
sh_flags : longword;
|
||||
sh_addr : longword;
|
||||
sh_offset : longword;
|
||||
sh_size : longword;
|
||||
sh_link : longword;
|
||||
sh_info : longword;
|
||||
sh_addralign : longword;
|
||||
sh_entsize : longword;
|
||||
end;
|
||||
function OpenElf32Beos(var e:TExeFile):boolean;
|
||||
var
|
||||
elfheader : telf32header;
|
||||
elfsec : telf32sechdr;
|
||||
secnames : array[0..255] of char;
|
||||
pname : pchar;
|
||||
i : longint;
|
||||
cookie : longint;
|
||||
info : image_info;
|
||||
result : status_t;
|
||||
begin
|
||||
// The only BeOS specific part is setting the processaddress
|
||||
cookie := 0;
|
||||
fillchar(info, sizeof(image_info), 0);
|
||||
get_next_image_info(0,cookie,info,sizeof(info));
|
||||
if (info._type = B_APP_IMAGE) then
|
||||
processaddress := cardinal(info.text)
|
||||
e.processaddress := cardinal(info.text)
|
||||
else
|
||||
processaddress := 0;
|
||||
LoadElf32Beos:=false;
|
||||
stabofs:=-1;
|
||||
stabstrofs:=-1;
|
||||
{ read and check header }
|
||||
if E.Size<sizeof(telf32header) then
|
||||
exit;
|
||||
blockread(f,elfheader,sizeof(telf32header));
|
||||
{$ifdef ENDIAN_LITTLE}
|
||||
if elfheader.magic0123<>$464c457f then
|
||||
exit;
|
||||
{$endif ENDIAN_LITTLE}
|
||||
{$ifdef ENDIAN_BIG}
|
||||
if elfheader.magic0123<>$7f454c46 then
|
||||
exit;
|
||||
{$endif ENDIAN_BIG}
|
||||
if elfheader.e_shentsize<>sizeof(telf32sechdr) then
|
||||
exit;
|
||||
{ read section names }
|
||||
seek(f,elfheader.e_shoff+elfheader.e_shstrndx*cardinal(sizeof(telf32sechdr)));
|
||||
blockread(f,elfsec,sizeof(telf32sechdr));
|
||||
seek(f,elfsec.sh_offset);
|
||||
blockread(f,secnames,sizeof(secnames));
|
||||
{ read section info }
|
||||
seek(f,elfheader.e_shoff);
|
||||
for i:=1to elfheader.e_shnum do
|
||||
begin
|
||||
blockread(f,elfsec,sizeof(telf32sechdr));
|
||||
pname:=@secnames[elfsec.sh_name];
|
||||
if (pname[4]='b') and
|
||||
(pname[1]='s') and
|
||||
(pname[2]='t') then
|
||||
begin
|
||||
if (pname[5]='s') and
|
||||
(pname[6]='t') then
|
||||
stabstrofs:=elfsec.sh_offset
|
||||
else
|
||||
begin
|
||||
stabofs:=elfsec.sh_offset;
|
||||
stabcnt:=elfsec.sh_size div sizeof(tstab);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
LoadElf32Beos:=(stabofs<>-1) and (stabstrofs<>-1);
|
||||
e.processaddress := 0;
|
||||
Result := OpenElf(e);
|
||||
end;
|
||||
{$endif beos}
|
||||
|
||||
|
||||
{$ifdef darwin}
|
||||
type
|
||||
MachoFatHeader=
|
||||
@ -1097,11 +1019,11 @@ const
|
||||
{$if defined(ELF32) or defined(ELF64)}
|
||||
openproc : @OpenElf;
|
||||
findproc : @FindSectionElf;
|
||||
{$endif}
|
||||
{$ifdef Beos}
|
||||
{$endif ELF32 or ELF64}
|
||||
{$ifdef BEOS}
|
||||
openproc : @OpenElf32Beos;
|
||||
findproc : @FindSectionElf32Beos;
|
||||
{$endif}
|
||||
findproc : @FindSectionElf;
|
||||
{$endif BEOS}
|
||||
{$ifdef darwin}
|
||||
openproc : @OpenMachO32PPC;
|
||||
findproc : @FindSectionMachO32PPC;
|
||||
|
@ -92,10 +92,15 @@ function do_isdevice(handle:thandle):boolean;forward;
|
||||
****************************************************************************}
|
||||
|
||||
{$ifdef FPC_USE_LIBC}
|
||||
{ Under Haiku, bcopy cause a problem when searching for include file
|
||||
in the compiler. So, we use the internal implementation for now
|
||||
under BeOS and Haiku. }
|
||||
{$ifndef BEOS}
|
||||
{ prefer libc implementations over our own, as they're most likely faster }
|
||||
{$i cgeneric.inc}
|
||||
{ is now declared as external reference to another routine in the interface }
|
||||
{$i cgenstr.inc}
|
||||
{$endif}
|
||||
{$endif FPC_USE_LIBC}
|
||||
|
||||
{$ifdef cpui386}
|
||||
|
@ -46,3 +46,27 @@ const convert_linuxlowascii_to_vga:array[#0..#31] of word=(
|
||||
$00ad,$00b1,$f879,$00be,$00b6,$00a7,$00f7,$00b8, { $f0..$f7 }
|
||||
$00b0,$00a8,$00b7,$00b9,$00b3,$00b2,$002a,$00a0 { $f8..$ff }
|
||||
);
|
||||
convert_lowascii_to_UTF8:array[#0..#31] of WideChar=(
|
||||
#0000,#9786,#9787,#9829,#9830,#9827,#9824,#8226,
|
||||
#9688,#9675,#9689,#9794,#9792,#9834,#9835,#9788,
|
||||
#9658,#9668,#8597,#8252,#0182,#0167,#9644,#8616,
|
||||
#8593,#8595,#8594,#8592,#8735,#8596,#9650,#9660
|
||||
);
|
||||
convert_cp437_to_UTF8:array[#128..#255] of WideChar=(
|
||||
#0199,#0252,#0233,#0226,#0228,#0224,#0229,#0231, { $80..$87 }
|
||||
#0234,#0235,#0232,#0239,#0238,#0236,#0196,#0197, { $88..$8f }
|
||||
#0201,#0230,#0198,#0244,#0246,#0242,#0251,#0249, { $90..$97 }
|
||||
#0255,#0214,#0220,#0162,#0163,#0165,#8359,#0402, { $98..$9f }
|
||||
#0225,#0237,#0243,#0250,#0241,#0209,#0170,#0186, { $a0..$a7 }
|
||||
#0191,#8976,#0172,#0189,#0188,#0161,#0171,#0187, { $a8..$af }
|
||||
#9617,#9618,#9619,#9474,#9508,#9569,#9570,#9558, { $b0..$b7 }
|
||||
#9557,#9571,#9553,#9559,#9565,#9564,#9563,#9488, { $b8..$bf }
|
||||
#9492,#9524,#9516,#9500,#9472,#9532,#9566,#9567, { $c0..$c7 }
|
||||
#9562,#9556,#9577,#9574,#9568,#9552,#9580,#9575, { $c8..$cf }
|
||||
#9576,#9572,#9573,#9561,#9560,#9554,#9555,#9579, { $d0..$d7 }
|
||||
#9578,#9496,#9484,#9608,#9604,#9612,#9616,#9600, { $d8..$df }
|
||||
#0945,#0223,#0915,#0960,#0931,#0963,#0181,#0964, { $e0..$e7 }
|
||||
#0934,#0920,#0937,#0948,#8734,#0966,#0949,#8745, { $e8..$ef }
|
||||
#8801,#0177,#8805,#8804,#8992,#8993,#0247,#8776, { $f0..$f7 }
|
||||
#0176,#8729,#0183,#8730,#8319,#0178,#9632,#0160 { $f8..$ff }
|
||||
);
|
||||
|
@ -71,7 +71,8 @@ type Tconsole_type=(ttyNetwork
|
||||
Tconversion=(cv_none,
|
||||
cv_cp437_to_iso01,
|
||||
cv_cp850_to_iso01,
|
||||
cv_linuxlowascii_to_vga);
|
||||
cv_linuxlowascii_to_vga,
|
||||
cv_cp437_to_UTF8);
|
||||
|
||||
Ttermcode=(
|
||||
enter_alt_charset_mode,
|
||||
@ -174,8 +175,21 @@ const term_codes_ansi:Ttermcodes=
|
||||
#$1B#$5B#$3F#$37#$6C, {exit_am_mode}
|
||||
#$1B#$28#$42#$1B#$29#$30); {ena_acs}
|
||||
|
||||
term_codes_beos:Ttermcodes=
|
||||
(nil,//#$0E, {enter_alt_charset_mode}
|
||||
nil,//#$0F, {exit_alt_charset_mode}
|
||||
#$1B#$5B#$48#$1B#$5B#$4A, {clear_screen}
|
||||
#$1B#$5B#$48, {cursor_home}
|
||||
#$1B'[?25h',// nil,//#$1B#$5B#$3F#$31#$32#$6C#$1B#$5B#$3F#$32#$35#$68, {cursor_normal}
|
||||
nil,//#$1B#$5B#$3F#$31#$32#$3B#$32#$35#$68, {cursor visible, underline}
|
||||
nil,//#$1B#$5B#$3F#$31#$32#$3B#$32#$35#$68, {cursor visible, block}
|
||||
#$1B'[?25l',//nil,//#$1B#$5B#$3F#$32#$35#$6C, {cursor_invisible}
|
||||
nil,//#$1B#$5B#$3F#$31#$30#$34#$39#$68, {enter_ca_mode}
|
||||
nil,//#$1B#$5B#$3F#$31#$30#$34#$39#$6C, {exit_ca_mode}
|
||||
nil,//#$1B#$5B#$3F#$37#$6C, {exit_am_mode}
|
||||
nil);//#$1B#$28#$42#$1B#$29#$30); {ena_acs}
|
||||
|
||||
const terminal_names:array[0..10] of string[7]=(
|
||||
const terminal_names:array[0..11] of string[7]=(
|
||||
'ansi',
|
||||
'cons',
|
||||
'eterm',
|
||||
@ -186,8 +200,9 @@ const terminal_names:array[0..10] of string[7]=(
|
||||
'screen',
|
||||
'vt100',
|
||||
'vt220',
|
||||
'xterm');
|
||||
terminal_data:array[0..10] of Ptermcodes=(
|
||||
'xterm',
|
||||
'beterm');
|
||||
terminal_data:array[0..11] of Ptermcodes=(
|
||||
@term_codes_ansi,
|
||||
@term_codes_freebsd,
|
||||
@term_codes_xterm,
|
||||
@ -198,7 +213,8 @@ const terminal_names:array[0..10] of string[7]=(
|
||||
@term_codes_xterm,
|
||||
@term_codes_vt100,
|
||||
@term_codes_vt220,
|
||||
@term_codes_xterm);
|
||||
@term_codes_xterm,
|
||||
@term_codes_beos);
|
||||
|
||||
const convert:Tconversion=cv_none;
|
||||
|
||||
@ -285,7 +301,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure SendEscapeSeqNdx(ndx:Ttermcode);
|
||||
|
||||
var p:PChar;
|
||||
@ -596,6 +611,32 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
function transform_cp437_to_UTF8(const st:string): string;
|
||||
var i:byte;
|
||||
c : char;
|
||||
converted : WideChar;
|
||||
s : WideString;
|
||||
begin
|
||||
transform_cp437_to_UTF8 := '';
|
||||
for i:=1 to length(st) do
|
||||
begin
|
||||
c:=st[i];
|
||||
case c of
|
||||
#0..#31:
|
||||
converted:=convert_lowascii_to_UTF8[c];
|
||||
#128..#255:
|
||||
converted:=convert_cp437_to_UTF8[c];
|
||||
else
|
||||
begin
|
||||
converted := #0;
|
||||
converted := c;
|
||||
end;
|
||||
end;
|
||||
s := s + converted;
|
||||
end;
|
||||
transform_cp437_to_UTF8 := Utf8Encode(s);
|
||||
end;
|
||||
|
||||
function transform(const hstr:string):string;
|
||||
|
||||
begin
|
||||
@ -606,6 +647,8 @@ var
|
||||
transform:=transform_cp437_to_iso01(hstr);
|
||||
cv_cp850_to_iso01:
|
||||
transform:=transform_cp850_to_iso01(hstr);
|
||||
cv_cp437_to_UTF8:
|
||||
transform:=transform_cp437_to_UTF8(hstr);
|
||||
else
|
||||
transform:=hstr;
|
||||
end;
|
||||
@ -935,6 +978,9 @@ begin
|
||||
437 in the hope that the actual font has similarity to codepage 437.}
|
||||
internal_codepage:=cp437;
|
||||
end;
|
||||
{$ifdef BEOS}
|
||||
convert := cv_cp437_to_UTF8;
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user