Hi Laurent:

Thanks for your offer to help. Sorry I was busy with another project but now I get back to MacRuby.

I have attached a file that causes the assertion error when loaded by the require command. Probably there is something else I need to change when porting from Ruby-Cocoa.

Thanks,
Bob Rice
#
#  JBH_F7575101_WindowController.rb
#  Cocoa-Ruby Driver Assistant
#
#  Created by Robert Rice on 9/4/09.
#  Copyright (c) 2009 Rice Audio. All rights reserved.
#

class JBH_F7575101_WindowController < NSWindowController
	
#	require 'TextUtilities'; include TextUtilities
	
	def init
		if super_init
			puts "JBH_F7575101_WindowController"
			initWithWindowNibName( 'JBH_F7575101' )
			end
		
		self
		end
	
	attr_writer :chartView, :remarksIndexView, :weatherView, :f11, :f12, :f13, :f21, :f22, :f23, :f31, :f32, :f33, :f41, :f42, :f43
	
	def Initialize( key, rptdate, historyEvent )
		@key = key
		@rptdate = rptdate
		@historyEvent = historyEvent
		
		@driverRec = historyEvent.driverRec
		@driver = historyEvent.driver
		
		@rules = historyEvent.rules
		@commentlist = historyEvent.commentlist
		puts "commentlist #[email protected]}"

		showWindow_( self )

		@headerFont = NSFont.fontWithName_size_( "Lucida Handwriting", 18 )

		[ @chartView, @remarksIndexView, @weatherView, @f11, @f12, @f13, @f21, @f22, @f23, @f31, @f32, @f33, @f41, @f42, @f43 ].each do | field |
