From fb82a96cc71011b30eef6c155f77dfedf6fd5658 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 15 Nov 2012 14:53:09 +0900 Subject: [PATCH] Better handling of progs.dat and line numbers. Not enough testing :P --- tools/qfcc/source/qfpreqcc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/source/qfpreqcc b/tools/qfcc/source/qfpreqcc index 9029149a6..1db1f9fd9 100755 --- a/tools/qfcc/source/qfpreqcc +++ b/tools/qfcc/source/qfpreqcc @@ -86,7 +86,7 @@ current_file = [] source_list = [] qcc_list = [] defines = {} -progs_dat = "progs.dat" +progs_dat = None progs_src = "progs.src" compile_this_file = 1 keep_newlines = 1 @@ -252,6 +252,7 @@ def process_source (source_file): arg1 = string.strip (g[1]) margs = string.strip (g[4]) #pprint ((directive, arg1, margs)) + comment_out = True if directive == 'pragma': if condition[-1]: parse_pragma (arg1, margs) @@ -286,8 +287,11 @@ def process_source (source_file): del condition[-1] else: if condition[-1]: - print "ignoring " + l - output.append ('//' + l) + comment_out = False + if comment_out: + output.append ('//' + l) + else: + output.append (l) else: if (includelist): fname = parse_filename (l) @@ -341,9 +345,11 @@ while i < len (sys.argv): del sys.argv[i] continue i = i + 1 +progs_dat = None do_preprogs_src () -progs_dat = source_list[0] -source_list = source_list[1:] +if progs_dat == None: + progs_dat = source_list[0] + source_list = source_list[1:] for s in source_list: process_source (s) f = open (progs_src, "wb")