Recent

Author Topic: Where is Concat function?  (Read 3473 times)

typo

  • Hero Member
  • *****
  • Posts: 3051
Where is Concat function?
« on: September 21, 2014, 12:40:41 am »
Concat(S1, S2..Sn);

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Where is Concat function?
« Reply #1 on: September 21, 2014, 12:47:23 am »
I do not see one declared anywhere in the laz1.2.4 installation tree.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Bart

  • Hero Member
  • *****
  • Posts: 5290
    • Bart en Mariska's Webstek
Re: Where is Concat function?
« Reply #2 on: September 21, 2014, 01:08:20 am »
Most likely a compilerproc.

Bart

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where is Concat function?
« Reply #3 on: September 21, 2014, 01:19:18 am »
It is yes. Note that there is a list in rtl/inc/system.fpd if you ever want to check built in types or procs.

That file is for documentation purposes, so not always in sync, but in general I found it to be mostly complete the past few years.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Where is Concat function?
« Reply #4 on: September 22, 2014, 01:25:39 am »
It is yes. Note that there is a list in rtl/inc/system.fpd if you ever want to check built in types or procs.

That file is for documentation purposes, so not always in sync, but in general I found it to be mostly complete the past few years.
Marco, can we just grep 'compilerproc' to achieve the same thing?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Where is Concat function?
« Reply #5 on: September 22, 2014, 09:42:39 am »
Yes and no. They are slightly different things.

concat() is a built-in.  The signature in system.fpd is how it is visible to the programmer:

Code: [Select]
Function Concat (Const S1,S2,S3,Sn  : String) : String;

Afaik the implementation of it is mostly done in compiler units ninl and pinline

Compilerprocs are functions called by code generated by the compiler.   

There is a relation of course, since code for built-ins are generated by the compiler, and the more complex ones need to call helpers which are compilerprocs.

Concat is such function, and grepping for it in combo with compilerproc will give you prototypes like (partial grep output:)

Code: [Select]
sstrings.inc:fpc_AnsiStr_ShortStr_Concat (Var S1: AnsiString; Var S2 : ShortString); compilerproc;
compproc.inc:Procedure fpc_WideStr_Concat (Var DestS : Widestring;const S1,S2 : WideString); compilerproc;
compproc.inc:Procedure fpc_WideStr_Concat_multi (Var DestS : Widestring;const sarr:array of Widestring); compilerproc;
compproc.inc:Procedure fpc_UnicodeStr_Concat (Var DestS : Unicodestring;const S1,S2 : UnicodeString); compilerproc;
compproc.inc:Procedure fpc_UnicodeStr_Concat_multi (Var DestS : Unicodestring;const sarr:array of Unicodestring); compilerproc;
generic.inc:procedure fpc_shortstr_concat(var dests:shortstring;const s1,s2:shortstring);compilerproc;
generic.inc:procedure fpc_shortstr_concat_multi(var dests:shortstring;const sarr:array of pshortstring);compilerproc;

Note that the compilerproc helper might only be part of the built-in implementation, code may also have been generated inline.

Note also that the built-in declaration is declared as "string", while in reality accepts all string types. That is the limitation of system.fpd (or actually, fpdoc that must process it). Grepping the compilerprocs is then a way to get a feel what is really supported.

 

TinyPortal © 2005-2018