def main():
    """Main processing function."""

    header_variables = []  # variables in astyle.h
    class_variables = []  # variables in the class constructor
    header_path = libastylewx.get_astylewx_directory() + "/src/AStyleIFace.h"
    astyleiface_path = libastylewx.get_astylewx_directory(
    ) + "/src/AStyleIFace.cpp"

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    get_header_variables(header_variables, header_path)
    get_constructor_variables(class_variables, astyleiface_path)

    print("Checking AStyleIFace header to class constructor.")
    total_variables = len(header_variables)
    print(
        "There are {0} variables in the header list.".format(total_variables))
    print()

    find_class_diffs(header_variables, class_variables)

    if __print_variables:
        print(header_variables)
        print(class_variables)
def main():
    """Main processing function."""

    # lists to compare virtual function overrides
    dlggui_functions = []  # functions in AStyleDlgBase.h
    dlg_functions = []  # functions in AStyleDlg.h
    # lists to compare events
    dlggui_identifiers = []  # identifiers in AStyleDlgBase.h
    dlggui_events = []  # event identifiers in AStyleDlgBase.cpp
    # lists to compare bind events
    dlggui_radio_buttons = []  # radio buttons in AStyleDlgBase.h
    dlg_bind_events = []  # bind events in AStyleDlg.cpp
    # file paths
    dlggui_path = libastylewx.get_astylewx_directory(
    ) + "/dialog/AStyleDlgBase.h"
    dlg_path = libastylewx.get_astylewx_directory() + "/src/AStyleDlg.h"
    dlgguisrc_path = libastylewx.get_astylewx_directory(
    ) + "/dialog/AStyleDlgBase.cpp"
    dlgsrc_path = libastylewx.get_astylewx_directory() + "/src/AStyleDlg.cpp"

    # extract data
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("AStyleDlg")
    # get lists to compare virtual function overrides
    get_dlggui_functions(dlggui_functions, dlggui_path)
    get_dlg_functions(dlg_functions, dlg_path)
    # lists to compare events
    get_dlggui_identifiers(dlggui_identifiers, dlggui_path)
    get_dlgguisrc_event_identifiers(dlggui_events, dlgguisrc_path)
    # lists to compare bind events
    get_dlggui_radio_buttons(dlggui_radio_buttons, dlggui_path)
    get_dlgsrc_conect_events(dlg_bind_events, dlgsrc_path)
    # find diffs
    find_function_diffs(dlggui_functions, dlg_functions)
    find_identifier_diffs(dlggui_identifiers, dlggui_events)
    find_radio_button_diffs(dlggui_radio_buttons, dlg_bind_events)
    if __is_resizable:
        print("AStyleDlgBase is resizeable.")

    if __print_functions:
        print(dlggui_functions)
        print(dlg_functions)
    if __print_identifiers:
        print(dlggui_identifiers)
        print(dlggui_events)
Example #3
0
def main():
    """Main processing function."""

    # lists to compare virtual function overrides
    dlggui_functions = []           # functions in AStyleDlgBase.h
    dlg_functions = []              # functions in AStyleDlg.h
    # lists to compare events
    dlggui_identifiers = []         # identifiers in AStyleDlgBase.h
    dlggui_events = []              # event identifiers in AStyleDlgBase.cpp
    # lists to compare bind events
    dlggui_radio_buttons = []       # radio buttons in AStyleDlgBase.h
    dlg_bind_events = []     # bind events in AStyleDlg.cpp
    # file paths
    dlggui_path = libastylewx.get_astylewx_directory() + "/dialog/AStyleDlgBase.h"
    dlg_path = libastylewx.get_astylewx_directory() + "/src/AStyleDlg.h"
    dlgguisrc_path = libastylewx.get_astylewx_directory() + "/dialog/AStyleDlgBase.cpp"
    dlgsrc_path = libastylewx.get_astylewx_directory() + "/src/AStyleDlg.cpp"

    # extract data
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("AStyleDlg")
    # get lists to compare virtual function overrides
    get_dlggui_functions(dlggui_functions, dlggui_path)
    get_dlg_functions(dlg_functions, dlg_path)
    # lists to compare events
    get_dlggui_identifiers(dlggui_identifiers, dlggui_path)
    get_dlgguisrc_event_identifiers(dlggui_events, dlgguisrc_path)
    # lists to compare bind events
    get_dlggui_radio_buttons(dlggui_radio_buttons, dlggui_path)
    get_dlgsrc_conect_events(dlg_bind_events, dlgsrc_path)
    # find diffs
    find_function_diffs(dlggui_functions, dlg_functions)
    find_identifier_diffs(dlggui_identifiers, dlggui_events)
    find_radio_button_diffs(dlggui_radio_buttons, dlg_bind_events)
    if __is_resizable:
        print("AStyleDlgBase is resizeable.")

    if __print_functions:
        print(dlggui_functions)
        print(dlg_functions)
    if __print_identifiers:
        print(dlggui_identifiers)
        print(dlggui_events)
