Changeset 1504


Ignore:
Timestamp:
Feb 8, 2014 7:48:36 AM (8 years ago)
Author:
jemian
Message:

simple start

Location:
topdoc/trunk/src/topdoc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • topdoc/trunk/src/topdoc/TokenLog.py

    r1497 r1504  
    3838        self.token_pointer = None
    3939        if PRINT_DIAGNOSTICS:
    40             v = self.nameTable.values()
    41             v.sort()
    42             print "\n".join( v )
     40            print "\n".join( sorted(self.nameTable.values()) )
    4341
    4442    def tokenName(self, tokType):
  • topdoc/trunk/src/topdoc/st_cmd.py

    r1503 r1504  
    55
    66from topdoc import *
     7import TokenLog
    78
    89
     
    1011    '''representation of an EPICS command file'''
    1112   
    12     def __init__(self, filename, **env):
     13    def __init__(self, top_dir, ioc_dir, filename, **env):
     14        self.top_dir = None
     15        self.ioc_dir = None
    1316        self.filename = None
    1417        self.absolute_filename = None
    1518        self.env = None
    16         if os.path.exists(filename):
    17             self.filename = filename
    18             self.absolute_filename = os.path.abspath(filename)
    19             self.env = env
     19        self.dirs = {}
     20        if os.path.exists(top_dir):
     21            cmd = os.path.join(os.path.abspath(top_dir), ioc_dir, filename)
     22            if os.path.exists(cmd):
     23                self.top_dir = top_dir
     24                self.ioc_dir = ioc_dir
     25                self.filename = filename
     26                self.absolute_filename = cmd
     27                self.absolute_cmd_path = os.path.dirname(cmd)
     28                self.env = env
     29                self.dirs[''] = self.absolute_cmd_path
     30                self.dirs['TOP_DIR'] = os.path.abspath(top_dir)
     31                self.parse()
     32   
     33    def parse(self):
     34        tokenLog = TokenLog.TokenLog()
     35        tokenLog.processFile(self.absolute_filename)
     36        tok = tokenLog.nextActionable()
    2037
    2138
    2239def main():
    23     #
    24     filelist = []
    25     path = os.path.join('..', '..', 'IOCs', '12id', 'iocBoot', 'ioc12ida1')
    26     filelist.append(os.path.join(path, 'st.cmd'))
    27     cmd = {}
    28     for fname in sorted(filelist):
    29         cmd[fname] = CommandFile(fname, STD='synApps/std/:')
    30         print cmd[fname].filename
     40    top = os.path.join('..', '..', 'IOCs', '12id')
     41    ioc = os.path.join('iocBoot', 'ioc12ida1')
     42    fname = 'st.cmd'
     43    cmd = CommandFile(top, ioc, fname, STD='synApps/std/:')
     44    print cmd.absolute_filename
    3145
    3246if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.