Introduction to CMAC. 7: Multi-Edit Tags

Post user created macros to share with others here.

Moderator: Moderators

Introduction to CMAC. 7: Multi-Edit Tags

Postby deleyd on Sun Feb 15, 2004 1:07 am

Introduction to CMAC. 7: Multi-Edit Tags

Multi-Edit tags makes it easy to quickly find your coded routines. This works for all programming languages that Multi-Edit supports. My example here will be for the Multi-Edit CMAC code files in the Multi-Edit\src folder.

In my previous post I mentioned we wanted to look for macro "SaveFile", but we didn't know which file in the Multi-Edit\src folder had the "SaveFile" code. Once we set up Multi-Edit Tags it will be quick and easy to find the "SaveFile" macro code.

In Multi-Edit select VIEW -> TAGS and VIEW -> Navigation Pane. (The navigation pane is toggled on and off via VIEW -> Navigation Pane, and what the Navigation Pane shows is determined by what items are checked under the third section of the VIEW menu, such as "Code Manager", "Project", "System", "Tags", and possibly others.)

Image

Initiate a Wildcard Tag Scan, which can be done in three different ways:
1) By clicking on the Image button (in the Tag View section of the image above).
2) Or by clicking on the Image button and then selecting "Wildcard tag scan".
3) Or by selecting TAGS -> "Wildcard tag scan..." (main menu).

Image

Click the Image button next to the "File(s)" field. Navigate to your Multi-Edit\src folder (e.g. "C:\Program Files\Multi-Edit\src"), click on a file such as "Ada.s":

Image

(Note: Originally instead of selecting "Ada.s" I did a CTRL-A to select all the *.s files and then clicked "Open". The resulting string of file names was longer than 1024 characters and overflowed an internal buffer, so I changed this post to do it this way instead.)

Click "Open", which will take you back to the "Wildcard Tag Scan" window:

Image

Edit 'Ada.s' to read '*.s', and enclose the whole string in double quotation marks because there are spaces in the file name.

Image

Click "OK", and Multi-Edit will scan all the files.

(NOTE: Another way to identify the files we want scanned would be to set your working directory to "C:\Program Files\Multi-Edit 9.10\Src\" and then just enter "*.s" in the Wildcard Tag Scan field.)

There's one caveat you need to know at this point. You need to load a *.s file into Multi-Edit and be switched to that window before the Tags feature will work. Doesn't matter what *.s file you load as long as the file name has a .s extension. Here I've loaded "Ada.s" as a convenient file. (Note both the files and the tags in the Tags pane are listed in reverse alphabetical order. You can sort them ascending by right-clicking in the window to get the context menu and selecting SORT -> ASCENDING.)

Image

Now we're ready to search for the "SaveFile" macro code. There are two ways to initiate a search:

1) TAGS -> "Prompt for tag..."
2) Or by clicking the Image button on the Tags pane and then selecting "Prompt for tag"

Enter "SaveFile" and click OK.

Image

Multi-Edit will take you straight to the code. [Note: if nothing seems to happen, double check that you currently are switched to a window with a *.s file in it.]

Now go to TAGS -> CONFIGURE and select the "Browse files first" checkbox.

Image

Repeat the "Prompt for tag..." and enter "SaveFile" again. This time a dialog box comes up.

Image

Click "Load" to go to the file into a normal edit window. (Clicking "Next" will instruct Multi-Tags to search for the next tag of the same name, if one exists.)

Another way to search for the tag is if you're in any *.s file and the word "SaveFile" appears, right click on the word "SaveFile" and select "Find tag under cursor" (or place the cursor on that word and do Shift+F11).

Another thing you can do at any time is click the Image Browse Current File button on the main toolbar and you will get a list of all routines in the current file. You can use this list to easily jump to any routine.
Image

Also try Tags -> List Tagged Files

For an alternate explanation see the November 2006 issue of The Developer News, which has an article on Tags, and another article on Projects.
Last edited by deleyd on Mon Nov 02, 2009 8:09 am, edited 9 times in total.
User avatar
deleyd
Developer
 
Posts: 1020
Joined: Tue Jul 29, 2003 4:27 pm
Location: Santa Barbara, CA

Postby Michal Vodicka on Mon Feb 16, 2004 7:38 pm

