Recent

Author Topic: macro that returns the lazarus/lcl version  (Read 10898 times)

taazz

  • Hero Member
  • *****
  • Posts: 5368
macro that returns the lazarus/lcl version
« on: June 19, 2014, 03:06:17 am »
OK the problem is that you guys release faster than I test or install. Good for you but I end up with multiple installations until I get thinks going at this time I have two 1.0.14 and 1.2.0 the problem starts when I try to install the 3rd party component to one of my installations they overwrite the existing ppus making switching from one version to an other a bit slower to get up to speed. I was thinking to editing all the packages and adding something like $(FPCVer) in the output path bat since most of your releases use the same fpc this wouldn't help at all.


So is there a way to retrieve the lazarus version similar to $(FPCVer) to be used in paths?
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #1 on: June 19, 2014, 07:30:59 am »
Brilliant idea, and will help me tidy my projects as well.

I've had a look on the wiki, and briefly in the code.   I can't see anything.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: macro that returns the lazarus/lcl version
« Reply #2 on: June 19, 2014, 08:00:20 am »
From my notes: it's at least available for the LCL version; can't seem to find a reference on the wiki
  similr lcl_fullversion for lazarus (needs LCLVersion in uses clause) (better than lcl_major and lcl_minor)
   {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)
   {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #3 on: June 19, 2014, 08:23:39 am »
Quote
   {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)
   {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0
That's in Code.   @Taazz is talking about IDE Macros.  Well, I assume that's what @Taazz is taking about.  We all know assumption makes an "ASS out of U and MPTION".  Wait, that doesn't sound right...

Either way, this is what I think the topic is about
http://wiki.lazarus.freepascal.org/IDE_Macros_in_paths_and_filenames

UPDATE: I particularly like the idea of using this for all those little bugtracker demo's.  Keep each build separate....
« Last Edit: June 19, 2014, 08:25:57 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BrunoK

  • Hero Member
  • *****
  • Posts: 723
  • Retired programmer
Re: macro that returns the lazarus/lcl version
« Reply #4 on: June 19, 2014, 08:35:39 am »
Would :

procedure TfmAccelChar.FormShow(Sender: TObject);
begin
  Caption := Caption + ' [FPC ' +
{$I %FPCVERSION%}
    +'/Laz ' +
{$I version.inc}
    +']';

That gives :
Caption='fmAccelChar [FPC 2.6.4/Laz 1.2.0]'

Be useful ?



Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #5 on: June 19, 2014, 08:39:59 am »
Quote
Would :

procedure TfmAccelChar.FormShow(Sender: TObject);
begin
  Caption := Caption + ' [FPC ' +
{$I %FPCVERSION%}
    +'/Laz ' +
{$I version.inc}
    +']';

That gives :
Caption='fmAccelChar [FPC 2.6.4/Laz 1.2.0]'

Be useful ?

I don't think so, I think we're talking about "Project" - "Options" - "Paths".   Have a look at the screenshot I've added here.  See I'm using $(TestDir), $(TargetCPU) etc.  Taazz is asking if there is a %(LAZVer) equivalent.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: macro that returns the lazarus/lcl version
« Reply #6 on: June 19, 2014, 09:08:08 am »
Quote
   {$IF LCL_FULLVERSION>=1000000} //for laz 1.0.0.0 (major,minor,release,patch)
   {$IF LCL_FULLVERSION>=1000200} //for laz 1.0.2.0
That's in Code.   @Taazz is talking about IDE Macros.
Sure, but LCL_FULLVERSION is a macro, conditional define or whatever it is (as you see I'm not clear on the distinctions). So perhaps it can be used as an IDE macro like its FPC equivalent.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #7 on: June 19, 2014, 09:22:40 am »
I've had a look in the code (for 1.2.2, I don't have trunk with me).  buildmanager.pas has a series of functions, one for each of IDE Macros defined in that wiki page.  Nothing there for Lazarus version. 

Doesn't look too hard to extend though, a string constant needs defining (elsewhere) and a matching function needs implementing and registering against the string.  Looks like a simple design - I like those...  I might have a play tonight and submit a patch.  Though there will be a new String that needs a translation creating for it.  That's the only bit I'm nervous about.  Don't want to a add a string that breaks other translations if there is no translation - really not sure how that side of life works...   I'll play though :-)

Mind you, there still might be a way with the existing macros and functions.  Just because I can't see it, don't mean it aint there :-)

Quote
LCL_FULLVERSION is a macro, conditional define or whatever it is (as you see I'm not clear on the distinctions)
I suspect the correct term is "hack" :-)

UPDATE: Forgot - dinner plans tonight :-(   I'll play with the code over the weekend...
« Last Edit: June 19, 2014, 09:35:44 am by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: macro that returns the lazarus/lcl version
« Reply #8 on: June 19, 2014, 05:55:46 pm »
As mike already said I'm interesting exclusively on IDE Macros and since we or subject how about extending those to allow me to add my own static macros as well eg I could add a macro named projects or components or what ever I need for that matter this ofcourse will be static for now or have a pascal script attach to it?
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #9 on: June 19, 2014, 09:29:29 pm »
Good golly.  I got $(LAZVer) working in 4 to 5 lines of code (depending on whether you count an if then else as three or four lines).  I had half an hour free before dinner and it was really was as easy as a first glance at the code suggested.  Mind you, I've got a lot of testing to do before I submit the patch, and I want to see if I can add a $(SVNRevision) as well.

Quote
since we or subject how about extending those to allow me to add my own static macros as well
Quote
or have a pascal script attach to it?

I'll leave that to my betters :-)   For now I'll see how I go with my first IDE patch.

Mind you, after a quick think - if you want to go down the pascal script side of things wouldn't a makefile be a better solution for you?  I vaguely remember discussion of fpmake being either developed, or rewritten, or, you know, something.  Not my world I'm afraid...


Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: macro that returns the lazarus/lcl version
« Reply #10 on: June 19, 2014, 09:38:46 pm »
Good golly.  I got $(LAZVer) working in 4 to 5 lines of code (depending on whether you count an if then else as three or four lines).  I had half an hour free before dinner and it was really was as easy as a first glance at the code suggested.  Mind you, I've got a lot of testing to do before I submit the patch, and I want to see if I can add a $(SVNRevision) as well.

Quote
since we or subject how about extending those to allow me to add my own static macros as well
Quote
or have a pascal script attach to it?

I'll leave that to my betters :-)   For now I'll see how I go with my first IDE patch.

Mind you, after a quick think - if you want to go down the pascal script side of things wouldn't a makefile be a better solution for you?  I vaguely remember discussion of fpmake being either developed, or rewritten, or, you know, something.  Not my world I'm afraid...
I'm a borlander we borlanders never learned or needed the use of make make files and all that barbaric command line interfaces and options. Those are shameful memories of the past we are not going back to such a barbaric era ever again give me death or give me a smashing IDE and all that  :P :P
« Last Edit: June 19, 2014, 09:40:24 pm by taazz »
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #11 on: June 19, 2014, 09:54:07 pm »
Quote
Those are shameful memories of the past

What?!  That's the bit you took from my glorious post about my first ever IDE mod going unexpectedly well?!?  Particularly with those mods being in the direction you personally were enquiring about?  For shame...  :D

Seriously though, I personally agree - never liked Makefiles.  I'll need to mull it over but right now I just can't picture how Pascal Scripts embedded within a part of the UI only are going to be any less evil though.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #12 on: June 19, 2014, 10:15:57 pm »
Darned :-(   I've mulled it over.  There's already a PascalScript mechanism for build time.  Project Options - Other.  You want to be able to declare variables or functions here somehow and access them as $(XXX) elsewhere....

I'll play, but I'm not promising anything.  Let's see how I go with the easier stuff first...  This honestly might need to be handed over to the grownups....
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: macro that returns the lazarus/lcl version
« Reply #13 on: June 19, 2014, 10:21:44 pm »
Quote
Those are shameful memories of the past

What?!  That's the bit you took from my glorious post about my first ever IDE mod going unexpectedly well?!?  Particularly with those mods being in the direction you personally were enquiring about?  For shame...  :D

Seriously though, I personally agree - never liked Makefiles.  I'll need to mull it over but right now I just can't picture how Pascal Scripts embedded within a part of the UI only are going to be any less evil though.

well it will enable me to add extra dynamic macros that will return the loged in user the users temp folder or any other special interest folder. this will enable me to have single installation for multiple users instead of one installation per user that is now.

It doesn't have to be pascal script you know as long as I can register my own functions and names through a package I could do the same and for god sake I do not mean that you should implement it the only thing I said was that now that I'm thinking about macros it would be good to have all or part of the above just an idea nothing more.
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1265
Re: macro that returns the lazarus/lcl version
« Reply #14 on: June 19, 2014, 10:37:22 pm »
Quote
it will enable me to add extra dynamic macros that will return the loged in user the users temp folder or any other special interest folder.
Been too long since I played with Delphi - can't remember this being a feature, or how it would have been implemented...  Sounds useful though.

Quote
Darned :-(   I've mulled it over.
This bit wasn't serious.  One of those dry humour things that loses translation without the body language or tone to help convey it...

Quote
for god sake I do not mean that you should implement it
And I never said I would, only that I would play.  I'll be honest, I'm intrigued by the whole concept (of expanding the IDE), and would genuinely love to play with this code...
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

 

TinyPortal © 2005-2018