Example #4
0
def main():
    """Main processing function."""

    dlggui_functions = []       # functions in EditorDlgBase.h
    dlg_functions = []          # functions in EditorDlg.h
    dlggui_path = libastylewx.get_astylewx_directory() + "/dialog/EditorDlgBase.h"
    dlg_path = libastylewx.get_astylewx_directory() + "/src/EditorDlg.h"

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("EditorDlg")
    get_dlggui_functions(dlggui_functions, dlggui_path)
    get_dlg_functions(dlg_functions, dlg_path)

    find_function_diffs(dlggui_functions, dlg_functions)

    if __print_functions:
        print(dlggui_functions)
        print(dlg_functions)
Example #5
0
def main():
    """Main processing function."""

    dlggui_functions = []       # functions in EditorDlgBase.h
    dlg_functions = []          # functions in EditorDlg.h
    dlggui_path = libastylewx.get_astylewx_directory() + "/dialog/EditorDlgBase.h"
    dlg_path = libastylewx.get_astylewx_directory() + "/src/EditorDlg.h"

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("EditorDlg")
    get_dlggui_functions(dlggui_functions, dlggui_path)
    get_dlg_functions(dlg_functions, dlg_path)

    find_function_diffs(dlggui_functions, dlg_functions)

    if __print_functions:
        print(dlggui_functions)
        print(dlg_functions)
Example #6
0
def get_image_directory():
    """Get the image directory path for the os environment.
       Extract the directory from path[0]
    """
    imagedir = libastylewx.get_astylewx_directory() + "/image/"
    imagedir = imagedir.replace('\\', '/')
    # verify the path
    if not os.path.isdir(imagedir):
        message = "Cannot find image directory: " + imagedir
        libastylewx.system_exit(message)
    return imagedir
Example #7
0
def get_image_directory():
    """Get the image directory path for the os environment.
       Extract the directory from path[0]
    """
    imagedir = libastylewx.get_astylewx_directory() + "/image/"
    imagedir = imagedir.replace('\\', '/')
    # verify the path
    if not os.path.isdir(imagedir):
        message = "Cannot find image directory: " + imagedir
        libastylewx.system_exit(message)
    return imagedir
def main():
    """Main processing function.
    """
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("Generating AStyleDlgBaseLnx")
    filedir = libastylewx.get_astylewx_directory(True) + "dialog"
    os.chdir(filedir)
    infile = filedir + os.sep + "AStyleDlgBase.cpp"
    outfile = filedir + os.sep + "AStyleDlgBaseLnx.cpp"
    create_astyledlggui_lnx(infile, outfile)
    print_totals()
def main():
    """Main processing function.
    """
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("Generating AStyleDlgBaseLnx")
    filedir = libastylewx.get_astylewx_directory(True) + "dialog"
    os.chdir(filedir)
    infile = filedir + os.sep + "AStyleDlgBase.cpp"
    outfile = filedir + os.sep + "AStyleDlgBaseLnx.cpp"
    create_astyledlggui_lnx(infile, outfile)
    print_totals()
def main():
    """Main processing function."""

    header_variables = []		# variables in astyle.h
    class_variables = []			# variables in the class constructor
    header_path = libastylewx.get_astylewx_directory() + "/src/AStyleIFace.h"
    astyleiface_path = libastylewx.get_astylewx_directory() + "/src/AStyleIFace.cpp"

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    get_header_variables(header_variables, header_path)
    get_constructor_variables(class_variables, astyleiface_path)

    print("Checking AStyleIFace header to class constructor.")
    total_variables = len(header_variables)
    print("There are {0} variables in the header list.".format(total_variables))
    print()

    find_class_diffs(header_variables, class_variables)

    if __print_variables:
        print(header_variables)
        print(class_variables)
