# Path: msp430/asm/rpn.py
# class Word(unicode):
# class RPNError(Exception):
# class RPNBase(list):
# class RPNStackOps(object):
# class RPNSimpleMathOps(object):
# class RPNMoreMathOps(object):
# class RPNBitOps(object):
# class RPNLogicOps(object):
# class RPNCompareOps(object):
# class RPN(RPNBase, RPNStackOps, RPNSimpleMathOps, RPNMoreMathOps,
#           RPNBitOps, RPNLogicOps, RPNCompareOps):
#     def __new__(cls, word, filename, lineno, text):
#     def lower(self):
# def annotated_words(sequence, filename=None, lineno=None, offset=None, text=None):
# def words_in_string(data, name='<string>', include_newline=False):
# def words_in_file(filename, fileobj=None, include_newline=False):
#     def __init__(self, message, filename=None, lineno=None, column=None, offset=None, text=None):
#     def __str__(self):
# def rpn_function(code):
#     def wrapper(stack):
# def word(name):
#     def decorate_word(function):
#     def __init__(self, namespace=None):
#     def interpret_sequence(self, sequence, filename=None):
#     def interpret(self, iterator):
#     def look_up(self, word):
#     def next_word(self):
#     def interpret_word(self, word):
#     def push(self, obj):
#     def pop(self):
#     def pop2(self):
#     def prettyprint(self, stack):
#     def __str__(self):
#     def printer(self, obj):
#     def clear(self, stack=None):
#     def dup(self, stack):
#     def drop(self, stack):
#     def swap(self, stack):
#     def over(self, stack):
#     def pick(self, stack):
#     def add(self, stack):
#     def sub(self, stack):
#     def mul(self, stack):
#     def div(self, stack):
#     def minimum(self, stack):
#     def maximum(self, stack):
#     def word_INT(self, stack):
#     def word_FLOAT(self, stack):
#     def negate(self, stack):
#     def bitor(self, stack):
#     def bitand(self, stack):
#     def bitxor(self, stack):
#     def bit_shift_left(self, stack):
#     def bit_shift_right(self, stack):
#     def bitnot(self, stack):
#     def word_NOT(self, stack):
#     def word_AND(self, stack):
#     def word_OR(self, stack):
#     def word_IFTE(self, stack):
#     def word_LIST(self, stack):
#     def smaller(self, stack):
#     def smaller_equal(self, stack):
#     def larger(self, stack):
#     def larger_equal(self, stack):
#     def equal(self, stack):
#     def not_equal(self, stack):
# def eval(words, stack=[], namespace={}):
# def python_function(code, namespace={}):
#     def wrapper(*args):
# def interpreter_loop(namespace={}, debug=False, rpn_class=RPN, rpn_instance=None):
#             N = min(4, len(self))


from msp430.asm import rpn
    from optparse import OptionParser
    from pprint import pprint
import pkgutil
    import os.path
            #~ print "XXX including %r" % name
            # XXX currently only internal imports are supported
            data = pkgutil.get_data('msp430.asm', 'definitions/%s.peripheral' % (name,))
            self.interpret(rpn.words_in_string(data, name='definitions/%s.peripheral' % (name,)))

    @rpn.word('BIT')
    def word_BIT(self, stack):
        """Define a bit"""
        if self.bits is None:
            raise SymbolError('BIT outside REGISTER definition not allowed')
        bit_name = self.next_word()
        value = 1 << self.pop()
        self.bits[value] = bit_name
        self.namespace[bit_name.lower()] = value

    @rpn.word('VALUE')
    def word_VALUE(self, stack):
        """Define a value"""
        value_name = self.next_word()
        value = self.pop()
        if self.register_values is not None:
            self.register_values[value] = value_name
        elif self.peripheral is not None:
            if '__values__' not in self.peripheral:
                self.peripheral['__values__'] = {}
            self.peripheral['__values__'][value] = value_name
        else:
            raise SymbolError('VALUE outside REGISTER or PERIPHERAL definition not allowed')
        self.namespace[value_name.lower()] = value


