User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Help with setting up and configuring custom user tools in UltraEdit (based on command line input)
13 posts Page 1 of 1
Hi
I'm a newb

I want to do a find in files of the selected text added a ":" in the end, then navigate to the first found file:
This is to find a specific label in some assembler code.

My initial macro is like this:

Code: Select all
InsertMode
ColumnModeOff
HexOff
IfSel
FindInFiles "" "" "^s:"
Else
SelectWord
IfSel
FindInFiles "" "" "^s:"
EndIf
EndIf

1) I do not know why the extra "" "" are inserted, but the macro editor does it when I save.
2) The macro now does make the search, but the output is guided to the editor instead of the output window. It would be nice to have it go to the output window.
3) I have no clue on how to get the editor to open the found file and line number.

I hope you can help
rgds
Cyrex
In your FindInFiles command it is not specified where to search. You have not posted which version of UltraEdit you use and therefore can't tell you if this is a known bug of the macro recorder or not.

Correct would be something like:

InsertMode
ColumnModeOff
HexOff
IfSel
FindInFiles OutputWin OpenFiles "" "" "^s:"
Else
SelectWord
IfSel
FindInFiles OutputWin OpenFiles "" "" "^s:"
EndIf
EndIf

or

InsertMode
ColumnModeOff
HexOff
IfSel
FindInFiles OutputWin "C:\Temp\" "*.asm" "^s:"
Else
SelectWord
IfSel
FindInFiles OutputWin "C:\Temp\" "*.asm" "^s:"
EndIf
EndIf

In the macro environment it is not possbile to access the content in the output window. So your second wish to open the first file and position the cursor to the found line is not possible with a macro. It would be possible with a script depending on the version of UltraEdit you use. So you have to double click on the line itself in the output window or use Ctrl+Shift+Down Arrow if you use UE v15.00+.
Best regards from Austria
Thanks a lot.

1) I'm using v15.

2) I want to search project files

3) If I can't navigate to the file location, the gain is too small I think.

I will try to look at scripts instead. Also I'm trying to generate a ctags like file, this would also cut down search time.
Maybe I should stop perusing the macro/script path and focus on generating the ctags look a like.

Thanks for the help
/Cyrex

one thought:
If I output to editor, then the macro environment can access it, can it then open the wanted file location?
Cyrex wrote: If I output to editor, then the macro environment can access it, can it then open the wanted file location?

You could open the file, but positioning the cursor at correct line is not possible with a macro because you can't convert the line number as string into an integer number for being used in a GotoLine command. Also the macro environment does not support variables. The only possibility would be to run from within the macro a user tool which calls UltraEdit with the "file name/line number" as parameter and when allow multiple instances is not enabled the file should be opened in the current instance of UltraEdit with cursor positioned on the correct line. So a script would be definitely better.

Even better than a script is using Ctags and the command Search - Find Symbol (with a hotkey). Because you are working already with a project using Ctags here should be your first choice as I would use too. To be more precise I have a C167 project with source files mainly written in C but contains also 3 assembler files and I use Ctags for that project. Search - Find Symbol to jump to a label in the assembler file based on the word at current cursor position (selecting the word is not necessary) works fine and with Search - Back (last position) I can jump back. Both commands are assigned to hotkeys. That should work also in your project. I think, you don't really need special Ctags parameters because assembler languages are supported natively by Ctags. So the standard Ctags parameters -L %fi -f %fo should be enough. So all you need to do is to specify in the project settings dialog the name and location for the ctags database file and create the database by executing Project - Create CTAG file.

Also possible would be to add to your wordfile a regular expression function string which finds labels in your assembler files and list them in the function list. I have not done this because an assembler file contains so many labels that this does not make really sense. So the function list for my C167 assembler files shows only the names of the procedures.
Best regards from Austria
Hi
Thanks once more for the quick reply.

I use Ctags and Cscope with all my "C" projects. (actually i got Cscope well integrated into UE, very nice .-)).

Using standard Ctags for my current assembler project does not work, as it seems to index all the wrong keywords :-)

All my core registers are indexed (So now I can easily find where I used the ALU) :-) and my macros and functions are not.

I have modified the wordfile to make the function list, but as you wrote your self, this is of little help when working with huge and multiple files.

What I want is to go to a function definition easy. At the time being the best way is a find in files on the selected keywords. And that is not as effective as I would like it to be.
/rgds
Cyrex
Looks like Ctags does not recognize your assembler files correct. Maybe you are not using a common file extension for your assembler files. I use following Ctags Options for my project:

-I _atbit+ --langmap=c:.c.h.inc,asm:.asm.def -L %fi -f %fo

-I _atbit+
is just for telling Ctags that _atbit is a special token. It is a special type to define a bit variable at a fixed location in the bitaddressable RAM of the C167 controller. You can forget that for your project.

--langmap=c:.c.h.inc,asm:.asm.def
is more interesting for you because it maps the files *.c, *.h and *.inc to the 'C' symbol parser, and *.asm and *.def to the ASM symbol parser. Maybe you need to do something similar for your project.

-L %fi -f %fo
is the standard and just tells Ctags to parse the lines from the file UltraEdit creates dynamically (%fi is the placeholder for the name of this list file) and should write data to the file you have specified in the project settings dialog (%fo is the placeholder for that file name).

I can see in the tag file created by Ctags that it contains all labels, procedure names, section names and register bank names. It contains also some assembler directives which are not really symbols, but that doesn't matter.

If you get a different result, you need to invest some time to read the documentation of Ctags and fine tune it for your requirements. You probably need to specify your own Perl regular expressions to find the symbols in your assembler files you want in the database. I can't really help you here because I never needed to read-in so deeply into the Ctags manual.
Best regards from Austria
Hi

I have made my own asm tags generator in python, and it works like a charm
Thanks for your help
/cyrex
Hi Cyrex,

I am also looking into intergrate cscope into UE for C programming. Do you mind sharing your intergration configuration of cscope? Thanks a lot.
HI
Of course you can see what I have done

Basically it's a some python scripts that wraps the cscope in a way that makes it use able from UE.
Its extremely fast and it provides much better insight than Ctags.

-so you'll need python

I have the scripts at my work, so don't exspect something until the end of the weekend.

rgds
cyrex
mofi:
I looked at the Ctags manual, and it seems like youre right, that ctags should work with assembler.

I will try to map the files as you suggests, but I fear it will not work, because the asm is not standard.

Also using the Python generator makes it possible to index what I want and handle special cases, - And it is allready working as good, maybee better than the standar Ctags. I off cource still need to find the bugs in my scripts :-).

I could use the Python sript to append function names to the wordfile and that way get syntax highlighting on functions ? I will look into that as well I guess.

/
Cyrex
I don't know what cscope is nor do I have Python installed. Ctags works fine for me (older projects) as well as the integrated parser for UEStudio (new projects). So thanks for your offer, but I don't need anything additional.
Best regards from Austria
Cyrex, I'm very interrested to know how you use cscope with UE. Could you share your python scripts?

Thanks a lot
Marc
Hi

Of course you can see my scripts, Its basically a Python wrapper for cscope. Cscope turned out to be a bit more cumbersome than expected, so I did not manage to get all the data out of it, but still it is better than ctags, because you can go both ways in a call tree, not only to definition.

I have paused its development, as I'm solely programming assembler at the moment, so I'm making scripts for that now. You'll have to take it from where it is, and I guess it is not easy without at least basic experience with Python.

rgds
Cyrex
13 posts Page 1 of 1
cron