[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Want to Use TI's symbols, footprints



A demonstration of why one should do a minimal test before sending out
code.

Looks like the previous email had a version where I am working on nets.

For those who care try this version:


On Thu, 2008-11-13 at 09:20 -0800, Steve Meier wrote:
> I have done a fair amount of work on translating entire PADs ASCII file
> format projects into PCB file format.
> 
> This includes translating the embedded foot prints.
> 
> The attached python script does a translation minus three points
> ( thermals, netlist, pin numbers are numerically listed and not the
> alpha numeric that devices such as BGAs use)
> 
> Also, it generates multiple overlapping vias that PCB complains about
> and then eliminates all but one.
> 
> You might try to use it to translate the TI foot prints. Or if you like
> modify it to translate the TI foot prints.
> 
> Steve Meier
> 
> _______________________________________________
> geda-user mailing list
> geda-user@xxxxxxxxxxxxxx
> http://www.seul.org/cgi-bin/mailman/listinfo/geda-user
#!/usr/bin/python

# package.py
# Copyright (C) 2008 Stephen Meier
# Converts PAD projects to PCB projects

# The GPL applies only to the python scripts.
# the output of the program belong to the user, their employer or their customer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#------------------------------------------------------------------

import sys
import re

#------------------------------------------------------------------
# Global values

my_board = 0
use_polygons = True

#------------------------------------------------------------------

def lineSplit(line):
    my_re = re.compile('([\s]+)')
    line = my_re.sub(" ", line)
    return line.split(" ")

#------------------------------------------------------------------
# 2/3 nM per base unit
# 38100 base units per 100th mill

def ascii2pcb(value):
    #tmp = ((((float(value) * 2.0) / 3.0) * 0.000000001) / 0.000000254)
    tmp = int(value) / 381
    return int(tmp)

#------------------------------------------------------------------

class cSilk:

    def __init__(self, type, width):
        self.points = []
        self.width = width
        self.type = type


    def add_point(self, x, y):
        self.points.append([x, y])

    def mprint(self):
        print "Silk Type: " + self.type

        for point in self.points:
            print "  x: " + point[0] + " Y: " + point[1]

    def pcb_write(self, rotation, file):
        #print ("silk write start")
        first_point = []
        second_point = []

        width = ascii2pcb(self.width)

        for point in self.points:
            if self.type == "CLOSED" or self.type == "OPEN":
                first_point = second_point
                second_point = point

                if len(first_point):
                    
                    x1 = ascii2pcb(first_point[0])
                    y1 = -ascii2pcb(first_point[1])
                    x2 = ascii2pcb(second_point[0])
                    y2 = -ascii2pcb(second_point[1])

                    #print ("silk write x1: " + str(x1) + " y1: " + str(y1) + " x2: " + str(x2) + " y2: " + str(y2))

                    if rotation == 90.0:
                        tmp = x1
                        x1 = y1
                        y1 = -tmp
                        tmp = x2
                        x2 = y2
                        y2 = -tmp
                    elif rotation == 180.0:
                        x1 = -x1
                        y1 = -y1
                        x2 = -x2
                        y2 = -y2
                    elif rotation == 270.0:
                        tmp = x1
                        x1 = -y1
                        y1 = tmp
                        tmp = x2
                        x2 = -y2
                        y2 = tmp
                        
                    file.write( "ElementLine [" + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) + " " + str(width) + "]\n")
                    
            elif self.type == "CIRCLE":
                first_point = second_point
                second_point = point

                
                if len(first_point):
          
                    x1 = ascii2pcb(first_point[0])
                    y1 = -ascii2pcb(first_point[1])
                    x2 = ascii2pcb(second_point[0])
                    y2 = -ascii2pcb(second_point[1])

                    if rotation == 90.0:
                        tmp = x1
                        x1 = y1
                        y1 = -tmp
                        tmp = x2
                        x2 = y2
                        y2 = -tmp
                    elif rotation == 180.0:
                        x1 = -x1
                        y1 = -y1
                        x2 = -x2
                        y2 = -y2
                    elif rotation == 270.0:
                        tmp = x1
                        x1 = -y1
                        y1 = tmp
                        tmp = x2
                        x2 = -y2
                        y2 = tmp

                    center_x = (x1 + x2) / 2
                    center_y = (y1 + y2) / 2

                    if abs(x2 - x1) > abs(y2 -y1):
                        diameter = abs(x2 - x1)/2
                    else:
                        diameter = abs(y2 - y1)/2
                
                    file.write( "ElementArc [" + str(center_x) + " " + str(center_y) + " " + str(diameter) + " " + str(diameter) + " 90 360 300 ]\n")
#------------------------------------------------------------------

class cText:

    def __init__(self, x, y, visible, mirrored, rotation):
        self.x = x
        self.y = y
        self.visible = visible
        self.mirrored = mirrored
        self.rotation = rotation
        self.string = ""


    def add_string(self, in_str):
        self.string = in_str

    def mprint(self):
        print "Text: " + self.string + " x: " + self.x + " y: " + self.y
    


    
#------------------------------------------------------------------

class cPolygon:

    def __init__(self, LEVEL):
        self.level = LEVEL
        self.corners = []
        self.PinNumber = 0

    def add_corner(self, x, y):
        self.corners.append([x, y])

    def SetPinNumber(self, pinnumber):
        self.PinNumber = pinnumber
        
    def pcb_write(self, level, file):

        if int(self.level) != int(level):
            return

        file.write("Polygon(\"clearpoly\")\n(\n")

        count = 0

        for corner in self.corners:

            x = ascii2pcb(corner[0])
            y = -ascii2pcb(corner[1])

            file.write("[" + str(x) + " " + str(y) + "]")

            if count == 3:
                file.write("\n")
                count = 0
            else:
                count += 1
                file.write(" ")

        if count != 0:
            file.write("\n")
        
        file.write(")\n")

    
#------------------------------------------------------------------

class cPieces:

    def __init__(self, PIECETYPE, WIDTHHGHT, LEVEL):
        self.PIECETYPE = PIECETYPE
        self.WIDTHHGHT = WIDTHHGHT
        self.level = LEVEL
        self.corners = []

    def add_corner(self, x, y):
        self.corners.append([x, y])

    def mprint(self):
        print "Piece: " + self.PIECETYPE

        for corner in self.corners:
            print "   Corner: x: " + str(corner[0]) + " y: " + str(corner[1])

    def pcb_write(self, level, x_offset, y_offset, file):
        #print("Piece TYPE: " + self.PIECETYPE + " Piece Level: " + str(self.level) + " level: " + str(level))

        if int(self.level) != int(level):
            return
        
        #print("found piece for this level")
        
        
        first_point = []
        second_point = []

        width = ascii2pcb(self.WIDTHHGHT)

        for corner in self.corners:
            if self.PIECETYPE == "CLOSED" or self.PIECETYPE == "OPEN":
                first_point = second_point
                second_point = corner

                if len(first_point):
                    
                    x1 = ascii2pcb(first_point[0] + x_offset)
                    y1 = -ascii2pcb(first_point[1] + y_offset)
                    x2 = ascii2pcb(second_point[0] + x_offset)
                    y2 = -ascii2pcb(second_point[1] + y_offset)

                    #print ("silk write x1: " + str(x1) + " y1: " + str(y1) + " x2: " + str(x2) + " y2: " + str(y2))
                    
                    #if width == 0:
                        #print ( "ZERO Line [" + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) + " " + str(width) + " " + str(width) + " \"\"]\n")
                    file.write( "Line [" + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) + " " + str(width) + " " + str(width) + " \"\"]\n")

        
#------------------------------------------------------------------

class cLine:

    def __init__(self, NAME, TYPE, XLOC, YLOC):
        self.NAME = NAME
        self.TYPE = TYPE
        self.XLOC = XLOC
        self.YLOC = YLOC
        self.pieces = []
        self.text = []

    def add_piece(self, piece):
        self.pieces.append(piece)

    def add_text(self, text):
        self.text.append(text)
        
    def mprint(self):
        print "Line: " + self.NAME + " Type: " + self.TYPE + " x: " + self.XLOC + " y: " + self.YLOC
        
        for text in self.text:
            text.mprint()

        for piece in self.pieces:
            piece.mprint()
            
    def pcb_write(self, level, file):
        #print("Line TYPE: " + self.TYPE + " Level: " + str(level))
        
        if self.TYPE == "LINES" or self.TYPE == "TRACE":
            for piece in self.pieces:
                piece.pcb_write(level, int(self.XLOC), int(self.YLOC), file)
        

            
