diff --git a/CurtaSim.xcodeproj/project.pbxproj b/CurtaSim.xcodeproj/project.pbxproj index 58edd5c..ea3012a 100644 --- a/CurtaSim.xcodeproj/project.pbxproj +++ b/CurtaSim.xcodeproj/project.pbxproj @@ -64,6 +64,7 @@ 9D24618F20D8B30C00227E1D /* curta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = curta.c; sourceTree = ""; }; 9D24619020D8B30C00227E1D /* joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = joystick.h; sourceTree = ""; }; 9D24619120D8B30C00227E1D /* curtaUI.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = curtaUI.c; sourceTree = ""; }; + 9D45ABB620E1E564008C3F16 /* errorFilter.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; name = errorFilter.sh; path = make/errorFilter.sh; sourceTree = ""; }; 9D65A1BF20DCA472004268B7 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; /* End PBXFileReference section */ @@ -122,6 +123,7 @@ 9D24617020D8B2AE00227E1D /* createDiskImage */, 9D24617220D8B2AE00227E1D /* DevApple.vii */, 9D24617420D8B2AE00227E1D /* dos33_template.dsk */, + 9D45ABB620E1E564008C3F16 /* errorFilter.sh */, 9D24617620D8B2AE00227E1D /* head.mk */, 9D24617820D8B2AE00227E1D /* prodos_template.dsk */, 9D24617A20D8B2AE00227E1D /* tail.mk */, diff --git a/CurtaSim.xcodeproj/project.xcworkspace/xcuserdata/jrand.xcuserdatad/UserInterfaceState.xcuserstate b/CurtaSim.xcodeproj/project.xcworkspace/xcuserdata/jrand.xcuserdatad/UserInterfaceState.xcuserstate index acc0024..8f66c77 100644 Binary files a/CurtaSim.xcodeproj/project.xcworkspace/xcuserdata/jrand.xcuserdatad/UserInterfaceState.xcuserstate and b/CurtaSim.xcodeproj/project.xcworkspace/xcuserdata/jrand.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/CurtaSim/make/errorFilter.sh b/CurtaSim/make/errorFilter.sh new file mode 100755 index 0000000..30259c1 --- /dev/null +++ b/CurtaSim/make/errorFilter.sh @@ -0,0 +1,59 @@ +#!/bin/sh + +PWD=`pwd` + +$* 2> /tmp/errors.$$ +RESULT=$? + +if [ $RESULT -ne 0 ] +then + exec /usr/bin/perl -x $0 $RESULT /tmp/errors.$$ "$PWD" +fi +exit 0 + +#!/usr/bin/perl + +use strict; + +my $result = $ARGV[0]; +my $filename = $ARGV[1]; +my $pwd = $ARGV[2]; + +open(FILE, "<$filename") || die "$0: Unable to open file, $!"; + +my $unresolvedRefError = undef; + +while () { + chomp; + + if (defined $unresolvedRefError) { + if (m/^ ([^(]+)\(([0-9]+)\)/) { + my $file = $1; + my $lineno = $2; + + if (! -f "$pwd/$file") { + $file =~ s/\.s$/.c/; + } + + $_ = "$pwd/$file:$lineno:0: Error: $unresolvedRefError"; + } else { + $unresolvedRefError = undef; + } + } + + if (m/^(Unresolved external .* referenced) in:/) { + $unresolvedRefError = $1; + $_ = ""; + } elsif (m/^([^(]+)\(([0-9]+)\):(.*)$/) { + my $file = $1; + my $lineno = $2; + my $error = $3; + + $_ = "$pwd/$file:$lineno:0:$error"; + } + print STDERR "$_\n"; +} + +unlink($filename); + +exit($result); diff --git a/CurtaSim/make/tail.mk b/CurtaSim/make/tail.mk index 6463582..4d72c06 100644 --- a/CurtaSim/make/tail.mk +++ b/CurtaSim/make/tail.mk @@ -95,7 +95,7 @@ cleanMacCruft: rm -rf pkg $(PGM): $(OBJS) - $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o "$(PGM)" $(OBJS) + make/errorFilter.sh $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o "$(PGM)" $(OBJS) $(DISKIMAGE): $(PGM) make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" $(COPYDIRS) @@ -104,12 +104,12 @@ execute: $(DISKIMAGE) osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)" %.o: %.c - $(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $< + make/errorFilter.sh $(CL65) $(MACHCONFIG) $(CFLAGS) --create-dep -c -o $@ $< sed -i .bak 's/\.s:/.o:/' $(@:.o=.u) rm -f $(@:.o=.u).bak %.o: %.s - $(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) -l -c -o $@ $< + make/errorFilter.sh $(CL65) $(MACHCONFIG) --cpu $(CPU) $(ASMFLAGS) -l -c -o $@ $< $(OBJS): Makefile