# setNeedsDisplay will cause the field to notify it's closest ancestor clip view to refresh its buffer for the drawing area
			field.setNeedsDisplay_( true ) if field != nil 
			end

		ShowDates()
		ShowTractor()
		ShowMiles()
		ShowDrivers()
		ShowTrailers()
		ShowTotals()
		ShowRemarks()
		ShowAlphaCode()
		ShowReporting()
		ShowTrips()
		ShowHistory()
		end
	
	def Fallback; @date.Fallback; end
	def SpringForward; @date.SpringForward; end
	
	def SetWindow( mywindow ) # Ruby method called from JBH_PrintView
		Model.instance.SetWindow( @key, mywindow )
		mywindow.setTitle_( "Driver #...@driver} on #...@rptdate}" )
		end
	
	def windowWillClose( notification ) # We will get this message as window delegate		
		Model.instance.WindowWillClose( @key )
		self.autorelease
		end
	
	attr_reader :rptdate, :driverRec, :rules, :commentlist

	attr_writer :reportMo, :reportmO, :reportDy, :reportdY, :reportYr, :reportyR	
	attr_writer :reportMov, :reportmOv, :reportDyv, :reportdYv, :reportYrv, :reportyRv
	attr_writer :endMo, :endmO, :endDy, :enddY, :endYr, :endyR

	def ShowDates
		startdate = @rptdate
		
		if @rules.totals.at( 0 ) == 24.0
			tenhour = @rules.tenhour
			while tenhour >= 48.0 # Combine two days off duty
				mydate = Time.local( startdate.slice( 0..3 ),  startdate.slice( 4..5 ), startdate.slice( 6..7 ) )
				yesterday = ( mydate - 24*60*60 ).strftime( "%Y%m%d" )
				break if yesterday.slice( 5..5 ) != startdate.slice( 5..5 ) # cannot span month
				startdate = yesterday
				tenhour -= 24.0
				end
			end
		
	# Space each character to fit in a box on the form
		startdate = startdate.slice( 2..7 )
		MonoSpace( startdate, @headerFont, [ @reportYr, @reportyR, @reportMo, @reportmO, @reportDy, @reportdY ] )
		MonoSpace( startdate, @headerFont, [ @reportYrv, @reportyRv, @reportMov, @reportmOv, @reportDyv, @reportdYv ] )

		enddate = ( startdate == @rptdate ? "      " : @rptdate.slice( 2..7 ) )
		MonoSpace( enddate, @headerFont, [ @endYr, @endyR, @endMo, @endmO, @endDy, @enddY ] )
		end

	attr_writer :tractor, :tRactor, :trActor, :traCtor, :tracTor, :tractOr
	attr_writer :tractorv, :tRactorv, :trActorv, :traCtorv, :tracTorv, :tractOrv
	attr_writer :startHub, :endHub
	
	def ShowTractor	
		starthub = endhub = 0
		
		tractor = @historyEvent.tractor.to_s
		tractor = ( tractor.empty? ? "None  " : tractor.ljust( 6 ) )

		MonoSpace( tractor, @headerFont, [ @tractor, @tRactor, @trActor, @traCtor, @tracTor, @tractOr ] )
		MonoSpace( tractor, @headerFont, [ @tractorv, @tRactorv, @trActorv, @traCtorv, @tracTorv, @tractOrv ] )

		font = NSFont.fontWithName_size_( "Lucida Handwriting", 14 )
		
		@odometerEvents = [ VehicleEvent, StoppedEvent ]
		
		if @startHub != nil # Linked?
			startHub = @historyEvent.startHub
			@startHub.setStringValue_( startHub == 0.0 ? "" : startHub.to_s.rjust( 6, '0' ) )
			@startHub.setFont_( font )
			end
		
		if @endHub != nil
			@endHub.setStringValue_( @historyEvent.endHub.to_s )
			@endHub.setFont_( font )
			end
		end

	attr_writer :driverMiles, :dRiverMiles, :drIverMiles
	def ShowMiles
		dvrMiles = @historyEvent.dvrMiles
		drivermiles = ( dvrMiles == nil ? "   " : dvrMiles.round.to_s.rjust( 3, '0' ) )
		MonoSpace( drivermiles, @headerFont, [ @driverMiles, @dRiverMiles, @drIverMiles ] )
		end
	
	attr_writer :driverNumber, :dRiverNumber, :drIverNumber, :driVerNumber, :drivErNumber
	attr_writer :codriver, :cOdriver, :coDriver, :codRiver, :codrIver
	attr_writer :driverName, :timeZone

	def ShowDrivers
		@driver = "?????" if @driver == nil
		MonoSpace( @driver, @headerFont, [ @driverNumber, @dRiverNumber, @drIverNumber, @driVerNumber, @drivErNumber ] )

		codriver = @driverRec.CoDrivers.first
		codriver = "     " if codriver == nil
		MonoSpace( codriver, @headerFont, [ @codriver, @cOdriver, @coDriver, @codRiver, @codrIver ] )
		
		if @driverName != nil
			@driverName.setStringValue_( @driverRec.drivername )
			@driverName.setFont_( @headerFont )
			end
		if @timeZone != nil
			@timeZone.setStringValue_( @driverRec.timeZone )
			@timeZone.setFont_( NSFont.fontWithName_size_( "Lucida Handwriting", 12 ) )
			end
		end

	attr_writer :trailer1, :tRailer1, :trAiler1, :traIler1, :traiLer1, :trailEr1
	attr_writer :trailer1v, :tRailer1v, :trAiler1v, :traIler1v, :traiLer1v, :trailEr1v
	
	attr_writer :trailer2, :tRailer2, :trAiler2, :traIler2, :traiLer2, :trailEr2
	attr_writer :trailer2v, :tRailer2v, :trAiler2v, :traIler2v, :traiLer2v, :trailEr2v
	
	def ShowTrailers
		( trl1, trl2 ) = @historyEvent.trailerlist
		
		trl1 = trl1.to_s
		trl1 = ( trl1.empty? ? "      " : trl1.rjust( 6 ) )
		MonoSpace( trl1, @headerFont, [ @trailer1, @tRailer1, @trAiler1, @traIler1, @traiLer1, @trailEr1 ] )
		MonoSpace( trl1, @headerFont, [ @trailer1v, @tRailer1v, @trAiler1v, @traIler1v, @traiLer1v, @trailEr1v ] )
		
		trl2 = trl2.to_s
		trl2 = ( trl2.empty? ? "      " : trl2.rjust( 6 ) )
		MonoSpace( trl2, @headerFont, [ @trailer2, @tRailer2, @trAiler2, @traIler2, @traiLer2, @trailEr2 ] )
		MonoSpace( trl2, @headerFont, [ @trailer2v, @tRailer2v, @trAiler2v, @traIler2v, @traiLer2v, @trailEr2v ] )
		end

	attr_writer :offDuty, :oFfDuty, :sleeper, :sLeeper, :driving, :dRiving, :onDuty, :oNDuty
	
	def ShowTotals
		fields = [ [ @offDuty, @oFfDuty ], [ @sleeper, @sLeeper ], [ @driving, @dRiving ], [ @onDuty, @oNDuty ] ]
		font = NSFont.fontWithName_size_( "Lucida Handwriting", 14 )
		col = 0
		puts "@rules.totals #[email protected]}"
		@rules.totals.each do | total |
			MonoSpace( ( total + 0.1 ).to_i.to_s.rjust( 2, '0' ), font, fields.at( col ) )
			col += 1
			end
		end

	def FractionFor( line, quarter )
		linetotal = @rules.totals.at( line - 1 )
		quarter == ( linetotal * 4 + 0.1 ).to_i % 4 # Return boolean
		end
	
	attr_writer :alphacode, :aLphacode, :alPhacode, :alpHacode, :alphAcode, :alphaCode
	
	def ShowAlphaCode
		alpha = @driverRec.alphacode.ljust( 6 )
		MonoSpace( alpha, @headerFont, [ @alphacode, @aLphacode, @alPhacode, @alpHacode, @alphAcode, @alphaCode ] )
		end
	
	def MonoSpace( data, font, fields )