#------------------------------------------------------------------

class cPin:

    def __init__(self, pin_number, x, y, height, width, offset, shape, rotation, drill_size, part):
        self.pin_number = pin_number
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.offset = offset
        self.shape = shape
        self.rotation = rotation
        self.drill_size = drill_size
        self.part = part

    def applyPinDef(self, pin_def):
        if (pin_def.pin_number == self.pin_number) or (pin_def.pin_number == "0"):
            self.width = pin_def.width
            self.height = pin_def.height
            self.offset = pin_def.offset
            self.shape = pin_def.shape
            self.rotation = pin_def.rotation
            self.drill_size = pin_def.drill_size

    def SetPart(self, part):
        self.part = part

    def mprint(self):
        print "Pin: Number: " + self.pin_number + " x: " + str(self.x) + " y: " + str(self.y) + " width: " + str(self.width) + " height: "\
              + str(self.height) + " shape: " + self.shape + " rotation " + str(self.rotation)
        
#------------------------------------------------------------------

class cPart:

    def __init__(self, decal_name, num_pins, x, y):
        self.name = ""
        self.decal_name = decal_name
        self.num_pins = num_pins
        self.x = x
        self.y = y
        self.pin_defs = []
        self.pins = []
        self.silk = []
        self.text = []
        self.polygons = []

    def addSilk(self, silk):
        self.silk.append(silk)
    
    def addText(self, text):
        self.text.append(text)

    def addPolygon(self, polygon):
        self.polygons.append(polygon)
    
    def addPin(self, pin):
        self.pins.append(pin)
    
    def addPinDef(self, pindef):
        self.pin_defs.append(pindef)

    def addName(self, name):
        self.name = name

    def copy(self):
        new_part = cPart( self.decal_name, self.num_pins, self.x, self.y)
        new_part.pin_defs = self.pin_defs

        for pin in self.pins:
            new_pin = cPin(pin.pin_number, pin.x, pin.y, pin.height, pin.width, pin.offset, pin.shape, pin.rotation, pin.drill_size, new_part);
            new_part.pins.append(new_pin)
        
        new_part.silk = self.silk
        new_part.text = self.text
        new_part.polygons = self.polygons
        return new_part

    def applyPinDef(self, pin_def):
        for pin in self.pins:
            pin.applyPinDef(pin_def)

    # A pin starts with a pin number which is just the count of where
    # it was in the ascii file with respect to the part header

    # some parts though will have pin numbers which are alpha numerical
    # e.g. AA32

    # this method finds the pin associated with the original pin number and
    # replaces it with the alpha numeric value

    def applyPinNumber(self, position, value):
        for pin in self.pins:
            
            if pin.pin_number == position:
                pin.pin_number = value

    def reCenter(self):
        max_x = -99999
        min_x =  99999
        max_y = -99999
        min_y =  99999
        
        for pin in self.pins:
            x = int(pin.x)
            y = int(pin.y)
            
            if x > max_x:
                max_x = x

            if x < min_x:
                min_x = x

            if y > max_y:
                max_y = y

            if y < min_y:
                min_y = y

        off_center_x = (max_x + min_x)/2

        off_center_y = (max_y + min_y)/2

        if off_center_x or off_center_y:
            for pin in self.pins:
                pin.x = str(int(pin.x) - off_center_x)
                pin.y = str(int(pin.y) - off_center_y)


    def mprint(self):
        print "PART: Name: " + self.name + " Decal Name: " + self.decal_name + " pin count: " + str(self.num_pins) + " x: " + str(self.x) + " y: " + str(self.y)

        for pin in self.pins:
            pin.mprint()

        print "----------------------------------------"
        print " pin defs "

        for pin in self.pin_defs:
            pin.mprint()

        for silk in self.silk:
            silk.mprint()

        #for text in self.text:
        #    text.mprint()


    def pcb_write(self, rotation, file):
        for silk in self.silk:
            silk.pcb_write(rotation, file)

#------------------------------------------------------------------

class cComponent:

    def __init__(self, refdes, part, x, y, rotation, mirrored):
        self.refdes = refdes
        self.part = part
        self.x = x
        self.y = y
        self.rotation = rotation
        self.mirrored = mirrored
        self.text = []

    def add_text(self, text):
        self.text.append(text)

    def mprint(self):
        print "Component: refdes: " + self.refdes + " x: " + str(self.x) + " y: " + str(self.y) + " mirrored: " + self.mirrored

        self.part.mprint()

        for text in self.text:
            text.mprint()

    def pcb_write(self, file):
        self.part.pcb_write(self.rotation, file)

#------------------------------------------------------------------

class cTrace:

    def __init__(self, x1, y1, x2, y2, width):
        self.x1 = x1
        self.y1 = y1
        self.x2 = x2
        self.y2 = y2
        self.width = width

    def mprint(self):
        print "Trace: x1: " + self.x1 + " y1: " + self.y1 + " x2: " + self.x2 + " y2: " + self.y2 + " width: " + self.width

#------------------------------------------------------------------

class cVia_Def:

    def __init__(self, name, drill_diameter, pad_shape, pad_size, copper_clearence, soldermask_clearence):
        self.name = name
        self.drill_diameter = drill_diameter
        self.pad_shape = pad_shape
        self.pad_size = pad_size
        self.copper_clearence = copper_clearence
        self.soldermask_clearence = soldermask_clearence

    def test_via_name(self, name):
        if self.name == name:
            return True
        else:
            return False

    def get_name(self):
        return self.name

    def mprint(self):
        print "Via Type: Name: " + self.name + " Drill Diameter: " + self.drill_diameter + " Pad Shape: " + self.pad_shape +\
              " Copper Clearence: " + self.copper_clearence + " Soldermask Clearence: " + self.soldermask_clearence

    def output(self, file_ptr):
        drill_diameter = ascii2pcb(self.drill_diameter)
        pad_size = ascii2pcb(self.pad_size)
        copper_clearence = ascii2pcb(self.copper_clearence)
        soldermask_clearence = ascii2pcb(self.soldermask_clearence)
        file_ptr.write(str(drill_diameter) + " " + str(pad_size) + " " + str(copper_clearence) + " " + str(soldermask_clearence))


#------------------------------------------------------------------

class cVia:

    def __init__(self, via_deff, x, y):
        self.via_deff = via_deff
        self.x = x
        self.y = y

    def output(self, file_ptr):
        x = ascii2pcb(self.x)
        y = -ascii2pcb(self.y)

        file_ptr.write("Via[ " + str(x) + " " + str(y) + " ")
        self.via_deff.output(file_ptr)
        file_ptr.write(" \"\" \"\" ]\n")
        

#------------------------------------------------------------------

class cLayer:

    def __init__(self, name, layer_number):
        self.name = name
        self.number = layer_number
        self.trace_list = []

    def append_trace(self, trace):
        self.trace_list.append(trace)

    def output_traces(self, file_ptr):
        file_ptr.write()

    def mprint(self):
        print "Layer Name: " + self.name + " Number: " + self.number

        for trace in self.trace_list:
            trace.mprint()

#------------------------------------------------------------------

class cNet:
    
    def __init__(self):
        self.name = ""
        self.pins = []

    def SetName(self, name):
        self.name = name

    def NameTest(self, name):
        if self.name == name:
            return True
        else:
            return False

    def addPin(self, pin):
        self.pins.append(pin)

    

#------------------------------------------------------------------

class cBoard:

    def __init__(self):
        self.max_layers = 0
        self.top_layer = 0
        self.bottom_layer = 0
        self.layers = []
        self.parts = []
        self.lines = []
        self.components = []
        self.polygons = []
        self.via_defs = []
        self.vias = []
        self.originX = 0
        self.originY = 0
        self.drill_plated_oversize = 0   # add this to the drill width for plated holes
        self.copper_clearence = 0        # seperation between copper pad or trace and copper polygon
        self.soldermask_clearence = 0    # distance from edge of pad or drill hole to soldermask
        self.pad_annular_thickness = 0   # add to drill to make pad for plated hole
        self.nets = []

    def add_Net(self, net):
        self.nets.append(net)

    def net_exists(self, net_name):