Example #11
0
def main():
    """Main processing function.
    """

    file_paths = ["AStyleDlgBase.h",
                  "AStyleDlgBase.cpp",
                  "EditorDlgBase.h",
                  "EditorDlgBase.cpp",
                  ]

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
#   print("Changing to {0}".format(__new_book))
    filedir = libastylewx.get_astylewx_directory(True) + "dialog"
    os.chdir(filedir)
    for file_path in file_paths:
        change_variables(file_path)
        print_totals(file_path)
Example #12
0
def main():
    """Main processing function.
    """

    file_paths = ["AStyleDlgBase.h",
                  "AStyleDlgBase.cpp",
                  "EditorDlgBase.h",
                  "EditorDlgBase.cpp",
                 ]

    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
#   print("Changing to {0}".format(__new_book))
    filedir = libastylewx.get_astylewx_directory(True) + "dialog"
    os.chdir(filedir)
    for file_path in file_paths:
        change_variables(file_path)
        print_totals(file_path)
Example #13
0
def main():
    """Main processing function."""

    # lists to compare virtual function overrides
    iface_functions = []    # functions in AStyleDlgBase.h
    mtest_functions = []    # functions in AStyleDlg.h
    # file paths
    iface_path = libastylewx.get_astylewx_directory() + "/src/AStyleIFace.h"
    mtest_path = libastylewx.get_astylewxtest_directory() + "/src/Main_Test.h"

    # extract data
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("Virtual Functions")
    get_iface_functions(iface_functions, iface_path)
    get_mtest_functions(mtest_functions, mtest_path)
    # find diffs
    find_function_diffs(iface_functions, mtest_functions)

    if __print_functions:
        # iface_functions.sort()
        print(iface_functions)
        # mtest_functions.sort()
        print(mtest_functions)
Example #14
0
def main():
    """Main processing function."""

    # lists to compare virtual function overrides
    iface_functions = []  # functions in AStyleDlgBase.h
    mtest_functions = []  # functions in AStyleDlg.h
    # file paths
    iface_path = libastylewx.get_astylewx_directory() + "/src/AStyleIFace.h"
    mtest_path = libastylewx.get_astylewxtest_directory() + "/src/Main_Test.h"

    # extract data
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    print("Virtual Functions")
    get_iface_functions(iface_functions, iface_path)
    get_mtest_functions(mtest_functions, mtest_path)
    # find diffs
    find_function_diffs(iface_functions, mtest_functions)

    if __print_functions:
        # iface_functions.sort()
        print(iface_functions)
        # mtest_functions.sort()
        print(mtest_functions)
Example #15
0
   with the current line numbers.
"""

# to disable the print statement and use the print() function (version 3 format)
from __future__ import print_function

import os
import platform
import subprocess
# local libraries
import libastylewx

# global variables ------------------------------------------------------------

__expected_version = "1.74"
__src_dir = libastylewx.get_astylewx_directory() + "/src/"
__py_dir = libastylewx.get_astylewxtest_directory() + "/file-py/"
__suppression_path = __py_dir + "cppcheck-suppress"

# -----------------------------------------------------------------------------

def main():
    """Main processing function.
    """
    generate_suppression_file()
    run_cppcheck()

# -----------------------------------------------------------------------------

def generate_suppression_file():
    """Generate the suppression file.
