Author Topic: get project properties in a macro  (Read 4491 times)

gregos_b

  • Community Member
  • Posts: 53
  • Hero Points: 0
get project properties in a macro
« on: July 09, 2008, 07:02:06 am »
Is it possible to get back all project properties in a macro. I'm looking for a way to get dependencies, static and dynamic linked libraries, compil options, etc... ?

Regards,

Greg

Graeme

  • Senior Community Member
  • Posts: 2641
  • Hero Points: 330
Re: get project properties in a macro
« Reply #1 on: July 09, 2008, 01:56:05 pm »
Have a look at something like the generate_makefile command in projmake.e - or anything that calls _xmlcfg_open and passes the name of a project.  In generate_makefile, you'll see it open the project xml file, then call _ProjectGet_ConfigNames and pass the xml handle. 

In project.sh, you'll see a bunch of structs relating to project properties info.  If you then search for references to say, PROJECT_CONFIG_INFO, you'll see the _ProjectGet_AllConfigsInfo function, which calls _ProjectGet_Configs and _xmlcfg_get_attribute and other xml parsing functions to get the project properties data.  If _ProjectGet_AllConfigsInfo doesn't return exactly what you want, you could parse the xml yourself using slick's xml functions.

Graeme

gregos_b

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: get project properties in a macro
« Reply #2 on: July 10, 2008, 08:17:38 am »
Thanks Graeme, I'm going to have a look at it.

gregos_b

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: get project properties in a macro
« Reply #3 on: July 17, 2008, 09:32:31 am »
That's ok, I have all I need in the file 'projmake.e'.
Is it possible to use, in my macro, a function defined in another file. I tried to call the function 'prepareCommand' defined in the 'projmake.e' file but SE says command not found ?

Graeme

  • Senior Community Member
  • Posts: 2641
  • Hero Points: 330
Re: get project properties in a macro
« Reply #4 on: July 17, 2008, 10:45:47 am »
That's ok, I have all I need in the file 'projmake.e'.
Is it possible to use, in my macro, a function defined in another file. I tried to call the function 'prepareCommand' defined in the 'projmake.e' file but SE says command not found ?

prepareCommand is a static function so you can't call it from another file. 

  • You can copy the function source itself into your own file along with any static functions it calls.

  • You can modify the projmake.e file itself and make the function non static.  The problem with modifying projmake.e is that every time SlickEdit ship a new version of the file, you have to re-apply your changes.  If you decide to modify projmake.e, I suggest first copying it to a folder of your own and load it from there, rather than change the file in the slickedit macros folder.

  • In slickedit 2007, you can add #include 'pathname ... /projmake.e' to your source file.  This seems to work in slick 2007 but not in slick 2008.  Also I'm not sure exactly what the effect of the #include will be  - you'll probably end up with a lot of duplicated "object / p-code" so I don't really recommend doing this. SE2008 has #import but it has problems with forward references which I haven't figured out the cause of yet!

Graeme

gregos_b

  • Community Member
  • Posts: 53
  • Hero Points: 0
Re: get project properties in a macro
« Reply #5 on: July 21, 2008, 08:36:24 am »
Thank's Graeme,

I agree with you, the best solution is to copy the file to a folder of my own and load it.

Greg