Recent

Author Topic: FInding source for an RTL function  (Read 1369 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 564
FInding source for an RTL function
« on: July 19, 2024, 12:36:53 am »
In the RTL reference (RTL.pdf, 2021) under the topic "BaseUnix' on page 207, there is an article on function "FpPipe."  There is an example program there  illustrating the function's use, but the example code never actually uses the function FpPipe(var fildes: TFilDes) : cint.    It does use the function assignpipe which is in fact and in turn described (with the same example program) under the RTL reference topic "Unix" on page 2078. 

This is a little confusing, so I set out to find the source for either of these functions in /fpcsrc/rtl thinking that would help clarify things, but I've had no luck. Can anyone tell me where I need to look?

dsiders

  • Hero Member
  • *****
  • Posts: 1282
Re: FInding source for an RTL function
« Reply #1 on: July 19, 2024, 04:27:11 am »
In the RTL reference (RTL.pdf, 2021) under the topic "BaseUnix' on page 207, there is an article on function "FpPipe."  There is an example program there  illustrating the function's use, but the example code never actually uses the function FpPipe(var fildes: TFilDes) : cint.    It does use the function assignpipe which is in fact and in turn described (with the same example program) under the RTL reference topic "Unix" on page 2078. 

This is a little confusing, so I set out to find the source for either of these functions in /fpcsrc/rtl thinking that would help clarify things, but I've had no luck. Can anyone tell me where I need to look?

For FPC 3.2.2:

Code: Text  [Select][+][-]
  1. fpc/3.2.2/source/rtl/bsd/bunxfunch.inc://Function FPpipe(var fildes : tfildes):cint;
  2. fpc/3.2.2/source/rtl/bsd/bunxsysc.inc:Function FPpipe(var fildes : tfildes):cint;
  3. fpc/3.2.2/source/rtl/linux/bunxsysc.inc:Function fppipe(var fildes : tfildes):cint;
  4. fpc/3.2.2/source/rtl/linux/mips/bsyscall.inc:Function fppipe(var fildes : tfildes):cint;assembler;
  5. fpc/3.2.2/source/rtl/linux/sparc/bsyscall.inc:Function fppipe(var fildes : tfildes):cint;assembler;
  6. fpc/3.2.2/source/rtl/linux/sparc64/bsyscall.inc:Function fppipe(var fildes : tfildes):cint;assembler;
  7. fpc/3.2.2/source/rtl/netwlibc/libc.pp:function FpPipe(var fildes:TFilDes):cInt;cdecl;external libc_nlm name 'pipe';
  8.  

And:

Code: Text  [Select][+][-]
  1. fpc/3.2.2/source/rtl/aix/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  2. fpc/3.2.2/source/rtl/beos/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  3. fpc/3.2.2/source/rtl/darwin/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  4. fpc/3.2.2/source/rtl/dragonfly/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  5. fpc/3.2.2/source/rtl/freebsd/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  6. fpc/3.2.2/source/rtl/haiku/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  7. fpc/3.2.2/source/rtl/linux/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  8. fpc/3.2.2/source/rtl/netbsd/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  9. fpc/3.2.2/source/rtl/openbsd/unixsysc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  10. fpc/3.2.2/source/rtl/openbsd/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  11. fpc/3.2.2/source/rtl/solaris/unxfunc.inc:Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  12. fpc/3.2.2/source/rtl/unix/unix.pp:Function AssignPipe(var pipe_in,pipe_out:text):cint;
  13. fpc/3.2.2/source/rtl/unix/unix.pp:Function AssignPipe(var pipe_in,pipe_out:file):cint;
  14.  
« Last Edit: July 19, 2024, 04:42:51 am by dsiders »
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 564
Re: FInding source for an RTL function
« Reply #2 on: July 19, 2024, 06:03:20 am »

For FPC 3.2.2:
...

OK thank you very much.  I didn't realize the source was in an  .inc file, which explains why it didn't show up in my various searches.    I've now found the correct .inc for my system in my installation's  /fpcsrc/rtl folder.

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: FInding source for an RTL function
« Reply #3 on: July 19, 2024, 06:29:50 am »
There is no excuse for old men not knowing how to use grep:
grep -nHIirF
If I smell bad code it usually is bad code and that includes my own code.

dsiders

  • Hero Member
  • *****
  • Posts: 1282
Re: FInding source for an RTL function
« Reply #4 on: July 19, 2024, 08:10:32 am »
There is no excuse for old men...

You could've just stopped there. (hint: I am one.)
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: FInding source for an RTL function
« Reply #5 on: July 19, 2024, 08:42:25 am »
In your case I have no doubt you can use grep... O:-)
Is grep a lost art?
You probably also know it was written by Ken Thompson.
« Last Edit: July 19, 2024, 08:50:04 am by Thaddy »
If I smell bad code it usually is bad code and that includes my own code.

Thaddy

  • Hero Member
  • *****
  • Posts: 16187
  • Censorship about opinions does not belong here.
Re: FInding source for an RTL function
« Reply #6 on: July 19, 2024, 08:53:54 am »
The super nerd..
If I smell bad code it usually is bad code and that includes my own code.

DavidL

  • New Member
  • *
  • Posts: 13
Re: FInding source for an RTL function
« Reply #7 on: July 19, 2024, 01:47:16 pm »
Yes, but do you know the reason it's called "grep"?   :-X

cdbc

  • Hero Member
  • *****
  • Posts: 1665
    • http://www.cdbc.dk
Re: FInding source for an RTL function
« Reply #8 on: July 19, 2024, 02:13:15 pm »
Hi
(g)nu(r)egular(e)x(p)ression
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

TRon

  • Hero Member
  • *****
  • Posts: 3643
Re: FInding source for an RTL function
« Reply #9 on: July 19, 2024, 02:21:37 pm »
fwiw: and for those that do not want or can't use grep there is always the trusty file manager that is able to search in files (recursively). Mind you, only the good/real ones do such as Double Commander :shameless plug:

Which reminds me of ssst (super sonic search tool) for ms-dos  :)

btw: isn't Lazarus capable of doing something similar ?
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8035
Re: FInding source for an RTL function
« Reply #10 on: July 19, 2024, 02:36:35 pm »
Hi
(g)nu(r)egular(e)x(p)ression
Regards Benny

I know that one should be cautious about overusing (and ascribing godlike omniscience to) the Internet, but can't ANYBODY do basic research around here?

Quote
What do grep, -E, and -F stand for?

The name grep comes from the way line editing was done on Unix. For example, ed uses the following syntax to print a list of matching lines on the screen:

global/regular expression/print
g/re/p

...and /that's/ from https://www.gnu.org/software/grep/manual/grep.html, i.e. not even GNU calls it GNU,

There's also https://en.wikipedia.org/wiki/Grep, plus man, /many/ more.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

cdbc

  • Hero Member
  • *****
  • Posts: 1665
    • http://www.cdbc.dk
Re: FInding source for an RTL function
« Reply #11 on: July 19, 2024, 02:54:44 pm »
Hi Mark
I didn't search, it was just the correlation with 'grep' in my head i.e.: simple deduction.
I wasn't far off though  ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018