File: WriteMinInit.py

package info (click to toggle)
paraview 3.14.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 234,468 kB
  • sloc: cpp: 2,166,013; ansic: 801,575; xml: 58,068; tcl: 49,247; python: 43,091; java: 16,625; fortran: 12,224; sh: 11,722; yacc: 5,688; perl: 3,128; makefile: 2,228; lex: 1,311; lisp: 486; asm: 471; pascal: 228
file content (72 lines) | stat: -rw-r--r-- 2,536 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import sys


#---------------------------------------------------------------------------
def outputExternDefinitions(f, classList):
    for className in classList:
        f.write("extern void " + className + "_Init(vtkClientServerInterpreter* csi);\n")
    f.write("\n")


#---------------------------------------------------------------------------
def outputInitializeFunction(f, classList, outputFile):
    f.write(
        "//-------------------------------------------------------------------------\n"
        "/*\n"
        " * This function initializes the classes to be used by the interpreter.\n"
        " *\n"
        " * @param csi client server interpreter reference\n"
        " */\n"
        "extern \"C\" void VTK_WRAP_CS_EXPORT vtkParaviewMinInit_Initialize(\n"
        "  vtkClientServerInterpreter *csi)\n"
        "{\n"
        )
    for className in classList:
        f.write("  " + className + "_Init(csi);\n")
    f.write("}\n")


#---------------------------------------------------------------------------
def outputParaviewInitFile(classList, outputFile):
    f = open(outputFile, 'w')
    f.write(
        "//-------------------------------------------------------------------------\n"
        "/*\n"
        "* @file   vtkParaviewMinInit.cxx\n"
        "*\n"
        "* @brief  This file is autogenerated from WriteMinInit.py\n"
        "*/\n"
        "//-------------------------------------------------------------------------\n"
        "\n"                                
        "#include \"vtkClientServerInterpreter.h\"\n"
        "\n"
        "#ifndef PARAVIEW_BUILD_SHARED_LIBS\n"
        "/* #undef PARAVIEW_BUILD_SHARED_LIBS */\n"
        "#endif\n"
        "#if defined(PARAVIEW_BUILD_SHARED_LIBS) && defined(_WIN32)\n"
        "# define VTK_WRAP_CS_EXPORT __declspec(dllexport)\n"
        "#else\n"
        "# define VTK_WRAP_CS_EXPORT\n"
        "#endif\n\n"
        )
    outputExternDefinitions(f, classList)
    outputInitializeFunction(f, classList, outputFile)


#---------------------------------------------------------------------------
def main(argv=None):
    if not argv: argv = sys.argv
    if len(argv) != 3:
        print "Usage: python WriteMinInit.py <class-list-file> <output-file>"
        sys.exit(1)

    classes = list()
    inFile = open(argv[1], 'r')
    for line in inFile: classes.append(line.strip())
    outputParaviewInitFile(classes, argv[2])


#---------------------------------------------------------------------------
if __name__ == "__main__":
    main()