# Path: msp430/asm/rpn.py
# class Word(unicode):
# class RPNError(Exception):
# class RPNBase(list):
# class RPNStackOps(object):
# class RPNSimpleMathOps(object):
# class RPNMoreMathOps(object):
# class RPNBitOps(object):
# class RPNLogicOps(object):
# class RPNCompareOps(object):
# class RPN(RPNBase, RPNStackOps, RPNSimpleMathOps, RPNMoreMathOps,
#           RPNBitOps, RPNLogicOps, RPNCompareOps):
#     def __new__(cls, word, filename, lineno, text):
#     def lower(self):
# def annotated_words(sequence, filename=None, lineno=None, offset=None, text=None):
# def words_in_string(data, name='<string>', include_newline=False):
# def words_in_file(filename, fileobj=None, include_newline=False):
#     def __init__(self, message, filename=None, lineno=None, column=None, offset=None, text=None):
#     def __str__(self):
# def rpn_function(code):
#     def wrapper(stack):
# def word(name):
#     def decorate_word(function):
#     def __init__(self, namespace=None):
#     def interpret_sequence(self, sequence, filename=None):
#     def interpret(self, iterator):
#     def look_up(self, word):
#     def next_word(self):
#     def interpret_word(self, word):
#     def push(self, obj):
#     def pop(self):
#     def pop2(self):
#     def prettyprint(self, stack):
#     def __str__(self):
#     def printer(self, obj):
#     def clear(self, stack=None):
#     def dup(self, stack):
#     def drop(self, stack):
#     def swap(self, stack):
#     def over(self, stack):
#     def pick(self, stack):
#     def add(self, stack):
#     def sub(self, stack):
#     def mul(self, stack):
#     def div(self, stack):
#     def minimum(self, stack):
#     def maximum(self, stack):
#     def word_INT(self, stack):
#     def word_FLOAT(self, stack):
#     def negate(self, stack):
#     def bitor(self, stack):
#     def bitand(self, stack):
#     def bitxor(self, stack):
#     def bit_shift_left(self, stack):
#     def bit_shift_right(self, stack):
#     def bitnot(self, stack):
#     def word_NOT(self, stack):
#     def word_AND(self, stack):
#     def word_OR(self, stack):
#     def word_IFTE(self, stack):
#     def word_LIST(self, stack):
#     def smaller(self, stack):
#     def smaller_equal(self, stack):
#     def larger(self, stack):
#     def larger_equal(self, stack):
#     def equal(self, stack):
#     def not_equal(self, stack):
# def eval(words, stack=[], namespace={}):
# def python_function(code, namespace={}):
#     def wrapper(*args):
# def interpreter_loop(namespace={}, debug=False, rpn_class=RPN, rpn_instance=None):
#             N = min(4, len(self))


# Path: msp430/asm/peripherals.py
from msp430.asm import rpn
    from optparse import OptionParser
    from pprint import pprint
import pkgutil
    import os.path

            #~ print "XXX including %r" % name
            # XXX currently only internal imports are supported
            data = pkgutil.get_data('msp430.asm', 'definitions/%s.peripheral' % (name,))
            self.interpret(rpn.words_in_string(data, name='definitions/%s.peripheral' % (name,)))

    @rpn.word('BIT')
    def word_BIT(self, stack):
        """Define a bit"""
        if self.bits is None:
            raise SymbolError('BIT outside REGISTER definition not allowed')
        bit_name = self.next_word()
        value = 1 << self.pop()
        self.bits[value] = bit_name
        self.namespace[bit_name.lower()] = value

    @rpn.word('VALUE')
    def word_VALUE(self, stack):
        """Define a value"""
        value_name = self.next_word()
        value = self.pop()
        if self.register_values is not None:
            self.register_values[value] = value_name
        elif self.peripheral is not None:
            if '__values__' not in self.peripheral:
                self.peripheral['__values__'] = {}
            self.peripheral['__values__'][value] = value_name
        else:
            raise SymbolError('VALUE outside REGISTER or PERIPHERAL definition not allowed')
        self.namespace[value_name.lower()] = value


    @rpn.word('REGISTER')