Lazarus
Programming => General => Topic started by: Gustavo 'Gus' Carreno on September 08, 2021, 09:59:46 pm
-
Hey Y'all,
Ok, here's the thing: I've started this repository (https://github.com/gcarreno/TestMarkdown/) on GitHub so I could have a spin on 2 Markdown libs that I found.
Those libs are:
- delphi-markdown (https://github.com/grahamegrieve/delphi-markdown)
- pashtmldown (https://github.com/BeRo1985/pashtmldown)
And if you look at the progress made, reflected by the current state of the app, I've been able to put 2 libs, side by side and test them.
Now, here comes the icky, complicated part:
I've found that someone as forked delphi-markdown and decided to call it fpc-markdown (https://github.com/mriscoc/fpc-markdown).
Since delphi-markdown and fpc-mardown have the same named units, my questions is:
How can I test them on the same program?
How can I pick up on namespacing, if there even is a distinction?
Can having them installed has packages help, instead of just adding the sources to the Project Options?
Many thanks in advance!!
Cheers,
Gus
-
Hey Y'all,
Can no one give me the slightest hint?
Even a simple: It's completely impossible, would be better than nothing?
Where's the helping spirit I've participated in and have lauded myself, hein peeps?
Cheers,
Gus
-
There were some mails/messages about namespaces (dotted unitnames) in fpc.
At least fpc trunk must already have that. Maybe 3.2 too.
I have not yet myself looked into it.
There may be switches to compile an entire package with a prefix.... (no idea)
-
Afaik
- 3.0+ supports files with dotted names.
- 3.2+ supports -FN to set scope prefixes
However most RTL/FCL/LCL units are not renamed to their dotted equivalent.
-
Can having them installed has packages help, instead of just adding the sources to the Project Options?
Don't know about packages and adding name spaces.
Assuming you are using Lazarus to manage the project: Create separate build profiles for the two libraries in your test project, where each library's build mode sets the Other unit files setting to point to that library's source folder, and separate Unit output directories so that the compiled units don't clash.
-
Hey Y'all,
@Martin_fr:
Thanks for that!!
I'm aware of the use of dotted namespacing ever since it was introduced in 3.0.
I've been using it ever since. I was overjoyed when I saw that this carried over from Delphi.
@marcov:
Is there a a link that gives more info on the -FN to set scope prefixes?
If this is what I think, it would, probably, solve my issue.
Well, it's not an issue, it's more of a curiosity, but hey, that's how we learn right?
@ccrause:
Assuming you are using Lazarus to manage the project: Create separate build profiles for the two libraries in your test project, where each library's build mode sets the Other unit files setting to point to that library's source folder, and separate Unit output directories so that the compiled units don't clash.
This option is what I'm trying to avoid. I'm also trying to avoid having 3 diff projects, one for each lib.
I've been aware of dotted namespacing since FPC 3.0 and I've been using it extensively in my personal projects.
My goal here is to have a comparison of all 3 libraries in one single executable, if at all possible.
I'm not quite sure this goal is attainable, since fpc-mardown is a fork of delphi-markdown and they use the same(non dotted namespaced) unit names.
Hence me asking if having them in different packages would allow me to prefix the unit name with the package name.
I'm lost and in need of the forum's overwhelming knowledge of the more savvy users!!
Cheers,
Gus
-
@marcov:
Is there a a link that gives more info on the -FN to set scope prefixes?
If this is what I think, it would, probably, solve my issue.
Well, it's not an issue, it's more of a curiosity, but hey, that's how we learn right?
I don't know if the information found its way into the documentation, but there's always my announcement mail (https://lists.freepascal.org/pipermail/fpc-announce/2018-May/000605.html) of the feature.
-
Hey PascalDragon,
I don't know if the information found its way into the documentation, but there's always my announcement mail (https://lists.freepascal.org/pipermail/fpc-announce/2018-May/000605.html) of the feature.
So many thanks for that!!!
I had a quick glance at it and it made a bit more sense, but not totally.
My main question is: Do you use that on the Main program compile directives or in the package compile directives?
Cuz it not that clear...
Cheers,
Gus
-
My main question is: Do you use that on the Main program compile directives or in the package compile directives?
You need to use it everywhere the compiler is invoked and default namespaces need to be used. It doesn't matter if you compile a whole program or a single unit (with dependencies) as otherwise the compiler simply won't find the correct units.
-
Hey PascalDragon,
You need to use it everywhere the compiler is invoked and default namespaces need to be used. It doesn't matter if you compile a whole program or a single unit (with dependencies) as otherwise the compiler simply won't find the correct units.
Yeap, makes sense.
And how would you go about setting that up on Lazarus?
Or does it have to be a thing you can only do in a script, or manually somehow?
Again, I'm so sorry for such newb questions and I cherish the morsels of knowledge that you impair on me!!
Cheers,
Gus
-
And how would you go about setting that up on Lazarus?
Or does it have to be a thing you can only do in a script, or manually somehow?
I don't know if Lazarus 2.2 will provide an explicit setting for them, but in absence of that you add the namespaces to the Custom Settings of the project or package (just as you'd add them on the command line).
-
Hey Pascal Dragon,
I don't know if Lazarus 2.2 will provide an explicit setting for them, but in absence of that you add the namespaces to the Custom Settings of the project or package (just as you'd add them on the command line).
Yup, makes sense. I always forget the Custom area, sorry!!
Thanks for the tip!!
Cheers,
Gus