Tip: wildcard tag scan allows to use wildcards. No need to select all files. Just write <path_to_mew_sources>\*.s or, if you prefer clicking on icons, select ada.s and replace string "ada" with *.
Michal Vodicka
Developer
 
Posts: 425
Joined: Fri Jul 25, 2003 8:16 pm
Location: Prague, Czech Republic

Postby ReidSweatman on Wed Feb 18, 2004 7:40 am

Tip #2: you can string either files or wildcards together, up to the limit of the textbox (haven't checked but probably around 234 characters) simply by separating them with semi-colons, like this:

<path_1>\*.s;<path_2>\*.cpp

and so on. Even easier, if you're working with a project, and have all the files you want tagged inserted in the project, you can just tag the entire project, using the button or menu control for the purpose. (A bit off-topic, but there's a checkbox in most of the search dialogs to limit the search to project files, as well, which is quite useful).
Reid Sweatman
User avatar
ReidSweatman
Developer
 
Posts: 455
Joined: Tue Jul 01, 2003 8:35 pm
Location: 2000 Light-years from Home

Project file tag scan

Postby lancej on Mon Jan 22, 2007 9:22 pm

Reid (or anyone),

Can you tell me (specifically) how to scan all of the files in my project? I have about 500 files in about 100 directories that I need to build a tag file for. I have added all of these files to the project, but I cannot find a command or option for scanning only these. I am using MEW 8.0d. (I purchased 9.0, but I have not had the energy to port everything over to it yet.)

Also, I could not find a "clean" way of adding the files to my project. I started with a text file that lists all the files (with full path names). I added <7f>FN= to each line of the text file and then copied it into the .prj file. Is there a better way.

Thanks,

Lance
lancej
Registered User
 
Posts: 5
Joined: Fri Nov 14, 2003 1:23 pm

Project file tag scan

Postby lancej on Wed Jan 24, 2007 11:26 am

All,

I think I answered my own questions.

I looked at my v9.1 and see that it has project tagging and 8.0j does not.

I wrote a quick and dirty macro for project file tagging and it seems to work. (I am something of a CMac newbie so critiques are welcome.) Just in case anyone else needs it (for pre-9.0) here it is:

Code: Select all
#include Project.sh
macro tag_project_scan trans2
{
  int origWinId, dbgId, prjWinId, tmpId, tmpId2;
  str fname[260];
  int noClose;

  noClose = parse_int("/NOCLOSE=", mparm_str);
  origWinId = window_id;
  create_window;
  dbgId = window_id;
  create_window;
  tmpId = window_id;
  switch_win_id(dbgId);
  tof;
  insert_mode = 1;

  make_window_visible(1);
  prjWinId = GetProjectListFile(1);

  switch_win_id(prjWinId);
  make_window_visible(1);
  tof;
  while (!AT_EOF) {
    fname = get_line;
    if (file_attr(fname) & 0x10) {
      down;
    } else {
      switch_win_id(tmpId);
      if ( switch_file( fname ) ) {
        tmpId2 = cur_window;
        switch_win_id( tmpId );
        link_window( tmpId2 );
      } else {
        return_str = fname;
        rm( "LdFiles /NWS=1/NBF=1/NR=1/NSW=1/NHA=1/NC=1" );
      }
      switch_win_id(dbgId);
      put_line( "scan: "+fname ); down;
      if ( error_level == 0 ) {
        switch_win_id(tmpId);
        rm( "Tag_Build /WW=1" + "/HFILE=" + fname );
        switch_win_id(dbgId);
      }
      switch_win_id(prjWinId);
      down;
    }
  }
  Tag_Save_TagFiles( );
  switch_win_id(prjWinId);
  delete_window;
  switch_win_id(tmpId);
  delete_window;
  switch_win_id(dbgId);
  if (!noClose) {
    delete_window;
    switch_win_id(origWinId);
  }
  make_window_visible(1);
}



By the way, while developing it (and learning CMac), I used a debug window to see what was happening. It turned out that having the file list it produces (in my case, almost 700 files) was handy, so I left a switch in the code to allow the window to remain.

Thanks,

Lance
lancej
Registered User
 
Posts: 5
Joined: Fri Nov 14, 2003 1:23 pm


Return to User Created Macros

Who is online

Users browsing this forum: No registered users and 0 guests