1. copying global stuff to one file
- Posted by Tone Škoda <tskoda at email.si> Nov 08, 2004
- 477 views
i would like a tool which copies needed global stuff from included files to file which includes them, and make that copied stuff non-global. i want this to avoid global names collisions. is there some tool like this already, or some way that it can be done easy? what i basically need is a program which will find out which global stuff from included files a file uses. is there some way this can easily be done? i want to release a cool library i made which profiles code. here's an example output:
=========================================================================== =========================================================================== Profiling on 8. November 2004 1:11:54 --------------------------------------------------------------------------- 1 Update 'All_work_objects' Total run time : 0.020000 seconds Average run time : 0.000034 seconds Times run : 581 --------------------------------------------------------------------------- --------------------------------------------------------------------------- 1 Update 'Potent_workobjs' Total run time : 199.250000 seconds Average run time : 0.342943 seconds Times run : 581 --------------------------------------------------------------------------- --------------------------------------------------------------------------- 2 Get indexes Total run time : 0.550000 seconds Average run time : 0.000947 seconds Times run : 581 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 2 Remove old Total run time : 0.770000 seconds Average run time : 0.001325 seconds Times run : 581 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 2 Add new Total run time : 197.930000 seconds Average run time : 0.340671 seconds Times run : 581 % of parent : 99% % of root parent : 99% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 3 Get 'relink_wobjs_ids' Total run time : 0.000000 seconds Average run time : 0.000000 seconds Times run : 581 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 3 Get 'new_potwobjs' Total run time : 197.170000 seconds Average run time : 0.339363 seconds Times run : 581 % of parent : 99% % of root parent : 98% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 4 get_potwobj_for_wobj(): WHOLE Total run time : 196.920000 seconds Average run time : 0.012053 seconds Times run : 16338 % of parent : 99% % of root parent : 98% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 5 startup Total run time : 2.090000 seconds Average run time : 0.000128 seconds Times run : 16338 % of parent : 1% % of root parent : 1% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 5 loop Total run time : 112.730000 seconds Average run time : 0.006900 seconds Times run : 16338 % of parent : 57% % of root parent : 56% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 6 join_two_wobjs() call Total run time : 4.040000 seconds Average run time : 0.000044 seconds Times run : 91892 % of parent : 3% % of root parent : 2% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 7 join_two_wobjs():WHOLE Total run time : 3.250000 seconds Average run time : 0.000035 seconds Times run : 91892 % of parent : 80% % of root parent : 1% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 6 get_work_object_distinctiveness() Total run time : 107.720000 seconds Average run time : 0.001172 seconds Times run : 91892 % of parent : 95% % of root parent : 54% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 5 getting borders Total run time : 81.460000 seconds Average run time : 0.004986 seconds Times run : 16338 % of parent : 41% % of root parent : 40% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 6 get_one_edge () call Total run time : 46.850000 seconds Average run time : 0.002823 seconds Times run : 16597 % of parent : 57% % of root parent : 23% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 7 get_one_edge(): WHOLE Total run time : 46.670000 seconds Average run time : 0.002812 seconds Times run : 16597 % of parent : 99% % of root parent : 23% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 8 Direct 'start_pixedge' Total run time : 0.550000 seconds Average run time : 0.000033 seconds Times run : 16597 % of parent : 1% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 8 main loop outside Total run time : 45.780000 seconds Average run time : 0.002758 seconds Times run : 16597 % of parent : 98% % of root parent : 22% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 8 end Total run time : 0.120000 seconds Average run time : 0.000007 seconds Times run : 16597 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 5 finish Total run time : 0.240000 seconds Average run time : 0.000015 seconds Times run : 16338 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 3 Add Total run time : 0.740000 seconds Average run time : 0.001274 seconds Times run : 581 % of parent : 0% % of root parent : 0% --------------------------------------------------------------------------- --------------------------------------------------------------------------- 1 Update 'Final_objects' Total run time : 1.930000 seconds Average run time : 0.003322 seconds Times run : 581 --------------------------------------------------------------------------- =========================================================================== ===========================================================================
2. Re: copying global stuff to one file
- Posted by Patrick Barnes <mrtrick at gmail.com> Nov 08, 2004
- 468 views
On Sun, 07 Nov 2004 19:41:20 -0800, Tone =C5=A0koda <guest at rapideuphoria.co= m> wrote: > > posted by: Tone =C5=A0koda <tskoda at email.si> > > i would like a tool which copies needed global stuff from included > files to file which includes them, and make that copied stuff > non-global. i want this to avoid global names collisions. > is there some tool like this already, or some way that it can be done > easy? Well, there's a problem with that - say there's a global routine setValue() in a library... You could write a program to find that your program used setValue() without much trouble. Alright, so copy the text of it out, paste it into your file, and remove the 'global'... Trouble is, the setValue function might call another function within the library... or it might read or write to a global variable in the library. Any function to do this would have to be recursive, for a start. Second thing is, what about statements that a library executes? You'd have to put them in too... It's a nice idea, but very difficult to implement. You'd be better off just copying the entire library into your code... stripping of 'global' is not difficult. > what i basically need is a program which will find out which global > stuff from included files a file uses. is there some way this can > easily be done? No, see above. > i want to release a cool library i made which profiles code. here's an > example output: Okay, are you planning to do this using the profile_time function within registered Euphoria? If not, I don't think it's possible. Even when 2.5 comes out, the public part will be the interpreter side, not the run-time side. I don't see how on earth you plan on profiling... -- MrTrick ----------
3. Re: copying global stuff to one file
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 08, 2004
- 493 views
On Sun, 07 Nov 2004 19:41:20 -0800, Tone =8Akoda <guest at RapidEuphoria.com> wrote: >i would like a tool which copies needed global stuff from included >files to file which includes them, and make that copied stuff >non-global. i want this to avoid global names collisions. >is there some tool like this already, or some way that it can be done >easy? > >what i basically need is a program which will find out which global >stuff from included files a file uses. is there some way this can >easily be done? > I've used shroud -clear for this, then edited the resulting file by hand. If you do this: include ... include ... global procedure SetText(...) setText(...) end procedure Then SetText will be externally visible, but setText will not. You can of course edit the file to remove SetText() and make setText() global. Regards, Pete.
4. Re: copying global stuff to one file
- Posted by Tone Škoda <tskoda at email.si> Nov 08, 2004
- 482 views
Patrick Barnes wrote: > > Well, there's a problem with that - say there's a global routine > setValue() in a library... You could write a program to find that your > program used setValue() without much trouble. Alright, so copy the > text of it out, paste it into your file, and remove the 'global'... > > Trouble is, the setValue function might call another function within > the library... or it might read or write to a global variable in the > library. Any function to do this would have to be recursive, for a > start. > > Second thing is, what about statements that a library executes? You'd > have to put them in too... I was aware of those things you mentioned. Ofcourse all the things that are needed would have to be copied, else code wouldn't even work anymore. > It's a nice idea, but very difficult to implement. You'd be better off > just copying the entire library into your code... stripping of > 'global' is not difficult. It looks it's really too difficult to bother. I was hoping there was some easy way to do it, using some existing preprocessor or something. Maybe I will copy it by hand or simply leave it as it is. > > i want to release a cool library i made which profiles code. here's an > > example output: > > Okay, are you planning to do this using the profile_time function > within registered Euphoria? No. I have already written this profile library. It simply measures how much time was spent in a block of code and how many times it was run. Ofcourse I have to put two procedures around the block of code I want to profile, a little more work than using with profile, but there are some other advantages (besides i made me a macro in msdev which automatically puts this code in, so it's not much trouble): start_profiler ("profiler name") <code> <code> <code> end_profiler ("profiler name")
5. Re: copying global stuff to one file
- Posted by Tone Škoda <tskoda at email.si> Nov 08, 2004
- 459 views
Pete Lomax wrote: > I've used shroud -clear for this, then edited the resulting file by > hand. If you do this: I don't have registered version of Eu.