Jump to content
Freeeee

Freeeee

Recommended Posts

 

I have looked at the Docs on embarcadero.com/Libraries .

 

In earlier versions of Turbo Pascal  there were functions and/or procedures we could write in a generalized form

and then save them as Dot INC files .  They could then be used in future programs without cutting or pasting

sometimes with a forward reference but  it would be named ...example " MakeDate.INC" 

You could include it in a new file without retyping it simply by putting    'MakeDat.INC"    in the procedures section of new code.

If it were in a separate folder you'd provide a path for the compiler.

Does anything like that now exist in 12.  ?

 

 

 

Share this post


Link to post

thanks for the answer but Unit do not provide the same funcionality

Units are stand alone and will compile and execute.  

and  require USES to tie units together.

 

An Include file was a piece of isolated code that could not be compiled on it's own.

It did 'some thing'  useful.

after working in Turbo pascal for several years you'd have a whole set of useful

include files.  Really nice for defining records too or as you mentioned for constants.

So the answer is NO there are no dot-inc files for Delphi 12.  Correct?

 

Share this post


Link to post

If I understand your question correctly, I would say that this has always existed.

 

You can incorporate pieces of code with {$I filename} , even an entire unit, such as when you want to have code for VCL and Firemonkey.

 

// here the FMX unit

{$I Delphi_Versions.inc}
{$DEFINE UseFMX}
unit FMX.your_unit;

interface

uses
 System.SysUtils, System.Types,  System.Classes;

 {$I your_unit.pas}
// herer VCL unit
{$I Delphi_Versions.inc}
{$IFNDEF UseFMX}
{$DEFINE UseVCL}
unit your_unit;

interface

uses
  SysUtils,Classes;
 
{$ENDIF}


implementation

 // your code for VCL and FMX

end.

 

Share this post


Link to post
15 hours ago, Freeeee said:

An Include file was a piece of isolated code that could not be compiled on it's own.

It did 'some thing'  useful.

after working in Turbo pascal for several years you'd have a whole set of useful

include files.  Really nice for defining records too or as you mentioned for constants.

Yes, that's what you would use units for if you programmed in Delphi - but of course you can pretend that it's still 1985 and continue using include files, if you prefer that.

Share this post


Link to post

Thanks for your reply.  And sarcasm.  

  

I found dot INC files very useful and wondered if they had been preserved.

They have not.  

I think they would still be useful.   

but I can do without them.  cutting and pasting works too.  just a bit tedious.

 

Apparently the  memory size of an "Ap" is no longer a problem.  

 

And it's perfectly acceptable to include all sorts of code in an Ap that the Ap never uses.

After all the IDE automatically includes: 

Winapi. Windows, Winapi.Messages, System.SysUtils,  System.Variants,

System.Classes, Vcl.Graphics,,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
Just to start a new VCL project.

 

 

 

     

 

 

 

 

Share this post


Link to post

Thanks Christopher 

Just to make sure you get this I'm using the reply to quote.

the URLto Delphi Basics  was REALLY helpful.

Thanks again.    

 

Share this post


Link to post
31 minutes ago, Freeeee said:

I found dot INC files very useful and wondered if they had been preserved.

They have not.  

I think they would still be useful.   

but I can do without them.  cutting and pasting works too.  just a bit tedious.

 

Apparently the  memory size of an "Ap" is no longer a problem.

Include files works just the same in Delphi as they did in TP. It's just that we don't use them as you describe anymore. Not because it isn't possible but because there are better ways of doing things now.

 

47 minutes ago, Freeeee said:

Apparently the  memory size of an "Ap" is no longer a problem.  

Memory size?

Do you think an application uses more memory because it uses units instead of include files? Well, it doesn't. And, if anything, using units will generally produce smaller exe files compared to include files.

 

39 minutes ago, Freeeee said:

And it's perfectly acceptable to include all sorts of code in an Ap that the Ap never uses.

After all the IDE automatically includes: 

Winapi. Windows, Winapi.Messages, System.SysUtils,  System.Variants,

System.Classes, Vcl.Graphics,,  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
Just to start a new VCL project.

You really should read the documentation I linked to - and more. So far most of what you have written are caused by not understanding the basics of Delphi.

Share this post


Link to post

INC files are still in use. Some of the programs I purchased use them.

Share this post


Link to post
58 minutes ago, Stano said:

INC files are still in use. Some of the programs I purchased use them.

Sure, I use them myself. But not for code and declarations.

Share this post


Link to post

thank you both.

Christopher pointed me to an online source that works really well for me, but thanks for the URL you provide Anders.

it pointed out that you CAN include short snippets of code as long as you do it in the right place and manner.

Of course it has to be interpreted by the compiler.   Changing to complex strings has made the compilers job 

much harder.   Apparently it understands Kanji.    Quite an accomplishment.

The right place is harder to find   (for me at least)  in the Emb. docs. pages. 