Example #16
0
def run_clang_tidy(tidy_exepath, tidy_version, file_name):
    """Run the clang-tidy program for the specified file.
       NOTE: The window stays open only if run from the console.
    """
    # cppcoreguidelines-owning-memory
    # cppcoreguidelines-pro-type-member-init gives constructor does not initialize warning
    # cppcoreguidelines-pro-type-vararg don't use printf in astyle_main
    # google-global-names-in-headers, don't like the restriction (std::vector)
    # google-build-using-namespace gives warning for "using namespace"
    # google-readability-braces-around-statements
    # google-readability-casting replaces c-style casts with c++ casts
    # google-readability-todo adds username to todo comments
    # google-runtime-int values are determined by wxWidgets
    # google-runtime-references 'const' is determined by wxWidgets, cannot fix
    # hicpp-braces-around-statements redirects to readability-braces-around-statements
    # hicpp-member-init adds braces to member variables for initialization
    # hicpp-use-auto redirects to modernize-use-auto
    # hicpp-use-noexcept redirects to modernize-use-noexcept
    # llvm-header-guard adds the filepath to the header guard name
    # misc-misplaced-widening-cast is casting size_t to int instead of int to size_t
    # misc-unused-parameters caused several false positives, is checked by compiler
    # readability-braces-around-statements expects braces around single statements
    # readability-implicit-bool-cast use 'if (x=0)' instead of 'if (!x)'
    # readability-implicit-bool-conversion replaces above ...bool-cast in version6
    # readability-simplify-boolean-expr returns a conditional statement
    #
    # modernize-use-auto recommends using auto for variable types
    #
    # to fix one option: (disable checks, add the option, include -fix)
    # clangtidy.append("-checks=-*,readability-implicit-bool-cast")
    # clangtidy.append("-fix")
    #
    # version 5 checks
    tidy_checks = ("-checks=*,"
                   "-cppcoreguidelines-pro-type-member-init,"
                   "-google-global-names-in-headers,"
                   "-google-readability-braces-around-statements,"
                   "-google-readability-todo,"
                   "-google-runtime-int,"
                   "-google-runtime-references,"
                   "-hicpp-member-init,"
                   "-llvm-header-guard,"
                   "-misc-unused-parameters,"
                   "-readability-braces-around-statements,"
                   "-readability-implicit-bool-cast,"
                   "-readability-simplify-boolean-expr,"
                   "-modernize-use-auto")
    # version 6 checks
    if tidy_version[:1] > "5":
        tidy_checks += (","
                        "-cppcoreguidelines-owning-memory,"
                        "-fuchsia-default-arguments,"
                        "-hicpp-braces-around-statements,"
                        "-hicpp-use-auto,"
                        "-hicpp-use-noexcept,"
                        "-readability-implicit-bool-conversion")
    clangtidy = [tidy_exepath]
    clangtidy.append(tidy_checks)
    clangtidy.append("-header-filter=-^wx,$Base.h") # exclude wx and dialog headers
    clangtidy.append(__src_dir + file_name)
    clangtidy.append("--")                  # compiler options follow
    clangtidy.append("-std=c++14")          # c++14 minimum is required for clang
    clangtidy.append("-fno-rtti")
    clangtidy.append("-fno-exceptions")
    clangtidy.append("-I" + libastylewx.get_astylewx_directory() + "/dialog")
    if os.name == "nt":
        clangtidy.append("-I" + __wxw + "/include")
        clangtidy.append("-I" + __wxw + "/lib/vc_lib/mswud")
    else:
        clangtidy.append("-I" + __wxw + "/include/wx-3.0")
        # too many errors with setup.h
        #clangtidy.append("-I" + __wxw + "/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0")
    # stdout file must have full path
    filename = __src_dir + "xclang-" + file_name + ".txt"
    outfile = open(filename, 'w')
    print()
    print(file_name)
    # shell=True keeps the console window open, but will not display if run from an editor
    # subprocess.check_call() doesn't work from an editor
    try:
        subprocess.check_call(clangtidy, stdout=outfile)
    except subprocess.CalledProcessError as err:
        libastylewx.system_exit("Bad clang-tidy return: " + str(err.returncode))
    except OSError:
        libastylewx.system_exit("Cannot find executable: " + clangtidy[0])
Example #17
0
import subprocess
import time
# local libraries
import libastylewx

# global variables ------------------------------------------------------------

# release number for distribution file
AS_RELEASE = "2.7"

# extract all platforms for testing (Windows, Linux, Mac)
#EXTRACT_ALL = False
EXTRACT_ALL = True

# inut from AStyleWx directory
__astylewx_dir = libastylewx.get_astylewx_directory()
# inut from AStyleWxTest directory
__astylewxtest_dir = libastylewx.get_astylewxtest_directory()
# inut from AStyle directory
__astyle_dir = libastylewx.get_astyle_directory()
# output to Project directory
__base_dir = libastylewx.get_project_directory()

# -----------------------------------------------------------------------------


