How to use the cog.inFile function in cog

To help you get started, weโ€™ve selected a few cog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hughperkins / DeepCL / cog-batteries / cog_addheaders.py View on Github external
def add_templated():
#    debug = open('debug.txt', 'a')
#    debug.write('foo\n')
#    debug.write('infile [' + cog.inFile + ']\n')

    infile = cog.inFile
    cppfile = infile.replace('.h','.cpp')
    splitinfile = infile.replace('\\','/').split('/')
    infilename = splitinfile[ len(splitinfile) - 1 ]
    classname = infilename.replace('.h','')
    # cog.outl('// classname: ' + classname)
    # cog.outl('// cppfile: ' + infilename.replace('.h','.cpp'))
    f = open(cppfile, 'r')
    in_multiline_comment = False
    in_header = False;
    line = f.readline()
    cog.outl('// generated, using cog:')
    while(line != ''):
       # cog.outl(line)
       if(line.strip().find("/*") >= 0):
           in_multiline_comment = True
       if(line.strip().find("*/") >= 0):
github hughperkins / DeepCL / cog-batteries / cog_addheaders.py View on Github external
def add(classname=''):
#    debug = open('debug.txt', 'a')
#    debug.write('foo\n')
#    debug.write('infile [' + cog.inFile + ']\n')

    infile = cog.inFile
    splitinfile = infile.replace('\\','/').split('/')
    infilename = splitinfile[ len(splitinfile) - 1 ]
    if classname == '':
        classname = infilename.replace('.h','')
    cppfile = infile.replace('.h','.cpp')
    # cog.outl('// classname: ' + classname)
    # cog.outl('// cppfile: ' + infilename.replace('.h','.cpp'))
    f = open(cppfile, 'r')
    in_multiline_comment = False
    in_header = False;
    line = f.readline()
    cog.outl('// generated, using cog:')
    while(line != ''):
       # cog.outl(line)
       if(line.strip().find("/*") >= 0):
           in_multiline_comment = True