Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert some prg to Compile-Time
Message
From
16/09/2003 12:00:42
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00829327
Message ID:
00829468
Views:
25
>OK,
>
>then I have a problem: I want a piece of code be a part of different prgs.
>
>Actually I have several projects, whoes main programs differ only slightly. The big part of them is the declaration of private variables that are then used in the app, instantiation of some common objects (application, Hauptmenu and so on), and this part is absolutely common to all my projects. Only the end of the main prg is specifical to the app. itself.
>
>I would of course like to maintain this common part separately in a prg-file. But then I have to somehow "#INSERT" it into the code at compile-time, otherwise I can't declare the variables in it.
>
>You are right, I did such thing before in FP26 with menus...

You could make your own "preprocessor", where you search all your PRGs for a certain mark (let's say, "#MYINSERT"), and replace with the contents of the specified file. Then, you would have to compile everything - and do all this in a copy of the project, not in the original. I don't know whether it is worthwhile...

Probably it is better to use parameters to pass appropriate values to a function, or a few public variables.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform