Changeset 319
- Timestamp:
- 04/25/07 03:54:23 (2 years ago)
- Files:
-
- trunk/bintod/bintod.d (modified) (5 diffs)
- trunk/rakefile (modified) (1 diff)
- trunk/swt-3.2.1-examples/resources_addressbook.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_clipboard.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_control.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_dnd.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_graphics.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_helloworld1.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_helloworld2.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_helloworld3.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_helloworld4.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_helloworld5.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_hoverhelp.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_imageanalyzer.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_javaviewer.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_layoutexample.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_paint.d (modified) (1 prop)
- trunk/swt-3.2.1-examples/resources_wizard.d (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bintod/bintod.d
r308 r319 27 27 import tango.text.convert.Utf; 28 28 import tango.text.convert.UnicodeBom; 29 import tango.text.Util : containsPattern;29 import tango.text.Util : replace, containsPattern; 30 30 import tango.text.stream.LineIterator; 31 31 … … 119 119 } ); 120 120 121 conduit.close(); 121 122 return(config); 122 123 } … … 128 129 } 129 130 Config config = parserConfig(args[1]); 130 auto cfgIter = new LineIterator!(char) (new FileConduit(args[1], FileConduit.ReadWriteCreate)); 131 auto config_src = new FileConduit(args[1], FileConduit.ReadExisting ); 132 auto cfgIter = new LineIterator!(char) ( config_src ); 131 133 132 134 FileConduit file = new FileConduit(config.mTargetFile, FileConduit.ReadWriteCreate); … … 142 144 mWriter.formatln(cfgIter.get); 143 145 } 146 config_src.close(); 144 147 mWriter.formatln("module {0};", config.mTargetModule); 145 148 mWriter.formatln(""); … … 160 163 foreach (ResourceData res; config.mResources) { 161 164 mWriter.formatln("version( {0} ){{", res.mVersion); 162 mWriter.formatln(" ubyte[] {0} = [ cast(ubyte)", res.mVarName); 163 FileConduit dataFc = new FileConduit(res.mFile, FileConduit.ReadWriteCreate); 165 166 version( Windows ){ 167 char[] fn = replace( res.mFile, '/', '\\' ); 168 } 169 else version( linux ){ 170 char[] fn = replace( res.mFile, '\\', '/' ); 171 } 172 auto path = new FilePath( fn ); 173 if( path.exists() ){ 174 Stdout.formatln( "processing file {}", fn ); 175 } 176 else{ 177 Stdout.formatln( "BINTOD Error: file {} does not exist.", fn ); 178 } 179 FileConduit dataFc = new FileConduit( fn, FileConduit.ReadExisting ); 164 180 ubyte[] data = new ubyte[] (dataFc.length); 165 181 dataFc.read(data); 182 dataFc.close(); 166 183 char[] showLine; 167 184 const LINE_ITEMCOUNT = 16; 168 185 uint lastIdx; 169 foreach (uint idx, ubyte d; data) { 170 lastIdx = idx; 171 if ((idx % LINE_ITEMCOUNT) == 0) { 172 mWriter(" "); 173 } 174 mWriter.format("0x{0:X2}, ", d); 175 if (isAlphaNumeric(d) || .containsPattern(" []{};:'\"~`!@#$%^&*()_+=-/?.>,<\\|", [cast(char)d])) { 176 showLine ~= d; 177 } 178 else { 179 switch (d) { 180 case '\n': 181 showLine ~= "\u00b6"; 182 break; 183 184 case '\t': 185 showLine ~= "\u00bb"; 186 break; 187 188 default: 189 showLine ~= '.'; 190 break; 191 } 192 } 193 if ((idx % LINE_ITEMCOUNT) == LINE_ITEMCOUNT - 1) { 194 mWriter.format(" // [0x{:X6}] {}", idx - (LINE_ITEMCOUNT - 1), showLine); 195 showLine = null; 186 if( data.length == 0 ){ 187 mWriter.formatln(" ubyte[] {0};", res.mVarName); 188 } 189 else{ 190 mWriter.formatln(" ubyte[] {0} = [ cast(ubyte)", res.mVarName); 191 foreach (uint idx, ubyte d; data) { 192 lastIdx = idx; 193 if ((idx % LINE_ITEMCOUNT) == 0) { 194 mWriter(" "); 195 } 196 mWriter.format("0x{0:X2}, ", d); 197 if (isAlphaNumeric(d) || .containsPattern(" []{};:'\"~`!@#$%^&*()_+=-/?.>,<\\|", [cast(char)d])) { 198 showLine ~= d; 199 } 200 else { 201 switch (d) { 202 case '\n': 203 showLine ~= "\u00b6"; 204 break; 205 206 case '\t': 207 showLine ~= "\u00bb"; 208 break; 209 210 default: 211 showLine ~= '.'; 212 break; 213 } 214 } 215 if ((idx % LINE_ITEMCOUNT) == LINE_ITEMCOUNT - 1) { 216 mWriter.format(" // [0x{:X6}] {}", idx - (LINE_ITEMCOUNT - 1), showLine); 217 showLine = null; 218 mWriter.newline(); 219 } 220 } 221 mWriter.format("];"); 222 bool printLastShowLine = false; 223 bool firstFill = true; 224 while ((lastIdx % LINE_ITEMCOUNT) != LINE_ITEMCOUNT - 1) { 225 if (!firstFill) { 226 mWriter(" "); 227 } 228 mWriter(" "); 229 firstFill = false; 230 lastIdx++; 231 printLastShowLine = true; 232 } 233 if (printLastShowLine) { 234 mWriter.format("// [0x{:X6}] {}", lastIdx - (LINE_ITEMCOUNT - 1), showLine); 196 235 mWriter.newline(); 197 236 } 198 }199 mWriter.format("];");200 bool printLastShowLine = false;201 bool firstFill = true;202 while ((lastIdx % LINE_ITEMCOUNT) != LINE_ITEMCOUNT - 1) {203 if (!firstFill) {204 mWriter(" ");205 }206 mWriter(" ");207 firstFill = false;208 lastIdx++;209 printLastShowLine = true;210 }211 if (printLastShowLine) {212 mWriter.format("// [0x{:X6}] {}", lastIdx - (LINE_ITEMCOUNT - 1), showLine);213 mWriter.newline();214 237 } 215 238 mWriter.formatln("}"c); trunk/rakefile
r318 r319 116 116 file resources => [resources_cfg, BINTOD_CMD] do 117 117 runInPath SWT_EXAMPLES do 118 puts "running bintod is disable, due to a bug on windows. Using the svn version of the #{resources}" 119 #sh P("../#{BINTOD_CMD} resources_#{t}.xml") 118 sh P("../#{BINTOD_CMD} resources_#{t}.xml") 120 119 end 121 120 end trunk/swt-3.2.1-examples/resources_addressbook.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_clipboard.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_control.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_dnd.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_graphics.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_helloworld1.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_helloworld2.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_helloworld3.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_helloworld4.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_helloworld5.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_hoverhelp.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_imageanalyzer.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_javaviewer.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_layoutexample.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_paint.d
- Property svn:eol-style set to native
trunk/swt-3.2.1-examples/resources_wizard.d
- Property svn:eol-style set to native
