Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-08

FPC_HAS_FEATURE_TEXTIO - Strange behaviour!

13 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

SirStorm25

Hi All!!!

Im trying to develop reading capabilities for an OS im helping to develop. When enabling the FPC_HAS_FEATURE_TEXTIO from the RTL, I get a few errors involving
the file: Text.inc.
All of the errors returned are mainly "do_" functions. E.g:
do_read
do_write
do_close
do_erase
dp_rename
etc...

any ideas on stopping this? Anyone know if I have to enable another define? I've tried {$define FPC_HAS_FEATURE_FILEIO}, but, no luck! :(

Regards

SirStorm25.

View this message in context: http://www.nabble.com/FPC_HAS_FEATURE_TEXTIO---Strange-behaviour%21-tp18968260p18968260.html Sent from the Free Pascal - General mailing list .
Marco van de Voort
to SirStorm25

In our previous episode, SirStorm25 said:

Show quoted text 14 lines
Im trying to develop reading capabilities for an OS im helping to develop. When enabling the FPC_HAS_FEATURE_TEXTIO from the RTL, I get a few errors involving the file: Text.inc. All of the errors returned are mainly "do_" functions. E.g: do_read do_write do_close do_erase dp_rename etc... any ideas on stopping this?

Implement them. You enabled the generic part of textio with that define, so the missing functions are the OS dependant primitives you need to implement for your OS.

Look at the other implementations (e.g. Dos or linux) to get a clue about what they are supposed to do.

SirStorm25
to Marco van de Voort
Marco van de Voort wrote 31 lines
In our previous episode, SirStorm25 said: > Im trying to develop reading capabilities for an OS im helping to > develop. > When enabling the FPC_HAS_FEATURE_TEXTIO from the RTL, I get a few errors > involving > the file: Text.inc. > All of the errors returned are mainly "do_" functions. > E.g: > do_read > do_write > do_close > do_erase > dp_rename > etc... > > any ideas on stopping this? Implement them. You enabled the generic part of textio with that define, so the missing functions are the OS dependant primitives you need to implement for your OS. Look at the other implementations (e.g. Dos or linux) to get a clue about what they are supposed to do. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Hello!

Any ideas where to find the source to a version of DOS with those functions implemented, linux source code always gets me confused %-| Regards

SirStorm25.

View this message in context: http://www.nabble.com/FPC_HAS_FEATURE_TEXTIO---Strange-behaviour%21-tp18968260p18968903.html Sent from the Free Pascal - General mailing list .
Marco van de Voort
to SirStorm25

In our previous episode, SirStorm25 said:

Any ideas where to find the source to a version of DOS with those functions implemented, linux source code always gets me confused %-|

They are not implemented in dos but FOR dos, in the Free Pascal RTL, dos version, dir rtl/go32v2

Tomas Hajny
to SirStorm25: Hello! Any ideas where to find the source to a version of DOS with those functions…
SirStorm25 wrote 30 lines
Marco van de Voort wrote: > > In our previous episode, SirStorm25 said: >> Im trying to develop reading capabilities for an OS im helping to >> develop. >> When enabling the FPC_HAS_FEATURE_TEXTIO from the RTL, I get a few errors >> involving >> the file: Text.inc. >> All of the errors returned are mainly "do_" functions. >> E.g: >> do_read >> do_write >> do_close >> do_erase >> dp_rename >> etc... >> >> any ideas on stopping this? > > Implement them. You enabled the generic part of textio with that define, > so > the missing functions are the OS dependant primitives you need to > implement > for your OS. > > Look at the other implementations (e.g. Dos or linux) to get a clue about > what they are supposed to do. Any ideas where to find the source to a version of DOS with those functions implemented, linux source code always gets me confused %-|

If you want to contribute to others involved in similar work (porting RTL/unit system to a new platform) in the future, you can add the missing descriptions on our (unfinished) wiki page related to this topic - see http://wiki.freepascal.org/System_unit_structure. I and other core team members are certainly willing to correct / extend your descriptions and answer any remaining questions you'd have after viewing some implementation of those routines (and checking functionality of the used API calls for the particular target platform if not known by you from the top of your head) and trying to describe them. This way the description becomes available for others, not just you.

Tomas

Marco van de Voort
to SirStorm25: Found em! The finaly question is: where do I put these? do I create my own sysfile.inc…

In our previous episode, SirStorm25 said:

Show quoted text 5 lines
Found em! The finaly question is: where do I put these? do I create my own sysfile.inc with just these functions, or do they rely on other functions located within the same file?

Yes, usually per OS the porter maintains a rtl/<theos> dir for general OSes, those dirs are in FPC repository, and 3rd party ones maintain such dirs in private.

Note that in general you want to include rtl/inc and rtl/<your cpu>.

Marco van de Voort
to SirStorm25

In our previous episode, SirStorm25 said:

Show quoted text 5 lines
The only problem I've found, is that the do_ procedures contain a line of code: syscopytodos, which seems to be specific to dos, any ideas as to where this function is stored?

In go32v2, but they are very dos specific. Remember, this is the dos specific part of the RTL.

How to implement this on your OS, depends totally on the specifics of your OS.

Marco van de Voort
to SirStorm25

In our previous episode, SirStorm25 said:

Would the OS still compile if I removed the syscopytodos and syscopyfromdos functions from the do_ procedures?

Yes of course. It wouldn't work though.

Marco van de Voort
to SirStorm25

In our previous episode, SirStorm25 said:

Nooo!!!!! What are these functions meant to do? This seems way more harder than it looks!

Well that is not that hard:

do_read - read bytes from file
do_write - write bytes to file
do_close - close file
do_erase - open file
do_rename - rename file

etc.

_BUT_ the devil is in the details, most notably you must wrap the errorhandling of your OS to match FPC's (which is a bit doslike).

For this, take the RTL of any OS you are familiar with, and study it.