1. Another dynamic include library
- Posted by "Boehme, Gabriel" <gboehme at POBOXB1.HQ.MSMAIL.MUSICLAND.COM> May 07, 1999
- 505 views
------------__kinesphere_boundary__ Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Greetings, all... The attached .zip file contains a library which allows you to dynamically i= nclude files into your program. This is very similar to the dynamic include= method Mark Honnor posted to the list on 3/28, but with several improvemen= ts: * You can use as many dynamic include files as you want * Already-included names are caught to prevent hard-to-trace problems * Temporary include file names can be restricted to prevent accidental overwriting of permanent include files Basically, here's how you use it: ------ include dynincl.e sequence list, another_list list =3D incl_file_function() create_include("_temp.e", list) include _temp.e delete_include("_temp.e") another_list =3D once_again() create_include("_temp2.e", another_list) include _temp2.e delete_include("_temp2.e") ------ If the programmer had tried this... create_include("_temp.e", another_list) -- the second time ..the program would have aborted with a "_temp.e has already been included= " message. Additionally, if the programmer had tried this... create_include("temp.e", list) ..the program would have aborted with a type-check failure on the include = file name. The default rule is that the file name's first character must be= '_' (an underscore). This rule can be changed to whatever you want; simply= modify valid_include_name(). See example.ex in the .zip file for an immediately-executable demonstration= . Be sure to let me know if you find this useful. Many thanks to Mark Honnor = for the original idea! :) Also, Robert Craig: please add this to the contributions page. Thanks! Be seeing you, Gabriel Boehme ------ "I can't understand why people are frightened by new ideas. I'm frightened = of old ones." - John Cage "Men invent new ideals because they dare not attempt old ideals. They look = forward with enthusiasm, because they are afraid to look back." - G.K. Ches= terton ------ ------------__kinesphere_boundary__ Mime-Version: 1.0