def main():
    """Main processing function.
    """
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
Example #18
0
def run_clang_tidy(tidy_exepath, tidy_version, file_name):
    """Run the clang-tidy program for the specified file.
       NOTE: The window stays open only if run from the console.
    """
    # cppcoreguidelines-owning-memory
    # cppcoreguidelines-pro-type-member-init gives constructor does not initialize warning
    # cppcoreguidelines-pro-type-vararg don't use printf in astyle_main
    # google-global-names-in-headers, don't like the restriction (std::vector)
    # google-build-using-namespace gives warning for "using namespace"
    # google-readability-braces-around-statements
    # google-readability-casting replaces c-style casts with c++ casts
    # google-readability-todo adds username to todo comments
    # google-runtime-int values are determined by wxWidgets
    # google-runtime-references 'const' is determined by wxWidgets, cannot fix
    # hicpp-braces-around-statements redirects to readability-braces-around-statements
    # hicpp-member-init adds braces to member variables for initialization
    # hicpp-use-auto redirects to modernize-use-auto
    # hicpp-use-noexcept redirects to modernize-use-noexcept
    # llvm-header-guard adds the filepath to the header guard name
    # misc-misplaced-widening-cast is casting size_t to int instead of int to size_t
    # misc-unused-parameters caused several false positives, is checked by compiler
    # readability-braces-around-statements expects braces around single statements
    # readability-implicit-bool-cast use 'if (x=0)' instead of 'if (!x)'
    # readability-implicit-bool-conversion replaces above ...bool-cast in version6
    # readability-simplify-boolean-expr returns a conditional statement
    #
    # modernize-use-auto recommends using auto for variable types
    #
    # to fix one option: (disable checks, add the option, include -fix)
    # clangtidy.append("-checks=-*,readability-implicit-bool-cast")
    # clangtidy.append("-fix")
    #
    # version 5 checks
    tidy_checks = ("-checks=*,"
                   "-cppcoreguidelines-pro-type-member-init,"
                   "-google-global-names-in-headers,"
                   "-google-readability-braces-around-statements,"
                   "-google-readability-todo,"
                   "-google-runtime-int,"
                   "-google-runtime-references,"
                   "-hicpp-member-init,"
                   "-llvm-header-guard,"
                   "-misc-unused-parameters,"
                   "-readability-braces-around-statements,"
                   "-readability-implicit-bool-cast,"
                   "-readability-simplify-boolean-expr,"
                   "-modernize-use-auto")
    # version 6 checks
    if tidy_version[:1] > "5":
        tidy_checks += (","
                        "-cppcoreguidelines-owning-memory,"
                        "-fuchsia-default-arguments,"
                        "-hicpp-braces-around-statements,"
                        "-hicpp-use-auto,"
                        "-hicpp-use-noexcept,"
                        "-readability-implicit-bool-conversion")
    clangtidy = [tidy_exepath]
    clangtidy.append(tidy_checks)
    clangtidy.append(
        "-header-filter=-^wx,$Base.h")  # exclude wx and dialog headers
    clangtidy.append(__src_dir + file_name)
    clangtidy.append("--")  # compiler options follow
    clangtidy.append("-std=c++14")  # c++14 minimum is required for clang
    clangtidy.append("-fno-rtti")
    clangtidy.append("-fno-exceptions")
    clangtidy.append("-I" + libastylewx.get_astylewx_directory() + "/dialog")
    if os.name == "nt":
        clangtidy.append("-I" + __wxw + "/include")
        clangtidy.append("-I" + __wxw + "/lib/vc_lib/mswud")
    else:
        clangtidy.append("-I" + __wxw + "/include/wx-3.0")
        # too many errors with setup.h
        #clangtidy.append("-I" + __wxw + "/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0")
    # stdout file must have full path
    filename = __src_dir + "xclang-" + file_name + ".txt"
    outfile = open(filename, 'w')
    print()
    print(file_name)
    # shell=True keeps the console window open, but will not display if run from an editor
    # subprocess.check_call() doesn't work from an editor
    try:
        subprocess.check_call(clangtidy, stdout=outfile)
    except subprocess.CalledProcessError as err:
        libastylewx.system_exit("Bad clang-tidy return: " +
                                str(err.returncode))
    except OSError:
        libastylewx.system_exit("Cannot find executable: " + clangtidy[0])
Example #19
0
import subprocess
import time
# local libraries
import libastylewx

# global variables ------------------------------------------------------------

# release number for distribution file
AS_RELEASE = "3.1"

# extract all platforms for testing (Windows, Linux, Mac)
EXTRACT_ALL = False
#EXTRACT_ALL = True

# inut from AStyleWx directory
__astylewx_dir = libastylewx.get_astylewx_directory()
# inut from AStyleWxTest directory
__astylewxtest_dir = libastylewx.get_astylewxtest_directory()
# inut from AStyle directory
__astyle_dir = libastylewx.get_astyle_directory()
# output to Project directory
__base_dir = libastylewx.get_project_directory()

# -----------------------------------------------------------------------------

def main():
    """Main processing function.
    """
    libastylewx.set_text_color("yellow")
    print(libastylewx.get_python_version())
    os.chdir(libastylewx.get_file_py_directory())