#        for net = self.nets:
#            if net.name = net_name:
#                return True
        return False

    def get_via_def_names(self):
        result = []
        for via_def in self.via_defs:
            result.append(via_def.get_name())
        return result

    def set_drill_plated_oversize(self, oversize):
        self.drill_plated_oversize = oversize

    def get_drill_plated_oversize(self):
        return self.drill_plated_oversize

    def set_pad_annular_thickness(self, thickness):
        self.pad_annular_thickness = thickness

    def get_pad_annular_thickness(self):
        return self.pad_annular_thickness

    def set_copper_clearence(self, clearence):
        self.copper_clearence = clearence

    def get_copper_clearence(self):
        return self.copper_clearence

    def set_soldermask_clearence(self, clearence):
        self.soldermask_clearence = clearence

    def get_soldermask_clearence(self):
        return self.soldermask_clearence

    def set_origin(self, x, y):
        self.originX = x
        self.originY = y

    def add_layer(self, layer):
        self.layers.append(layer)

    def set_max_layers(self, max_layers):
        self.max_layers = max_layers

    def add_part(self, part):
        self.parts.append(part)

    def get_part(self, part_name):
        for part in self.parts:
            if part.name == part_name:
                return part

        print "part_get failed for " + part_name
        return 0

    def get_part_by_decal_name(self, decal_name):
        for part in self.parts:
            if part.decal_name == decal_name:
                return part

        print "part_get_by_decal_name failed for " + decal_name
        return 0

    def add_line(self, line):
        self.lines.append(line)

    def add_component(self, component):
        self.components.append(component)

    def add_via_def(self, via_def):
        self.via_defs.append(via_def)

    def find_via_def(self, name):
        for via_def in self.via_defs:
            if via_def.test_via_name(name):
                return via_def

        return 0

    def add_via(self, via):
        self.vias.append(via)

    def add_polygon(self, polygon):
        self.polygons.append(polygon)

    def mprint(self):
        print "BOARD: max layers: " + str(self.max_layers) + " top layer: " + str(self.top_layer) + " bottom layer: " + str(self.bottom_layer)

        for layer in self.layers:
            layer.mprint()

        for part in self.parts:
            part.mprint()

        for component in self.components:
            component.mprint()

        #    for line in self.lines:
        #    line.mprint()
        
        
#------------------------------------------------------------------



"""Finite state machine, featuring transition actions."""
 
FSMError = 'Invalid input to finite state machine'
 
class FSM:
    
    """Finite state machine, featuring transition actions.
    
    The class stores a dictionary of (state, input) keys,
    and (state, action) values.
   
    When a (state, input) search is performed:
    * an exact match is checked first,
    * (state, None) is checked next.
   
    The action is of the following form:
    * function(current_state, input)
    """
   
    def __init__(self):
        self.states = {}
        self.state = None
        self.old_state = None
        self.dbg = None
        self.state_lst = []
  
    def add(self, state, input, newstate, action):
        """Add a transition to the FSM."""
        self.states[(state, input)] = (newstate, action)
  
    def execute(self, input, state_line):
        """Perform a transition and execute action."""
        si = (self.state, input)
        sn = (self.state, None)

        #print "execute from: " + self.state + "  to: " + input + "\n"
        
        # exact state match?
        if self.states.has_key(si):
            self.old_state = self.state
            newstate, action = self.states[si]
            
        # no, how about a None (catch-all) match?
        elif self.states.has_key(sn):
            newstate, action = self.states[sn]
            
            if self.dbg != None:
                self.dbg.write('State: %s / Input: %s /'
                           'Next State: %s / Action: %s\n' %
                              (self.state, input, newstate, action))
        else:
            print "No Transition from " + self.state + " to " + input
            exit()

        self.state_lst.append(self.state)
        self.old_state = self.state
        self.state = newstate
        line = action(self.old_state, input, state_line)
        self.state = self.state_lst.pop()
        return line
   
    def start(self, state):
        """Define the start state.
   
        Actually, this just resets the current state.
        """
        self.state = state
   
    def debug(self, out):
        """Assign a writable file to log transitions."""
        self.dbg = out

#------------------------------------------------------------------

def ready_action(state, input, state_line):

    line = input_file.readline()
    line = input_file.readline()

    while 1:
        line = line.strip()
        
        while line == "":
            line = input_file.readline()

        for event in events:
            if line.find(event)!=-1:
                line = fsm.execute(event, line)
                break

    return ""

#------------------------------------------------------------------

def remark_action(state, input, state_line):

    line = state_line
    
    while 1:
        line = input_file.readline()

        my_list = line.split(" ")
        
        if my_list[0] != "*REMARK*":
            break
        
    return line

#------------------------------------------------------------------

def pcb_action(state, input, state_line):
    
    global my_board

    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                return line

        my_list = lineSplit(line)

        if my_list[0] == "MAXIMUMLAYER":
            my_board.set_max_layers(int(my_list[1]))

        if my_list[0] == "ORIGIN":
            print my_list[1] + " " + my_list[2]
            my_board.set_origin(int(my_list[1]), int(my_list[2]))

        if my_list[0] == "ARPTOM":
            print "board soldermask clearence: " + my_list[1]
            my_board.set_soldermask_clearence(int(my_list[1]))

        if my_list[0] == "PLNSEPGAP":
            my_board.set_copper_clearence(int(my_list[1]))

        if my_list[0] == "DRLOVERSIZE":
            my_board.set_drill_plated_oversize(int(my_list[1]))

        if my_list[0] == "ARDTOP":
            my_board.set_pad_annular_thickness(int(my_list[1]))



    return ""

#------------------------------------------------------------------
    
def text_action(state, input, state_line):
    line = state_line
    
    while 1:
        
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                return line
        
    return ""

#------------------------------------------------------------------
    
def reuse_action(state, input, state_line):
    return ""
    
#------------------------------------------------------------------

def lines_action(state, input, state_line):
    global my_board
    
    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave lines_action"
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)

        name = my_list[0]
        type = my_list[1]
        xloc = my_list[2]
        yloc = my_list[3]
        pieces = int(my_list[4])

        if len(my_list) > 5:
            if my_list[5].isdigit():
                text = int(my_list[5])
            else:        
                SIGSTR = my_list[5]
        else:
            text = 0

        my_line = cLine(name, type, xloc, yloc)

        for count in range(pieces):
            line = input_file.readline()

            line = line.strip()

            my_list = lineSplit(line)

            PIECETYPE = my_list[0]
            corners = int(my_list[1])
            WIDTHHGHT = my_list[2]
            LEVEL = my_list[3]

            if (WIDTHHGHT == 0):
                print ("ZERO WIDTHHGHT")

            my_piece = cPieces(PIECETYPE, WIDTHHGHT, LEVEL)

            for count2 in range(corners):
                line = input_file.readline()

                line = line.strip()

                my_list = lineSplit(line)

                my_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)

            my_line.add_piece(my_piece)

        for count in range(text):
            line = input_file.readline()

            line = line.strip()

            my_list = lineSplit(line)

            my_text = cText(my_list[5], my_list[6], my_list[1], my_list[7], my_list[3])

            line = input_file.readline()
            
            my_text.add_string(line)

            my_line.add_text(my_text)

        my_board.add_line(my_line)
        
    return ""
    
#------------------------------------------------------------------

def cluster_action(state, input, state_line):
    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave cluster_action"
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)

    return ""
    
#------------------------------------------------------------------

