equal
deleted
inserted
replaced
24 import getopt,sys,os |
24 import getopt,sys,os |
25 from types import * |
25 from types import * |
26 |
26 |
27 from nodemanager import * |
27 from nodemanager import * |
28 |
28 |
|
29 _ = lambda x: x |
|
30 |
29 def usage(): |
31 def usage(): |
30 print "\nUsage of objdictgen.py :" |
32 print _("\nUsage of objdictgen.py :") |
31 print "\n %s XMLFilePath CFilePath\n"%sys.argv[0] |
33 print "\n %s XMLFilePath CFilePath\n"%sys.argv[0] |
32 |
34 |
33 try: |
35 try: |
34 opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) |
36 opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) |
35 except getopt.GetoptError: |
37 except getopt.GetoptError: |
53 |
55 |
54 if __name__ == '__main__': |
56 if __name__ == '__main__': |
55 if fileIn != "" and fileOut != "": |
57 if fileIn != "" and fileOut != "": |
56 manager = NodeManager() |
58 manager = NodeManager() |
57 if os.path.isfile(fileIn): |
59 if os.path.isfile(fileIn): |
58 print "Parsing input file" |
60 print _("Parsing input file") |
59 result = manager.OpenFileInCurrent(fileIn) |
61 result = manager.OpenFileInCurrent(fileIn) |
60 if not isinstance(result, (StringType, UnicodeType)): |
62 if not isinstance(result, (StringType, UnicodeType)): |
61 Node = result |
63 Node = result |
62 else: |
64 else: |
63 print result |
65 print result |
64 sys.exit(-1) |
66 sys.exit(-1) |
65 else: |
67 else: |
66 print "%s is not a valid file!"%fileIn |
68 print _("%s is not a valid file!")%fileIn |
67 sys.exit(-1) |
69 sys.exit(-1) |
68 print "Writing output file" |
70 print _("Writing output file") |
69 result = manager.ExportCurrentToCFile(fileOut) |
71 result = manager.ExportCurrentToCFile(fileOut) |
70 if isinstance(result, (UnicodeType, StringType)): |
72 if isinstance(result, (UnicodeType, StringType)): |
71 print result |
73 print result |
72 sys.exit(-1) |
74 sys.exit(-1) |
73 print "All done" |
75 print _("All done") |
74 |
76 |