#!/usr/bin/env ruby
##############################################################################
#
# == gdsdebug.rb
#
# Reads a GDSII file and provides record-by-record details as the file is
# read.  This is useful for debugging any GDSII read issues either by this
# library or by another application.
#
# === Author
#
# James D. Masters (james.d.masters@gmail.com)
#
# === History
#
# * 03/26/2007 (jdm): Initial version
#
##############################################################################


require 'gdsii/record.rb'
include Gdsii

# usage...
if (file_name = ARGV[0]).nil? then
  abort "
Reads a GDSII file and provides record-by-record details as the file is read.
This is useful for debugging any GDSII read issues either by this library or
by another application.

Usage: gdsdebug.rb <gds-file>

"
end

# display the string representation for each record
File.open(file_name, 'rb') do |file|
  Record.read_debug = true
  while (rec = Record.read(file)) do
    # nothing additional required; debug messages will be printed
  end
end

