[comp.sys.mac] Is there a way to get line numbers in MPW?

buzz@phoenix.Princeton.EDU (Mahboud Zabetian) (03/14/88)

I'm sorry to be posting here, but we don't seem to have comp.sys.mac.programmer
anymore.

How would I get line numbers for my source files in MPW?  When I use the C
compiler, I get error messages and the lines that the errors occured in.
But how do I get the editor to show line numbers so that I can find my errors
more easily?

I'm sure this is probably a stupid question.  Forgive my ignorance.
-- 
Mahboud Zabetian				buzz@phoenix.princeton.edu
183 Little Hall 					(609) 520-1271
Princeton University, Princeton, NJ 08544		(609) 734-7760
****** Anyone need a soon-to-graduate hardware/software engineer? ********

sho@tybalt.caltech.edu (Sho Kuwamoto) (03/14/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>I'm sorry to be posting here, but we don't seem to have comp.sys.mac.programmer
>anymore.
>
>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?
>
>I'm sure this is probably a stupid question.  Forgive my ignorance.
>-- 
I found this absolutely impossible to figure out, and then it seemed
pretty obvious once someone told me.  You select the line with the
error message and hit Enter.  I don't remember the exact syntax of the
error message, but it's something like:

	File bletch.c : line n 		# Some random error here.

which apparently is a valid shell command.

						-Sho

 (sho@tybalt.caltech.edu, sho@caltech.bitnet, ...!cit-vax!tybalt!sho)

gae@osupyr.UUCP (Gerald Edgar) (03/14/88)

Choose Find... under the Find menu, then click the
"Selection Expression" choice.  Then you can type
the line number you want to find.

See chapter 3 of the MPW manual for an example of this.

-- 
  Gerald A. Edgar                               TS1871@OHSTVMA.bitnet
  Department of Mathematics                     gae@osupyr.UUCP
  The Ohio State University  ...{akgua,gatech,ihnp4,ulysses}!cbosgd!osupyr!gae
  Columbus, OH 43210                            70715,1324  CompuServe

lsr@Apple.COM (Larry Rosenstein) (03/15/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>
>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?

Select the line that contains the file name & line number and hit enter.
There are MPW Shell scripts for the file and line commands that do the
correct thing.  This also applies to the output from compare; you can select
an output line, hit enter, and it will bring up both files and scroll to
show the difference.


-- 
		 Larry Rosenstein,  Object Specialist
 Apple Computer, Inc.  20525 Mariani Ave, MS 32E  Cupertino, CA 95014
	    AppleLink:Rosenstein1    domain:lsr@Apple.COM
		UUCP:{sun,voder,nsc,decwrl}!apple!lsr

rmh@Apple.COM (Rick Holzgrafe) (03/15/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?

You don't need line numbers.

Just execute the error message: click on the line that says "File foo; line 27"
(or whatever) and hit ENTER. MPW will display the offending file's window
(opening a window for it if necessary), and will select the offending line
and show it to you.

Another nifty tip: instead of hitting ENTER, you can click in the little
window-pane at the lower left, where the name of the currently-running
tool shows. It's the same as hitting ENTER.

==========================================================================
Rick Holzgrafe			 | {sun,voder,nsc,mtxinu,dual}!apple!rmh
Communications Software Engineer | AppleLink HOLZGRAFE1    rmh@apple.com
Apple Computer, Inc.		 | "All opinions expressed are mine, and
20525 Mariani Ave. MS: 27-Y	 | do not necessarily represent those of
Cupertino, CA 95014		 | my employer, Apple Computer Inc."

mz@well.UUCP (Michael Zentner) (03/15/88)

MPW C puts the line number and error message in the worksheet window, in the
form of something like:  "File <filename>  line xxx # <error message>".
By selecting the whole line (3 clicks) and hitting <enter> to execute it, MPW
will open the <filename> to line xxx. Since the # is MPW comment, everything 
after that is ignored when the command is executed. The default alias for
File is Target, by the way.         

wetter@tybalt.caltech.edu (Pierce T. Wetter) (03/15/88)

 THere are two ways to do what you want. The first is to use one of the 
print options which puts line numbers in your file when it prints, then
compare.

 However this isn't what you really want to do. What you really want to do
is go to the line the compiler says has the error. To do that triple click on
the Line #; File "name" message and hit enter. This will take you to the right
line in the right file.
Pierce Wetter - I can type faster then a vax, therefore vaxes are slow.
              - my mac always keeps up therefore macs are fast.

In a five year period we can get one superb programming language.  Only
we can't control when the five year period will begin.

--------------------------------------------

wetter@tybalt.caltech.edu

--------------------------------------------

kaufman@Shasta.STANFORD.EDU (Marc Kaufman) (03/15/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:

>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?

I don't know how to get the numbers, but here is how to find the errors:

	TRIPLE-click on the line containing the error message (this
	  selects the entire line)
	then-- type ENTER

MPW will bring up the file into the top window (opening it if necessary),
and select the line with the error (highlighting it).

Marc Kaufman (kaufman@Shasta.stanford.edu)

smethers@psu-cs.UUCP (Paul Smethers) (03/15/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?
>

I don't have my manual handy, so I'm not sure about printing.  While editing,
however, I'm pretty sure that you can't actually display a line number,
but can find one by typing in your worksheet "line xxx" and mpw will select
the given line xxx in the window beneath the worksheet, thus placing
you on the erroneous line.

I also don't use mpw for compiles, but I do use it for "compare" to tell
the difference between files from time to time.  The compare function
generates actual statements surrounded by parethesis that select the
file and line number automactially.  In "compare", you can simply
double-click on the parenthesis and the command becomes selected because
of mpw's matching parenthesis ability.  Hitting enter does the command.
If the compiler generates similar executable errors, you may be
able to do the same process to immediatly open the file and go to the
line.

Paul Smethers
SmethersBarnes

drc@dbase.UUCP (Dennis Cohen) (03/16/88)

In article <2060@phoenix.Princeton.EDU>, buzz@phoenix.Princeton.EDU (Mahboud Zabetian) writes:
> How would I get line numbers for my source files in MPW?  When I use the C
> compiler, I get error messages and the lines that the errors occured in.
> But how do I get the editor to show line numbers so that I can find my errors
> more easily?
> 

There is no need for you to see the line numbers.  Just select the entire line
on the worksheet that says what the file and line number are and press "Enter".
This will make the appropriate file the active window and the line in question
the current selection.

Dennis Cohen
Ashton-Tate Macintosh Division
dBASE Mac Development Team
--------------------------
Disclaimer:  Any opinions expressed above are the property of the author.

tomas@Apple.COM (Tom Taylor) (03/18/88)

In article <2060@phoenix.Princeton.EDU> buzz@phoenix (Mahboud Zabetian) writes:
>I'm sorry to be posting here, but we don't seem to have comp.sys.mac.programmer
>anymore.
>
>How would I get line numbers for my source files in MPW?  When I use the C
>compiler, I get error messages and the lines that the errors occured in.
>But how do I get the editor to show line numbers so that I can find my errors
>more easily?
>
>I'm sure this is probably a stupid question.  Forgive my ignorance.

Simply select the error message that looks something like:

File "foo.c"; Line 518 # ...

and hit enter.  The editor will bring foo.c to the front and select line
518 for you.  File is aliased to Target, which makes the argument the front
window.  Line is a script (found in {Scripts})  which simply selects the line
argument.  You can manually go to any line in any file by bringing up the
Find dialog, typing in the line number, clicking the Selection Expression
radio button, and clicking the Find button.  There is no way to make the
editor display line numbers to the left of the source.

Tom Taylor
Development Systems Group

ralph@computing-maths.cardiff.ac.uk (Ralph Martin) (03/18/88)

Posting-Front-End: GNU Emacs 18.47.1 of Mon Nov 23 1987 on v1 (berkeley-unix)


While people are right in saying that hitting enter on the error report does
jump to the given line, they are right only in a limited way. This mechanism
is not really smart enough. If you have two or more errors, and in correcting 
the first one, you increase/decrease the number of lines in the file, hitting
enter on the second error report takes you to the wrong place.

The mechanism needs to be more subtle, and take you to the line IN THE 
ORIGINAL file with that line number, not the LINE IN THE EDITED FILE.

I have seen systems which get this right. Perhaps Apple could look into 
making this a bit smarter in future versions of MPW.

earleh@eleazar.Dartmouth.EDU (Earle R. Horton) (03/23/88)

In article <7678@apple.Apple.Com>, rmh@Apple.COM (Rick Holzgrafe) writes:

> Another nifty tip: instead of hitting ENTER, you can click in the little
> window-pane at the lower left, where the name of the currently-running
> tool shows. It's the same as hitting ENTER.

Or, if you have an ADB keyboard, press control-'C'.  VMS and UNIX users take
note, you can START a tool on the Mac with control-'C'!  I'm fortunate enough
to be left handed, so I have taken to not even using the ENTER key, but
rather control-'C' every time.
-- 
*********************************************************************
*Earle R. Horton, H.B. 8000, Dartmouth College, Hanover, NH 03755   *
*********************************************************************

smethers@psu-cs.UUCP (Paul Smethers) (03/24/88)

In article <232@cf-cm.UUCP> ralph@computing-maths.cardiff.ac.uk (Ralph Martin) writes:
>While people are right in saying that hitting enter on the error report does
>jump to the given line, they are right only in a limited way. This mechanism
>is not really smart enough. If you have two or more errors, and in correcting 
>the first one, you increase/decrease the number of lines in the file, hitting
>enter on the second error report takes you to the wrong place.
>
Again, I only use mpw's "compare" function which works similarly.  With
compare, I work through the differences from the bottom up, starting with
the last comparison and working backwards to the first.  This way, if I
change the line count in something I changed in one file, the line numbers
of previous problems are not affected (as I changed something following
those lines, not before them).

Paul Smethers
SmethersBarnes