diff options
author | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-12-02 17:49:47 +0000 |
---|---|---|
committer | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-12-02 17:49:47 +0000 |
commit | 68fb62dfd93c31fbfb367e012e123791b939e05a (patch) | |
tree | 2c4c9207c1d834a6fbab514eb8606e5349103cc9 /tools | |
parent | db06ccae6135ebf9c42a29f5df8796752caecbaf (diff) |
Add #line directives to the genertated dissector.
Now the compiler knows where a line comes from and errors point to the .cnf or -template.[ch] file instead of the generated code.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16654 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/asn2eth.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/asn2eth.py b/tools/asn2eth.py index 3a0853aa99..318855f292 100755 --- a/tools/asn2eth.py +++ b/tools/asn2eth.py @@ -1290,7 +1290,7 @@ class EthCnf: return ''; if (not self.fn[name][ctx]): return ''; - return self.fn[name][ctx]['text'] + return '#line %u "%s"\n%s\n' % (self.fn[name][ctx]['lineno'],self.fn[name][ctx]['fn'],self.fn[name][ctx]['text']); def add_pdu(self, par, is_new, fn, lineno): #print "add_pdu(par=%s, %s, %d)" % (str(par), fn, lineno) @@ -1631,10 +1631,14 @@ class EthOut: fout.write(self.fhdr(out_nm)) fout.write('/* Input file: ' + in_nm +' */\n') fout.write('\n') + fout.write('#line 1 "%s"\n' % (in_nm)) include = re.compile(r'^\s*#\s*include\s+[<"](?P<fname>[^>"]+)[>"]', re.IGNORECASE) + cont_linenum = 0; + while (True): + cont_linenum = cont_linenum + 1; line = fin.readline() if (line == ''): break ifile = None @@ -1649,12 +1653,12 @@ class EthOut: if (ifile): fout.write('\n') fout.write('/*--- Included file: ' + ifile + ' ---*/\n') - fout.write('\n') + fout.write('#line 1 "' + ifile + '"\n') finc = file(ifile, "r") fout.write(finc.read()) fout.write('\n') fout.write('/*--- End of included file: ' + ifile + ' ---*/\n') - fout.write('\n') + fout.write('#line %i "%s"\n' % (cont_linenum+1,in_nm) ) finc.close() else: fout.write(line) |