def partdecal_action(state, input, state_line):
    
    global my_board
    
    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave partdecal_action"
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)

        #print "partdecal_action: " + my_list[0]

        name = my_list[0]
        origin_x = int(my_list[2])
        origin_y = int(my_list[3])
        silk_count = int(my_list[4])
        pin_count = int(my_list[5])
        pin_def_count = int(my_list[6])
        text1_count = int(my_list[7])
        text2_count = int(my_list[8])
        
        my_part = cPart(name, pin_count, origin_x, origin_y)
        
        my_board.add_part(my_part)

        #------------------------------------------------
        # silk screen

        for count in range(silk_count):

            hide = 1
            
            line = input_file.readline()

            #print "line: " + line
            
            my_list = lineSplit(line)

            #if len(my_list) > 3:
            #    if my_list[3] == "20":
            #        hide = 0

            if my_list[0] == "COPCLS":
                my_polygon = cPolygon(my_list[3])

                my_polygon.SetPinNumber(my_list[4])
                
                my_part.addPolygon(my_polygon)
                
                my_length = int(my_list[1])
            
                for second_count in range(my_length):
                    line = input_file.readline()
                    #if hide != 0:
                    my_list = lineSplit(line)
                    my_polygon.add_corner(my_list[0], my_list[1])

            if my_list[0] == "COPCIR":
                #my_polygon = cPolygon(my_list[3])

                #my_polygon.SetPinNumber(my_list[4])
                
                #my_part.addPolygon(my_polygon)
                
                #my_length = int(my_list[1])
            
                for second_count in range(my_length):
                    line = input_file.readline()
                    #if hide != 0:
                    my_list = lineSplit(line)
                    #my_polygon.add_corner(my_list[0], my_list[1])

            elif my_list[0] == "CIRCLE":
                
                my_silk = cSilk(my_list[0], my_list[2])

                if my_list[3] != "20":
                    my_part.addSilk(my_silk)
                        
                my_length = int(my_list[1])
            
                for second_count in range(my_length):
                    line = input_file.readline()
                    #if hide != 0:
                    my_list = lineSplit(line)
                    my_silk.add_point(my_list[0], my_list[1])
                
            elif my_list[0] == "CLOSED":

                my_silk = cSilk(my_list[0], my_list[2])
            
                if my_list[3] != "20":
                    my_part.addSilk(my_silk)
                        
                my_length = int(my_list[1])
            
                for second_count in range(my_length):
                    line = input_file.readline()
                    #if hide != 0:
                    my_list = lineSplit(line)
                    my_silk.add_point(my_list[0], my_list[1])
                
            elif my_list[0] == "OPEN":
           
                my_silk = cSilk(my_list[0], my_list[2])
            
                if my_list[3] != "20":
                    my_part.addSilk(my_silk)
                        
                my_length = int(my_list[1])
            
                for second_count in range(my_length):
                    line = input_file.readline()
                    #if hide != 0:
                    my_list = lineSplit(line)
                    my_silk.add_point(my_list[0], my_list[1])
                
        #------------------------------------------------
        # Silk screen text first
        
        for count in range(text1_count):
            
            line = input_file.readline()
                
            my_list = lineSplit(line)

            my_text = cText(my_list[5], my_list[6], my_list[1], my_list[7], my_list[3])
            
            line = input_file.readline()
            
            my_text.add_string(line)
                
            my_part.addText(my_text)

        #------------------------------------------------
        # Silk screen text second
               
        for count in range(text2_count):
            
            line = input_file.readline()
                
            my_list = lineSplit(line)

            my_text = cText(my_list[5], my_list[6], my_list[1], my_list[7], my_list[3])
            
            line = input_file.readline()
            
            my_text.add_string(line)
                
            my_part.addText(my_text)

        #------------------------------------------------
        # pins

        for count in range(pin_count):
            
            line = input_file.readline()

            line = line.strip("T")
        
            my_list = lineSplit(line)

            x = my_list[0]
            y = my_list[1]
            height = 0
            width = 0
            offset = 0
            shape = ""
            rotation = 0.0
            drill_size = 0

            my_pin = cPin(str(count+1), x, y, height, width, offset, shape, rotation, drill_size, my_part)
            
            my_part.addPin(my_pin)

        #------------------------------------------------
        # pin definitions

        #print "pin_def_count: " + str(pin_def_count)

        for count in range(pin_def_count):

            x = 0

            y = 0
            
            line = input_file.readline()
            
            my_list = lineSplit(line)

            my_length = int(my_list[2])

            pin_number = my_list[1]

            for second_count in range(my_length):
                line = input_file.readline()

                my_list = lineSplit(line)

                if second_count < 1:
                    shape = my_list[2]
                    
                    if shape == 'R':
                        width = int(my_list[1])
                        height = 0

                    elif shape == "S":
                        width = int(my_list[1])
                        height = 0

                    else:
                        rotation = float(my_list[3])
                        width = int(my_list[1])
                        height = int(my_list[4])
                        offset = int(my_list[5])
                    
                    if (len(my_list) > 3) and my_list[2].find("F")== -1:
                        drill_size = my_list[3]
                    else:
                        drill_size = 0

            my_pin = cPin(pin_number, x, y, height, width, offset, shape, rotation, drill_size)
            
            my_part.addPinDef(my_pin)

            # assuming that the default pin_def is always the first one we read

            my_part.applyPinDef(my_pin)


    return ""
    
#------------------------------------------------------------------

def parttype_action(state, input, state_line):

    global my_board

    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave partdecal_action"
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)


        if (my_list[1].rfind(":") > -1):
            tmp_str = my_list[1].split(":")
            my_list[1] = tmp_str[0]
        

        my_part = my_board.get_part_by_decal_name(my_list[1])

        if my_part == 0:
            continue

        if my_part.name == "":
            my_part = my_part.copy()
            my_board.add_part(my_part)

        my_part.addName(my_list[0])

        pin_count = int(my_list[6])

        if pin_count > 0:
            count = 0

            while count < pin_count:

                line = input_file.readline()

                line = line.strip()

                my_list = lineSplit(line)

                for my_pin in my_list:
                    my_part.applyPinNumber(count, my_pin)
                    count = count + 1
    
    return ""
    
#------------------------------------------------------------------

def part_action(state, input, state_line):
    global my_board
    
    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave part_action"
                #my_board.mprint()
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)

        
        if (my_list[1].rfind("@") > -1):
            #print  "found @: " + str(my_list)
            tmp_str = my_list[1].split("@")
            my_list[1] = tmp_str[0]
            #print  "      @: " + str(my_list)
            tmp_part = my_board.get_part_by_decal_name(tmp_str[1])
        else:
            tmp_part = 0

        if tmp_part:
            my_part =  tmp_part
        else:
            my_part = my_board.get_part(my_list[1])

        text_count = int(my_list[11])

        my_component = cComponent(my_list[0], my_part, int(my_list[2]), int(my_list[3]), float(my_list[4]), my_list[6])

        for count in range(text_count):
            line = input_file.readline()
                
            my_list = lineSplit(line)

            my_text = cText(my_list[5], my_list[6], my_list[1], my_list[7], my_list[3])
            
            line = input_file.readline()
            
            my_text.add_string(line)
                
            my_component.add_text(my_text)

        my_board.add_component(my_component)

    return ""
    
#------------------------------------------------------------------

def route_action(state, input, state_line):
    #print "route_action"


    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        #print "route line: " + line

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "route_action end: " + line
                return line
            
    return ""

    
#------------------------------------------------------------------

def teardrop_test(my_list, my_char, my_string):
    result = False

    my_offset = 0
    list_count = -1

    for el in my_list:
        list_count += 1
        #print "el: " + el
        if el.isalpha():
            my_offset = list_count  

            if my_list[my_offset] == my_char:
                result = True

    return result

#------------------------------------------------------------------

