예제 #1
0
def getfunctionsfile(filename):
    functionsfile = DocsFunctionsFile(0)
    functionsfile.name = filename
    functionsfile.new = 1                        
    function = DocsFunction(0)
    for root, dirs, files in os.walk(os.path.join(documentation_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1]=='.markdown' and file_split[0] == filename+"_functions": 
                f = open(os.path.join(root,name),'r')
                state = 'begin'
                linenum = 0
                for line in f:
                    line = line.decode("utf-8", "replace")
                    if state == 'begin' and line.find('#functions') == 0:
                        state = 'functionsfile'
                        functionsfile.module = os.path.basename(root)
                        functionsfile.new = False
                    elif state == 'functionsfile' and line.find('##Description') == 0:
                        state = 'filedescription'
                    elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n':
                        functionsfile.description = functionsfile.description + line
                    elif state == 'filedescription' or state=='description' and line.find('###')==0:
                        if(state=='description'):
                            functionsfile.function_list.append(function)
                        state = 'function'
                        function = DocsFunction(0)
                    elif state == 'function' and line.find('_')==0 and line.find('_description')==-1:
                        #print "##########field: " + line
                        addfield(function,line)
                    elif state == 'function' and line.find('_description')==0:
                        state = 'description'
                    elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n':
                        function.description = function.description + line
    return functionsfile
예제 #2
0
def getfunctionsfile(filename):
    functionsfile = DocsFunctionsFile(0)
    functionsfile.name = filename
    functionsfile.new = 1                        
    function = DocsFunction(0)
    for root, dirs, files in os.walk(os.path.join(documentation_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1]=='.markdown' and file_split[0] == filename+"_functions": 
                f = open(os.path.join(root,name),'r')
                state = 'begin'
                linenum = 0
                for line in f:
                    if state == 'begin' and line.find('#functions') == 0:
                        state = 'functionsfile'
                        functionsfile.module = os.path.basename(root)
                        functionsfile.new = False
                    elif state == 'functionsfile' and line.find('##Description') == 0:
                        state = 'filedescription'
                    elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n':
                        functionsfile.description = functionsfile.description + line
                    elif state == 'filedescription' or state=='description' and line.find('###')==0:
                        if(state=='description'):
                            functionsfile.function_list.append(function)
                        state = 'function'
                        function = DocsFunction(0)
                    elif state == 'function' and line.find('_')==0 and line.find('_description')==-1:
                        #print "##########field: " + line
                        addfield(function,line)
                    elif state == 'function' and line.find('_description')==0:
                        state = 'description'
                    elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and line!='\n':
                        function.description = function.description + line
    return functionsfile
예제 #3
0
def list_all_functions(db, groupid, advanced):
    cursor = db.cursor()
    sql = 'SELECT c.id,c.name FROM documentation_functions c JOIN documentation_files f WHERE c.linkid=f.id and f.groupid=%s and f.advanced=%s and c.advanced=%s and f.visible=1 and c.visible=1 and c.linktable="files" ORDER BY f.sortid, c.sortid'
    cursor.execute(sql, (groupid, advanced, advanced))
    functions = cursor.fetchall()
    function_list = []
    for dbfunction in functions:
        function = DocsFunction(dbfunction[0])
        function.name = dbfunction[1]
        function_list.append(function)
    return function_list
예제 #4
0
def list_all_functions(db, groupid, advanced):
    cursor = db.cursor()
    sql = 'SELECT c.id,c.name FROM documentation_functions c JOIN documentation_files f WHERE c.linkid=f.id and f.groupid=%s and f.advanced=%s and c.advanced=%s and f.visible=1 and c.visible=1 and c.linktable="files" ORDER BY f.sortid, c.sortid'
    cursor.execute(sql, (
        groupid,
        advanced,
        advanced,
    ))
    functions = cursor.fetchall()
    function_list = []
    for dbfunction in functions:
        function = DocsFunction(dbfunction[0])
        function.name = dbfunction[1]
        function_list.append(function)
    return function_list
예제 #5
0
def list_all(db, linkid, linktable='class'):
    cursor = db.cursor()
    sql = 'SELECT id,name,description,returns,returns_description,parameters,syntax,version_started,version_deprecated,visible,advanced FROM documentation_functions WHERE linktable=%s and linkid= %s'
    cursor.execute(sql, (
        linktable,
        linkid,
    ))
    dbfunctions = cursor.fetchall()
    functions = []
    for dbfunction in dbfunctions:
        function = DocsFunction(dbfunction[0])
        function.new = 0
        function.name = dbfunction[1]
        function.description = str(dbfunction[2]).replace(
            '[code]', '\n$$code(lang=c++)\n').replace('[/code]',
                                                      '\n$$/code\n') + "\n\n"
        if (dbfunction[3] == ""):
            function.returns = "void"
        else:
            function.returns = tostr(dbfunction[3])
        function.returns_description = str(dbfunction[4]).replace('\n', ' ')
        function.parameters = dbfunction[5].replace('<BR/>', ', ').replace(
            '<br/>', ', ')
        function.syntax = dbfunction[6]
        if (dbfunction[7] == 0 or dbfunction[7] is None):
            function.version_started = "006"
        else:
            function.version_started = tostr(dbfunction[7])
        if (dbfunction[8] == 0 or dbfunction[8] is None):
            function.version_deprecated = ""
        else:
            function.version_deprecated = tostr(dbfunction[8])
        function.visible = dbfunction[9]
        function.advanced = dbfunction[10]

        functions.append(function)

    return functions
예제 #6
0
def getfunctionsfile(filename):
    functionsfile = DocsFunctionsFile(0)
    functionsfile.name = filename
    functionsfile.new = 1
    function = DocsFunction(0)
    prevBreakLine = False
    for root, dirs, files in os.walk(os.path.join(documentation_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1] == '.markdown' and file_split[
                    0] == filename + "_functions":
                f = open(os.path.join(root, name), 'rU')
                state = 'begin'
                linenum = 0
                for line in f:
                    line = line.decode("utf-8", "replace")
                    if state == 'begin' and line.find('#functions') == 0:
                        state = 'functionsfile'
                        functionsfile.module = os.path.basename(root)
                        functionsfile.new = False

                    elif state == 'functionsfile' and line.find('_') == 0:
                        addfield(functionsfile, line)

                    elif state == 'functionsfile' and line.find(
                            '##Description') == 0:
                        state = 'filedescription'
                        prevBreakLine = False

                    elif state == 'filedescription' and line.find(
                            '<!----------------------------------------------------------------------------->'
                    ) == -1 and (line != '\n' or not prevBreakLine):
                        functionsfile.description = functionsfile.description + line
                        prevBreakLine = (line == '\n')

                    elif state == 'filedescription' or state == 'description' and line.find(
                            '###') == 0:
                        if (state == 'description'):
                            functionsfile.function_list.append(function)
                        state = 'function'
                        function = DocsFunction(0)

                    elif state == 'function' and line.find(
                            '_') == 0 and line.find('_description') == -1:
                        #print "##########field: " + line
                        addfield(function, line)

                    elif state == 'function' and line.find(
                            '_description') == 0:
                        state = 'description'
                        prevBreakLine = False

                    elif state == 'description' and line.find(
                            '<!----------------------------------------------------------------------------->'
                    ) == -1 and (line != '\n' or not prevBreakLine):
                        function.description = function.description + line
                        prevBreakLine = (line == '\n')

                if (state == 'description'):
                    functionsfile.function_list.append(function)

    functionsfile.function_list.sort(key=lambda function: function.name)
    return functionsfile
예제 #7
0
def getfunctionsfile(filename):
    functionsfile = DocsFunctionsFile(0)
    functionsfile.name = filename
    functionsfile.new = 1
    function = DocsFunction(0)
    prevBreakLine = False
    for root, dirs, files in os.walk(os.path.join(documentation_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1] == ".markdown" and file_split[0] == filename + "_functions":
                f = open(os.path.join(root, name), "rU")
                state = "begin"
                linenum = 0
                for line in f:
                    line = line.decode("utf-8", "replace")
                    if state == "begin" and line.find("#functions") == 0:
                        state = "functionsfile"
                        functionsfile.module = os.path.basename(root)
                        functionsfile.new = False

                    elif state == "functionsfile" and line.find("_") == 0:
                        addfield(functionsfile, line)

                    elif state == "functionsfile" and line.find("##Description") == 0:
                        state = "filedescription"
                        prevBreakLine = False

                    elif (
                        state == "filedescription"
                        and line.find(
                            "<!----------------------------------------------------------------------------->"
                        )
                        == -1
                        and (line != "\n" or not prevBreakLine)
                    ):
                        functionsfile.description = functionsfile.description + line
                        prevBreakLine = line == "\n"

                    elif state == "filedescription" or state == "description" and line.find("###") == 0:
                        if state == "description":
                            functionsfile.function_list.append(function)
                        state = "function"
                        function = DocsFunction(0)

                    elif state == "function" and line.find("_") == 0 and line.find("_description") == -1:
                        # print "##########field: " + line
                        addfield(function, line)

                    elif state == "function" and line.find("_description") == 0:
                        state = "description"
                        prevBreakLine = False

                    elif (
                        state == "description"
                        and line.find(
                            "<!----------------------------------------------------------------------------->"
                        )
                        == -1
                        and (line != "\n" or not prevBreakLine)
                    ):
                        function.description = function.description + line
                        prevBreakLine = line == "\n"

                if state == "description":
                    functionsfile.function_list.append(function)

    functionsfile.function_list.sort(key=lambda function: function.name)
    return functionsfile
예제 #8
0
def getfunctionsfile(filename):
    functionsfile = DocsFunctionsFile(0)
    functionsfile.name = filename
    functionsfile.new = 1
    function = DocsFunction(0)
    prevBreakLine = False;
    for root, dirs, files in os.walk(os.path.join(documentation_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1]=='.markdown' and file_split[0] == filename+"_functions":
                functionsfile.path = name
                f = open(os.path.join(root,name),'rU')
                state = 'begin'
                linenum = 0
                for line in f:
                    #line = line.decode("utf-8", "replace")
                    if state == 'begin' and line.find('#functions') == 0:
                        state = 'functionsfile'
                        functionsfile.module = os.path.basename(root)
                        functionsfile.new = False

                    elif state == 'functionsfile' and line.find('_')==0:
                        addfield(functionsfile,line)

                    elif state == 'functionsfile' and line.find('##Description') == 0:
                        state = 'filedescription'
                        prevBreakLine = False

                    elif state == 'filedescription' and line.find('<!----------------------------------------------------------------------------->')==-1 and (line!='\n' or not prevBreakLine):
                        functionsfile.description = functionsfile.description + line
                        prevBreakLine = (line=='\n')

                    elif state == 'filedescription' or state=='description' and line.find('###')==0:
                        if(state=='description'):
                            functionsfile.function_list.append(function)
                        state = 'function'
                        function = DocsFunction(0)

                    elif state == 'function' and line.find('_')==0 and line.find('_inlined_description')==-1 and line.find('_description')==-1:
                        #print "##########field: " + line
                        addfield(function,line)

                    elif state == 'function' and line.find('_inlined_description')==0:
                        state = 'inlined_description'
                        prevBreakLine = True

                    elif (state == 'inlined_description' or state=='function') and line.find('_description')==0:
                        state = 'description'
                        prevBreakLine = False

                    elif state == 'inlined_description' and line.find('##')!=0 and line.find('_description')==-1 and (line!='\n' or not prevBreakLine):
                        function.inlined_description = function.inlined_description + line
                        prevBreakLine = (line=='\n')

                    elif state == 'description' and line.find('<!----------------------------------------------------------------------------->')==-1 and (line!='\n' or not prevBreakLine):
                        function.description = function.description + line
                        prevBreakLine = (line=='\n')

                if(state=='description'):
                    functionsfile.function_list.append(function)

    functionsfile.function_list.sort(key=lambda function: function.syntax)
    return functionsfile
예제 #9
0
def list_all(db,linkid,linktable='class'):
    cursor=db.cursor()
    sql='SELECT id,name,description,returns,returns_description,parameters,syntax,version_started,version_deprecated,visible,advanced FROM documentation_functions WHERE linktable=%s and linkid= %s'
    cursor.execute(sql,(linktable,linkid,))
    dbfunctions = cursor.fetchall()
    functions = []
    for dbfunction in dbfunctions:
        function = DocsFunction(dbfunction[0])
        function.new = 0
        function.name = dbfunction[1]
        function.description = str(dbfunction[2]).replace('[code]','\n$$code(lang=c++)\n').replace('[/code]','\n$$/code\n') + "\n\n"
        if(dbfunction[3]==""):
            function.returns = "void"
        else:
            function.returns = tostr(dbfunction[3])
        function.returns_description = str(dbfunction[4]).replace('\n',' ')
        function.parameters = dbfunction[5].replace('<BR/>',', ').replace('<br/>',', ')
        function.syntax = dbfunction[6]
        if(dbfunction[7]==0 or dbfunction[7] is None):
            function.version_started = "006"
        else:
            function.version_started = tostr(dbfunction[7])
        if(dbfunction[8]==0 or dbfunction[8] is None):
            function.version_deprecated = ""
        else:
            function.version_deprecated = tostr(dbfunction[8])
        function.visible = dbfunction[9]
        function.advanced = dbfunction[10]
        
        functions.append(function)

    return functions