#		return if data.to_s.empty?	
		col = 0
		data.to_s.split( "" ).each do | chr |
			field = fields.at( col )
			raise "MonoSpace field not linked" if field == nil

			field.setStringValue_( chr == nil ? " " : chr )
			field.setFont_( font )

			col += 1
			end
		end
	
	attr_writer :remarks
	def ShowRemarks
		priorcomment = ""
		commentline = 0
		remarksBlock = ""
		
		@commentlist.each do | mycomment |
			puts mycomment
			
			if not priorcomment.empty?
				commentline += 1
				remarksBlock << "(#{commentline}) #{priorcomment}  "
				end
					
			priorcomment = mycomment.at( 1 )
			end
		
		return if @remarks == nil
		
		raise "remarks not linked" if @remarks == nil
		@remarks.setStringValue_( remarksBlock )
		len = remarksBlock.length
		return if len == 0
			
		remarkssize = ( 10 * 18 / Math::sqrt( len ) ).to_i
		remarkssize = 18 if remarkssize > 18
		@remarks.setFont_( NSFont.fontWithName_size_( "Lucida Handwriting", remarkssize ) )
		end

	attr_writer :reportingterm, :reportingaddress
	def ShowReporting
		reportingTerm = @driverRec.reportingterm
		puts "reportingTerm #{reportingTerm.inspect}"
		
		raise "reportingterm not linked" if @reportingterm == nil
		@reportingterm.setStringValue_( joincomments( reportingTerm[ 'city' ], reportingTerm[ 'state' ] ) )
		@reportingterm.setFont_( NSFont.fontWithName_size_( "Lucida Handwriting", 10 ) )

		raise "reportingaddress not linked" if @reportingaddress == nil
		addr = reportingTerm[ 'address' ]
		@reportingaddress.setStringValue_( addr ) if addr != nil
		@reportingaddress.setFont_( NSFont.fontWithName_size_( "Lucida Handwriting", 10 ) )
		end

	attr_writer :trips
	def ShowTrips
		tripEventList = @historyEvent.tripEventList
			
		tripStr = ""
		tripEventList.each do | tripEvent |
			tripStr << ", " if not tripStr.empty?
			tripStr << tripEvent.trip.to_s
			end
		
		tripStr = "None" if tripStr.empty?
		
		tripsize = 18
		tripsize = 12 if tripEventList.length > 1
		tripsize = 10 if tripEventList.length > 4
		
		raise "trips not linked" if @trips == nil
		@trips.setStringValue_( tripStr )
		@trips.setFont_( NSFont.fontWithName_size_( "Lucida Handwriting", tripsize ) )
		end
	
	attr_writer :on1, :on2, :on3, :on4, :on5, :on6, :on7, :on8, :on9, :on10, :on11, :on12, :on13, :on14
	
	def ShowHistory
		worked = @rules.history14day
		fields = [ @on1, @on2, @on3, @on4, @on5, @on6, @on7, @on8, @on9, @on10, @on11, @on12, @on13, @on14 ]
		( 0..13 ).each do | col |
			field = fields.at( col )
			raise "history14day field not linked" if field == nil
			
			on = worked.at( col )
			field.setStringValue_( on == nil ? "0" : self.DrawFraction( on.to_f ) )
			field.setFont_( NSFont.fontWithName_size_( "Arial Narrow", 8 ) )
			end
		end

	end


On Sep 12, 2009, at 3:08 PM, Laurent Sansonetti wrote:

Hi Robert,

Unless you found what was wrong, feel free to contact me off-list with a copy of your app and I will investigate the problem.

Laurent

On Sep 12, 2009, at 9:48 AM, Robert Rice wrote:

Hi Laurent:

It's a relatively large application that I ported from a RubyCocoa environment. I need the threading support hook that was removed from Ruby in the Snow Leopard release.

I'll try to track it down better by porting and testing modules a little at a time.

Thanks,
Bob Rice

On Sep 11, 2009, at 12:53 PM, Laurent Sansonetti wrote:

Looks like we are hitting an assertion in the symbol generator... Could you send us what you are trying to execute here?

Laurent

Sent from my iPhone

On Sep 11, 2009, at 9:48 AM, Robert Rice <[email protected]> wrote:

How would I track down the following error from the nightly build?

[Session started at 2009-09-11 12:43:22 -0400.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1344) (Fri Jul 3 01:19:56 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".tty /dev/ttys000
Loading program into debugger…
Program loaded.
run
[Switching to process 326]
Running…
Assertion failed: (1==0), function rb_intern3, file parse.y, line 9596.
Program received signal:  “SIGABRT”.
sharedlibrary apply-load-rules all
warning: Could not find object file "/Users/mattetti/src/macruby- gitsvn/trunk/array.o" - no debug information available for "array.c".

warning: Could not find object file "/Users/mattetti/src/macruby- gitsvn/trunk/bignum.o" - no debug information available for "bignum.c".

...
Thanks,
Bob Rice

On Sep 10, 2009, at 2:24 PM, Matt Aimonetti wrote:

Latest trunk code available as an unofficial pkg ready to install: http://rubyurl.com/5K3W

Lots of bug fixes, improved macgem (not finished yet but you can install gems and load them using `gem 'gem_name'; require 'whatever'`).
Things are looking pretty good on trunk :)

- Matt
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to