def add_path(self, list, path, recursive, origin): recursive = string.lower(recursive) if recursive not in ["true", "false"]: umake_lib.fatal( 'CWAccessPath: recursive must be "true" or "false"') origin = string.lower(origin) if origin not in ["project relative", "shell relative"]: umake_lib.fatal( 'CWAccessPath: origin must be "project relative" or '\ '"shell relative"') list.append( (path, recursive, origin) )
def extract_ascw_path(_as_path, project): """extract_ascw_path takes a path string in AppleScript Codewarrior form and extracts the data from it, returning a 3-tuple of strings: Input String: '{name:":Win32-x86 Support:", recursive:true, origin:shell relative}' Returns Tuple: (":Win32-x86 Support:", "true", "shell relative")""" _as_path = string.strip(_as_path) if len(_as_path) == 0: umake_lib.fatal("extract_ascw_path() called with empty path") if _as_path[0] != "{" or _as_path[-1] != "}": umake_lib.fatal( "extract_ascw_path() called with invalid path=\"%s\"" % (_as_path)) _as_path = _as_path[1:-1] list = string.split(_as_path, ",") name = "" recursive = "" origin = "" for item in list: i = string.find(item, ":") key = string.lower(string.strip(item[:i])) value = string.strip(item[i+1:]) if key == "name": name = value[1:-1] if name[:7] == "SRCROOT": name = os.path.join(project.src_root_path, name[7:]) elif key == "recursive": recursive = value elif key == "origin": origin = value else: umake_lib.fatal( "extract_ascw_path: unhandled field=\"%s\"" % (key)) return (name, recursive, origin)
def WriteDLLTab(platform, project, plugin_list): """Write the dlltab.cpp file, and include it in the project source list. The dlltab.cpp file defines a global function table used by pnmisc/dllaccess.cpp for loading staticly linked plugins.""" externsection = [] tablesection = [] dlltypesection = [] includes = [ ] header1 = """ /* This file is generated automatically. Please do not edit. */ """ structs = """ typedef struct DLLMAP { const char * dllName; const char * entryPoint; int pluginType; void * funcptr; } DLLMAP; extern const DLLMAP g_dllMap []; typedef struct DLLTYPEMAP { const char * dllName; int pluginType; } DLLTYPEMAP; extern const DLLTYPEMAP g_dllTypeMap[]; """ for target in plugin_list: ## retrieve the dll type from the registry try: dll_type = bldreg.get_value('dll_type', target) except KeyError: umake_lib.fatal('cannot find [dll_type] for target %s in registry' % (target)) if dll_type == 'codec': my_type = 'DLLTYPE_CODEC' elif dll_type == 'common': my_type = 'DLLTYPE_COMMON' else: my_type = 'DLLTYPE_PLUGIN' dlltypesection.append('\t{ "%s", %s },' % (target, my_type)) ## retrieve the dll entrypoints from the registry try: exported_functions = bldreg.get_value('export', target) except KeyError: umake_lib.fatal('cannot find exported functions for target %s in registry' % (target)) exported_function_list = string.split(exported_functions, ',') for symbol in exported_function_list: tmp = bldreg.get("export_protos", target+"::"+symbol, ["", None, None]) if type(tmp) == types.StringType: tmp = [ tmp, None, None ] args, include, path = tmp if include and include not in includes: includes.append(include) if path: project.AddModuleIncludes(path) externsection.append('STDAPI entrypoint_for_%s_%s (%s);' % (target, symbol, args)) tablesection.append( '\t{"%s", "%s", %s, (void*)entrypoint_for_%s_%s},' % ( target, symbol, my_type, target, symbol)) ## add the static target to the library list try: target_lib = bldreg.get_value('targets', target) except KeyError: umake_lib.fatal('cannot rfind [targets] path for target %s in registry' % (target)) handle = bldreg.get("file_to_handle", target_lib, None) if handle: project.AddModuleLibraries(handle) else: umake_lib.warning("codegen couldn't find which module created '%s'" % target_lib) target_lib = os.path.join(project.src_root_path, target_lib) project.AddLibraries(target_lib) ## FIXME: these should not be hardcoded! includes.append("dllacces.h") includes.append("dllpath.h") dlltab = open("dlltab.cpp", "w") def emit(x = "", tab = dlltab) : tab.write(x + "\n") emit(header1) for i in includes: emit('#include "%s"' % i) emit(structs) emit() emit(string.joinfields(externsection, "\n")) emit() emit() emit("const DLLTYPEMAP g_dllTypeMap[] = {") emit(string.joinfields(dlltypesection, "\n")) emit("\t{NULL, 0}\n};") emit("const DLLMAP g_dllMap[] = {") emit(string.joinfields(tablesection, "\n")) emit("\t{NULL, NULL, 0, NULL}\n};\n") ## have dlltab.cpp automagicly added to the source list project.AddSources("dlltab.cpp")
def getCleanFunction(self): umake_lib.fatal('__getCleanFunction() not implemented')
def getOutputName(self, targetName): umake_lib.fatal('getOutputName() not implemented')
def getCleanFunction( self ): umake_lib.fatal( '__getCleanFunction() not implemented' )
def getOutputName( self , targetName ): umake_lib.fatal( 'getOutputName() not implemented' )