How to Scan the Source Code

Home Forums Multi-Edit Support How to Scan the Source Code

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #22119
    kkavish847
    Participant

    How to Scan the Source Code with the Help of MACRO in Multiedit 8.0G Gold.

    Could you help me with the small Macro which will scan the Source Code for a Specific Character.

    For Ex :-

    IF A = B
    ……..
    ELSE
    ……..
    END-IF.

    Here we just need to search whether END-IF is used or not. If there is any Sample Macro which we can Run in MULTIEDIT 8.0G Gold to scan the Source Code. It would be very Useful.

    Thanks in Advance

    #22121
    Clay Martin
    Keymaster

    Hi,
    This would not be a simple macro as it would have to deal with nested ifs. On the surface it seems if you search for an if and then search line by line for either an end if or another if, if you found an if before an end if you have a mising end if. But nested if statements prevent that assumption. You would need a loop doing the searching and if an if is found before an end if, you increment a counter. When you find an end if you decrement the counter. If at the end of the code you have a positive value on the counter then an end if is missing.

    ME 8 is a very old version so I don’t know if it has the Tools-Match language structure function. That would allow you to place your cursor on the if statement, invoke that function and it would find the matching end if, or visa versa.

    If ME 8 has that function you can go to the extension setup and look for the name of the match language structure CMAC macro. That macros’s source might be a good jump off point for what you want to do.

    Thanks,
    Clay

    #22123
    kkavish847
    Participant

    Hi Clay,

    Thank You So Much for the Explanation.

    Now I am getting a new Issue,

    I have written a Small Macro of HELLO WORLD and saved it as .S
    I am compiling the macro with COMPILE CMACWIN Macro in Multiedit 2008.

    After Compiling I am getting NO ERRORS. MACRO FILE = ” LOCATION ”

    But there is No File ( .MAC ) at that location.

    Could you please help me at this.

    Thanks in Advance for your Swift Response.

    #22127
    kkavish847
    Participant

    Hi Clay,

    Above Issue has been Resolved Successfully.

    Thanks

    #22129
    Clay Martin
    Keymaster

    Hi,
    If you go to this post and scroll down there are links to many tutorials on using the CMac language.

    changing an existing macro

    Thanks,
    Clay

    #22131
    kkavish847
    Participant

    Hi Clay,

    Thank You So Much for your help.

    I have written a Small Macro and its running also.

    The only Issue right now I am Facing is I cannot able to find the .MAC file.

    I checked in the below mentioned path :-
    C:\Users\AppData\Roaming\Multi Edit Software\Multi-Edit\11\Config.04\MAC

    But Nothing Found, I checked the Hidden files also but Nothing present there also.

    Could you please help me on this.

    I am Using Multi Edit 2008.

    Thanks in Advance 🙂

    #22132
    kkavish847
    Participant

    Hi Clay,

    Everything is working fine but now I am facing issue while writing a small macro to open a file and scan for a Specific field and display in the tool pane or create a new file.

    Could you help me with the Small Macro or Reference to Similar existing Macro.

    Thanks in Advance 🙂

    #22133
    Clay Martin
    Keymaster

    Hi,
    Not sure about writing to the tool pane but if you want a macro to tell you something you can use Make _message. See how here

    Introduction to CMAC. 4: Make_Message

    If you want to write something to a new file you should use LDfiles to open the file. The function is found in MESYS.s. Open the file from the install src directory then search for ldfiles. 2nd search will take you to the function and its inputs are described in the comments at the top of the function. It is the go to macro for loading existing or new files. You can search the Help-cmac reference for the phrase File Access Function List to see the other file manipulation functions.

    To get a named mac file you need to start your .s file with
    macro_file name-of-mac-file;

    Also to use functions from other system mac files you need an include of the header file like this:
    #include MESYS.sh

    Also when switching between open files you should use their Window id, You can find out about these functions by searching the cmac reference for: Window Function List

    Also you may want to look at Help-Cmac user guide. Especially Chap 12.

    I realized that the link I gave you for the tutorials, in that post the links to the actual tutorials are broken. Instead you can get to them by searching the forum for the title of the one you want, then search the search results page with your browser search for the title until it is found in a title.

    Hope this helps,
    Clay

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