1 | #include <jenga/include/smoothie/LexicalAnalysis.h>
|
---|
2 |
|
---|
3 | #include "../BasicCompiler_Common/common.h"
|
---|
4 |
|
---|
5 | void KillSpaces(char *str1,char *str2){
|
---|
6 | int i,i2,i3,IsStr;
|
---|
7 | for(i=0,i2=0,IsStr=0;;i++,i2++){
|
---|
8 | if((str1[i]==' '||str1[i]=='\t')&&IsStr==0){
|
---|
9 | i3=i+1;
|
---|
10 | while(str1[i3]==' '||str1[i3]=='\t') i3++;
|
---|
11 | if(i!=0){
|
---|
12 | if(i==1){
|
---|
13 | if(IsVariableChar(str1[i-1])&&
|
---|
14 | IsVariableChar(str1[i3])){
|
---|
15 | //識別子間にある省略すべきでない空白
|
---|
16 | str2[i2++]=' ';
|
---|
17 | }
|
---|
18 | }
|
---|
19 | else{
|
---|
20 | if(str1[i-2]!=1&&IsVariableChar(str1[i-1])&&
|
---|
21 | IsVariableChar(str1[i3])){
|
---|
22 | //識別子間にある省略すべきでない空白
|
---|
23 | str2[i2++]=' ';
|
---|
24 | }
|
---|
25 | }
|
---|
26 | }
|
---|
27 | i=i3;
|
---|
28 | }
|
---|
29 | if(str1[i]=='\"') IsStr^=1;
|
---|
30 | str2[i2]=str1[i];
|
---|
31 | if(str1[i]=='\0') break;
|
---|
32 | }
|
---|
33 | }
|
---|
34 | void KillStringSpaces(char *str){
|
---|
35 | char *s2;
|
---|
36 |
|
---|
37 | extern HANDLE hHeap;
|
---|
38 | s2=(char *)HeapAlloc(hHeap,0,lstrlen(str)+1);
|
---|
39 | lstrcpy(s2,str);
|
---|
40 | KillSpaces(s2,str);
|
---|
41 | HeapDefaultFree(s2);
|
---|
42 | return;
|
---|
43 | }
|
---|
44 | BOOL RemoveStringQuotes(char *str){
|
---|
45 | int i;
|
---|
46 | if(str[0]!='\"') return 0;
|
---|
47 | for(i=0;;i++){
|
---|
48 | str[i]=str[i+1];
|
---|
49 | if(str[i]=='\"') break;
|
---|
50 | }
|
---|
51 | str[i]=0;
|
---|
52 | if(str[i+2]!='\0') return 0;
|
---|
53 | return 1;
|
---|
54 | }
|
---|
55 | void RemoveStringPare(char *str){
|
---|
56 | int i;
|
---|
57 | i=lstrlen(str);
|
---|
58 | if(str[0]!='('||str[i-1]!=')') return;
|
---|
59 | SlideString(str+1,-1);
|
---|
60 | str[i-2]=0;
|
---|
61 | }
|
---|
62 | void RemoveStringBracket(char *str){
|
---|
63 | int i;
|
---|
64 | i=lstrlen(str);
|
---|
65 | if(str[0]!='['||str[i-1]!=']') return;
|
---|
66 | SlideString(str+1,-1);
|
---|
67 | str[i-2]=0;
|
---|
68 | }
|
---|
69 | void SetStringQuotes(char *str){
|
---|
70 | int i;
|
---|
71 | if(str[0]=='\"') return;
|
---|
72 | i=lstrlen(str);
|
---|
73 | SlideString(str,1);
|
---|
74 | str[0]='\"';
|
---|
75 | str[i+1]='\"';
|
---|
76 | str[i+2]=0;
|
---|
77 | }
|
---|
78 | int FormatString_EscapeSequence(char *buffer){
|
---|
79 | int i2,i3,i4;
|
---|
80 |
|
---|
81 | for(i2=0,i3=0;;i2++,i3++){
|
---|
82 | if(IsDBCSLeadByte(buffer[i3])){
|
---|
83 | buffer[i2++]=buffer[i3++];
|
---|
84 | buffer[i2]=buffer[i3];
|
---|
85 | if(buffer[i3]=='\0') break;
|
---|
86 | continue;
|
---|
87 | }
|
---|
88 | if(buffer[i3]=='\\'){
|
---|
89 | switch(buffer[i3+1]){
|
---|
90 | case '\\':
|
---|
91 | buffer[i2]='\\';
|
---|
92 | i3++;
|
---|
93 | break;
|
---|
94 | case '0':
|
---|
95 | buffer[i2]='\0';
|
---|
96 | i3++;
|
---|
97 | break;
|
---|
98 | case 'n':
|
---|
99 | buffer[i2]='\n';
|
---|
100 | i3++;
|
---|
101 | break;
|
---|
102 | case 'q':
|
---|
103 | buffer[i2]='\"';
|
---|
104 | i3++;
|
---|
105 | break;
|
---|
106 | case 'r':
|
---|
107 | buffer[i2]='\r';
|
---|
108 | i3++;
|
---|
109 | break;
|
---|
110 | case 't':
|
---|
111 | buffer[i2]='\t';
|
---|
112 | i3++;
|
---|
113 | break;
|
---|
114 | case 'x':
|
---|
115 | //16進表記
|
---|
116 | char temporary[8];
|
---|
117 | temporary[0]=buffer[i3+2];
|
---|
118 | temporary[1]=buffer[i3+3];
|
---|
119 | temporary[2]=0;
|
---|
120 | CharUpper(temporary);
|
---|
121 |
|
---|
122 | i4=temporary[0]-0x30;
|
---|
123 | if(i4<0||9<i4){
|
---|
124 | i4=temporary[0]-0x41+10;
|
---|
125 | if(i4<0xA||0xF<i4){
|
---|
126 | buffer[i2]=buffer[i3];
|
---|
127 | break;
|
---|
128 | }
|
---|
129 | }
|
---|
130 | temporary[0]=i4;
|
---|
131 |
|
---|
132 | i4=temporary[1]-0x30;
|
---|
133 | if(i4<0||9<i4){
|
---|
134 | i4=temporary[1]-0x41+10;
|
---|
135 | if(i4<0xA||0xF<i4){
|
---|
136 | buffer[i2]=buffer[i3];
|
---|
137 | break;
|
---|
138 | }
|
---|
139 | }
|
---|
140 | temporary[1]=i4;
|
---|
141 |
|
---|
142 | buffer[i2]=temporary[0]*0x10+temporary[1];
|
---|
143 | i3+=3;
|
---|
144 | break;
|
---|
145 | default:
|
---|
146 | buffer[i2]=buffer[i3];
|
---|
147 | break;
|
---|
148 | }
|
---|
149 | }
|
---|
150 | else{
|
---|
151 | buffer[i2]=buffer[i3];
|
---|
152 | if(buffer[i3]=='\0') break;
|
---|
153 | }
|
---|
154 | }
|
---|
155 | return i2;
|
---|
156 | }
|
---|
157 | void SlideString(char *buffer, int slide){
|
---|
158 | char *temp;
|
---|
159 | temp=(char *)malloc(lstrlen(buffer)+1);
|
---|
160 | lstrcpy(temp,buffer);
|
---|
161 | lstrcpy(buffer+slide,temp);
|
---|
162 | free(temp);
|
---|
163 | }
|
---|
164 | void SlideBuffer(char *buffer,int length,int slide){
|
---|
165 | void *temp;
|
---|
166 | temp=malloc(length+1);
|
---|
167 | memcpy(temp,buffer,length);
|
---|
168 | memcpy(buffer+slide,temp,length);
|
---|
169 | free(temp);
|
---|
170 | }
|
---|
171 |
|
---|
172 | int GetCpFromLine(int LineNum){
|
---|
173 | extern char *basbuf;
|
---|
174 |
|
---|
175 | int i,nCount=0;
|
---|
176 | for(i=0;;i++){
|
---|
177 | if(basbuf[i]=='\n'){
|
---|
178 | nCount++;
|
---|
179 | if(LineNum==nCount){
|
---|
180 | for(i++;;i++){
|
---|
181 | if(IsCommandDelimitation(basbuf[i])) break;
|
---|
182 | }
|
---|
183 | return i;
|
---|
184 | }
|
---|
185 | }
|
---|
186 | }
|
---|
187 | }
|
---|
188 | BOOL GetLineNum(int pos,int *pLine,char *FileName){
|
---|
189 | extern INCLUDEFILEINFO IncludeFileInfo;
|
---|
190 | extern char *basbuf;
|
---|
191 | int i,i2,i3,i4,i5;
|
---|
192 |
|
---|
193 | i=pos;
|
---|
194 | if(basbuf[i]=='\n') i--;
|
---|
195 | for(i3=0,i2=0;i3<i;i3++){
|
---|
196 | if(basbuf[i3]=='\n') i2++;
|
---|
197 | if(basbuf[i3]=='\0') return 0;
|
---|
198 | }
|
---|
199 | i4=0;
|
---|
200 | while(IncludeFileInfo.LineOfFile[i2]!=IncludeFileInfo.LineOfFile[i4]) i4++;
|
---|
201 | for(i3=0,i5=0;i5<i4;i3++){
|
---|
202 | if(basbuf[i3]=='\n') i5++;
|
---|
203 | if(basbuf[i3]=='\0') return 0;
|
---|
204 | }
|
---|
205 | for(i5=0;i4<i2;i3++){
|
---|
206 | if(basbuf[i3]=='\n'){
|
---|
207 | i4++;
|
---|
208 | i5++;
|
---|
209 | if(IncludeFileInfo.LineOfFile[i2]<IncludeFileInfo.LineOfFile[i4]){
|
---|
210 | for(;IncludeFileInfo.LineOfFile[i2]!=IncludeFileInfo.LineOfFile[i4];i3++){
|
---|
211 | if(basbuf[i3]=='\n') i4++;
|
---|
212 | }
|
---|
213 | }
|
---|
214 | }
|
---|
215 | if(basbuf[i3]=='\0') return 0;
|
---|
216 | }
|
---|
217 |
|
---|
218 | if(IncludeFileInfo.LineOfFile[i2]==-1){
|
---|
219 | //ファイル・行番号を特定できなかった場合
|
---|
220 | *pLine=-1;
|
---|
221 | FileName[0]=0;
|
---|
222 | }
|
---|
223 | else{
|
---|
224 | //行番号をセット
|
---|
225 | *pLine=i5;
|
---|
226 |
|
---|
227 | //ファイル名をセット
|
---|
228 | lstrcpy(FileName,IncludeFileInfo.ppFileNames[IncludeFileInfo.LineOfFile[i2]]);
|
---|
229 | }
|
---|
230 |
|
---|
231 | return 1;
|
---|
232 | }
|
---|
233 |
|
---|
234 | char GetEndXXXCommand(char es){
|
---|
235 | switch(es){
|
---|
236 | case ESC_SUB:
|
---|
237 | return ESC_ENDSUB;
|
---|
238 | case ESC_FUNCTION:
|
---|
239 | return ESC_ENDFUNCTION;
|
---|
240 | case ESC_MACRO:
|
---|
241 | return ESC_ENDMACRO;
|
---|
242 | case ESC_TYPE:
|
---|
243 | return ESC_ENDTYPE;
|
---|
244 | case ESC_CLASS:
|
---|
245 | return ESC_ENDCLASS;
|
---|
246 | case ESC_INTERFACE:
|
---|
247 | return ESC_ENDINTERFACE;
|
---|
248 | case ESC_ENUM:
|
---|
249 | return ESC_ENDENUM;
|
---|
250 | }
|
---|
251 | return 0;
|
---|
252 | }
|
---|
253 | void GetDefaultNameFromES(char es,char *name){
|
---|
254 | name[0]=0;
|
---|
255 | switch(es){
|
---|
256 | case ESC_PSMEM:
|
---|
257 | lstrcpy(name,"->");
|
---|
258 | break;
|
---|
259 | case ESC_MOD:
|
---|
260 | lstrcpy(name,"Mod");
|
---|
261 | break;
|
---|
262 | case ESC_AND:
|
---|
263 | lstrcpy(name,"And");
|
---|
264 | break;
|
---|
265 | case ESC_OR:
|
---|
266 | lstrcpy(name,"Or");
|
---|
267 | break;
|
---|
268 | case ESC_XOR:
|
---|
269 | lstrcpy(name,"Xor");
|
---|
270 | break;
|
---|
271 | case ESC_NOT:
|
---|
272 | lstrcpy(name,"Not");
|
---|
273 | break;
|
---|
274 | case ESC_AS:
|
---|
275 | lstrcpy(name,"As");
|
---|
276 | break;
|
---|
277 | case ESC_THEN:
|
---|
278 | lstrcpy(name,"Then");
|
---|
279 | break;
|
---|
280 | case ESC_ELSE:
|
---|
281 | lstrcpy(name,"Else");
|
---|
282 | break;
|
---|
283 | case ESC_IF:
|
---|
284 | lstrcpy(name,"If");
|
---|
285 | break;
|
---|
286 | case ESC_ELSEIF:
|
---|
287 | lstrcpy(name,"ElseIf");
|
---|
288 | break;
|
---|
289 | case ESC_ENDIF:
|
---|
290 | lstrcpy(name,"End If");
|
---|
291 | break;
|
---|
292 | case ESC_DEF:
|
---|
293 | lstrcpy(name,"Def");
|
---|
294 | break;
|
---|
295 | case ESC_DECLARE:
|
---|
296 | lstrcpy(name,"Declare");
|
---|
297 | break;
|
---|
298 | case ESC_ABSTRACT:
|
---|
299 | lstrcpy(name,"Abstract");
|
---|
300 | break;
|
---|
301 | case ESC_VIRTUAL:
|
---|
302 | lstrcpy(name,"Virtual");
|
---|
303 | break;
|
---|
304 | case ESC_OVERRIDE:
|
---|
305 | lstrcpy(name,"Override");
|
---|
306 | break;
|
---|
307 | case ESC_SUB:
|
---|
308 | lstrcpy(name,"Sub");
|
---|
309 | break;
|
---|
310 | case ESC_ENDSUB:
|
---|
311 | lstrcpy(name,"End Sub");
|
---|
312 | break;
|
---|
313 | case ESC_EXITSUB:
|
---|
314 | lstrcpy(name,"Exit Sub");
|
---|
315 | break;
|
---|
316 | case ESC_FUNCTION:
|
---|
317 | lstrcpy(name,"Function");
|
---|
318 | break;
|
---|
319 | case ESC_ENDFUNCTION:
|
---|
320 | lstrcpy(name,"End Function");
|
---|
321 | break;
|
---|
322 | case ESC_EXITFUNCTION:
|
---|
323 | lstrcpy(name,"Exit Function");
|
---|
324 | break;
|
---|
325 | case ESC_BYVAL:
|
---|
326 | lstrcpy(name,"ByVal ");
|
---|
327 | break;
|
---|
328 | case ESC_BYREF:
|
---|
329 | lstrcpy(name,"ByRef ");
|
---|
330 | break;
|
---|
331 | case ESC_TYPE:
|
---|
332 | lstrcpy(name,"Type");
|
---|
333 | break;
|
---|
334 | case ESC_ENDTYPE:
|
---|
335 | lstrcpy(name,"End Type");
|
---|
336 | break;
|
---|
337 | case ESC_EXITFOR:
|
---|
338 | lstrcpy(name,"Exit For");
|
---|
339 | break;
|
---|
340 | case ESC_EXITWHILE:
|
---|
341 | lstrcpy(name,"Exit While");
|
---|
342 | break;
|
---|
343 | case ESC_EXITDO:
|
---|
344 | lstrcpy(name,"Exit Do");
|
---|
345 | break;
|
---|
346 | case ESC_SELECTCASE:
|
---|
347 | lstrcpy(name,"Select Case");
|
---|
348 | break;
|
---|
349 | case ESC_CASE:
|
---|
350 | lstrcpy(name,"Case");
|
---|
351 | break;
|
---|
352 | case ESC_CASEELSE:
|
---|
353 | lstrcpy(name,"Case Else");
|
---|
354 | break;
|
---|
355 | case ESC_ENDSELECT:
|
---|
356 | lstrcpy(name,"End Select");
|
---|
357 | break;
|
---|
358 | case ESC_CONST:
|
---|
359 | lstrcpy(name,"Const");
|
---|
360 | break;
|
---|
361 | case ESC_TYPEDEF:
|
---|
362 | lstrcpy(name,"TypeDef");
|
---|
363 | break;
|
---|
364 | case ESC_WITH:
|
---|
365 | lstrcpy(name,"With");
|
---|
366 | break;
|
---|
367 | case ESC_ENDWITH:
|
---|
368 | lstrcpy(name,"End With");
|
---|
369 | break;
|
---|
370 | case ESC_CDECL:
|
---|
371 | lstrcpy(name,"cdecl");
|
---|
372 | break;
|
---|
373 | case ESC_MACRO:
|
---|
374 | lstrcpy(name,"Macro");
|
---|
375 | break;
|
---|
376 | case ESC_ENDMACRO:
|
---|
377 | lstrcpy(name,"End Macro");
|
---|
378 | break;
|
---|
379 | case ESC_EXITMACRO:
|
---|
380 | lstrcpy(name,"Exit Macro");
|
---|
381 | break;
|
---|
382 | case ESC_EXPORT:
|
---|
383 | lstrcpy(name,"Export");
|
---|
384 | break;
|
---|
385 | case ESC_CONTINUE:
|
---|
386 | lstrcpy(name,"Continue");
|
---|
387 | break;
|
---|
388 | case ESC_CLASS:
|
---|
389 | lstrcpy(name,"Class");
|
---|
390 | break;
|
---|
391 | case ESC_ENDCLASS:
|
---|
392 | lstrcpy(name,"End Class");
|
---|
393 | break;
|
---|
394 | case ESC_INTERFACE:
|
---|
395 | lstrcpy(name,"Interface");
|
---|
396 | break;
|
---|
397 | case ESC_ENDINTERFACE:
|
---|
398 | lstrcpy(name,"End Interface");
|
---|
399 | break;
|
---|
400 | case ESC_ENUM:
|
---|
401 | lstrcpy(name,"Enum");
|
---|
402 | break;
|
---|
403 | case ESC_ENDENUM:
|
---|
404 | lstrcpy(name,"End Enum");
|
---|
405 | break;
|
---|
406 | }
|
---|
407 | }
|
---|
408 | void GetCalcName(int idCalc,char *name){
|
---|
409 | switch(idCalc){
|
---|
410 | case CALC_XOR:
|
---|
411 | lstrcpy(name,"xor");
|
---|
412 | break;
|
---|
413 | case CALC_OR:
|
---|
414 | lstrcpy(name,"or");
|
---|
415 | break;
|
---|
416 | case CALC_AND:
|
---|
417 | lstrcpy(name,"and");
|
---|
418 | break;
|
---|
419 | case CALC_NOT:
|
---|
420 | lstrcpy(name,"Not");
|
---|
421 | break;
|
---|
422 |
|
---|
423 | case CALC_PE:
|
---|
424 | lstrcpy(name,"<=");
|
---|
425 | break;
|
---|
426 | case CALC_QE:
|
---|
427 | lstrcpy(name,">=");
|
---|
428 | break;
|
---|
429 | case CALC_NOTEQUAL:
|
---|
430 | lstrcpy(name,"<>");
|
---|
431 | break;
|
---|
432 | case CALC_SUBSITUATION:
|
---|
433 | case CALC_EQUAL:
|
---|
434 | lstrcpy(name,"=");
|
---|
435 | break;
|
---|
436 | case CALC_P:
|
---|
437 | lstrcpy(name,"<");
|
---|
438 | break;
|
---|
439 | case CALC_Q:
|
---|
440 | lstrcpy(name,">");
|
---|
441 | break;
|
---|
442 |
|
---|
443 | case CALC_SHL:
|
---|
444 | lstrcpy(name,"<<");
|
---|
445 | break;
|
---|
446 | case CALC_SHR:
|
---|
447 | lstrcpy(name,">>");
|
---|
448 | break;
|
---|
449 | case CALC_ADDITION:
|
---|
450 | lstrcpy(name,"+");
|
---|
451 | break;
|
---|
452 | case CALC_SUBTRACTION:
|
---|
453 | lstrcpy(name,"-");
|
---|
454 | break;
|
---|
455 | case CALC_MOD:
|
---|
456 | lstrcpy(name,"mod");
|
---|
457 | break;
|
---|
458 | case CALC_PRODUCT:
|
---|
459 | lstrcpy(name,"*");
|
---|
460 | break;
|
---|
461 | case CALC_QUOTIENT:
|
---|
462 | lstrcpy(name,"/");
|
---|
463 | break;
|
---|
464 | case CALC_INTQUOTIENT:
|
---|
465 | lstrcpy(name,"\\");
|
---|
466 | break;
|
---|
467 | case CALC_AS:
|
---|
468 | lstrcpy(name,"As");
|
---|
469 | break;
|
---|
470 | case CALC_BYVAL:
|
---|
471 | lstrcpy(name,"ByVal");
|
---|
472 | break;
|
---|
473 | case CALC_MINUSMARK:
|
---|
474 | lstrcpy(name,"-");
|
---|
475 | break;
|
---|
476 | case CALC_POWER:
|
---|
477 | lstrcpy(name,"^");
|
---|
478 | break;
|
---|
479 |
|
---|
480 | case CALC_ARRAY_GET:
|
---|
481 | lstrcpy(name,"[]");
|
---|
482 | break;
|
---|
483 | case CALC_ARRAY_SET:
|
---|
484 | lstrcpy(name,"[]=");
|
---|
485 | break;
|
---|
486 | }
|
---|
487 | }
|
---|
488 |
|
---|
489 | BOOL IsFile(char *path){
|
---|
490 | WIN32_FIND_DATA wfd;
|
---|
491 | HANDLE hFind;
|
---|
492 |
|
---|
493 | hFind=FindFirstFile(path,&wfd);
|
---|
494 | if(hFind==INVALID_HANDLE_VALUE){
|
---|
495 | return 0;
|
---|
496 | }
|
---|
497 | FindClose(hFind);
|
---|
498 |
|
---|
499 | return 1;
|
---|
500 | }
|
---|
501 | BOOL GetFolder(HWND hWnd,char *folder,char *OpenFolderTitle){
|
---|
502 | BROWSEINFO BrowseInfo;
|
---|
503 | LPITEMIDLIST pidlBrowse;
|
---|
504 | LPMALLOC g_pMalloc;
|
---|
505 | char temporary[MAX_PATH];
|
---|
506 |
|
---|
507 | BrowseInfo.hwndOwner=hWnd;
|
---|
508 | BrowseInfo.pszDisplayName=temporary;
|
---|
509 | BrowseInfo.pidlRoot=NULL;
|
---|
510 | BrowseInfo.lpszTitle=OpenFolderTitle;
|
---|
511 | BrowseInfo.ulFlags=BIF_RETURNONLYFSDIRS;
|
---|
512 | BrowseInfo.lpfn=NULL;
|
---|
513 | BrowseInfo.lParam=(LPARAM)0;
|
---|
514 | BrowseInfo.iImage=0;
|
---|
515 | pidlBrowse=SHBrowseForFolder(&BrowseInfo);
|
---|
516 | if(pidlBrowse){
|
---|
517 | if(SHGetMalloc(&g_pMalloc)!=0) return 0;
|
---|
518 | SHGetPathFromIDList(pidlBrowse,folder);
|
---|
519 | g_pMalloc->Free(pidlBrowse);
|
---|
520 | g_pMalloc->Release();
|
---|
521 | return 1;
|
---|
522 | }
|
---|
523 | return 0;
|
---|
524 | }
|
---|
525 |
|
---|
526 | void ShortPathToLongPath(const char *ShortPath,char *LongPath){
|
---|
527 | HANDLE hFind;
|
---|
528 | WIN32_FIND_DATA wfd;
|
---|
529 | int i;
|
---|
530 | char dummy[MAX_PATH];
|
---|
531 | for(i=0;i<MAX_PATH;i++){
|
---|
532 | LongPath[i]=ShortPath[i];
|
---|
533 | if((ShortPath[i-1]==':'&&ShortPath[i]=='\\')||(ShortPath[i-1]=='\\'&&ShortPath[i]=='\\')){
|
---|
534 | LongPath[i+1]=0;
|
---|
535 | break;
|
---|
536 | }
|
---|
537 | }
|
---|
538 | if(ShortPath[i-1]=='\\'&&ShortPath[i]=='\\'){
|
---|
539 | for(i++;i<MAX_PATH;i++){
|
---|
540 | if(IsDBCSLeadByte(ShortPath[i])){
|
---|
541 | i++;
|
---|
542 | continue;
|
---|
543 | }
|
---|
544 | LongPath[i]=ShortPath[i];
|
---|
545 | if(ShortPath[i]=='\\'){
|
---|
546 | LongPath[i+1]=0;
|
---|
547 | break;
|
---|
548 | }
|
---|
549 | }
|
---|
550 | for(i++;i<MAX_PATH;i++){
|
---|
551 | if(IsDBCSLeadByte(ShortPath[i])){
|
---|
552 | i++;
|
---|
553 | continue;
|
---|
554 | }
|
---|
555 | LongPath[i]=ShortPath[i];
|
---|
556 | if(ShortPath[i]=='\\'){
|
---|
557 | LongPath[i+1]=0;
|
---|
558 | break;
|
---|
559 | }
|
---|
560 | }
|
---|
561 | }
|
---|
562 | for(i++;i<MAX_PATH;i++){
|
---|
563 | if(IsDBCSLeadByte(ShortPath[i])){
|
---|
564 | i++;
|
---|
565 | continue;
|
---|
566 | }
|
---|
567 | if(ShortPath[i]=='\\'||ShortPath[i]=='\0'){
|
---|
568 | strncpy(dummy,ShortPath,i);
|
---|
569 | dummy[i]=0;
|
---|
570 | if((hFind=FindFirstFile(dummy,&wfd))!=INVALID_HANDLE_VALUE) FindClose(hFind);
|
---|
571 | lstrcat(LongPath,wfd.cFileName);
|
---|
572 |
|
---|
573 | if(ShortPath[i]=='\0') break;
|
---|
574 | lstrcat(LongPath,"\\");
|
---|
575 |
|
---|
576 | if(ShortPath[i]=='\\'&&ShortPath[i+1]=='\0'){
|
---|
577 | break;
|
---|
578 | }
|
---|
579 | }
|
---|
580 | }
|
---|
581 | }
|
---|