📄 umake_win_vc7_makefile.py
字号:
# ***** BEGIN LICENSE BLOCK *****# Source last modified: $Id: umake_win_vc7_makefile.py,v 1.9 2004/10/20 23:41:25 hubbe Exp $# # Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.# # The contents of this file, and the files included with this file,# are subject to the current version of the RealNetworks Public# Source License (the "RPSL") available at# http://www.helixcommunity.org/content/rpsl unless you have licensed# the file under the current version of the RealNetworks Community# Source License (the "RCSL") available at# http://www.helixcommunity.org/content/rcsl, in which case the RCSL# will apply. You may also obtain the license terms directly from# RealNetworks. You may not use this file except in compliance with# the RPSL or, if you have a valid RCSL with RealNetworks applicable# to this file, the RCSL. Please see the applicable RPSL or RCSL for# the rights, obligations and limitations governing use of the# contents of the file.# # Alternatively, the contents of this file may be used under the# terms of the GNU General Public License Version 2 or later (the# "GPL") in which case the provisions of the GPL are applicable# instead of those above. If you wish to allow use of your version of# this file only under the terms of the GPL, and not to allow others# to use your version of this file under the terms of either the RPSL# or RCSL, indicate your decision by deleting the provisions above# and replace them with the notice and other provisions required by# the GPL. If you do not delete the provisions above, a recipient may# use your version of this file under the terms of any one of the# RPSL, the RCSL or the GPL.# # This file is part of the Helix DNA Technology. RealNetworks is the# developer of the Original Code and owns the copyrights in the# portions it created.# # This file, and the files included with this file, is distributed# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET# ENJOYMENT OR NON-INFRINGEMENT.# # Technology Compatibility Kit Test Suite(s) Location:# http://www.helixcommunity.org/content/tck# # Contributor(s):# This file was contributed by Christian Buchner# # ***** END LICENSE BLOCK *****# # """ Makefile generator which generates nmake files and VC7 SLN/VCPROJ files """## This 'inherits' umake_win_makefileimport osimport umakeimport typesumake.my_exec_file(os.path.join(umake.UMAKE_ROOT, "umake_win_makefile.py"), None, globals())import md5project_extension = "vcproj"workspace_extension = "sln"#### FIXME list:## o Make "real" projects instead of projects that just invoke makefiles##def hexify(str): ret = [] for c in str: ret.append("%02X" % ord(c)) return string.join(ret,"")try: md5.new("").hexdigest() def md5hex(str): return md5.new(str).hexdigest()except AttributeError: def md5hex(str): return hexify(md5.new(str).digest())guidhash={}def make_guid(str): if guidhash.has_key(str): return guidhash[str] guid = md5hex(str) guid = "{%s-%s-%s-%s-%s}" % (guid[0:8], guid[8:12], guid[12:16], guid[16:20], guid[20:32] ) guidhash[str]=guid return guidclass xml: def __init__(self, tagname, attributes=None, data=None): self.tagname=tagname self.attributes=attributes self.data=data def encode(self, x): x=str(x) x=string.replace(x,"&","&") x=string.replace(x,"<","<") x=string.replace(x,">",">") x=string.replace(x,'"',""") return x def quot(self, x): return '"'+self.encode(x)+'"' def generate(self, indent=0): i="\t" * indent ret=[ "%s<%s" % (i, self.tagname) ] if self.attributes: ## Contrary to the XML standard, VC7 always needs the ## "Name" attribute to be first if self.attributes.has_key("Name"): ret.append( "\n%s\tName=%s" % (i,self.quot(self.attributes["Name"]))) for (key, val) in self.attributes.items(): if key == "Name": continue ret.append( "\n%s\t%s=%s" % (i,key,self.quot(val))) if self.data != None: ret.append(">\n") for d in self.data: if type(d) == types.StringType: ret.append("\t") ret.append(i) ret.append(string.join(string.split(self.encode(d),"\n"), "\n\t"+i)) else: ret.extend(d.generate(indent+1)) ret.append("\n") ret.append("%s</%s>" % (i, self.tagname)) else: ret.append("/>\n") return ret;def split_arguments(line): ret=[] p = 0 line = line + " " space=[' ', '\r', '\t','\012'] while p < len(line): if line[p] in space: p=p+1 continue slashes=0 quoted=0 arg=[] while p < len(line): if line[p] == '\\': slashes = slashes + 1 p=p+1 continue if line[p] == '"' and (slashes & 1) == 0: arg.append("\\" * (slashes/2)) slashes=0 quoted=1-quoted p=p+1 continue if slashes: arg.append("\\" * slashes) slashes=0 if line[p] in space and not quoted: break arg.append(line[p]) p=p+1 continue ret.append(string.join(arg,"")) return retdef ProcessOptions(line, func, options, case_insensetive=None): if type(options) == types.StringType: o={} options=string.replace(options,":",":\n") options=string.replace(options,";",";\n") options=string.replace(options,"=","=\n") options=string.replace(options,".",".\n") for x in string.split(options,"\n"): if x: if case_insensetive: o[x[:-1]]=x[-1:] else: o[x[:-1]]=string.lower(x[-1:]) options=o opt = '' for arg in split_arguments(line): if opt: func(opt, arg) opt='' continue if arg[0] in ['/', '-']: opt=arg[1:] if case_insensetive: opt=string.lower(opt) arg='' odata=options.get(opt) if not odata: otmp = string.split(opt, ":", 1) if len(otmp) > 1 and options.get(otmp[0]) in [':',';']: opt = otmp[0] arg = otmp[1] odata = options.get(opt) if not odata and len(opt)>1: odata=options.get(opt[0:2]) if odata: arg=opt[2:] opt=opt[0:2] if not odata: odata=options.get(opt[0]) if odata: arg=opt[1:] opt=opt[0] if odata in [':','='] and not arg: continue func(opt, arg) opt='' else: func('', arg)class Config(Config): """Class representing one profile in a MSDEV project""" def Option(self, opt, arg): if opt == "nologo": self.toolopts["SuppressStartupBanner"]="TRUE" return print "Unknown Option (%s): %s: %s" % (self.toolopts["Name"], repr(opt), repr(arg)) if opt: self.xopts.append("/%s%s " % (opt, arg)) def SimpleCompilerOption(self, opt, arg): if string.lower(opt) == "i": self.includes.append(arg) return if string.lower(opt) == "d": self.defines.append(arg) return return self.Option(opt,arg) def trueorfalse(self, arg): if arg == "-": return "FALSE" return "TRUE" def CompilerOption(self, opt, arg): if opt in [ "FD","c","Tp" ]: return if opt == "W": self.toolopts["WarningLevel"]=arg return if opt == "wd": self.toolopts["DisableSpecificWarnings"]=arg return if opt == "FI": self.forced_includes.append(arg) return if opt == "Fd": self.toolopts["ProgramDataBaseFileName"]=arg return if opt == "O": if arg == "d": arg = "0" if arg in [ "0","1","2" ]: self.toolopts["Optimization"]=arg return if arg[0] == "y": self.toolopts["OmitFramePointers"]=self.trueorfalse(arg[1:]) return if opt == "M": if arg == "T": self.toolopts["RuntimeLibrary"]=0 return if arg == "Td": self.toolopts["RuntimeLibrary"]=1 return if arg == "D": self.toolopts["RuntimeLibrary"]=2 return if arg == "Dd": self.toolopts["RuntimeLibrary"]=3 return if arg == "L": self.toolopts["RuntimeLibrary"]=4 return if arg == "Ld": self.toolopts["RuntimeLibrary"]=5 return if opt == "Y": if arg[0] == "X": if arg == "X": self.toolopts["UsePrecompiledHeader"]=2 else: self.toolopts["PrecompiledHeaderThrough"]=arg[1:] return if opt == "F": if arg[0] == "D": return if arg[0] == "p": self.toolopts["PrecompiledHeaderFile"]=arg[1:] return if opt == "G": if arg[0] == "X": self.toolopts["ExceptionHandling"]=self.trueorfalse(arg[1:]) return if arg[0] == "R": self.toolopts["RuntimeTypeInfo"]=self.trueorfalse(arg[1:]) return if arg == "d": # CDECL self.toolopts["CallingConvention"]=0 return if arg == "r": # FASTCALL self.toolopts["CallingConvention"]=1 return if arg == "z": # STDCALL self.toolopts["CallingConvention"]=2 return if opt[:1] == "Z": if opt == "Z7": self.toolopts["DebugInformationFormat"]="1" return if opt == "Zd": self.toolopts["DebugInformationFormat"]="2" return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -