Standard location for user/custom .sh files?

Product Compare Forums Multi-Edit Support Standard location for user/custom .sh files?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #2706
    jayterry
    Participant

    If I have written a macro and created a .sh file so that the routines could be called be other macros, then what is the "standard" location for my .sh file? I know I could put it in the ME\Src directory — but for the same reason there is a separate directory in the user profile directory for custom .mac files, I would have thought there would be a Src directory in the user profile for custom .sh files.

    #8896
    Clay Martin
    Keymaster

    When you compile a CMAC file the resulting MAC file will be put in your config directory. That directory is searched before the main MAC directory. As you can see from below, the include file has to have the same location as the source being compiled. While you can have a directory anywhere on you hard drive that contains your macro sources, and when you compile them they are placed in the MAC directory in the Config directory. So if you want to use your .sh files for your other mac files, they can be keep in the same location. But if you wanted to use them to modify the CMAC code that comes with ME, you should place them in the Src directory. I tend to keep all my CMAC code in the installation Src directory, but then again I don’t have vista.

    From the CMAC language guide
    #Include File (optional)
    This may be inserted in a macro file to include another file in the source. The path for the Include File is assumed to be the same as the original source unless specified otherwise. Include Files may NOT be nested (you can’t include a file in an include file).

    #8898
    jayterry
    Participant

    Of course, it depends on preference. :) But I prefer the methodology of keeping the ME directory "clean", and having all my customizations, configurations, and personal macros in a separate user directory. That works great for .mac files since there is a Mac directory in the user directory. So even if I want to replace/override a system .mac file, I can just put it in my user\Mac directory and ME will find it there first.

    I was just wondering if (or maybe why?) there wasn’t the same kind of functionality for .sh files. For example, if I need to use a routine from Win32.s then I just use "#include Win32.sh" and ME knows by default where to find it (i.e., in ME\Src). But say for example that I have a "utility" .mac file (let’s call it myutility.mac) with common routines that I can use in all my other custom .mac files. If I’m writing a new custom macro (let’s call it mynew.mac) and I want to use some routines in myutility.mac, then I need to "#include myutility.sh" in my code for mynew.s. In order to do this, I must either put myutility.sh in ME\Src (thus "polluting" the ME directory) or put a duplicate copy of it in every directory where I have custom code that uses it (thus making it messy to keep the right version everywhere). Seems like there should be a user\Src, same as there’s a user\Mac, that the CMAC compiler looks for by default to find custom .sh files in the same way that ME looks in user\Mac first for .mac files.

    As I continue to investigate, I see that the macro compiler (CMACWIN) does have a -I option to provide a list of dirs in which to find include files. But you would think there should be a standard (default) location it checks without having to be told (i.e., one for the user’s custom files in addition to the default on it already uses for ME\Src). And I also notice that you can create a CMACWIN.ini and add an "include=…" parameter. Only problem I have with that is that it expects CMACWIN.ini to be in the same directory as CMACWIN.exe, which puts you back to "polluting" the ME installation directory.

    None of this is really that big a deal. There are certainly ways to work with/around it. Or maybe I’m just missing something that someone could point out to me. If not, I guess I’d just like to make the suggestion to have a Src dir in the user profile and have CMACWIN check there automatically to find include files.

    Thanks

    #8899
    Clay Martin
    Keymaster

    I’ll pass along the suggestion about the standard user directory (maybe a Src in the user config area). I have a feeling that this stems from the incremental changes made over time to how the compiler works and how the industry views code locations.

    One thing you could try, in the include statement in your xyz.s file, fully path the xyz.sh file like
    #Include \mysttuff\prog1\xyz.sh

    #8900
    jayterry
    Participant

    I’m guessing you’re right about the reason why it works the way it does. It kinda looks like when they were making sure they removed all user config and data from the ME dir to a user dir (to be compliant with new standards for Vista and beyond), they simply overlooked changing the default location of the compiler config file (cmacwin.ini) and/or a default location for user’s include files.

    As for fully qualifying the path to the .sh file on the #include in my .s, I’m sure that will probably work. However, I would still consider that just a workaround because I really doubt I could use a metacommand to specify the directory (e.g., #include <user-path>\Src\my.sh), so it would have to be hard-coded, thus making it non-portable.

    But thanks for the idea, and for passing along the suggestion to the developers. I wish this could be implemented in the upcoming release, but I imagine they might be loathe to change anything like that this late in the dev cycle. :) C’est la vie

    Thanks

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.