TNames -> BNames and other minor changes.

This commit is contained in:
oscarl-2
2003-12-20 03:18:05 +00:00
parent 337fbe9499
commit 199a50758f
4 changed files with 280 additions and 268 deletions

View File

@@ -1,5 +1,6 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Eric Jourde
Copyright (C) 2002 - 2003 Eric Jourde
Oscar Lesta
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -15,17 +16,15 @@
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit BString;
interface
uses
beobj, SupportDefs, os;
BeObj, SupportDefs, OS;
type
TString = class(TBeObject)
private
BString = class(TBeObject)
public
constructor Create; override;
// constructor Create(value : PChar); override;
@@ -36,29 +35,36 @@ type
function String_pchar : PChar;
// Affectation
procedure SetTo(value:PChar; lenght : cardinal);
procedure SetTo( from: TString);
procedure SetTo( value:TString; length1: cardinal);
procedure Adopt( from:TString);
procedure SetTo(value : PChar; lenght : cardinal);
procedure SetTo(from : TString);
procedure SetTo(value : TString; length1 : cardinal);
procedure Adopt(from : TString);
end;
function BString_Create(AObject : TBeObject) : TCPlusObject;
cdecl; external BePascalLibName name 'BString_Create';
function BString_Create(AObject : TBeObject; value : PChar) : TCPlusObject;
cdecl; external BePascalLibName name 'BString_Create_1';
procedure BString_Free(AObject : TCPlusObject);
cdecl; external BePascalLibName name 'BString_Free';
function BString_CountChars(AObject : TCPlusObject) : cardinal;
cdecl; external BePascalLibName name 'BString_CountChars';
function BString_Length(AObject : TCPlusObject) : cardinal;
cdecl; external BePascalLibName name 'BString_Length';
function BString_String(AObject : TCPlusObject) : Pchar;
cdecl; external BePascalLibName name 'BString_String';
function BString_Create(AObject : TBeObject):TCPlusObject; cdecl; external BePascalLibName name 'BString_Create';
function BString_Create(AObject : TBeObject;value : PChar):TCPlusObject; cdecl; external BePascalLibName name 'BString_Create_1';
procedure BString_Free(AObject : TCPlusObject);cdecl; external BePascalLibName name 'BString_Free';
function BString_CountChars(AObject : TCPlusObject): cardinal;cdecl; external BePascalLibName name 'BString_CountChars';
function BString_Length(AObject : TCPlusObject): cardinal;cdecl; external BePascalLibName name 'BString_Length';
function BString_String(AObject : TCPlusObject): Pchar;cdecl; external BePascalLibName name 'BString_String';
procedure BString_SetTo(AObject : TCPlusObject;value:Pchar;length:cardinal);cdecl; external BePascalLibName name 'BString_SetTo';
procedure BString_SetTo_1(AObject : TCPlusObject; from: TBeObject);cdecl; external BePascalLibName name 'BString_SetTo_1';
procedure BString_SetTo_2(AObject : TCPlusObject; value:TBeObject;length: cardinal);cdecl; external BePascalLibName name 'BString_SetTo_2';
procedure BString_Adopt(AObject : TCPlusObject; from:TBeObject);cdecl; external BePascalLibName name 'BString_Adopt';
procedure BString_SetTo(AObject : TCPlusObject; value : Pchar; length : cardinal);
cdecl; external BePascalLibName name 'BString_SetTo';
procedure BString_SetTo_1(AObject : TCPlusObject; from : TBeObject);
cdecl; external BePascalLibName name 'BString_SetTo_1';
procedure BString_SetTo_2(AObject : TCPlusObject; value : TBeObject; length : cardinal);
cdecl; external BePascalLibName name 'BString_SetTo_2';
procedure BString_Adopt(AObject : TCPlusObject; from : TBeObject);
cdecl; external BePascalLibName name 'BString_Adopt';
{
BString &
BString_Adopt_1(BString *String, BString &from,
int32 length)
@@ -444,67 +450,62 @@ BString_CharacterDeescape_1
(BString *String, char escapeChar)
}
implementation
constructor TString.Create;
constructor BString.Create;
begin
inherited;
CPlusObject := BString_Create(Self);
end;
{constructor TString.Create_1(value:PChar);
{
constructor BString.Create_1(value:PChar);
begin
inherited;
CPlusObject := BString_Create_1(Self,value);
CPlusObject := BString_Create_1(Self, value);
end;
}
destructor TString.Destroy;
destructor BString.Destroy;
begin
if CPlusObject <> nil then
BString_Free(CPlusObject);
inherited;
end;
function TString.CountChars : integer;
function BString.CountChars : integer;
begin
result:=BString_CountChars(CPlusObject);
Result := BString_CountChars(CPlusObject);
end;
function TString.length : integer;
function BString.length : integer;
begin
result:=BString_Length(CPlusObject);
Result := BString_Length(CPlusObject);
end;
function TString.String_pchar : PChar;
function BString.String_pchar : PChar;
begin
result:=BString_String(CPlusObject);
Result := BString_String(CPlusObject);
end;
procedure TString.SetTo(value:PChar; lenght : cardinal);
procedure BString.SetTo(value : PChar; lenght : cardinal);
begin
BString_SetTo(CPlusObject,value,lenght);
end;
procedure TString.SetTo( from: TString);
procedure BString.SetTo(from : TString);
begin
BString_SetTo_1(CPlusObject, from);
end;
procedure TString.SetTo( value:TString;length1: cardinal);
procedure BString.SetTo( value : TString; length1 : cardinal);
begin
BString_SetTo_2(CPlusObject, value,length1);
BString_SetTo_2(CPlusObject, value, length1);
end;
procedure TString.Adopt( from:TString);
procedure BString.Adopt(from : TString);
begin
BString_Adopt(CPlusObject, from);
end;
end.

View File

@@ -1,6 +1,7 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
Copyright (C) 2002 - 2003 Olivier Coursiere
Eric Jourde
Oscar Lesta
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -16,21 +17,20 @@
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit dataio;
unit DataIO;
interface
uses
beobj, supportdefs;
BeObj, SupportDefs;
type
BDataIO = class(TBeObject)
private
public
constructor Create; override;
destructor Destroy; override;
function Read(buffer : Pointer; size : Size_t) : SSize_t; virtual; abstract;
function Write(buffer : Pointer; size : Size_t) : SSize_t; virtual; abstract;
function Read(buffer : Pointer; size : size_t) : ssize_t; virtual; abstract;
function Write(buffer : Pointer; size : size_t) : ssize_t; virtual; abstract;
{ procedure _ReservedDataIO1;
procedure _ReservedDataIO2;
procedure _ReservedDataIO3;
@@ -48,19 +48,18 @@ type
// function operator=( : BDataIO) : BDataIO;
// procedure int32 _reserved[2];
end;
type
TPositionIO = class(BDataIO)
private
BPositionIO = class(BDataIO)
public
constructor Create; override;
destructor Destroy; override;
// function Read(buffer : Pointer; size : Size_t) : SSize_t; override;
// function Write(buffer : Pointer; size : Size_t) : SSize_t; override;
function ReadAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; virtual; abstract;
function WriteAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; virtual; abstract;
// function Read(buffer : Pointer; size : size_t) : ssize_t; override;
// function Write(buffer : Pointer; size : size_t) : ssize_t; override;
function ReadAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t; virtual; abstract;
function WriteAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t; virtual; abstract;
function Seek(aposition : off_t; seek_mode : Cardinal) : off_t; virtual; abstract;
// function Position : off_t; virtual;
function SetSize(size : off_t) : Status_t; virtual;
function SetSize(size : off_t) : status_t; virtual;
{ procedure _ReservedPositionIO1;
procedure _ReservedPositionIO2;
procedure _ReservedPositionIO3;
@@ -76,63 +75,61 @@ type
}
// procedure int32 _reserved[2];
end;
type
TMallocIO = class(TPositionIO)
private
BMallocIO = class(BPositionIO)
public
constructor Create; override;
destructor Destroy; override;
function ReadAt(pos : off_t; abuffer : Pointer; size : Size_t) : SSize_t; override;
function WriteAt(pos : off_t; abuffer : Pointer; size : Size_t) : SSize_t; override;
function ReadAt(pos : off_t; abuffer : Pointer; size : size_t) : ssize_t; override;
function WriteAt(pos : off_t; abuffer : Pointer; size : size_t) : ssize_t; override;
function Seek(pos : off_t; seek_mode : Cardinal) : off_t; override;
// function Position : off_t; override;
function SetSize(size : off_t) : Status_t; override;
procedure SetBlockSize(blocksize : Size_t); virtual;
function SetSize(size : off_t) : status_t; override;
procedure SetBlockSize(blocksize : size_t); virtual;
function Buffer : Pointer;
// function BufferLength : Size_t;
// function BufferLength : size_t;
{ procedure _ReservedMallocIO1;
procedure _ReservedMallocIO2;
}
// constructor Create(MallocIO : TMallocIO);
// function operator=( : TMallocIO) : TMallocIO;
{ function fBlockSize : Size_t;
function fMallocSize : Size_t;
function fLength : Size_t;
{ function fBlockSize : size_t;
function fMallocSize : size_t;
function fLength : size_t;
function fData : PChar;
function fPosition : off_t;
}
// procedure _reserved[1] : integer;
end;
type
TMemoryIO = class(TPositionIO)
private
BMemoryIO = class(BPositionIO)
public
constructor Create; override;
constructor Create(p : Pointer; len : Size_t); virtual;
constructor Create(p : Pointer; len : size_t); virtual;
destructor Destroy; override;
function ReadAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; override;
function WriteAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; override;
function ReadAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t; override;
function WriteAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t; override;
function Seek(pos : off_t; seek_mode : Cardinal) : off_t; override;
// function Position : off_t; override;
function SetSize(size : off_t) : Status_t; override;
function SetSize(size : off_t) : status_t; override;
{ procedure _ReservedMemoryIO1;
procedure _ReservedMemoryIO2;
}
constructor Create(MemoryIO : TMemoryIO);
// function operator=(MemoryIO : TMemoryIO) : TMemoryIO;
constructor Create(MemoryIO : BMemoryIO);
// function operator=(MemoryIO : BMemoryIO) : BMemoryIO;
{ function fReadOnly : boolean;
function fBuf : PChar;
function fLen : Size_t;
function fPhys : Size_t;
function fPos : Size_t;
function fLen : size_t;
function fPhys : size_t;
function fPos : size_t;
}
// function _reserved[1] : int32;
end;
function BDataIO_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BDataIO_Create_1';
procedure BDataIO_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BDataIO_Free';
//function BDataIO_Read(AObject : TCPlusObject; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BDataIO_Read';
//function BDataIO_Write(AObject : TCPlusObject; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BDataIO_Write';
//function BDataIO_Read(AObject : TCPlusObject; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BDataIO_Read';
//function BDataIO_Write(AObject : TCPlusObject; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BDataIO_Write';
{procedure BDataIO__ReservedDataIO1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BDataIO__ReservedDataIO1';
procedure BDataIO__ReservedDataIO2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BDataIO__ReservedDataIO2';
procedure BDataIO__ReservedDataIO3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BDataIO__ReservedDataIO3';
@@ -151,13 +148,13 @@ function BDataIO_Create(AObject : TBeObject; DataIO : BDataIO) : TCPlusObject; c
//procedure BDataIO_int32 _reserved[2](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BDataIO_int32 _reserved[2]';
function BPositionIO_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BPositionIO_Create';
procedure BPositionIO_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BPositionIO_Free';
function BPositionIO_Read(AObject : TCPlusObject; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BPositionIO_Read';
function BPositionIO_Write(AObject : TCPlusObject; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BPositionIO_Write';
function BPositionIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BPositionIO_ReadAt';
function BPositionIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BPositionIO_WriteAt';
function BPositionIO_Read(AObject : TCPlusObject; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BPositionIO_Read';
function BPositionIO_Write(AObject : TCPlusObject; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BPositionIO_Write';
function BPositionIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BPositionIO_ReadAt';
function BPositionIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BPositionIO_WriteAt';
function BPositionIO_Seek(AObject : TCPlusObject; position : off_t; seek_mode : Cardinal) : off_t; cdecl; external BePascalLibName name 'BPositionIO_Seek';
//function BPositionIO_Position(AObject : TCPlusObject) : off_t; cdecl; external BePascalLibName name 'BPositionIO_Position';
function BPositionIO_SetSize(AObject : TCPlusObject; size : off_t) : Status_t; cdecl; external BePascalLibName name 'BPositionIO_SetSize';
function BPositionIO_SetSize(AObject : TCPlusObject; size : off_t) : status_t; cdecl; external BePascalLibName name 'BPositionIO_SetSize';
{procedure BPositionIO__ReservedPositionIO1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BPositionIO__ReservedPositionIO1';
procedure BPositionIO__ReservedPositionIO2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BPositionIO__ReservedPositionIO2';
procedure BPositionIO__ReservedPositionIO3(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BPositionIO__ReservedPositionIO3';
@@ -174,14 +171,14 @@ procedure BPositionIO__ReservedPositionIO12(AObject : TCPlusObject); cdecl; exte
//procedure BPositionIO_int32 _reserved[2](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BPositionIO_int32 _reserved[2]';
function BMallocIO_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BMallocIO_Create';
procedure BMallocIO_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMallocIO_Free';
function BMallocIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BMallocIO_ReadAt';
function BMallocIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BMallocIO_WriteAt';
function BMallocIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BMallocIO_ReadAt';
function BMallocIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BMallocIO_WriteAt';
function BMallocIO_Seek(AObject : TCPlusObject; pos : off_t; seek_mode : Cardinal) : off_t; cdecl; external BePascalLibName name 'BMallocIO_Seek';
//function BMallocIO_Position(AObject : TCPlusObject) : off_t; cdecl; external BePascalLibName name 'BMallocIO_Position';
function BMallocIO_SetSize(AObject : TCPlusObject; size : off_t) : Status_t; cdecl; external BePascalLibName name 'BMallocIO_SetSize';
procedure BMallocIO_SetBlockSize(AObject : TCPlusObject; blocksize : Size_t); cdecl; external BePascalLibName name 'BMallocIO_SetBlockSize';
function BMallocIO_SetSize(AObject : TCPlusObject; size : off_t) : status_t; cdecl; external BePascalLibName name 'BMallocIO_SetSize';
procedure BMallocIO_SetBlockSize(AObject : TCPlusObject; blocksize : size_t); cdecl; external BePascalLibName name 'BMallocIO_SetBlockSize';
function BMallocIO_Buffer(AObject : TCPlusObject) : Pointer; cdecl; external BePascalLibName name 'BMallocIO_Buffer';
//function BMallocIO_BufferLength(AObject : TCPlusObject) : Size_t; cdecl; external BePascalLibName name 'BMallocIO_BufferLength';
//function BMallocIO_BufferLength(AObject : TCPlusObject) : size_t; cdecl; external BePascalLibName name 'BMallocIO_BufferLength';
{procedure BMallocIO__ReservedMallocIO1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMallocIO__ReservedMallocIO1';
procedure BMallocIO__ReservedMallocIO2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMallocIO__ReservedMallocIO2';
}
@@ -195,18 +192,18 @@ procedure BMallocIO_off_t fPosition(AObject : TCPlusObject); cdecl; external BeP
procedure BMallocIO_int32 _reserved[1](AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMallocIO_int32 _reserved[1]';
}
function BMemoryIO_Create(AObject : TBeObject) : TCPlusObject; cdecl; external BePascalLibName name 'BMemoryIO_Create';
function BMemoryIO_Create(AObject : TBeObject; p : Pointer; len : Size_t) : TCPlusObject; cdecl; external BePascalLibName name 'BMemoryIO_Create_1';
function BMemoryIO_Create(AObject : TBeObject; p : Pointer; len : size_t) : TCPlusObject; cdecl; external BePascalLibName name 'BMemoryIO_Create_1';
procedure BMemoryIO_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO_Free';
function BMemoryIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BMemoryIO_ReadAt';
function BMemoryIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : Size_t) : SSize_t; cdecl; external BePascalLibName name 'BMemoryIO_WriteAt';
function BMemoryIO_ReadAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BMemoryIO_ReadAt';
function BMemoryIO_WriteAt(AObject : TCPlusObject; pos : off_t; buffer : Pointer; size : size_t) : ssize_t; cdecl; external BePascalLibName name 'BMemoryIO_WriteAt';
function BMemoryIO_Seek(AObject : TCPlusObject; pos : off_t; seek_mode : Cardinal) : off_t; cdecl; external BePascalLibName name 'BMemoryIO_Seek';
function BMemoryIO_Position(AObject : TCPlusObject) : off_t; cdecl; external BePascalLibName name 'BMemoryIO_Position';
function BMemoryIO_SetSize(AObject : TCPlusObject; size : off_t) : Status_t; cdecl; external BePascalLibName name 'BMemoryIO_SetSize';
function BMemoryIO_SetSize(AObject : TCPlusObject; size : off_t) : status_t; cdecl; external BePascalLibName name 'BMemoryIO_SetSize';
{procedure BMemoryIO__ReservedMemoryIO1(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO__ReservedMemoryIO1';
procedure BMemoryIO__ReservedMemoryIO2(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO__ReservedMemoryIO2';
}
function BMemoryIO_Create(AObject : TBeObject; MemoryIO : TCPlusObject) : TCPlusObject; cdecl; external BePascalLibName name 'BMemoryIO_Create';
//function BMemoryIO_operator=(AObject : TCPlusObject; : TMemoryIO) : TMemoryIO; cdecl; external BePascalLibName name 'BMemoryIO_operator=';
//function BMemoryIO_operator=(AObject : TCPlusObject; : BMemoryIO) : BMemoryIO; cdecl; external BePascalLibName name 'BMemoryIO_operator=';
{procedure BMemoryIO_bool fReadOnly(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO_bool fReadOnly';
procedure BMemoryIO_char *fBuf(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO_char *fBuf';
procedure BMemoryIO_size_t fLen(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BMemoryIO_size_t fLen';
@@ -309,318 +306,317 @@ begin
end;
}
constructor TPositionIO.Create;
constructor BPositionIO.Create;
begin
CPlusObject := BPositionIO_Create(Self);
end;
destructor TPositionIO.Destroy;
destructor BPositionIO.Destroy;
begin
BPositionIO_Free(CPlusObject);
end;
{function TPositionIO.Read(buffer : Pointer; size : Size_t) : SSize_t;
{function BPositionIO.Read(buffer : Pointer; size : size_t) : ssize_t;
begin
Result := BPositionIO_Read(CPlusObject, buffer, size);
end;
function TPositionIO.Write(buffer : Pointer; size : Size_t) : SSize_t;
function BPositionIO.Write(buffer : Pointer; size : size_t) : ssize_t;
begin
Result := BPositionIO_Write(CPlusObject, buffer, size);
end;
}
{function TPositionIO.ReadAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t;
{function BPositionIO.ReadAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t;
begin
Result := BPositionIO_ReadAt(CPlusObject, pos, buffer, size);
end;
function TPositionIO.WriteAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t;
function BPositionIO.WriteAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t;
begin
Result := BPositionIO_WriteAt(CPlusObject, pos, buffer, size);
end;
function TPositionIO.Seek(aposition : off_t; seek_mode : Cardinal) : off_t;
function BPositionIO.Seek(aposition : off_t; seek_mode : Cardinal) : off_t;
begin
Result := BPositionIO_Seek(CPlusObject, aposition, seek_mode);
end;
}
{function TPositionIO.Position : off_t;
{function BPositionIO.Position : off_t;
begin
Result := BPositionIO_Position(CPlusObject);
end;
}
function TPositionIO.SetSize(size : off_t) : Status_t;
function BPositionIO.SetSize(size : off_t) : status_t;
begin
Result := BPositionIO_SetSize(CPlusObject, size);
end;
{procedure TPositionIO._ReservedPositionIO1;
{procedure BPositionIO._ReservedPositionIO1;
begin
BPositionIO__ReservedPositionIO1(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO2;
procedure BPositionIO._ReservedPositionIO2;
begin
BPositionIO__ReservedPositionIO2(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO3;
procedure BPositionIO._ReservedPositionIO3;
begin
BPositionIO__ReservedPositionIO3(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO4;
procedure BPositionIO._ReservedPositionIO4;
begin
BPositionIO__ReservedPositionIO4(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO5;
procedure BPositionIO._ReservedPositionIO5;
begin
BPositionIO__ReservedPositionIO5(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO6;
procedure BPositionIO._ReservedPositionIO6;
begin
BPositionIO__ReservedPositionIO6(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO7;
procedure BPositionIO._ReservedPositionIO7;
begin
BPositionIO__ReservedPositionIO7(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO8;
procedure BPositionIO._ReservedPositionIO8;
begin
BPositionIO__ReservedPositionIO8(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO9;
procedure BPositionIO._ReservedPositionIO9;
begin
BPositionIO__ReservedPositionIO9(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO10;
procedure BPositionIO._ReservedPositionIO10;
begin
BPositionIO__ReservedPositionIO10(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO11;
procedure BPositionIO._ReservedPositionIO11;
begin
BPositionIO__ReservedPositionIO11(CPlusObject);
end;
procedure TPositionIO._ReservedPositionIO12;
procedure BPositionIO._ReservedPositionIO12;
begin
BPositionIO__ReservedPositionIO12(CPlusObject);
end;
}
{procedure TPositionIO.int32 _reserved[2];
{procedure BPositionIO.int32 _reserved[2];
begin
BPositionIO_int32 _reserved[2](CPlusObject);
end;
}
constructor TMallocIO.Create;
constructor BMallocIO.Create;
begin
CPlusObject := BMallocIO_Create(Self);
end;
destructor TMallocIO.Destroy;
destructor BMallocIO.Destroy;
begin
BMallocIO_Free(CPlusObject);
end;
function TMallocIO.ReadAt(pos : off_t; abuffer : Pointer; size : Size_t) : SSize_t;
function BMallocIO.ReadAt(pos : off_t; abuffer : Pointer; size : size_t) : ssize_t;
begin
Result := BMallocIO_ReadAt(CPlusObject, pos, abuffer, size);
end;
function TMallocIO.WriteAt(pos : off_t; abuffer : Pointer; size : Size_t) : SSize_t;
function BMallocIO.WriteAt(pos : off_t; abuffer : Pointer; size : size_t) : ssize_t;
begin
Result := BMallocIO_WriteAt(CPlusObject, pos, abuffer, size);
end;
function TMallocIO.Seek(pos : off_t; seek_mode : Cardinal) : off_t;
function BMallocIO.Seek(pos : off_t; seek_mode : Cardinal) : off_t;
begin
Result := BMallocIO_Seek(CPlusObject, pos, seek_mode);
end;
{function TMallocIO.Position : off_t;
{function BMallocIO.Position : off_t;
begin
Result := BMallocIO_Position(CPlusObject);
end;
}
function TMallocIO.SetSize(size : off_t) : Status_t;
function BMallocIO.SetSize(size : off_t) : status_t;
begin
Result := BMallocIO_SetSize(CPlusObject, size);
end;
procedure TMallocIO.SetBlockSize(blocksize : Size_t);
procedure BMallocIO.SetBlockSize(blocksize : size_t);
begin
BMallocIO_SetBlockSize(CPlusObject, blocksize);
end;
function TMallocIO.Buffer : Pointer;
function BMallocIO.Buffer : Pointer;
begin
Result := BMallocIO_Buffer(CPlusObject);
end;
{function TMallocIO.BufferLength : Size_t;
{function BMallocIO.BufferLength : size_t;
begin
Result := BMallocIO_BufferLength(CPlusObject);
end;
}
{procedure TMallocIO._ReservedMallocIO1;
{procedure BMallocIO._ReservedMallocIO1;
begin
BMallocIO__ReservedMallocIO1(CPlusObject);
end;
procedure TMallocIO._ReservedMallocIO2;
procedure BMallocIO._ReservedMallocIO2;
begin
BMallocIO__ReservedMallocIO2(CPlusObject);
end;
}
//constructor TMallocIO.Create(MallocIO : TMallocIO);
//constructor BMallocIO.Create(MallocIO : BMallocIO);
//begin
// CPlusObject := BMallocIO_Create(Self, MallocIO);
//end;
{function TMallocIO.operator=( : TMallocIO) : TMallocIO;
{function BMallocIO.operator=( : BMallocIO) : BMallocIO;
begin
BMallocIO_operator=(CPlusObject, );
end;
}
{function TMallocIO.fBlockSize : Size_t;
{function BMallocIO.fBlockSize : size_t;
begin
Result := BMallocIO_fBlockSize(CPlusObject);
end;
function TMallocIO.fMallocSize : Size_t;
function BMallocIO.fMallocSize : size_t;
begin
Result := BMallocIO_size_t fMallocSize(CPlusObject);
end;
function TMallocIO.fLength : Size_t;
function BMallocIO.fLength : size_t;
begin
BMallocIO_size_t fLength(CPlusObject);
end;
function TMallocIO.fData : PChar;
function BMallocIO.fData : PChar;
begin
Result := BMallocIO_char *fData(CPlusObject);
end;
function TMallocIO.fPosition : off_t;
function BMallocIO.fPosition : off_t;
begin
Result := BMallocIO_fPosition(CPlusObject);
end;
}
{procedure TMallocIO.int32 _reserved[1];
{procedure BMallocIO.int32 _reserved[1];
begin
BMallocIO_int32 _reserved[1](CPlusObject);
end;
}
constructor TMemoryIO.Create;
constructor BMemoryIO.Create;
begin
CPlusObject := BMemoryIO_Create(Self);
end;
constructor TMemoryIO.Create(p : Pointer; len : Size_t);
constructor BMemoryIO.Create(p : Pointer; len : size_t);
begin
CPlusObject := BMemoryIO_Create(Self, p, len);
end;
destructor TMemoryIO.Destroy;
destructor BMemoryIO.Destroy;
begin
BMemoryIO_Free(CPlusObject);
end;
function TMemoryIO.ReadAt(pos : off_t; buffer : Pointer; size : Size_t) : SSize_t;
function BMemoryIO.ReadAt(pos : off_t; buffer : Pointer; size : size_t) : ssize_t;
begin
Result := BMemoryIO_ReadAt(CPlusObject, pos, buffer, size);
end;
function TMemoryIO.WriteAt(pos : off_t; buffer : Pointer; size :Size_t) :SSize_t;
function BMemoryIO.WriteAt(pos : off_t; buffer : Pointer; size :size_t) :ssize_t;
begin
Result := BMemoryIO_WriteAt(CPlusObject, pos, buffer, size);
end;
function TMemoryIO.Seek(pos : off_t; seek_mode : Cardinal) : off_t;
function BMemoryIO.Seek(pos : off_t; seek_mode : Cardinal) : off_t;
begin
Result := BMemoryIO_Seek(CPlusObject, pos, seek_mode);
end;
{function TMemoryIO.Position : off_t;
{function BMemoryIO.Position : off_t;
begin
Result := BMemoryIO_Position(CPlusObject);
end;
}
function TMemoryIO.SetSize(size : off_t) : Status_t;
function BMemoryIO.SetSize(size : off_t) : status_t;
begin
Result := BMemoryIO_SetSize(CPlusObject, size);
end;
{procedure TMemoryIO._ReservedMemoryIO1;
{procedure BMemoryIO._ReservedMemoryIO1;
begin
BMemoryIO__ReservedMemoryIO1(CPlusObject);
end;
procedure TMemoryIO._ReservedMemoryIO2;
procedure BMemoryIO._ReservedMemoryIO2;
begin
BMemoryIO__ReservedMemoryIO2(CPlusObject);
end;
}
constructor TMemoryIO.Create(MemoryIO : TMemoryIO);
constructor BMemoryIO.Create(MemoryIO : BMemoryIO);
begin
CPlusObject := BMemoryIO_Create(Self, MemoryIO.CPlusObject);
end;
{function TMemoryIO.operator=( : TMemoryIO) : TMemoryIO;
{function BMemoryIO.operator=( : BMemoryIO) : BMemoryIO;
begin
BMemoryIO_operator=(CPlusObject, );
end;
}
{procedure TMemoryIO.bool fReadOnly;
{procedure BMemoryIO.bool fReadOnly;
begin
BMemoryIO_bool fReadOnly(CPlusObject);
end;
procedure TMemoryIO.char *fBuf;
procedure BMemoryIO.char *fBuf;
begin
BMemoryIO_char *fBuf(CPlusObject);
end;
procedure TMemoryIO.size_t fLen;
procedure BMemoryIO.size_t fLen;
begin
BMemoryIO_size_t fLen(CPlusObject);
end;
procedure TMemoryIO.size_t fPhys;
procedure BMemoryIO.size_t fPhys;
begin
BMemoryIO_size_t fPhys(CPlusObject);
end;
procedure TMemoryIO.size_t fPos;
procedure BMemoryIO.size_t fPos;
begin
BMemoryIO_size_t fPos(CPlusObject);
end;
procedure TMemoryIO.int32 _reserved[1];
procedure BMemoryIO.int32 _reserved[1];
begin
BMemoryIO_int32 _reserved[1](CPlusObject);
end;

View File

@@ -1,6 +1,7 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursière
Copyright (C) 2002 - 2003 Olivier Coursière
Eric Jourde
Oscar Lesta
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -16,50 +17,51 @@
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit Flattenable;
interface
uses
beobj, SupportDefs, os;
BeObj, SupportDefs, OS;
type
BFlattenable = class(TBeObject)
private
public
constructor Create; override;
destructor Destroy; override;
function IsFixedSize : boolean;
function TypeCode : Type_code;
function Flatten( buffer :pointer; size : ssize_t) : Status_t;
function AllowsTypeCode( code : Type_code) : boolean;
function Unflatten(c :Type_code ; buf :pointer ; size: ssize_t) : Status_t;
function IsFixedSize : Boolean;
function TypeCode : type_code;
function Flatten(buffer : Pointer; size : ssize_t) : status_t;
function AllowsTypeCode(code : Type_code) : Boolean;
function Unflatten(c : type_code; buf : Pointer; size : ssize_t) : status_t;
end;
procedure BFlattenable_Free(AObject : TCPlusObject);
cdecl; external BePascalLibName name 'BFlattenable_Free';
procedure BFlattenable_Free(AObject : TCPlusObject); cdecl; external BePascalLibName name 'BFlattenable_Free';
function BFlattenable_IsFixedSize(AObject : TCPlusObject) : boolean;cdecl; external BePascalLibName name 'BFlattenable_IsFixedSize';
function BFlattenable_TypeCode(AObject : TCPlusObject) : Type_code;cdecl; external BePascalLibName name 'BFlattenable_TypeCode';
function BFlattenable_Flatten( AObject : TCPlusObject;buffer :pointer; size : ssize_t) : Status_t;cdecl; external BePascalLibName name 'BFlattenable_Flatten';
function BFlattenable_AllowsTypeCode( AObject : TCPlusObject;code : Type_code) : boolean;cdecl; external BePascalLibName name 'BFlattenable_AllowsTypeCode';
function BFlattenable_Unflatten(AObject : TCPlusObject;c :Type_code ; buf :pointer ; size: ssize_t) : Status_t;cdecl; external BePascalLibName name 'BFlattenable_Unflatten';
function BFlattenable_IsFixedSize(AObject : TCPlusObject) : Boolean;
cdecl; external BePascalLibName name 'BFlattenable_IsFixedSize';
function BFlattenable_TypeCode(AObject : TCPlusObject) : type_code;
cdecl; external BePascalLibName name 'BFlattenable_TypeCode';
function BFlattenable_Flatten(AObject : TCPlusObject; buffer : Pointer;
size : ssize_t) : status_t;
cdecl; external BePascalLibName name 'BFlattenable_Flatten';
function BFlattenable_AllowsTypeCode(AObject : TCPlusObject;code : type_code)
: boolean;
cdecl; external BePascalLibName name 'BFlattenable_AllowsTypeCode';
function BFlattenable_Unflatten(AObject : TCPlusObject; c : type_code;
buf : Pointer; size : ssize_t) : Status_t;
cdecl; external BePascalLibName name 'BFlattenable_Unflatten';
implementation
constructor BFlattenable.Create;
begin
CreatePas;
CPlusObject:=self;
CPlusObject := self;
end;
destructor BFlattenable.Destroy;
begin
if CPlusObject <> nil then
@@ -67,30 +69,29 @@ begin
inherited;
end;
function BFlattenable.IsFixedSize : boolean;
function BFlattenable.IsFixedSize : Boolean;
begin
result:=BFlattenable_IsFixedSize(CPlusObject);
Result := BFlattenable_IsFixedSize(CPlusObject);
end;
function BFlattenable.TypeCode : Type_code;
function BFlattenable.TypeCode : type_code;
begin
result:=BFlattenable_TypeCode(CPlusObject);
Result := BFlattenable_TypeCode(CPlusObject);
end;
function BFlattenable.Flatten( buffer :pointer; size : ssize_t) : Status_t;
function BFlattenable.Flatten(buffer : Pointer; size : ssize_t) : status_t;
begin
result:=BFlattenable_Flatten(CPlusObject,buffer,size);
Result := BFlattenable_Flatten(CPlusObject, buffer, size);
end;
function BFlattenable.AllowsTypeCode( code : Type_code) : boolean;
function BFlattenable.AllowsTypeCode(code : type_code) : Boolean;
begin
result:=BFlattenable_AllowsTypeCode(CPlusObject,code);
Result := BFlattenable_AllowsTypeCode(CPlusObject, code);
end;
function BFlattenable.Unflatten(c :Type_code ; buf :pointer ; size: ssize_t) : Status_t;
function BFlattenable.Unflatten(c : type_code; buf : Pointer; size : ssize_t) : status_t;
begin
result:=BFlattenable_Unflatten(CPlusObject,c,buf,size);
Result := BFlattenable_Unflatten(CPlusObject, c, buf, size);
end;
end.

View File

@@ -1,6 +1,7 @@
{ BePascal - A pascal wrapper around the BeOS API
Copyright (C) 2002 Olivier Coursiere
Copyright (C) 2002-2003 Olivier Coursiere
Eric Jourde
Oscar Lesta
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -16,34 +17,47 @@
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit SupportDefs;
interface
type
// Descriptive formats
Status_t = Longint;
Bigtime_t = int64;
Type_code = Cardinal;
Perform_code = Cardinal;
// For Storage kit
// TODO : move these declarations in a different unit (but which one ?).
// C++ declarations are in /boot/develop/headers/posix/sys/types.h,
// not in SupportDefs.h
Dev_t = Longint;
Off_t = int64;
// pointer types for FreePascal : to make life easier
PStatus_t = ^Status_t;
// TODO : import other functions !
dev_t = Longint;
off_t = Int64;
// import from stddef.h
Size_t = Cardinal;
SSize_t = Longint;
size_t = Longword;
ssize_t = Longint;
// ------------------
// Descriptive formats
status_t = Longint;
bigtime_t = int64;
type_code = Longword;
perform_code = Longword;
// pointer types for FreePascal : to make life easier
Pstatus_t = ^status_t;
const
B_EMPTY_STRING = '';
//----- Atomic functions; old value is returned -----------------
function atomic_add(var value : Longint; addvalue : Longint) : Longint;
cdecl; external 'root' name 'atomic_add';
function atomic_and(var value : Longint; andvalue : Longint) : Longint;
cdecl; external 'root' name 'atomic_and';
function atomic_or(var value : Longint; orvalue : Longint) : Longint;
cdecl; external 'root' name 'atomic_or';
//----- Other stuff ---------------------------------------------
function get_stack_frame : Pointer; cdecl; external 'root' name 'get_stack_frame';
implementation
end.