write / writeln declaration 
Author Message
 write / writeln declaration

Hello,

I want to develope an object "O", which is able to print text in text-
and in grahics mode onto the screen.
In textmode my O.write(ln) function should work like the normal
write(ln) function. Now I am looking for the explicite declaration for
the normal write(ln) function.
I only found the description :
writeln([var f:text;] v1 [,v2,...vn]);

Does anyone know, how I have to declare my O.write(ln) - function, so
that I can give the same parameters to the normal write(ln) function?

O.write(???);
begin
  write(???);
end;

thanks in advance,

Lutz



Wed, 18 Jun 1902 08:00:00 GMT  
 write / writeln declaration

Quote:

> Hello,

> I want to develope an object "O", which is able to print text in text-
> and in grahics mode onto the screen.
> In textmode my O.write(ln) function should work like the normal
> write(ln) function. Now I am looking for the explicite declaration for
> the normal write(ln) function.
> I only found the description :
> writeln([var f:text;] v1 [,v2,...vn]);

> Does anyone know, how I have to declare my O.write(ln) - function, so
> that I can give the same parameters to the normal write(ln) function?

You can't do it with BP/TP. Routines like Write(ln) and Read(ln) require
some compiler "magic", which is not available to normal programs. If
you use compilers that support function overloading (IIRC, FreePascal does
this) then you can implement several versions of the same routine, and the
compiler will know which one to call, depending on the parameters
supplied when the routine is called.

Best regards, The Chief
--------
Dr. A{*filter*}la A. Olowofoyeku (The African Chief)

Homepage: http://www.*-*-*.com/
Author of: Chief's Installer Pro v5.00 for Win32
     ftp://ftp.simtel.net/pub/simtelnet/win95/install/chief500.zip



Wed, 18 Jun 1902 08:00:00 GMT  
 write / writeln declaration

Quote:

> Hello,

> I want to develope an object "O", which is able to print text in text-
> and in grahics mode onto the screen.
> In textmode my O.write(ln) function should work like the normal
> write(ln) function. Now I am looking for the explicite declaration for
> the normal write(ln) function.
> I only found the description :
> writeln([var f:text;] v1 [,v2,...vn]);

> Does anyone know, how I have to declare my O.write(ln) - function, so
> that I can give the same parameters to the normal write(ln) function?

You can't because write(ln) and many other system calls aren't
procedures in the sense that _you_ could write a procedure with the
same user interface as write(ln). They are in fact 'commands' built-in
in the compiler and they only look like procedures to the programmer.

Note the magic capabilities of write(ln). You may give it a file
variable as the first parameter, or you may not. You may give it any
number of parameters of any "writable" type in any order and the
system "knows" their type and you may use some weird sytax like
i:3:5.

A TP procedure defined by you _must_ have a fixed parameter list and a
fixed number of parameters.

Regards
Horst



Wed, 18 Jun 1902 08:00:00 GMT  
 write / writeln declaration

Quote:



>You can't do it with BP/TP. Routines like Write(ln) and Read(ln) require
>some compiler "magic", which is not available to normal programs. If
>you use compilers that support function overloading (IIRC, FreePascal does
>this) then you can implement several versions of the same routine, and the
>compiler will know which one to call, depending on the parameters
>supplied when the routine is called.

even with this you can't code something like write() wince this proc has an
undefined number of variables and not exactly what you are describing

regards
  shy shalom



Wed, 18 Jun 1902 08:00:00 GMT  
 write / writeln declaration

Quote:

> Hello,

> I want to develope an object "O", which is able to print text in text-
> and in grahics mode onto the screen.
> In textmode my O.write(ln) function should work like the normal
> write(ln) function. Now I am looking for the explicite declaration for
> the normal write(ln) function.
> I only found the description :
> writeln([var f:text;] v1 [,v2,...vn]);

> Does anyone know, how I have to declare my O.write(ln) - function, so
> that I can give the same parameters to the normal write(ln) function?

As other posters have said, you can't in Borlandish Pascal you can't
create your own routines that take a variable number of parameters.

However, you CAN redefine where and how the standard text file Read[Ln]
/Write[Ln] routines get/put their parameters by creating a "Text File
Device Driver".  See the source for the WinCRT or Printer units if you
have them for examples.

There's still no way AFAIK to make these into methods of a object/class
though.

HTH

Stephen Posey



Wed, 18 Jun 1902 08:00:00 GMT  
 write / writeln declaration

Quote:

> Hello,

> I want to develope an object "O", which is able to print text in text-
> and in grahics mode onto the screen.
> In textmode my O.write(ln) function should work like the normal
> write(ln) function. Now I am looking for the explicite declaration for
> the normal write(ln) function.
> I only found the description :
> writeln([var f:text;] v1 [,v2,...vn]);

> Does anyone know, how I have to declare my O.write(ln) - function, so
> that I can give the same parameters to the normal write(ln) function?

> O.write(???);
> begin
>   write(???);
> end;

> thanks in advance,

> Lutz

Look in the 1QA articles of the FAQ page in the TP-links.
There is an example of redirection for the Write procedure
to create a string. Maybe it helps.
http://www.geocities.com/SiliconValley/2926/tpf.html
Franz Glaser


Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Write/Writeln bug?

2. writeln--write?

3. To writeln or write

4. Wanted: Fast Write and WriteLn replacement...

5. Howto write a procedure like Writeln

6. Pointer declarations

7. Variant fields in object declaration in TP7 or DELPHI

8. declaration error

9. Program name declaration

10. ODBC32 API Declaration Unit for Delphi 2.0

11. {10:3 declaration}????

12. Help: Unfamiliar type declaration

 

 
Powered by phpBB® Forum Software