Diff

Not logged in

Differences From Artifact [97a142a9264ab72a]:

To Artifact [9a6609551ad86e62]:


1 -private import std.string; 1 +private import win32.windows; 2 +private import std.string; 2 3 private import std.file; 3 -private import win32.ansi.windows; 4 4 5 -char lastChar( char[] s ) 6 - { return *CharPrev(s, cast(char*)s+s.length); } 5 +char lastChar( string s ) 6 + { return *CharPrevA(cast(char*)s.ptr, cast(char*)s.ptr+s.length); } 7 7 8 8 //---------------------------------------------------------------- 9 9 // int do_opApply!(E, C)( collection, delegate ); 10 10 // int do_opApply!(E) ( array, delegate ); 11 11 // forwarding the opApply call to another collection 12 12 //---------------------------------------------------------------- 13 13 ................................................................................ 67 67 foreach( int t ; x ) assert( t==2 ); 68 68 } 69 69 70 70 //---------------------------------------------------------------- 71 71 // コマンドライン解析 72 72 //---------------------------------------------------------------- 73 73 74 -char[][] cmd_parse( char[] str, bool in_resp=false ) 74 +string[] cmd_parse( string str, bool in_resp=false ) 75 75 { 76 - char[][] ans; 76 + string[] ans; 77 77 char resp_char = '@'; 78 78 79 79 for(int i=0; i!=str.length; ) 80 80 { 81 81 // 空白スキップ 82 82 while( i!=str.length && 0<=str[i] && str[i]<=' ' ) 83 83 ++i; 84 84 if( i == str.length ) 85 85 break; 86 86 87 87 // ""を考慮して一個パラメタ切り出し 88 - char[] param; 88 + string param; 89 89 if( str[i] == '"' ) 90 90 { 91 91 int j = ++i; 92 92 while( j!=str.length ) 93 93 { 94 94 if( str[j]=='"' && 95 95 (j+1==str.length || 0<=str[j+1] && str[j+1]<=' ') ) ................................................................................ 108 108 i = j; 109 109 } 110 110 111 111 // レスポンスファイル関連の処理 112 112 if( !in_resp && param[0]==resp_char ) 113 113 { 114 114 try { 115 - char[] rsp = cast(char[]) std.file.read( param[1 .. param.length] ); 115 + string rsp = cast(string) std.file.read( param[1 .. param.length] ); 116 116 ans ~= cmd_parse(rsp,true); 117 117 } catch( FileException e ) {} 118 118 } 119 119 else if( param.length>=2 && param[0..2]=="--" ) 120 120 { 121 121 resp_char = (param.length==2 ? '\0' : param[2]); 122 122 } ................................................................................ 128 128 return ans; 129 129 } 130 130 131 131 //---------------------------------------------------------------- 132 132 // DOS形式でファイル音更新時刻を書き換え 133 133 //---------------------------------------------------------------- 134 134 135 -void dosSetFTime( char[] fname, ushort date, ushort time ) 135 +void dosSetFTime( string fname, ushort date, ushort time ) 136 136 { 137 137 FILETIME ft,lc; 138 138 if( DosDateTimeToFileTime( date, time, &lc ) ) 139 139 if( LocalFileTimeToFileTime( &lc, &ft ) ) 140 140 { 141 - HANDLE han = CreateFile( toStringz(fname), 142 - GENERIC_READ | GENERIC_WRITE, 143 - FILE_SHARE_READ,NULL, 144 - OPEN_EXISTING, 145 - FILE_ATTRIBUTE_NORMAL, 146 - NULL ); 141 + HANDLE han = CreateFileA( toStringz(fname), 142 + GENERIC_READ | GENERIC_WRITE, 143 + FILE_SHARE_READ,null, 144 + OPEN_EXISTING, 145 + FILE_ATTRIBUTE_NORMAL, 146 + null ); 147 147 if( han==INVALID_HANDLE_VALUE ) 148 148 return; 149 149 150 - SetFileTime( han,&ft,NULL,&ft ); 150 + SetFileTime( han,&ft,null,&ft ); 151 151 CloseHandle( han ); 152 152 } 153 153 } 154 154 155 155 //---------------------------------------------------------------- 156 156 // 指定時刻(DOS形式)より新しいファイルか? 157 157 //---------------------------------------------------------------- 158 158 159 -bool newer_than( ushort d1, ushort t1, char[] fname ) 159 +bool newer_than( ushort d1, ushort t1, string fname ) 160 160 { 161 - HANDLE han = CreateFile( toStringz(fname), 162 - GENERIC_READ | GENERIC_WRITE, 163 - FILE_SHARE_READ,NULL, 164 - OPEN_EXISTING, 165 - FILE_ATTRIBUTE_NORMAL, 166 - NULL ); 161 + HANDLE han = CreateFileA( toStringz(fname), 162 + GENERIC_READ | GENERIC_WRITE, 163 + FILE_SHARE_READ,null, 164 + OPEN_EXISTING, 165 + FILE_ATTRIBUTE_NORMAL, 166 + null ); 167 167 if( han==INVALID_HANDLE_VALUE ) 168 168 return false; 169 169 FILETIME ft; 170 170 GetFileTime( han, null, null, &ft ); 171 171 CloseHandle( han ); 172 172 173 173 FILETIME lc;