def signal_action(state, input, state_line):
    line = " "
    previous_line = " "
    next_line = " "

    my_list = lineSplit(input)

    #if my_board.net_exists(my_list[1]):
    #    new_net = cNet()
    #    new_net.SetName(my_list[1])
    #    my_board_add_Net(new_net)

    new_piece = 0

    via_def_names = my_board.get_via_def_names()

    while 1:
        if (line != " "):
            previous_line = line

        if (next_line != " "):
            line = next_line

        next_line = input_file.readline()
        
        # strip whitespace
        next_line = next_line.strip()
        
        # strip whitespace
        next_line = next_line.strip()
            
        my_list = lineSplit(line)

        my_next_list = lineSplit(next_line);

        my_previous_list = lineSplit(previous_line);

        while len(my_list) < 6:
            my_list.append("");


        #print ("-----------------------------------------------------------------")
        #print ("previous line: " + previous_line)
        #print ("line: " + line)
        #print ("next line: " + next_line)

        if line != "" and line != " ":

            for via_def_name in via_def_names:
                if line.find(via_def_name) != -1:
                    via_def = my_board.find_via_def(via_def_name)
                    new_via = cVia(via_def, int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY )
                    my_board.add_via(new_via)

            if line[0].isalpha() and line != " ":
                #print ("isalpha: " + line)
                new_line = cLine("", "TRACE", 0, 0)
                previous_line = " "
                line = " "
                my_list = []
                my_next_list = []
                my_previous_list = []
                piece_start = False
            elif not piece_start and my_list[4] == "1792":
                junk = "1792"
                #print "what?"
            elif not piece_start and my_list[4]:
                #print ("start a new piece")
                my_board.add_line(new_line)
                piece_start = True
                new_piece = cPieces("OPEN", my_list[3], -1)
                new_line.add_piece(new_piece)
                new_piece.level = my_list[2]
                new_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)

                if teardrop_test(my_list, "N", my_list[5]):
                    #print("next teardrop")
                    new_piece.add_corner(int(my_next_list[0]) + my_board.originX, int(my_next_list[1]) - my_board.originY)                    
            else:
                #print ("new_piece")
                if not teardrop_test(my_list, "P", my_list[5]) and not teardrop_test(my_list, "N", my_list[5]):
                    if my_list[2] == new_piece.level and my_list[2] != "65":
                        #print("not a teardrop add corner to existing piece")
                        new_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)
                    else:
                        #print("not a teardrop add corner to new piece")
                        new_piece = cPieces("OPEN", my_list[3], -1)
                        new_line.add_piece(new_piece)
                        new_piece.level = my_list[2]
                        new_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)
                        new_piece.add_corner(int(my_previous_list[0]) + my_board.originX, int(my_previous_list[1]) - my_board.originY)
                        

                if teardrop_test(my_list, "P", my_list[5]):
                    #print("previous teardrop")
                    new_piece = cPieces("OPEN", my_list[3], -1)
                    new_line.add_piece(new_piece)
                    new_piece.level = my_previous_list[2]
                    new_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)
                    new_piece.add_corner(int(my_previous_list[0]) + my_board.originX, int(my_previous_list[1]) - my_board.originY)
                if teardrop_test(my_list, "N", my_list[5]):
                    #print("next teardrop")
                    new_piece = cPieces("OPEN", my_list[3], -1)
                    new_line.add_piece(new_piece)
                    new_piece.level = my_list[2]
                    new_piece.add_corner(int(my_list[0]) + my_board.originX, int(my_list[1]) - my_board.originY)
                    new_piece.add_corner(int(my_next_list[0]) + my_board.originX, int(my_next_list[1]) - my_board.originY)

        #if new_piece:
            #new_piece.mprint()

        for event in events:
            if next_line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif next_line.find(event)!=-1:
                return next_line
            
    return ""
    
#------------------------------------------------------------------

def pour_action(state, input, state_line):
    
    poly_start = False
    
    while 1:
        line = input_file.readline()
        
        if not line:
            break
        
        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue
        
        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                return line
            
        # strip whitespace
        line = line.strip()
            
        if line == "":
            continue

        my_list = lineSplit(line)

        if not poly_start and line[0].isalpha() and line != " ":
            x_offset = int(my_list[2])
            y_offset = int(my_list[3])
            poly_start = True
            
        elif (my_list[0] == "POLY"):
            new_polygon = cPolygon(my_list[4])
            my_board.add_polygon(new_polygon)
            number_points = my_list[1]

            for count in range(int(number_points)):
                
                line = input_file.readline()
                
                if not line:
                    break
                
                # strip whitespace
                line = line.strip()
                
                if line == "":
                    continue

                my_list = lineSplit(line)

                new_polygon.add_corner(int(my_list[0]) + my_board.originX + x_offset, int(my_list[1]) - my_board.originY + y_offset)
            
            poly_start = False

    return ""

#------------------------------------------------------------------

def misc_action(state, input, state_line):
    global my_board
    
    global layer_name
    global top_layer
    global bottom_layer

    #print "misc_action"

    layer_data = 0
    layer_depth = 0
    in_layer = 0

    while 1:
        line = input_file.readline()

        #print "line: " + line

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
                break
            elif line.find(event)!=-1:
                return line

        if layer_data == 1:    

            if line.find("{")!=-1 :
                layer_depth = layer_depth + 1
                
            if line.find("}")!=-1 :
                layer_depth = layer_depth - 1

            if layer_depth == 0:
                layer_data = 0

            if layer_depth == 1:
                if line.find("LAYER ") != -1:
                    in_layer = 1
                    my_list = line.split(" ")
                    layer_number = int(my_list[1])

            if layer_depth == 2 and in_layer:
                if line.find("LAYER_NAME") != -1:
                    my_list = line.split(" ")
                    
                    layer_name = my_list[1]

                    new_layer = cLayer(layer_name, layer_number)

                    my_board.add_layer(new_layer)

                if line.find("COMPONENT Y")!=-1:
                    if my_board.top_layer == 0:
                        my_board.top_layer = layer_number
                    elif my_board.bottom_layer == 0:
                        my_board.bottom_layer = layer_number

        if line.find("LAYER DATA") != -1:
            layer_data = 1

    return ""

#------------------------------------------------------------------

def via_action(state, input, state_line):
    while 1:
        line = input_file.readline()

        if not line:
            break

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        for event in events:
            if line.find("*REMARK*")!=-1:
                line = fsm.execute("*REMARK*", line)
            elif line.find(event)!=-1:
                #print "leave via_action"
                return line

        # strip whitespace
        line = line.strip()
        
        if line == "":
            continue

        my_list = lineSplit(line)

        if line[0].isalpha():
            drill_size = int(my_list[1]) + my_board.get_drill_plated_oversize()
            pad_size = my_board.get_pad_annular_thickness() + drill_size
            copper_clearence = my_board.get_copper_clearence()
            soldermask_clearence = drill_size + my_board.get_soldermask_clearence()
            via_def = cVia_Def(my_list[0], drill_size, "R", pad_size, copper_clearence, soldermask_clearence)
            
            my_board.add_via_def(via_def)

            for count in range(int(my_list[2])):

                line = input_file.readline()

                # strip whitespace
                line = line.strip()
                
                if line == "":
                    continue


    return ""
 
#------------------------------------------------------------------