And you are correct Anders, that I do not (yet) understand the basics of   Modern    Delphi.  But I'm trying,.

Thanks for the pointers.

By the way, Anders,, what do you use Includes for? 

 

 

Edited by Freeeee
inserted Modern

Share this post


Link to post
1 hour ago, Freeeee said:

The right place is harder to find   (for me at least)  in the Emb. docs. pages. 

I don't understand what you mean by that.

 

Bottom line:

 

inc files still exist and work just like they always have:

 

If you include a file its contents are placed in-line where you include it when the unit is compiled.

 

Where that "right place" to include it is, depends entirely on what you are roping into your unit.

 

"Useful records" definitely do not make sense as inc files.

 

Source code included in Delphi uses inc files extensively and I wish it didn't. It makes understanding the units and navigating source take longer.

 

There are good reasons to use inc files, such as defining compiler directives that you need to be consistent across multiple units, but if your "stuff" can just be made into units, then it should not be placed in inc files. 

 

IMO. :-)

Edited by Brandon Staggs

Share this post


Link to post
6 hours ago, Freeeee said:

Anders,, what do you use Includes for? 

  • Compiler options:
    {$ALIGN 8}
    {$ASSERTIONS ON}
    {$BOOLEVAL OFF}
    {$DEBUGINFO OFF}
    {$EXTENDEDSYNTAX ON}
    {$IMPORTEDDATA ON}
    {$IOCHECKS ON}
    {$LOCALSYMBOLS ON}
    ...etc...

     

  • Compile-time feature flags & compiler version, and platform detection (these were snipped from the Graphics32 library):
    (*
      Symbol: NO_GENERIC_METACLASS_LISTS
      -------------------------------
    
         The C++ Builder linker has problems resolving ambiguities caused by
         metaclass types because they all get mangled as TClass. As a result
         of this the compiled object files end up containing duplicate
         symbols, which in turn causes a LIB266 linker error.
         Specifically we get into problems with TCustomClassList<T> where "T"
         is a metaclass.
         To work around the problem we define the NO_GENERIC_METACLASS_LISTS
         for C++ Builder which causes us to use TClassList for all class types.
    *)
    {$if defined(BCB)}
    {$define NO_GENERIC_METACLASS_LISTS}
    {$ifend}
    
    (*
      Symbol: GENERIC_POINTERS
      -------------------------------
    
        Typed pointers to generic types are supported.
    
      Older Delphi versions cannot resolve a pointer to a generic type correctly
      and therefore must use plan untyped pointers instead.
      Exact Delphi version is unknown but XE4 doesn't work and Delphi 10 does.
    
      The symbol is defined for XE5 and later, and for FPC.
      The exact version of Delphi that supports the feature is unknown at this
      time.
    *)
    {$if defined(FPC)}
      {$define GENERIC_POINTERS}
    {$elseif (CompilerVersion > 25.0)}
      {$define GENERIC_POINTERS}
    {$ifend}

     

  • Like 1

Share this post


Link to post

thanks. that helps.

you put those in for specific reasons.

Does the compiler or debugger put in a whole bunch (2 or 3 screen on the editor.

They just showed up on units I have been working on.

I guess I cliked a button some where. 😕 

Share this post


Link to post
9 hours ago, Freeeee said:

Does the compiler or debugger put in a whole bunch (2 or 3 screen on the editor.

I'm not sure I understand your question.

You can get the editor to insert the current compiler options into the source with Ctrl+O+O (default and classic keyboard binding), if that's what you're asking.

Share this post


Link to post

Yup.  That's exactly what I was asking.  Thanks.,!

I still use the Rand Programmer's editor. 

Only one I've ever used that can select, cut,  copy and paste  Columns of  text.

CTRK+O would Put you into the underlying O/S .  exit would put you back into the editor where you left off.

habit die hard.  I can easily see how I could have caused the compiler to insert those directives.

 

Won't hurt to remove them I'm presuming.

 

thanks again.,

 

Share this post


Link to post
23 minutes ago, Freeeee said:

habit die hard.

Yup. I started with Turbo Pascal's ancestor PolyPascal, which used WordStar key bindings, and I have used that ever since (that's the Classic IDE binding in Delphi).

Unfortunately many of Delphi's newer editor functions aren't available with the Classic IDE key bindings. That said, I seem to remember that Classic had a key binding for column mode but I can't remember what it was. ^KN or something like that.

 

38 minutes ago, Freeeee said:

Won't hurt to remove them I'm presuming.

No, it shouldn't. The compiler will use the project options by default.

Share this post


Link to post

thanks   didn't know that.

 

but... it's about time.

Some "Old" ideas are still valid and worthwhile.

 

:classic_rolleyes:

Share this post


Link to post

Rand is OK, but I'm a more modern, WordStar kind of guy. Just love me my WordStar diamond, and loved Delphi for incorporating WordStar shortcuts.:classic_ninja:

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×