"Offset" for line numbers?

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

"Offset" for line numbers?

Postby cpt.z » Mon Sep 17, 2007 7:15 pm

Hi.

I'm a MUMPS programmer and often errors are thrown at me in a format like this: <SYNTAX>PTWNDW^cROU123+4. That means I have to look here:

Code: Select all
...
55  ;
56 PTWNDW(DX,DY,ABC) ; foo
57  N A,B,C
58  Q:ABC="" "bar"
59  S A=42
60  S B=A+(DX*C                                 <--- (56+4=60)
61  ...
...

Okay, actually 56+4 is quite easy to solve, but sometimes a routine starts at line 137 and errors occur at +73, +119 and so on, and finding them gets quite annoying. It would be nice to add an temporary offset to line numbers like this

Code: Select all
...
--  ...
--  Q ERR
--  ;-
 0 PTWNDW(DX,DY,ABC) ; foo
 1  N A,B,C
 2  Q:ABC="" "bar"
 3  S A=42
 4  S B=A+(DX*C                                 <--- (0+4=4)
 5  ...
...

Is this possible?

Edit: I'm using UEStudio '06, but I'm sure its more a question concerning the underlying editor.

TIA

Z.
User avatar
cpt.z
Newbie
 
Posts: 1
Joined: Wed Apr 18, 2007 11:00 pm

Re: "Offset" for line numbers?

Postby Mofi » Tue Sep 18, 2007 12:06 pm

There is no option for relative line numbers. I have following ideas:

Go to start of the routine with the error, press Ctrl+Shift+Home to select everything to top of the file and then Ctrl+X to cut it. Now goto the line with the error and correct it, Press Ctrl+Home and then paste back with Ctrl+V the top of the file.

Go to start of the routine with the error, activate the column mode with Alt+C, press key Shift and hold it why you move the cursor down with key DOWN ARROW to end of the routine. Press now the hotkey for Column - Insert Number to insert in the select lines an increasing number starting with 0. Go to the line with the error, press Ctrl+Z to undo the inserting of the numbers and press Alt+C to switch back to normal edit mode and now you can correct the error.

Last suggestion would be what I would do. Assuming the ouput of the programmer is captured into the output window or a file I would write a script which copies the text in the output window or file and reformats it to the format required by UE/UES to simply double click on a line with an error in the output window to open the file (if not already open) and position the cursor on the line with the error. With a script it is no problem to calculate always the absolute line number of an error. That is definitely the a better solution as 1st and 2nd suggestion but requires some programming skills.

A fourth method would be the best solution, but would require much more programming skills. I have written for myself years ago 2 programs which filter the compiler outputs of "Turbo C" (very old DOS version) and Tasking C166 compiler/assembler/linker directly during compilation of a project to get the output UE/UES need. That lets me run the compilers directly from within UE/UES and I get the errors in the output ready for easy reading it, navigation to it and correct it. If you write something similar for MUMPS, you would need no extra step inside UEStudio to go to an error and correct it.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: "Offset" for line numbers?

Postby yetanotherforum » Fri Apr 10, 2009 9:01 am

Something I thought I'd add to this discussion (even though it is two years old) in case anyone has a similar requirement in the future...

Although the help does not list it, you can goto a "relative" reference using + and -

For example,

Press Ctrl-G

Enter <base line number>

Press Enter

Press Ctrl - G

Enter "+4" (excluding quotes)

Press Enter

UltraEdit will move you that number of lines from your current location.

You may be able to use this in macros (I haven't tried) to implement your temporary offset requirement.
yetanotherforum
Newbie
 
Posts: 1
Joined: Fri Apr 10, 2009 8:54 am

Re: "Offset" for line numbers?

Postby Mofi » Fri Apr 10, 2009 10:36 am

A +/- line number specification can't be used in macros. The macro recorder records the absolute (=resulting) line / column number and it is not possible to edit a macro and enter line or column numbers with a + or - for command GotoLine.

But many thanks for the info of this undocumented feature.

A relative number works also for the column number. And in the dialog it is also possible to use 0 as line number like in macros or scripts to just set the cursor to a different column (absolute or relative) in the current line. Additionally it is possible to specify 0 as column number to set the cursor in the same column to a different line.

+/- works even for page breaks, but UltraEdit does not remember +2 or -1, just 2 and 1, while for line/column numbers +/- numbers are remembered correct for next usage in the Go To dialog. A jump to a bookmark with a relative number is not possible.

I will ask IDM for documenting in help about the Goto Line/Page/Bookmark command all these possibilities.

The task of the initial request could be nowadays solved using a script because with a script it is possible to get the content of the output window, make the calculation and position the cursor on the correct line.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: "Offset" for line numbers?

Postby sklad2 » Fri Apr 10, 2009 11:08 am

This tip of +/- offset with Ctrl+G was great!!!! I had not idea this would work.
User avatar
sklad2
Advanced User
Advanced User
 
Posts: 58
Joined: Thu Mar 08, 2007 12:00 am


Return to UltraEdit General Discussion