示例#1
0
文件: format.py 项目: hiker/stan
#!/usr/bin/env python

import string
from Stylesheets.Default   import DefaultStylesheet

class MyStyle(DefaultStylesheet):
    
    def __init__(self):
        DefaultStylesheet.__init__(self, 'free')
        self['keywordcase'   ] = 'upper'
        self['variablecase'  ] = 'lower'
        self['contlinemarker'] = '>'
        self["maxcols"       ] = 72
     
# ==============================================================================

if __name__=="__main__":
    import sys
    from Tools.Project import Project

    project = Project()
    ssheet  = MyStyle()
    for i in sys.argv[1:]:
        o = project.oGetObjectForIdentifier(i, "file")
        print ssheet.ToString(o)
    
示例#2
0
文件: Dump.py 项目: hiker/stan
                lWhenDump = map(int,l)
            except ValueError:
                Usage()
        elif sKey=="-m":
            bDoMPI=1
        elif sKey=="-l":
            l = string.split(sVal,"-",1)
            if len(l)==1:
                try:
                    nLineFrom=nLineTo=int(l[0])
                except ValueError:
                    Usage()
            else:
                try:
                    nLineFrom=int(l[0])
                    nLineTo=int(l[1])
                except ValueError:
                    Usage()

    # There must be exactly one filename
    if len(lArgs)!=1:
        Usage()
    sFilename = lArgs[0]
    project = Project()
    #    try:
    objFile = project.oGetObjectForIdentifier(sFilename, "file")
    #except:
    #print "Errors parsing file '%s'."%sFilename
        
    Dump(objFile, nLineFrom, nLineTo, lWhenDump, bDoMPI=bDoMPI)