Changeset 280
- Timestamp:
- 05/24/07 23:06:45 (2 years ago)
- Files:
-
- trunk/utils/ArgParser.d (modified) (2 diffs)
- trunk/utils/Script.d (modified) (1 diff)
- trunk/utils/bless.d (modified) (19 diffs)
- trunk/utils/bless_bn.d (modified) (1 diff)
- trunk/utils/ddlinfo.d (modified) (7 diffs)
- trunk/utils/ddlinfo_bn.d (modified) (1 diff)
- trunk/utils/insitu.d (modified) (8 diffs)
- trunk/utils/insitu_bn.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/utils/ArgParser.d
r193 r280 1 1 /+ 2 Copyright (c) 2005-200 6Eric Anderton, Lars Ivar Igesund2 Copyright (c) 2005-2007 Eric Anderton, Lars Ivar Igesund 3 3 4 4 Permission is hereby granted, free of charge, to any person … … 251 251 unittest { 252 252 253 //import mango.text.String;253 //import tango.text.String; 254 254 255 255 ArgParser parser = new ArgParser(); trunk/utils/Script.d
r277 r280 56 56 57 57 void build(char[] options,char[] target){ 58 version(Windows) execute("build","-Xstd ",options,fixPath(target));58 version(Windows) execute("build","-Xstd -d",options,fixPath(target)); 59 59 version(linux) execute("build","-Xstd -version=Posix",options,fixPath(target)); 60 60 } trunk/utils/bless.d
r218 r280 1 1 /+ 2 Copyright (c) 2005 Eric Anderton2 Copyright (c) 2005-2007 Eric Anderton 3 3 4 4 Permission is hereby granted, free of charge, to any person … … 35 35 private import ddl.ddl.DDLBinary; 36 36 37 private import mango.io.File;38 private import mango.io.Stdout;39 private import mango.io.FilePath;40 private import mango.io.FileConduit;41 42 private import mango.text.LineIterator;37 private import tango.io.File; 38 private import tango.io.Stdout; 39 private import tango.io.FilePath; 40 private import tango.io.FileConduit; 41 42 private import tango.text.stream.LineIterator; 43 43 44 44 private import utils.bless_bn; … … 56 56 char[] result; 57 57 58 if(parts | PathPart.Root) result ~= path. getRoot;59 if(parts | PathPart.Path) result ~= path. getPath;60 if(parts | PathPart.Name) result ~= path. getName;61 if(parts | PathPart.Suffix) result ~= path. getSuffix;62 if(parts | PathPart.Ext) result ~= path. getExtension;58 if(parts | PathPart.Root) result ~= path.root; 59 if(parts | PathPart.Path) result ~= path.path; 60 if(parts | PathPart.Name) result ~= path.name; 61 if(parts | PathPart.Suffix) result ~= path.suffix; 62 if(parts | PathPart.Ext) result ~= path.ext; 63 63 64 64 return result; … … 67 67 68 68 char[] helpText = 69 "Bless - DDL wrapper utility - V1.2 Build %d69 "Bless - DDL wrapper utility - V1.2 Build {0} 70 70 Copyright (C) 2005,2006 Eric Anderton 71 71 Documentation: http://www.dsource.org/projects/ddl … … 76 76 77 77 Usage: 78 bless <object file> { -switch }78 bless <object file> {{ -switch } 79 79 80 80 -v verbose output … … 91 91 92 92 if(args.length == 1){ 93 Stdout. println(helpText,auto_build_number);94 Stdout. println("Supported Object Types:");93 Stdout.format(helpText,auto_build_number).newline; 94 Stdout.format("Supported Object Types:").newline; 95 95 foreach(char[] ext; registry.getSupportedTypes){ 96 Stdout. print("%s",ext);97 } 98 Stdout. println("");96 Stdout.format("{0} ",ext); 97 } 98 Stdout.newline; 99 99 return 0; 100 100 } … … 103 103 104 104 // pick through the options (if any) 105 b itverbose = false;106 b itextract = false;107 b itnoCreate = false;105 bool verbose = false; 106 bool extract = false; 107 bool noCreate = false; 108 108 char[] outputFileName = ""; 109 109 char[] filename = ""; … … 112 112 // configure the arg parser 113 113 ArgParser parser = new ArgParser(delegate uint(char[] value,uint ordinal){ 114 if(ordinal > 0) throw new DDLException("Invalid argument %s",value);114 if(ordinal > 0) throw new DDLException("Invalid argument {0}",value); 115 115 filename = value; 116 116 return value.length; … … 157 157 158 158 parser.bind("-", "p",delegate uint(char[] value){ 159 FileConduit file = new FileConduit(value);160 //TODO: determine if file exists, or just let exception fall through?161 //if(file.exists){162 LineIterator iter = new LineIterator(file);159 auto path = new FilePath(value); 160 if(path.exists){ 161 auto file = new FileConduit(path); 162 auto iter = new LineIterator!(char)(file); 163 163 while(iter.next){ 164 164 parseAttribute(iter.get); 165 165 } 166 166 return value.length; 167 //}168 //else{169 //throw new Exception("Cannot find properties file: '" ~ value ~ "'");170 //}167 } 168 else{ 169 throw new Exception("Cannot find properties file: '" ~ value ~ "'"); 170 } 171 171 }); 172 172 … … 179 179 180 180 // get the file 181 FileBuffer file = newFileBuffer(filename);181 FileBuffer file = FileBuffer(filename); 182 182 char[] originalOutputFile = filePathPart(file.getPath,PathPart.Root | PathPart.Path | PathPart.Name | PathPart.Suffix); 183 183 … … 187 187 188 188 if(noCreate){ 189 Stdout. println("loaded attributes:");189 Stdout.format("loaded attributes:").newline; 190 190 foreach(char[] name,char[] value; attributes){ 191 Stdout. println("%s = %s",name,value);191 Stdout.format("{0} = {1}",name,value).newline; 192 192 } 193 193 } … … 196 196 /* 197 197 if(!file.exists){ 198 Stdout. println("File '%s' does not exist.",file.filename);198 Stdout.format("File '{0}' does not exist.",file.filename).newline; 199 199 return 1; 200 200 } … … 204 204 //NOTE: rather than just be satisfied with what loader likes this file 205 205 // we load the entire file via its loader to ensure that it will work later. 206 DynamicLibrary lib = registry.load(file.getPath.to String());206 DynamicLibrary lib = registry.load(file.getPath.toUtf8()); 207 207 208 208 if(!lib){ 209 Stdout. println("Cannot load '%s'",file.getPath.toString());209 Stdout.format("Cannot load '{0}'",file.getPath.toUtf8()).newline; 210 210 return 1; 211 211 } … … 213 213 // output 214 214 if(verbose){ 215 Stdout. println("filename: '%s'",file.getPath.toString());216 Stdout. println("type: '%s'",lib.getType);215 Stdout.format("filename: '{0}'",file.getPath.toUtf8()).newline; 216 Stdout.format("type: '{0}'",lib.getType).newline; 217 217 } 218 218 219 219 if(extract){ 220 220 if(lib.getType != DDLLoader.typeName){ 221 Stdout. println("cannot extract from a non-ddl file ('%s').",file.getPath.toString());221 Stdout.format("cannot extract from a non-ddl file ('{0}').",file.getPath.toUtf8()).newline; 222 222 return 1; 223 223 } 224 224 } 225 225 else if(lib.getType == DDLLoader.typeName){ 226 Stdout. println("'%s' already appears to be a ddl file.",file.getPath.toString());226 Stdout.format("'{0}' already appears to be a ddl file.",file.getPath.toUtf8()).newline; 227 227 return 1; 228 228 } … … 231 231 // coerce complete load of the ddl binary file 232 232 DDLBinary binary = new DDLBinary(); 233 binary.load( newFileBuffer(file.getPath));233 binary.load(FileBuffer(file.getPath)); 234 234 235 235 // save to output file … … 244 244 } 245 245 246 if(verbose) Stdout. println("out file: '%s'",outputFileName);246 if(verbose) Stdout.format("out file: '{0}'",outputFileName).newline; 247 247 248 248 if(!noCreate){ 249 249 File destFile = new File(outputFileName); 250 250 destFile.write(binary.getBinaryData); 251 if(verbose) Stdout. println("Created '%s'",outputFileName);251 if(verbose) Stdout.format("Created '{0}'",outputFileName).newline; 252 252 } 253 253 } 254 254 else{ 255 if(verbose) Stdout. println("out file: '%s'",outputFileName);255 if(verbose) Stdout.format("out file: '{0}'",outputFileName).newline; 256 256 257 257 // create the file and save it … … 268 268 269 269 if(!("std.filename" in attributes)){ 270 attributes["std.filename"] = file.getPath. getName ~ "." ~ file.getPath.getExtension;270 attributes["std.filename"] = file.getPath.name ~ "." ~ file.getPath.ext; 271 271 } 272 272 … … 281 281 if(sym.type == SymbolType.Strong || SymbolType.Weak){ 282 282 binary.definedNamespaces ~= sym.name; 283 if(verbose) Stdout. println("module %s",demangleSymbol(sym.name));283 if(verbose) Stdout.format("module {0}",demangleSymbol(sym.name)).newline; 284 284 } 285 285 else{ 286 286 binary.importedModules ~= sym.name; 287 if(verbose) Stdout. println("module %s",demangleSymbol(sym.name));287 if(verbose) Stdout.format("module {0}",demangleSymbol(sym.name)).newline; 288 288 } 289 289 } … … 292 292 293 293 if(!noCreate){ 294 FileBuffer outputFile = new FileBuffer(outputFileName,FileStyle.ReadWriteCreate); 295 binary.save(outputFile); 296 297 outputFile.flush(); 298 outputFile.getConduit().close(); 294 FileBuffer outputFile = FileBuffer(outputFileName,null); 295 binary.save(outputFile); 296 outputFile.save(); 299 297 300 if(verbose) Stdout. println("Created '%s'",outputFileName);298 if(verbose) Stdout.format("Created '{0}'",outputFileName).newline; 301 299 } 302 300 } trunk/utils/bless_bn.d
r277 r280 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 7 21;4 long auto_build_number = 742; trunk/utils/ddlinfo.d
r219 r280 1 1 /+ 2 Copyright (c) 2005-200 6Eric Anderton2 Copyright (c) 2005-2007 Eric Anderton 3 3 4 4 Permission is hereby granted, free of charge, to any person … … 33 33 private import ddl.FileBuffer; 34 34 35 private import mango.io.Stdout;35 private import tango.io.Stdout; 36 36 37 37 char[] helpText = 38 "DDL Info - DDL information utility - V1.2 Build %d38 "DDL Info - DDL information utility - V1.2 Build {0} 39 39 Copyright (C) 2005-2006 Eric Anderton 40 40 Documentation: http://www.dsource.org/projects/ddl … … 43 43 44 44 Usage: 45 ddlinfo <object file> { -switch }45 ddlinfo <object file> {{ -switch } 46 46 47 47 -r raw output instead of friendly names/symbols. … … 55 55 56 56 if(args.length == 1){ 57 Stdout. println(helpText,auto_build_number);58 Stdout. println("Supported Object Types:");57 Stdout.format(helpText,auto_build_number).newline; 58 Stdout.format("Supported Object Types:").newline; 59 59 foreach(char[] ext; regsitry.getSupportedTypes){ 60 Stdout. print("%s",ext);60 Stdout.format("{0} ",ext); 61 61 } 62 Stdout. println("");62 Stdout.newline; 63 63 return 0; 64 64 } … … 73 73 // configure the arg parser 74 74 ArgParser parser = new ArgParser(delegate uint(char[] value,uint ordinal){ 75 if(ordinal > 0) throw new DDLException("Invalid argument %s",value);75 if(ordinal > 0) throw new DDLException("Invalid argument {0}",value); 76 76 filename = value; 77 77 return value.length; … … 107 107 108 108 // get the file 109 FileBuffer file = newFileBuffer(filename);109 FileBuffer file = FileBuffer(filename); 110 110 111 111 //TODO: validate a few things 112 112 /* if(!file.exists){ 113 Stdout. println("file '%s' does not exist.",file.filename);113 Stdout.format("file '{0}' does not exist.",file.filename).newline; 114 114 return 1; 115 115 } … … 120 120 121 121 if(!lib){ 122 Stdout. println("file '%s' is not supported.",file.getPath.toString());122 Stdout.format("file '{0}' is not supported.",file.getPath.toUtf8()).newline; 123 123 return 1; 124 124 } 125 125 126 Stdout. println("filename: '%s'",file.getPath.toString());127 Stdout. println("type: '%s'",lib.getType);126 Stdout.format("filename: '{0}'",file.getPath.toUtf8()).newline; 127 Stdout.format("type: '{0}'",lib.getType).newline; 128 128 129 129 if(xRay){ 130 Stdout. println("%s",lib.toString());130 Stdout.format("{0}",lib.toUtf8()).newline; 131 131 } 132 132 else{ 133 133 if(displayAttribs){ 134 134 if(lib.getAttributes.length > 0){ 135 Stdout. println("attributes: ");135 Stdout.format("attributes: ").newline; 136 136 foreach(char[] name,char[] value; lib.getAttributes){ 137 Stdout. println("%s - %s",name,value);137 Stdout.format("{0} - {1}",name,value).newline; 138 138 } 139 139 } 140 140 } 141 141 if(displaySymbols){ 142 Stdout. println("\nModules (%d):",lib.getModules.length);142 Stdout.format("\nModules ({0}):",lib.getModules.length).newline; 143 143 foreach(DynamicModule mod; lib.getModules()){ 144 Stdout. println("\n%s",mod.getName());145 Stdout. println("\nSymbols (%d):",mod.getSymbols.length);144 Stdout.format("\n{0}",mod.getName()).newline; 145 Stdout.format("\nSymbols ({0}):",mod.getSymbols.length).newline; 146 146 147 147 foreach(symbol; mod.getSymbols){ 148 148 if(rawOutput){ 149 Stdout. println("%s %s",symbol.getTypeName,symbol.name);149 Stdout.format("{0} {1}",symbol.getTypeName,symbol.name).newline; 150 150 } 151 151 else{ 152 Stdout. println("%s %s",symbol.getTypeName,demangleSymbol(symbol.name));152 Stdout.format("{0} {1}",symbol.getTypeName,demangleSymbol(symbol.name)).newline; 153 153 } 154 154 } trunk/utils/ddlinfo_bn.d
r277 r280 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 8 00;4 long auto_build_number = 822; trunk/utils/insitu.d
r179 r280 1 1 /+ 2 Copyright (c) 2005 Eric Anderton2 Copyright (c) 2005-2007 Eric Anderton 3 3 4 4 Permission is hereby granted, free of charge, to any person … … 35 35 private import utils.ArgParser; 36 36 37 private import mango.io.Stdout;38 private import mango.io.FileConduit;39 private import mango.text.Text;37 private import tango.io.Stdout; 38 private import tango.io.FileConduit; 39 private import Text = tango.text.Util; 40 40 41 41 char[] helpText = 42 "InSitu - Optimized in situ module generator - V1.1 %d42 "InSitu - Optimized in situ module generator - V1.1 {0} 43 43 Copyright (C) 2005 Eric Anderton 44 44 Documentation: http://www.dsource.org/projects/ddl … … 48 48 49 49 Usage: 50 insitu <map file> { -switch }50 insitu <map file> {{ -switch } 51 51 52 52 -f Specify output file … … 64 64 65 65 if(args.length == 1 || args.length > 3){ 66 Stdout. println(helpText,auto_build_number);67 Stdout. println("Supported Object Types:");66 Stdout.format(helpText,auto_build_number).newline; 67 Stdout.format("Supported Object Types:").newline; 68 68 foreach(char[] ext; registry.getSupportedTypes){ 69 Stdout. print("%s",ext);69 Stdout.format("{0} ",ext); 70 70 } 71 Stdout. println("");71 Stdout.newline; 72 72 return 0; 73 73 } … … 82 82 // Configure the parser and parse the command line 83 83 ArgParser parser = new ArgParser(delegate uint(char[] value,uint ordinal){ 84 if(ordinal > 0) throw new DDLException("Invalid argument %s",value);84 if(ordinal > 0) throw new DDLException("Invalid argument {0}",value); 85 85 filename = value; 86 86 return value.length; … … 109 109 110 110 // get the file 111 FileBuffer inputFile = newFileBuffer(filename);111 FileBuffer inputFile = FileBuffer(filename); 112 112 113 113 if(outputFilename == ""){ 114 outputFilename = inputFile.getPath.to String;114 outputFilename = inputFile.getPath.toUtf8; 115 115 } 116 116 … … 119 119 inputBinary.load(inputFile); 120 120 121 //debugLog("%dbytes loaded",inputFile.buffer.length);122 //debugLog("%dexports total",inputBinary.getAllSymbols().values.length);121 debug debugLog("{0} bytes loaded",inputFile.buffer.length); 122 debug debugLog("{0} exports total",inputBinary.getAllSymbols().values.length); 123 123 if(!filenameOverride){ 124 uint split = Text.rIndexOf(outputFilename,'.'); 125 if(split == -1){ 126 outputFilename ~= ".situ"; 124 foreach_reverse(split,ch; outputFilename){ 125 if(ch == '.'){ 126 outputFilename = outputFilename[0..split] ~ ".situ"; 127 goto filenameOverrideDone; 128 } 127 129 } 128 else{129 outputFilename = outputFilename[0..split] ~ ".situ";130 }130 // just append by default 131 outputFilename ~= ".situ"; 132 filenameOverrideDone: {} 131 133 } 132 134 133 FileBuffer outputFile = new FileBuffer(outputFilename,FileStyle.ReadWriteCreate);135 FileBuffer outputFile = FileBuffer(outputFilename,null); 134 136 135 137 // commit the data to the lib-style binary … … 138 140 outputBinary.save(outputFile,compressionLevel); 139 141 140 outputFile.flush(); 141 outputFile.getConduit().close(); 142 outputFile.save(); 142 143 143 144 return 0; trunk/utils/insitu_bn.d
r277 r280 2 2 // This file is automatically maintained by the BUILD utility, 3 3 // Please refrain from manually editing it. 4 long auto_build_number = 7 18;4 long auto_build_number = 739;