def end_action(state, input, state_line):

    global my_board
    
    output_file.write("# release: pcb 1.99x\n")
    output_file.write("# date:    Tue May 27 15:42:40 2008\n")
    output_file.write("# user:    steve (Steve Meier)\n")
    output_file.write("# host:    linux-imkq.site\n\n")
    output_file.write("# To read pcb files, the pcb version (or the cvs source date) must be >= the file version\n")
    output_file.write("FileVersion[20070407]\n\n")
    
    output_file.write("PCB[\"\" 4000000 4000000]\n\n")
    
    output_file.write("Grid[196.000000 0 0 0]\n")
    output_file.write("Cursor[0 0 0.000000]\n")
    output_file.write("PolyArea[200000000.000000]\n")
    output_file.write("Thermal[0.500000]\n")
    output_file.write("DRC[500 400 450 200 800 500]\n")
    output_file.write("Flags(\"shownumber,nameonpcb,uniquename,clearnew,thindrawpoly\")\n")
    
    output_file.write("Groups(\"")

    for count in range(1, my_board.max_layers+1):
        #print "count: " + str(count) + " top_layer: " + str(my_board.top_layer) + " bottom_layer: " + str(my_board.bottom_layer)
        output_file.write(str(count))
        if count == my_board.top_layer:
            output_file.write(",c")
        if count == my_board.bottom_layer:
            output_file.write(",s")
        if count < my_board.max_layers:
            output_file.write(":")

                
    output_file.write("\")\n")
        
    output_file.write("Styles[\"Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,500,2200,1000,500\"]\n\n")
    
    output_file.write("Symbol(' ' 18)\n")
    output_file.write("(\n")
    output_file.write(")\n")
    output_file.write("Symbol('!' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 0 50 8)\n")
    output_file.write("	SymbolLine(0 10 0 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('\"' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 20 8)\n")
    output_file.write("	SymbolLine(10 10 10 20 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('#' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 35 20 35 8)\n")
    output_file.write("	SymbolLine(0 25 20 25 8)\n")
    output_file.write("	SymbolLine(15 20 15 40 8)\n")
    output_file.write("	SymbolLine(5 20 5 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('$' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(15 15 20 20 8)\n")
    output_file.write("	SymbolLine(5 15 15 15 8)\n")
    output_file.write("	SymbolLine(0 20 5 15 8)\n")
    output_file.write("	SymbolLine(0 20 0 25 8)\n")
    output_file.write("	SymbolLine(0 25 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 40 8)\n")
    output_file.write("	SymbolLine(15 45 20 40 8)\n")
    output_file.write("	SymbolLine(5 45 15 45 8)\n")
    output_file.write("	SymbolLine(0 40 5 45 8)\n")
    output_file.write("	SymbolLine(10 10 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('%' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 0 20 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 10 10 8)\n")
    output_file.write("	SymbolLine(10 10 15 15 8)\n")
    output_file.write("	SymbolLine(15 15 15 20 8)\n")
    output_file.write("	SymbolLine(10 25 15 20 8)\n")
    output_file.write("	SymbolLine(5 25 10 25 8)\n")
    output_file.write("	SymbolLine(0 20 5 25 8)\n")
    output_file.write("	SymbolLine(0 50 40 10 8)\n")
    output_file.write("	SymbolLine(35 50 40 45 8)\n")
    output_file.write("	SymbolLine(40 40 40 45 8)\n")
    output_file.write("	SymbolLine(35 35 40 40 8)\n")
    output_file.write("	SymbolLine(30 35 35 35 8)\n")
    output_file.write("	SymbolLine(25 40 30 35 8)\n")
    output_file.write("	SymbolLine(25 40 25 45 8)\n")
    output_file.write("	SymbolLine(25 45 30 50 8)\n")
    output_file.write("	SymbolLine(30 50 35 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('&' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 15 0 25 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 35 15 20 8)\n")
    output_file.write("	SymbolLine(5 50 10 50 8)\n")
    output_file.write("	SymbolLine(10 50 20 40 8)\n")
    output_file.write("	SymbolLine(0 25 25 50 8)\n")
    output_file.write("	SymbolLine(5 10 10 10 8)\n")
    output_file.write("	SymbolLine(10 10 15 15 8)\n")
    output_file.write("	SymbolLine(15 15 15 20 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(''' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 20 10 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('(' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(')' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 5 15 8)\n")
    output_file.write("	SymbolLine(5 15 5 45 8)\n")
    output_file.write("	SymbolLine(0 50 5 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('*' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 20 20 40 8)\n")
    output_file.write("	SymbolLine(0 40 20 20 8)\n")
    output_file.write("	SymbolLine(0 30 20 30 8)\n")
    output_file.write("	SymbolLine(10 20 10 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('+' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 20 30 8)\n")
    output_file.write("	SymbolLine(10 20 10 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(',' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 60 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('-' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('.' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('/' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 30 15 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('0' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 40 20 20 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('1' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(10 10 10 50 8)\n")
    output_file.write("	SymbolLine(0 20 10 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('2' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 20 10 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 25 8)\n")
    output_file.write("	SymbolLine(0 50 25 25 8)\n")
    output_file.write("	SymbolLine(0 50 25 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('3' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('4' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 20 10 8)\n")
    output_file.write("	SymbolLine(0 30 25 30 8)\n")
    output_file.write("	SymbolLine(20 10 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('5' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(0 10 0 30 8)\n")
    output_file.write("	SymbolLine(0 30 5 25 8)\n")
    output_file.write("	SymbolLine(5 25 15 25 8)\n")
    output_file.write("	SymbolLine(15 25 20 30 8)\n")
    output_file.write("	SymbolLine(20 30 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('6' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(0 30 15 30 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(20 35 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('7' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 25 25 8)\n")
    output_file.write("	SymbolLine(25 10 25 25 8)\n")
    output_file.write("	SymbolLine(0 10 25 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('8' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 25 5 30 8)\n")
    output_file.write("	SymbolLine(0 15 0 25 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 25 8)\n")
    output_file.write("	SymbolLine(15 30 20 25 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('9' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 20 30 8)\n")
    output_file.write("	SymbolLine(20 15 20 30 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 15 0 25 8)\n")
    output_file.write("	SymbolLine(0 25 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(':' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 25 5 25 8)\n")
    output_file.write("	SymbolLine(0 35 5 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(';' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 10 40 8)\n")
    output_file.write("	SymbolLine(10 25 10 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('<' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 10 20 8)\n")
    output_file.write("	SymbolLine(0 30 10 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('=' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 25 20 25 8)\n")
    output_file.write("	SymbolLine(0 35 20 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('>' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 20 10 30 8)\n")
    output_file.write("	SymbolLine(0 40 10 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('?' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(10 30 10 35 8)\n")
    output_file.write("	SymbolLine(10 45 10 50 8)\n")
    output_file.write("	SymbolLine(0 15 0 20 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 20 8)\n")
    output_file.write("	SymbolLine(10 30 20 20 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('@' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 40 8)\n")
    output_file.write("	SymbolLine(0 40 10 50 8)\n")
    output_file.write("	SymbolLine(10 50 40 50 8)\n")
    output_file.write("	SymbolLine(50 35 50 10 8)\n")
    output_file.write("	SymbolLine(50 10 40 0 8)\n")
    output_file.write("	SymbolLine(40 0 10 0 8)\n")
    output_file.write("	SymbolLine(10 0 0 10 8)\n")
    output_file.write("	SymbolLine(15 20 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 30 35 8)\n")
    output_file.write("	SymbolLine(30 35 35 30 8)\n")
    output_file.write("	SymbolLine(35 30 40 35 8)\n")
    output_file.write("	SymbolLine(35 30 35 15 8)\n")
    output_file.write("	SymbolLine(35 20 30 15 8)\n")
    output_file.write("	SymbolLine(20 15 30 15 8)\n")
    output_file.write("	SymbolLine(20 15 15 20 8)\n")
    output_file.write("	SymbolLine(40 35 50 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('A' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 0 50 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 20 10 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 50 8)\n")
    output_file.write("	SymbolLine(0 30 25 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('B' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(25 35 25 45 8)\n")
    output_file.write("	SymbolLine(20 30 25 35 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 25 8)\n")
    output_file.write("	SymbolLine(20 30 25 25 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('C' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 20 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('D' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 45 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('E' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 15 30 8)\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('F' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(0 30 15 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('G' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(5 10 20 10 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(25 35 25 45 8)\n")
    output_file.write("	SymbolLine(20 30 25 35 8)\n")
    output_file.write("	SymbolLine(10 30 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('H' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(25 10 25 50 8)\n")
    output_file.write("	SymbolLine(0 30 25 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('I' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 10 10 8)\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(0 50 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('J' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 15 45 8)\n")
    output_file.write("	SymbolLine(10 50 15 45 8)\n")
    output_file.write("	SymbolLine(5 50 10 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('K' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 30 20 10 8)\n")
    output_file.write("	SymbolLine(0 30 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('L' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('M' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 10 15 25 8)\n")
    output_file.write("	SymbolLine(15 25 30 10 8)\n")
    output_file.write("	SymbolLine(30 10 30 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('N' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 10 0 15 8)\n")
    output_file.write("	SymbolLine(0 15 25 40 8)\n")
    output_file.write("	SymbolLine(25 10 25 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('O' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('P' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 25 8)\n")
    output_file.write("	SymbolLine(20 30 25 25 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('Q' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 0 45 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 15 10 8)\n")
    output_file.write("	SymbolLine(15 10 20 15 8)\n")
    output_file.write("	SymbolLine(20 15 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(10 40 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('R' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(25 15 25 25 8)\n")
    output_file.write("	SymbolLine(20 30 25 25 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(5 30 25 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('S' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(20 10 25 15 8)\n")
    output_file.write("	SymbolLine(5 10 20 10 8)\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(0 15 0 25 8)\n")
    output_file.write("	SymbolLine(0 25 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write("	SymbolLine(20 30 25 35 8)\n")
    output_file.write("	SymbolLine(25 35 25 45 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('T' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 20 10 8)\n")
    output_file.write("	SymbolLine(10 10 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('U' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(20 10 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('V' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 40 8)\n")
    output_file.write("	SymbolLine(0 40 10 50 8)\n")
    output_file.write("	SymbolLine(10 50 20 40 8)\n")
    output_file.write("	SymbolLine(20 10 20 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('W' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 50 15 35 8)\n")
    output_file.write("	SymbolLine(15 35 30 50 8)\n")
    output_file.write("	SymbolLine(30 10 30 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('X' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 15 8)\n")
    output_file.write("	SymbolLine(0 15 25 40 8)\n")
    output_file.write("	SymbolLine(25 40 25 50 8)\n")
    output_file.write("	SymbolLine(0 40 0 50 8)\n")
    output_file.write("	SymbolLine(0 40 25 15 8)\n")
    output_file.write("	SymbolLine(25 10 25 15 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('Y' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 15 8)\n")
    output_file.write("	SymbolLine(0 15 10 25 8)\n")
    output_file.write("	SymbolLine(10 25 20 15 8)\n")
    output_file.write("	SymbolLine(20 10 20 15 8)\n")
    output_file.write("	SymbolLine(10 25 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('Z' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 25 10 8)\n")
    output_file.write("	SymbolLine(25 10 25 15 8)\n")
    output_file.write("	SymbolLine(0 40 25 15 8)\n")
    output_file.write("	SymbolLine(0 40 0 50 8)\n")
    output_file.write("	SymbolLine(0 50 25 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('[' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 5 10 8)\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 50 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('\\' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 30 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol(']' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 5 50 8)\n")
    output_file.write("	SymbolLine(0 50 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('^' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 15 5 10 8)\n")
    output_file.write("	SymbolLine(5 10 10 15 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('_' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('a' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(20 30 20 45 8)\n")
    output_file.write("	SymbolLine(20 45 25 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('b' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(20 35 20 45 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('c' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('d' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(20 10 20 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('e' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(0 40 20 40 8)\n")
    output_file.write("	SymbolLine(20 40 20 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('f' 10)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 15 5 50 8)\n")
    output_file.write("	SymbolLine(5 15 10 10 8)\n")
    output_file.write("	SymbolLine(10 10 15 10 8)\n")
    output_file.write("	SymbolLine(0 30 10 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('g' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(0 60 5 65 8)\n")
    output_file.write("	SymbolLine(5 65 15 65 8)\n")
    output_file.write("	SymbolLine(15 65 20 60 8)\n")
    output_file.write("	SymbolLine(20 30 20 60 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('h' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('i' 10)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 20 0 25 8)\n")
    output_file.write("	SymbolLine(0 35 0 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('j' 10)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 20 5 25 8)\n")
    output_file.write("	SymbolLine(5 35 5 60 8)\n")
    output_file.write("	SymbolLine(0 65 5 60 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('k' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write("	SymbolLine(0 35 15 50 8)\n")
    output_file.write("	SymbolLine(0 35 10 25 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('l' 10)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('m' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 35 5 50 8)\n")
    output_file.write("	SymbolLine(5 35 10 30 8)\n")
    output_file.write("	SymbolLine(10 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 50 8)\n")
    output_file.write("	SymbolLine(20 35 25 30 8)\n")
    output_file.write("	SymbolLine(25 30 30 30 8)\n")
    output_file.write("	SymbolLine(30 30 35 35 8)\n")
    output_file.write("	SymbolLine(35 35 35 50 8)\n")
    output_file.write("	SymbolLine(0 30 5 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('n' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 35 5 50 8)\n")
    output_file.write("	SymbolLine(5 35 10 30 8)\n")
    output_file.write("	SymbolLine(10 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 50 8)\n")
    output_file.write("	SymbolLine(0 30 5 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('o' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 20 45 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('p' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 35 5 65 8)\n")
    output_file.write("	SymbolLine(0 30 5 35 8)\n")
    output_file.write("	SymbolLine(5 35 10 30 8)\n")
    output_file.write("	SymbolLine(10 30 20 30 8)\n")
    output_file.write("	SymbolLine(20 30 25 35 8)\n")
    output_file.write("	SymbolLine(25 35 25 45 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(10 50 20 50 8)\n")
    output_file.write("	SymbolLine(5 45 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('q' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(20 35 20 65 8)\n")
    output_file.write("	SymbolLine(15 30 20 35 8)\n")
    output_file.write("	SymbolLine(5 30 15 30 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(0 35 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('r' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 35 5 50 8)\n")
    output_file.write("	SymbolLine(5 35 10 30 8)\n")
    output_file.write("	SymbolLine(10 30 20 30 8)\n")
    output_file.write("	SymbolLine(0 30 5 35 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('s' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 50 20 50 8)\n")
    output_file.write("	SymbolLine(20 50 25 45 8)\n")
    output_file.write("	SymbolLine(20 40 25 45 8)\n")
    output_file.write("	SymbolLine(5 40 20 40 8)\n")
    output_file.write("	SymbolLine(0 35 5 40 8)\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 20 30 8)\n")
    output_file.write("	SymbolLine(20 30 25 35 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('t' 10)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 10 5 45 8)\n")
    output_file.write("	SymbolLine(5 45 10 50 8)\n")
    output_file.write("	SymbolLine(0 25 10 25 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('u' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write("	SymbolLine(20 30 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('v' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 0 40 8)\n")
    output_file.write("	SymbolLine(0 40 10 50 8)\n")
    output_file.write("	SymbolLine(10 50 20 40 8)\n")
    output_file.write("	SymbolLine(20 30 20 40 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('w' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(5 50 10 50 8)\n")
    output_file.write("	SymbolLine(10 50 15 45 8)\n")
    output_file.write("	SymbolLine(15 30 15 45 8)\n")
    output_file.write("	SymbolLine(15 45 20 50 8)\n")
    output_file.write("	SymbolLine(20 50 25 50 8)\n")
    output_file.write("	SymbolLine(25 50 30 45 8)\n")
    output_file.write("	SymbolLine(30 30 30 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('x' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 20 50 8)\n")
    output_file.write("	SymbolLine(0 50 20 30 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('y' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 0 45 8)\n")
    output_file.write("	SymbolLine(0 45 5 50 8)\n")
    output_file.write("	SymbolLine(20 30 20 60 8)\n")
    output_file.write("	SymbolLine(15 65 20 60 8)\n")
    output_file.write("	SymbolLine(5 65 15 65 8)\n")
    output_file.write("	SymbolLine(0 60 5 65 8)\n")
    output_file.write("	SymbolLine(5 50 15 50 8)\n")
    output_file.write("	SymbolLine(15 50 20 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('z' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 30 20 30 8)\n")
    output_file.write("	SymbolLine(0 50 20 30 8)\n")
    output_file.write("	SymbolLine(0 50 20 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('{' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(5 15 10 10 8)\n")
    output_file.write("	SymbolLine(5 15 5 25 8)\n")
    output_file.write("	SymbolLine(0 30 5 25 8)\n")
    output_file.write("	SymbolLine(0 30 5 35 8)\n")
    output_file.write("	SymbolLine(5 35 5 45 8)\n")
    output_file.write("	SymbolLine(5 45 10 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('|' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 0 50 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('}' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 10 5 15 8)\n")
    output_file.write("	SymbolLine(5 15 5 25 8)\n")
    output_file.write("	SymbolLine(5 25 10 30 8)\n")
    output_file.write("	SymbolLine(5 35 10 30 8)\n")
    output_file.write("	SymbolLine(5 35 5 45 8)\n")
    output_file.write("	SymbolLine(0 50 5 45 8)\n")
    output_file.write(")\n")
    output_file.write("Symbol('~' 12)\n")
    output_file.write("(\n")
    output_file.write("	SymbolLine(0 35 5 30 8)\n")
    output_file.write("	SymbolLine(5 30 10 30 8)\n")
    output_file.write("	SymbolLine(10 30 15 35 8)\n")
    output_file.write("	SymbolLine(15 35 20 35 8)\n")
    output_file.write("	SymbolLine(20 35 25 30 8)\n")
    output_file.write(")\n")


    for via in my_board.vias:
        via.output(output_file)

    origin_x = ascii2pcb(my_board.originX)
    origin_y = ascii2pcb(my_board.originY)

    for component in my_board.components:

        comp_x = ascii2pcb(component.x)
        comp_y = -ascii2pcb(component.y)

        if component.mirrored == 'M':
            onsolder_str = "onsolder"
        else:
            onsolder_str = ""

        
        output_file.write( "Element[ \"" + onsolder_str + "\" \"\" \"" + component.refdes + "\" \"\" " + str(comp_x + origin_x))
        output_file.write( " " + str(comp_y + origin_y) + " 0 0 0 0 \"\"]\n")
        output_file.write( "(\n" )


        component.pcb_write(output_file)

        for pin in component.part.pins:
           
            width = ascii2pcb(pin.width)
            
            height = abs(ascii2pcb(pin.height))

            clearence = ascii2pcb(my_board.copper_clearence)
            mask = ascii2pcb(my_board.soldermask_clearence)

            offset = ascii2pcb(pin.offset)

            if height != 0:

                if width > height:
                    #   pin.rotation = pin.rotation + 90.0
                    
                    #if pin.rotation >= 360:
                    #    pin.rotation = pin.rotation - 360.0

                    tmp_x = width
                    width = height
                    height = tmp_x

                height = height/2 - width/2

            pin_x = ascii2pcb(pin.x)
            pin_y = -ascii2pcb(pin.y)

            rotation = component.rotation + pin.rotation

            if rotation >= 360.0:
                rotation = rotation - 360.0

            if component.rotation == 0.0:
                x1 = pin_x
                x2 = pin_x
                y1 = pin_y
                y2 = pin_y
            if component.rotation == 270.0:
                y1 = pin_x
                y2 = pin_x
                x1 = -pin_y
                x2 = -pin_y
            if component.rotation == 180.0:
                x1 = -pin_x
                x2 = -pin_x
                y1 = -pin_y
                y2 = -pin_y
            if component.rotation == 90.0:
                x1 =  pin_y
                x2 =  pin_y
                y1 =  -pin_x
                y2 =  -pin_x

            if rotation == 0.0:
                x1 = x1 - height + offset
                x2 = x2 + height + offset
                y1 = y1
                y2 = y2
            elif rotation == 270.0:
                x1 = x1
                x2 = x2
                y1 = y1 - height + offset
                y2 = y2 + height + offset
            elif rotation == 180.0:
                x1 = x1 - height + offset 
                x2 = x2 + height + offset
                y1 = y1
                y2 = y2
            else:
                x1 = x1
                x2 = x2
                y1 = y1 - height + offset 
                y2 = y2 + height + offset

            if pin.shape == "R":
                shape_flag = ""
            else:
                shape_flag = "square"

            if shape_flag == "square" and onsolder_str == "onsolder":
                shape_flag = "square,"

            if pin.drill_size == 0:
                output_file.write("Pad[" + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) +\
                                  " " + str(width) + " " + str(clearence) + " " + str(mask) + " \"" + pin.pin_number + "\" "\
                                  + " \"" + pin.pin_number + "\" \"" + shape_flag + onsolder_str + "\"]\n")
            else:
                output_file.write("Pin[" + str(x1) + " " + str(y1) + " " +\
                                  " " + str(width) + " " + str(clearence) + " " + str(mask) + " " + str(ascii2pcb(pin.drill_size)) + " \"" + pin.pin_number + "\" "\
                                  + " \"" + pin.pin_number + "\" \"" + shape_flag + onsolder_str + "\"]\n")
                

        for polygon in component.part.polygons:
            corner = polygon.corners[0]
            
            x1 = ascii2pcb(corner[0])
            y1 = -ascii2pcb(corner[1])

            corner = polygon.corners[2]
            
            x2 = ascii2pcb(corner[0])
            y2 = -ascii2pcb(corner[1])

            print "pre x1: " + str(x1) + " y1: " + str(y1) + " x2: " + str(x2) + " y2: " + str(y2)
            print "x dir: " + str(abs(x2-x1)) + " y dir: " + str(abs(y2 - y1))
            
            rotation = component.rotation

            if abs(x2 - x1) > abs(y2 - y1):
                length = abs(x2-x1)
                width = abs(y2-y1)
                length -= width
                avg = (x2 + x1)/2
                x2 = avg + length/2
                x1 = avg - length/2
                y1 = (y2 + y1)/2
                y2 = y1
            else:
                length = abs(y2-y1)
                width = abs(x2-x1)
                length -= width
                avg = (y2 + y1)/2
                y2 = avg + length/2
                y1 = avg - length/2
                x1 = (x2 + x1)/2
                x2 = x1

            print "post x1: " + str(x1) + " y1: " + str(y1) + " x2: " + str(x2) + " y2: " + str(y2) + " length: " + str(length) + " width: " + str(width)

            shape_flag = "square"

            if shape_flag == "square" and onsolder_str == "onsolder":
                shape_flag = "square,"

            output_file.write("Pad[" + str(x1) + " " + str(y1) + " " + str(x2) + " " + str(y2) +\
                              " " + str(width) + " " + str(clearence) + " " + str(mask) + " \"" + polygon.PinNumber + "\" "\
                              + " \"" + polygon.PinNumber + "\" \"" + shape_flag + onsolder_str + "\"]\n")
                
                
        output_file.write( ")\n" )



    p_count = 0
            
    for count in range(1, my_board.max_layers+1):
        output_file.write( "Layer(" + str(count) + " \"")

        for layer in my_board.layers:
            if layer.number == count:
                output_file.write(layer.name)
                break
                           
        output_file.write( "\")\n")
        output_file.write( "(\n")
        
        for line in my_board.lines:
            line.pcb_write(count, output_file);

        if use_polygons:
            for polygon in my_board.polygons:
                polygon.pcb_write(count, output_file)

        output_file.write( ")\n")

    # solder silkscreen
    output_file.write( "Layer(" + str(my_board.max_layers+1) + " \"silk\")\n")
    output_file.write( "(\n")
    for line in my_board.lines:
        line.pcb_write(29, output_file);
    for line in my_board.lines:
        line.pcb_write(28, output_file);
    output_file.write( ")\n")

    # component silkscreen
    output_file.write( "Layer(" + str(my_board.max_layers+2) + " \"silk\")\n")
    output_file.write( "(\n")
    for line in my_board.lines:
        line.pcb_write(26, output_file);
    for line in my_board.lines:
        line.pcb_write(28, output_file);
    output_file.write( ")\n")

    exit()

    return ""

#------------------------------------------------------------------

def usage():
    print "Usage: ascii2pcb infile.asc outfile.pcb [options]"
    print "options are a - followed by n"
    print "  option n means do not include polygons for layers"

#------------------------------------------------------------------

if sys.argv[1:]:
    try:
        input_file = open(sys.argv[1], 'r')
    except IOError, msg:
        print 'Can\'t open "%s":' % sys.argv[1], msg
        sys.exit(1)
else:
    usage()
    exit()

if sys.argv[2:]:
    try:
        output_file = open(sys.argv[2], 'w')
    except IOError, msg:
        print 'Can\'t open "%s":' % sys.argv[1], msg
        sys.exit(1)
else:
    usage()
    exit()


print sys.argv

if sys.argv[3] == "-n":
    use_polygons = False
else:
    use_polygons = True

my_board = cBoard();

events = ["*CLUSTER*", "*ITEMS*", "*LINES*", "*MISC*", "*PARTDECAL*", "*PART*", "*PARTTYPE*", "*PCB*", \
          "*POUR*", "*REMARK*", "*REUSE*", "*ROUTE*", "*SIGNAL*", "*TEXT*",  "*VIA*", \
          "*END*"]

fsm = FSM()


fsm.start("start")

fsm.add("start", "ready", "ready", ready_action)
fsm.add("ready", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*PCB*", "*PCB*", pcb_action)
fsm.add("*PCB*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*TEXT*", "*TEXT*", text_action)
fsm.add("*TEXT*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*REUSE*", "*REUSE*", reuse_action)
fsm.add("*REUSE*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*LINES*", "*LINES*", lines_action)
fsm.add("*LINES*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*CLUSTER*", "*CLUSTER*", cluster_action)
fsm.add("*CLUSTER*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*VIA*", "*VIA*", via_action)
fsm.add("*VIA*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*PARTDECAL*", "*PARTDECAL*", partdecal_action)
fsm.add("*PARTDECAL*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*PARTTYPE*", "*PARTTYPE*", parttype_action)
fsm.add("*PARTTYPE*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*PART*", "*PART*", part_action)
fsm.add("*PART*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*ROUTE*", "*ROUTE*", route_action)
fsm.add("*ROUTE*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*SIGNAL*", "*SIGNAL*", signal_action)
fsm.add("*SIGNAL*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*POUR*", "*POUR*", pour_action)
fsm.add("*POUR*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*MISC*", "*MISC*", misc_action)
fsm.add("*MISC*", "*REMARK*", "*REMARK*", remark_action)
fsm.add("ready", "*END*", "*END*", end_action)

fsm.execute("ready", "")

output_file.close()
input_file.close()

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user