Hello all,
to get address of function I can use @MyFunction, but if I use it within
MyFunction - I get address of Result. How can I get address of current
function? (It's not for assigning to something else. It is for a kind of
self modifying code.)
Regards
Žilvinas Ledas
___
On 18 Jul 2010, at 12:11, Žilvinas Ledas wrote:
> to get address of function I can use @MyFunction, but if I use it within
> MyFunction - I get address of Result. How can I get address of current
> function?
@unitname.function (or @programname.function if you are in the main program
file)
J
On 18 Jul 2010, at 12:50, Jonas Maebe wrote:
> On 18 Jul 2010, at 12:11, Žilvinas Ledas wrote:
>
>> to get address of function I can use @MyFunction, but if I use it within
>> MyFunction - I get address of Result. How can I get address of current
>> function?
>
> @unitname.function (or @progr
On 2010-07-18 13:51, Jonas Maebe wrote:
On 18 Jul 2010, at 12:50, Jonas Maebe wrote:
On 18 Jul 2010, at 12:11, Žilvinas Ledas wrote:
to get address of function I can use @MyFunction, but if I use it within
MyFunction - I get address of Result. How can I get address of current func
Hi!
You can use WriteStr to "Writeln" to a String (needs 2.4.0 and above).
Example:
var
s: String;
begin
WriteStr(s, 'Hello World');
end;
Also you can try unit StreamIO (in fcl-base) which allows you to use
Streams as TextFiles (you can also look at it to learn how to implement
your own
Hi again!
I forgot to mention:
If you want to redirect StdOut (or Output as the variable is called in
Pascal) you need to assign a new TextFile to Output (but keep the old
one around and assign it back later when your application is terminating).
Example:
var
oldoutput, f: TextFile;
begin
On 18 Jul 2010, at 13:14, Žilvinas Ledas wrote:
> I want to use it this way:
> 1) Gel all @unitname.function addresses.
> 2) Use disassembler to find nearest next RET.
> 3) Then I assume that I have start and end of the function in the binary file.
>
> It works at least for the concept-showing a
On 2010-07-18 15:42, Jonas Maebe wrote:
On 18 Jul 2010, at 13:14, Žilvinas Ledas wrote:
I want to use it this way:
1) Gel all @unitname.function addresses.
2) Use disassembler to find nearest next RET.
3) Then I assume that I have start and end of the function in the binary file.
It work
2010/7/18 Sven Barth :
> Also you can try unit StreamIO (in fcl-base) which allows you to use Streams
> as TextFiles (you can also look at it to learn how to implement your own
> text driver).
This looks more promising, streams seem to be a more high level
implementation of such concepts. I'm cur
Hi!
On 18.07.2010 17:07, Bernd wrote:
But I do not understand the following:
function TStream.Write(const Buffer; Count: Longint): Longint;
what type is Buffer? How does it get away with the missing type
declaration without the compiler failing to compile this at all?
Quote from the Docs (
If I have a class with a property Phase: TrrPhase where TrrPhase is an
enumeration such as (rrQuiescent, rrInitialised), is there an elegant
way of extending the enumeration and overriding the property type so
that a derived class can use the new values?
--
Mark Morgan Lloyd
markMLl .AT. tel
As far as I know, properties cannot be overridden. However, you could
consider using subrange types, as the example below shows.
type
Fruit = (Apple, Banana, Cherry, Orange, Pineapple);
LimitedFruit = Apple..Cherry;
You can use the full enumeration as the property's type, and then
restrict i
OK, I got it working now. Just in case somebody else is googling for
something like this:
first I define a class TDebugStream that will later replace the standard output:
Type
TDebugStream = class(TStream)
function Write(const Buffer; Count : Longint) : Longint; override;
end;
implementa
On Sun, 18 Jul 2010, Bernd wrote:
OK, I got it working now. Just in case somebody else is googling for
something like this:
first I define a class TDebugStream that will later replace the standard output:
Type
TDebugStream = class(TStream)
function Write(const Buffer; Count : Longint) :
2010/7/18 Michael Van Canneyt :
> I think that simply
>
> AssignStream(Output,S);
> Rewrite(Output);
>
> Probably would work as well.
Yes, you are of course right, this is simpler. I just forgot to
simplify it after I was initially playing around and experimenting
with a separate file and without
Jetcheng Chu wrote:
As far as I know, properties cannot be overridden. However, you could
consider using subrange types, as the example below shows.
type
Fruit = (Apple, Banana, Cherry, Orange, Pineapple);
LimitedFruit = Apple..Cherry;
You can use the full enumeration as the property's typ
I have used object to make more easy, not need to create or free it,
MyObject = object
private
FProp1: integer;
public
Prop1: integer read FProp1 write FProp1
procedure Proc1;
end;
used like
var
O: MyObject;
begin
O.Proc1;
end;
1 - The problem, i have random value in the prop1(I am not
On 18 Jul 2010, at 21:01, Zaher Dirkey wrote:
> MyObject = object
> private
> FProp1: integer;
> public
> Prop1: integer read FProp1 write FProp1
> procedure Proc1;
> end;
>
> used like
> var
> O: MyObject;
> begin
> O.Proc1;
> end;
>
> 1 - The problem, i have random value in the prop1(I a
On Sun, Jul 18, 2010 at 10:20 PM, Jonas Maebe wrote:
> > 2 - is there a method i can override it to init my properties without to
> > call it manualy O.init;
>
> No.
Can i ask to be an "Feature Request" in FPC?
Thanks
--
Zaher Dirkey
___
fpc-pascal
> Yes, I was thinking that. However if the basic class was say a
> round-robin scheduler with phases rrQuiescent and rrInitialised and the
> descendant was say an HP comms protocol handler with additional phases
> hpReceivingPadding, hpReceivedSync and so on it would seem to be
> questionable pract
20 matches
Mail list logo