Example #1
0
def process(fn, outfile, lazy=False):
    if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime:
	return
    print 'Processing %s into %s' % (fn, outfile)
    gen = Gen()
    directives.execute(directives.load(fn),gen)
    result = gen.generate()
    print >> open(outfile, 'w'), result
Example #2
0
 def get_aux(self, name):
     if self.auxiliary is None:
         aux_gen = Gen(priority_order=['require', 'define'])
         directives.execute(
             directives.load(os.path.join(scriptdir, 'gderived-defs')),
             aux_gen)
         self.auxiliary = aux_gen.global_bindings
     return self.auxiliary[name]
Example #3
0
def process(fn, outfile, lazy=False):
    if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime:
        return
    print 'Processing %s into %s' % (fn, outfile)
    gen = Gen()
    directives.execute(directives.load(fn), gen)
    result = gen.generate()
    print >> open(outfile, 'w'), result
Example #4
0
def process(fn, outfile, lazy=False):
    if lazy and os.stat(fn).st_mtime < os.stat(outfile).st_mtime:
        return
    print('Processing %s into %s' % (fn, outfile))
    gen = Gen()
    directives.execute(directives.load(fn),gen)
    result = gen.generate()
    result = hack_derived_header(outfile, result)
    print(result, file=open(outfile, 'w'))
Example #5
0
def process(fn, outfile, lazy=False):
    if (lazy and os.path.exists(outfile)
            and os.stat(fn).st_mtime < os.stat(outfile).st_mtime):
        return
    print 'Processing %s into %s' % (fn, outfile)
    gen = Gen()
    directives.execute(directives.load(fn), gen)
    result = gen.generate()
    result = hack_derived_header(outfile, result)
    print >> open(outfile, 'w'), result
Example #6
0
def process(fn, outfile, lazy=False):
    if lazy and os.path.exists(outfile) and os.stat(fn).st_mtime < os.stat(outfile).st_mtime:
        return
    print "Processing %s into %s" % (fn, outfile)
    gen = Gen()
    directives.execute(directives.load(fn), gen)
    result = gen.generate()
    result = hack_derived_header(outfile, result)
    result = add_imports(gen, outfile, result)
    print >> open(outfile, "w"), result
Example #7
0
    def dire_incl(self, name, parm, body):
        if body is not None:
            self.invalid(name, 'non-empty body')

        def load():
            for d in directives.load(parm.strip()+'.derived'):
                if d.name not in ('noinherit', 'import'):
                    yield d
                
        included_directives = list(load())
        directives.execute(included_directives, self)
Example #8
0
def process(fn, mergefile=None, lazy=False):
    if lazy and mergefile and os.stat(fn).st_mtime < os.stat(mergefile).st_mtime:
	return
    gen = Gen()
    directives.execute(directives.load(fn),gen)
    result = gen.generate()
    if mergefile is None:
        print result
    else:
	print 'Merging %s into %s' % (fn, mergefile)
        result = merge(mergefile, result)
Example #9
0
    def dire_incl(self, name, parm, body):
        if body is not None:
            self.invalid(name, "non-empty body")

        def load():
            for d in directives.load(parm.strip() + ".derived"):
                if d.name not in ("noinherit", "import"):
                    yield d

        included_directives = list(load())
        directives.execute(included_directives, self)
Example #10
0
def process(fn, mergefile=None, lazy=False):
    if lazy and mergefile and os.stat(fn).st_mtime < os.stat(
            mergefile).st_mtime:
        return
    gen = Gen()
    directives.execute(directives.load(fn), gen)
    result = gen.generate()
    if mergefile is None:
        print result
    else:
        print 'Merging %s into %s' % (fn, mergefile)
        result = merge(mergefile, result)
Example #11
0
def process(fn, outfile, lazy=False):
    if (lazy and os.path.exists(outfile)
            and os.stat(fn).st_mtime < os.stat(outfile).st_mtime):
        print(outfile)
        return
    print('Processing %s into %s' % (fn, outfile))
    gen = Gen()
    directives.execute(directives.load(fn), gen)
    result = gen.generate()
    result = hack_derived_header(outfile, result)
    result = add_imports(gen, outfile, result)
    if not os.path.exists(outfile):
        pathlib.Path(os.path.dirname(outfile)).mkdir(parents=True,
                                                     exist_ok=True)
    print(result, file=open(outfile, 'w'))
Example #12
0
 def dire_incl(self,name,parm,body):
     if body is not None:
         self.invalid(name,'non-empty body')
     directives.execute(directives.load(parm.strip()+'.derived'),self)
Example #13
0
 def dire_require(self, name, parm, body):
     if body is not None:
         self.invalid('require', 'non-empty body')
     sub_gen = Gen(bindings=self.global_bindings, priority__order=['require', 'define'])
     directives.execute(directives.load(parm.strip()), sub_gen)        
Example #14
0
 def dire_incl(self, name, parm, body):
     if body is not None:
         self.invalid(name, 'non-empty body')
     directives.execute(directives.load(parm.strip() + '.derived'), self)
Example #15
0
 def get_aux(self, name):
     if self.auxiliary is None:
         aux_gen = Gen(priority_order=["require", "define"])
         directives.execute(directives.load(os.path.join(scriptdir, "gexpose-defs")), aux_gen)
         self.auxiliary = aux_gen.global_bindings
     return self.auxiliary[name]
Example #16
0
 def get_aux(self,name):
     if self.auxiliary is None:
         aux_gen = Gen(priority_order=['require','define'])
         directives.execute(directives.load(os.path.join(scriptdir,'gderived-defs')),aux_gen)
         self.auxiliary = aux_gen.global_bindings
     return self.auxiliary[name]
Example #17
0
 def dire_require(self,name,parm,body):
     if body is not None:
         self.invalid('require','non-empty body')
     sub_gen = Gen(bindings=self.global_bindings, priority__order=['require','define'])
     directives.execute(directives.load(parm.strip()),sub_gen)        
Example #18
0
 def dire_incl(self, name, parm, body):
     if body is not None:
         self.invalid(name, "non-empty body")
     directives.execute(directives.load(parm.strip() + ".expose"), self)