November 26, 2004 at 8:57 am #1392
I have modified c.s to create comment blocks like –
rather than –
and changed the macro_file statrment to
to create a uniquely names macro file.
As I am using a networked version I have compiled the macro and placed it in my mac subfolder of my user folder and is called c_gt.mac.
I have also changed all references in the language setup dialog for the c language to refer to this new file name.
This works perfectly until I exit and restart multiedit where it will revert back to the behaviour of the original c.s until i compile the modified c.s again when it will start to use the modified behaviour.
Is there any way of making the new behaviour happen by default on startup. I do not want to modify the global c.s macro.
I have attached the modified c.s and an screenshot of the language dialog.
Thanks,November 26, 2004 at 2:38 pm #4955AndyColsonParticipant
I’ll give this a shot… It may not be exact, but hopefully close.
My guess is that, when mew loads a .C file it loads the c.mac macros, which probably include CInit and friends.
many places in the code get the “proper” function to call by prepending the current language (eg: “C”) to the function name (eg: “Match”) so the CMatch function would be called. I’m guessing when you compile your c_gt file, it replaces the old CInit, and CMatch, etc with your’s.
I dont know if this would actually work, but you can try it. In your Config directory, there is a startup.cfg file. Add a line like:
That’ll cause MEW to load the macros on startup.
Otherwise, if your changes arent hugely sweeping, I’d say just edit the c.s file… oh, unless noone else on the network wants that type of comment.
-AndyNovember 26, 2004 at 9:28 pm #4956Michal VodickaParticipant
Unfortunately, MEW doesn’t always distinguish the macro file. When there are two macros of the same name in two different files, the first loaded will be used even if you prefix macro call with the second file name. MEW simply ignores macro file if macro of requested name is already loaded.
When you compile the file, all macros are reloaded so things work. After restart original file is probably loaded before yours.
I guess you have two possibilities. Change original c.s file instead of creating variant; this is exactly what I did for the same purpose (different comments). If you share macros with others, you can make decision which type of comments to use based on a global variable which you’d set for yourself. Also, I believe MEW is able to load per-user macros in network environment but I forgot details.
The second possibility is to rename all macros in changed file i.e use CGtInit instead of CInit.November 26, 2004 at 9:32 pm #4957Michal VodickaParticipant
Ah, I guess Andy is right, too. Generic language code expect some macro names are prefixed with language name so if you’d want to rename macros, you’d have to create new language. I believe editing original file is the best possibility.November 29, 2004 at 8:13 am #4959
I tried adding the LoadMac c_gt to the startup.cfg and it did not make any difference.
I then tried changing the function name to CGTIndent and removing all of the other functions from the file that I hadn’t changed and this worked.
Editing the main c.s file would be the most elagant solution – although what would happen when the next update came along and overwrote the c.s file?
Would it be possible to add a global to the official distribution in the way that you mentioned to do this style of comment blocks? Defaulting to the original method.
GraemeNovember 29, 2004 at 5:41 pm #4960DanHughesParticipant
You didn’t mention which version of Multi-Edit you are using but the 9.10 release has updated network support to allow using local copies of modified system macros.
What you would do is to copy the default C.s into a local directory, I use Src in my user directory. Then you can modify this local copy of the C.s file to add your changes, without renaming the macros. When you compile the macro be sure to use the “Compile CMacWin Macro (default)” entry since it puts the C.mac file into the <MAC_PATH> directory, which should be the Mac directory under your user directory when the network environement variables are setup.
Now when Multi-Edit looks to load a macro file, it will first look for the macro in the user\Mac directory and if it finds one it loads it otherwise it will load it from the Multi-Edit Mac directory from the network. Of course if the macro file is included in the Mew.mcl library file then this wouldn’t work. In that case you would then create a user defined macro file, I use Ldh_Sys.s, and place in it a copy of all of the macros you want to modify, without name changes, and compile it. Then in your Startup.cfg file you can add a line containing something like “LoadMac Ldh_Sys”. In fact that line is actually in the release file only it is commented out.
To determine which macro files are loaded into the Mew.mcl library file, look in the MewMcl32.lst file in the Multi-Edit Utils directory under the [MERGE] section.November 30, 2004 at 8:37 am #4965
Yes, I am using 9.10.3.
I tried this method with the original file, but without renaming it to c_gt.mac, and it works perfectly.
- You must be logged in to reply to this topic.