Changeset 280

Show
Ignore:
Timestamp:
05/24/07 23:06:45 (2 years ago)
Author:
pragma
Message:

Dirty commit. please see r278 for something stable.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/utils/ArgParser.d

    r193 r280  
    11/+ 
    2     Copyright (c) 2005-2006 Eric Anderton, Lars Ivar Igesund 
     2    Copyright (c) 2005-2007 Eric Anderton, Lars Ivar Igesund 
    33 
    44    Permission is hereby granted, free of charge, to any person 
     
    251251unittest { 
    252252 
    253     //import mango.text.String; 
     253    //import tango.text.String; 
    254254 
    255255    ArgParser parser = new ArgParser(); 
  • trunk/utils/Script.d

    r277 r280  
    5656 
    5757void build(char[] options,char[] target){ 
    58     version(Windows) execute("build","-Xstd",options,fixPath(target)); 
     58    version(Windows) execute("build","-Xstd -d",options,fixPath(target)); 
    5959    version(linux) execute("build","-Xstd -version=Posix",options,fixPath(target)); 
    6060} 
  • trunk/utils/bless.d

    r218 r280  
    11/+ 
    2     Copyright (c) 2005 Eric Anderton 
     2    Copyright (c) 2005-2007 Eric Anderton 
    33             
    44    Permission is hereby granted, free of charge, to any person 
     
    3535private import ddl.ddl.DDLBinary; 
    3636 
    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; 
     37private import tango.io.File; 
     38private import tango.io.Stdout; 
     39private import tango.io.FilePath; 
     40private import tango.io.FileConduit; 
     41 
     42private import tango.text.stream.LineIterator; 
    4343 
    4444private import utils.bless_bn; 
     
    5656    char[] result; 
    5757     
    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
    6363     
    6464    return result;   
     
    6767 
    6868char[] helpText =  
    69 "Bless - DDL wrapper utility - V1.2 Build %d 
     69"Bless - DDL wrapper utility - V1.2 Build {0} 
    7070Copyright (C) 2005,2006 Eric Anderton 
    7171Documentation: http://www.dsource.org/projects/ddl 
     
    7676 
    7777Usage:  
    78   bless <object file> { -switch } 
     78  bless <object file> {{ -switch } 
    7979 
    8080  -v       verbose output 
     
    9191     
    9292    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
    9595        foreach(char[] ext; registry.getSupportedTypes){ 
    96             Stdout.print("%s ",ext);   
    97         } 
    98         Stdout.println("")
     96            Stdout.format("{0} ",ext);     
     97        } 
     98        Stdout.newline
    9999        return 0; 
    100100    } 
     
    103103 
    104104    // pick through the options (if any) 
    105     bit verbose = false; 
    106     bit extract = false; 
    107     bit noCreate = false; 
     105    bool verbose = false; 
     106    bool extract = false; 
     107    bool noCreate = false; 
    108108    char[] outputFileName = ""; 
    109109    char[] filename = ""; 
     
    112112    // configure the arg parser 
    113113    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); 
    115115        filename = value; 
    116116        return value.length; 
     
    157157     
    158158    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); 
    163163            while(iter.next){ 
    164164                parseAttribute(iter.get); 
    165165            } 
    166166            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       
    171171    }); 
    172172     
     
    179179     
    180180    // get the file 
    181     FileBuffer file = new FileBuffer(filename); 
     181    FileBuffer file = FileBuffer(filename); 
    182182    char[] originalOutputFile = filePathPart(file.getPath,PathPart.Root | PathPart.Path | PathPart.Name | PathPart.Suffix); 
    183183     
     
    187187     
    188188    if(noCreate){ 
    189         Stdout.println("loaded attributes:")
     189        Stdout.format("loaded attributes:").newline
    190190        foreach(char[] name,char[] value; attributes){ 
    191             Stdout.println("%s = %s",name,value)
     191            Stdout.format("{0} = {1}",name,value).newline
    192192        } 
    193193    } 
     
    196196    /* 
    197197    if(!file.exists){ 
    198         Stdout.println("File '%s' does not exist.",file.filename)
     198        Stdout.format("File '{0}' does not exist.",file.filename).newline
    199199        return 1; 
    200200    } 
     
    204204    //NOTE: rather than just be satisfied with what loader likes this file 
    205205    // we load the entire file via its loader to ensure that it will work later. 
    206     DynamicLibrary lib = registry.load(file.getPath.toString()); 
     206    DynamicLibrary lib = registry.load(file.getPath.toUtf8()); 
    207207         
    208208    if(!lib){ 
    209         Stdout.println("Cannot load '%s'",file.getPath.toString())
     209        Stdout.format("Cannot load '{0}'",file.getPath.toUtf8()).newline
    210210        return 1; 
    211211    } 
     
    213213    // output 
    214214    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
    217217    }    
    218218         
    219219    if(extract){ 
    220220        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
    222222            return 1; 
    223223        } 
    224224    }    
    225225    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
    227227        return 1; 
    228228    } 
     
    231231        // coerce complete load of the ddl binary file 
    232232        DDLBinary binary = new DDLBinary(); 
    233         binary.load(new FileBuffer(file.getPath)); 
     233        binary.load(FileBuffer(file.getPath)); 
    234234         
    235235        // save to output file 
     
    244244        } 
    245245                 
    246         if(verbose) Stdout.println("out file: '%s'",outputFileName)
     246        if(verbose) Stdout.format("out file: '{0}'",outputFileName).newline
    247247         
    248248        if(!noCreate){ 
    249249            File destFile = new File(outputFileName); 
    250250            destFile.write(binary.getBinaryData); 
    251             if(verbose) Stdout.println("Created '%s'",outputFileName)
     251            if(verbose) Stdout.format("Created '{0}'",outputFileName).newline
    252252        } 
    253253    } 
    254254    else{ 
    255         if(verbose) Stdout.println("out file: '%s'",outputFileName)
     255        if(verbose) Stdout.format("out file: '{0}'",outputFileName).newline
    256256 
    257257        // create the file and save it 
     
    268268                                 
    269269        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
    271271        } 
    272272 
     
    281281                    if(sym.type == SymbolType.Strong || SymbolType.Weak){                    
    282282                        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
    284284                    } 
    285285                    else{ 
    286286                        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
    288288                    } 
    289289                } 
     
    292292                 
    293293        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(); 
    299297             
    300             if(verbose) Stdout.println("Created '%s'",outputFileName)
     298            if(verbose) Stdout.format("Created '{0}'",outputFileName).newline
    301299        } 
    302300    } 
  • trunk/utils/bless_bn.d

    r277 r280  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 721
     4long auto_build_number = 742
  • trunk/utils/ddlinfo.d

    r219 r280  
    11/+ 
    2     Copyright (c) 2005-2006 Eric Anderton 
     2    Copyright (c) 2005-2007 Eric Anderton 
    33             
    44    Permission is hereby granted, free of charge, to any person 
     
    3333private import ddl.FileBuffer; 
    3434 
    35 private import mango.io.Stdout; 
     35private import tango.io.Stdout; 
    3636 
    3737char[] helpText =  
    38 "DDL Info - DDL information utility - V1.2 Build %d 
     38"DDL Info - DDL information utility - V1.2 Build {0} 
    3939Copyright (C) 2005-2006 Eric Anderton 
    4040Documentation: http://www.dsource.org/projects/ddl 
     
    4343 
    4444Usage:  
    45   ddlinfo <object file> { -switch } 
     45  ddlinfo <object file> {{ -switch } 
    4646   
    4747  -r       raw output instead of friendly names/symbols. 
     
    5555     
    5656    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
    5959        foreach(char[] ext; regsitry.getSupportedTypes){ 
    60             Stdout.print("%s ",ext);   
     60            Stdout.format("{0} ",ext);     
    6161        } 
    62         Stdout.println("")
     62        Stdout.newline
    6363        return 0; 
    6464    } 
     
    7373    // configure the arg parser 
    7474    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); 
    7676        filename = value; 
    7777        return value.length; 
     
    107107     
    108108    // get the file 
    109     FileBuffer file = new FileBuffer(filename);    
     109    FileBuffer file = FileBuffer(filename);    
    110110 
    111111    //TODO: validate a few things 
    112112/*  if(!file.exists){ 
    113         Stdout.println("file '%s' does not exist.",file.filename)
     113        Stdout.format("file '{0}' does not exist.",file.filename).newline
    114114        return 1; 
    115115    } 
     
    120120     
    121121    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
    123123        return 1; 
    124124    } 
    125125 
    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
    128128     
    129129    if(xRay){ 
    130         Stdout.println("%s",lib.toString())
     130        Stdout.format("{0}",lib.toUtf8()).newline
    131131    } 
    132132    else{ 
    133133        if(displayAttribs){ 
    134134            if(lib.getAttributes.length > 0){ 
    135                 Stdout.println("attributes: ")
     135                Stdout.format("attributes: ").newline
    136136                foreach(char[] name,char[] value; lib.getAttributes){ 
    137                     Stdout.println("%s - %s",name,value)
     137                    Stdout.format("{0} - {1}",name,value).newline
    138138                } 
    139139            } 
    140140        } 
    141141        if(displaySymbols){ 
    142             Stdout.println("\nModules (%d):",lib.getModules.length)
     142            Stdout.format("\nModules ({0}):",lib.getModules.length).newline
    143143            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
    146146                 
    147147                foreach(symbol; mod.getSymbols){ 
    148148                    if(rawOutput){ 
    149                         Stdout.println("%s %s",symbol.getTypeName,symbol.name)
     149                        Stdout.format("{0} {1}",symbol.getTypeName,symbol.name).newline
    150150                    } 
    151151                    else{ 
    152                         Stdout.println("%s %s",symbol.getTypeName,demangleSymbol(symbol.name))
     152                        Stdout.format("{0} {1}",symbol.getTypeName,demangleSymbol(symbol.name)).newline
    153153                    }                
    154154                } 
  • trunk/utils/ddlinfo_bn.d

    r277 r280  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 800
     4long auto_build_number = 822
  • trunk/utils/insitu.d

    r179 r280  
    11/+ 
    2     Copyright (c) 2005 Eric Anderton 
     2    Copyright (c) 2005-2007 Eric Anderton 
    33             
    44    Permission is hereby granted, free of charge, to any person 
     
    3535private import utils.ArgParser; 
    3636 
    37 private import mango.io.Stdout; 
    38 private import mango.io.FileConduit; 
    39 private import mango.text.Text
     37private import tango.io.Stdout; 
     38private import tango.io.FileConduit; 
     39private import Text = tango.text.Util
    4040 
    4141char[] helpText =  
    42 "InSitu - Optimized in situ module generator - V1.1 %d 
     42"InSitu - Optimized in situ module generator - V1.1 {0} 
    4343Copyright (C) 2005 Eric Anderton 
    4444Documentation: http://www.dsource.org/projects/ddl 
     
    4848 
    4949Usage:  
    50   insitu <map file>  { -switch } 
     50  insitu <map file>  {{ -switch } 
    5151   
    5252  -f    Specify output file 
     
    6464     
    6565    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
    6868        foreach(char[] ext; registry.getSupportedTypes){ 
    69             Stdout.print("%s ",ext); 
     69            Stdout.format("{0} ",ext); 
    7070        } 
    71         Stdout.println("")
     71        Stdout.newline
    7272        return 0; 
    7373    } 
     
    8282    // Configure the parser and parse the command line   
    8383    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); 
    8585        filename = value; 
    8686        return value.length; 
     
    109109     
    110110    // get the file 
    111     FileBuffer inputFile = new FileBuffer(filename);       
     111    FileBuffer inputFile = FileBuffer(filename);       
    112112         
    113113    if(outputFilename == ""){ 
    114         outputFilename = inputFile.getPath.toString;       
     114        outputFilename = inputFile.getPath.toUtf8;         
    115115    }    
    116116     
     
    119119    inputBinary.load(inputFile); 
    120120     
    121     //debugLog("%d bytes loaded",inputFile.buffer.length); 
    122     //debugLog("%d exports total",inputBinary.getAllSymbols().values.length); 
     121    debug debugLog("{0} bytes loaded",inputFile.buffer.length); 
     122    debug debugLog("{0} exports total",inputBinary.getAllSymbols().values.length); 
    123123    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            } 
    127129        } 
    128         else{ 
    129            outputFilename = outputFilename[0..split] ~ ".situ"; 
    130        
     130        // just append by default 
     131        outputFilename ~= ".situ";  
     132        filenameOverrideDone: {
    131133    } 
    132134     
    133     FileBuffer outputFile = new FileBuffer(outputFilename,FileStyle.ReadWriteCreate); 
     135    FileBuffer outputFile = FileBuffer(outputFilename,null); 
    134136             
    135137    // commit the data to the lib-style binary 
     
    138140    outputBinary.save(outputFile,compressionLevel); 
    139141     
    140     outputFile.flush(); 
    141     outputFile.getConduit().close(); 
     142    outputFile.save(); 
    142143 
    143144    return 0; 
  • trunk/utils/insitu_bn.d

    r277 r280  
    22// This file is automatically maintained by the BUILD utility, 
    33// Please refrain from manually editing it. 
    4 long auto_build_number = 718
     4long auto_build_number = 739