Changeset 21 for Include/basic/command.sbp
- Timestamp:
- Nov 27, 2006, 3:00:10 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/basic/command.sbp
r1 r21 35 35 36 36 Macro EXEC(lpFilePath As *Byte)(lpCmdLine As *Byte) 37 ShellExecute(0, "open", lpFilePath, lpCmdLine, 0,SW_SHOWNORMAL)37 ShellExecute(0,"open",lpFilePath,lpCmdLine,0,SW_SHOWNORMAL) 38 38 End Macro 39 39 … … 56 56 '---------------- 57 57 58 Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)58 Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord) 59 59 If VarPtr(retAns) Then 60 retAns = MessageBox(hWnd, str, title, boxType)60 retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType) 61 61 Else 62 MessageBox(hWnd, str, title, boxType)62 MessageBox(hWnd,lpStr,lpTitle,BoxType) 63 63 End If 64 64 End Macro 65 65 66 Macro WINDOW(ByRef hWnd As Long, hOwner As HWND, x As Long, y As Long, nWidth As Long, nHeight As Long, ByRef title As String, dwStyle As DWord)(ByRef classNameAs String, id As DWord, lpFunc As DWord, dwExStyle As DWord)66 Macro WINDOW(ByRef hWnd As Long, hOwner As Long, x As Long, y As Long, nWidth As Long, nHeight As Long, lpTitle As String, dwStyle As DWord)(lpClass As String, id As DWord, lpFunc As DWord, dwExStyle As DWord) 67 67 If VarPtr(hWnd) Then 68 hWnd = CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0),NULL)68 hWnd=CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL) 69 69 Else 70 CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0),NULL)70 CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL) 71 71 End If 72 72 End Macro … … 76 76 End Macro 77 77 78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)( ByRef strAs String, id As Long, hSubMenu As HMENU, state As Long)78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long) 79 79 Dim mii As MENUITEMINFO 80 80 81 ZeroMemory(VarPtr(mii), Len(mii)) 82 With mii 83 .cbSize = Len(mii) 84 .fMask = IIM_TYPE 85 86 If str.Length = 0 Then 87 .fType = MFT_SEPARATOR 88 Else 89 .fType = MFT_STRING 90 .fMask = .fMask or MIIM_STATE or MIIM_ID 91 .dwTypeData = str.Chars 92 .wID = id 93 If hSubMenu Then 94 .fMask = .fMask or MIIM_SUBMENU 95 .hSubMenu = hSubMenu 96 End If 97 .fState = state 81 FillMemory(VarPtr(mii),Len(mii),0) 82 mii.cbSize=Len(mii) 83 mii.fMask=MIIM_TYPE 84 85 If lpString.Length=0 Then 86 mii.fType=MFT_SEPARATOR 87 Else 88 mii.fType=MFT_STRING 89 mii.fMask=mii.fMask or MIIM_STATE or MIIM_ID 90 mii.dwTypeData=StrPtr(lpString) 91 mii.wID=id 92 If hSubMenu Then 93 mii.fMask=mii.fMask or MIIM_SUBMENU 94 mii.hSubMenu=hSubMenu 98 95 End If 99 End With 100 101 InsertMenuItem(hMenu, PosID, flag, mii) 96 mii.fState=state 97 End If 98 99 InsertMenuItem(hMenu,PosID,flag,mii) 102 100 End Macro 103 101 … … 107 105 '-------------- 108 106 109 Dim _System_hFile[255] As HANDLE 110 111 Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long) 107 Dim _System_hFile(255) As Long 108 Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long) 112 109 Dim dwAccess As Long 113 110 Dim bAppend As Long 114 111 Dim dwCreationDisposition As Long 115 112 116 FileNumber --113 FileNumber=FileNumber-1 117 114 118 115 bAppend=0 … … 133 130 End Select 134 131 135 _System_hFile[FileNumber] = CreateFile(fileName, dwAccess, 0, ByVal 0, dwCreationDisposition, FILE_ATTRIBUTE_NORMAL, 0) 136 137 If bAppend Then SetFilePointer(_System_hFile[FileNumber], 0, 0, FILE_END) 138 End Macro 139 132 _System_hFile(FileNumber)=CreateFile(lpFileName,dwAccess,0,ByVal NULL,dwCreationDisposition,FILE_ATTRIBUTE_NORMAL,NULL) 133 134 If bAppend Then SetFilePointer(_System_hFile(FileNumber),0,NULL,FILE_END) 135 End Macro 140 136 Macro CLOSE()(FileNumber As Long) 141 FileNumber --137 FileNumber=FileNumber-1 142 138 143 139 If _System_hFile(FileNumber) Then 144 CloseHandle(_System_hFile [FileNumber])145 _System_hFile(FileNumber) =0140 CloseHandle(_System_hFile(FileNumber)) 141 _System_hFile(FileNumber)=0 146 142 End If 147 143 End Macro … … 151 147 Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord 152 148 Sub INPUT_FromFile(FileNumber As Long) 153 Dim i As Long ,i2 As Long, i3 As Long149 Dim i As Long ,i2 As Long, i3 As Long 154 150 Dim buffer As String 155 151 Dim temp[1] As Byte … … 157 153 Dim IsStr As Long 158 154 159 FileNumber --155 FileNumber=FileNumber-1 160 156 161 157 buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0)) … … 177 173 IsStr=0 178 174 While 1 179 i3 ++175 i3=i3+1 180 176 181 177 i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0) … … 201 197 If dwAccessBytes=0 Then Exit While 202 198 If temp[0]=Asc(",") Then Exit While 203 If temp[0] <> 32 And temp[0] <> 9Then199 If Not(temp[0]=32 or temp[0]=9) Then 204 200 SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT) 205 201 Exit While … … 231 227 Dim pTempStr As *String 232 228 pTempStr=_System_InputDataPtr[i] As *String 233 pTempStr->Assign(buffer.Chars, i3) 229 230 pTempStr->Length=i3 231 pTempStr->Chars=_System_realloc(pTempStr->Chars,pTempStr->Length+1) 232 memcpy(pTempStr->Chars,buffer.Chars,pTempStr->Length) 233 pTempStr->Chars[pTempStr->Length]=0 234 234 End Select 235 235 236 i ++236 i=i+1 237 237 If _System_InputDataPtr[i]=0 Then Exit While 238 238 Wend … … 241 241 Sub PRINT_ToFile(FileNumber As Long, buf As String) 242 242 Dim dwAccessByte As DWord 243 FileNumber --243 FileNumber=FileNumber-1 244 244 245 245 WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL) … … 263 263 buffer[i3]=UsingStr[i2] 264 264 If UsingStr[i2]=0 Then Exit While 265 i2 ++266 i3 ++265 i2=i2+1 266 i3=i3+1 267 267 Wend 268 268 … … 274 274 275 275 Dim length_num As Long, length_buf As Long 276 Dim dblRoundOff =0 As Double276 Dim dblRoundOff=0 As Double 277 277 278 278 … … 283 283 i4=i2 284 284 While UsingStr[i4]=Asc("#") 285 i4 ++285 i4=i4+1 286 286 Wend 287 287 If UsingStr[i4]=Asc(".") Then 288 i4 ++288 i4=i4+1 289 289 290 290 dblRoundOff=0.5 291 291 While UsingStr[i4]=Asc("#") 292 i4 ++292 i4=i4+1 293 293 dblRoundOff=dblRoundOff/10 294 294 Wend … … 304 304 305 305 '符号が有る場合は、一文字分のスペースを考慮する 306 If sign Then length_num ++306 If sign Then length_num=length_num+1 307 307 308 308 length_buf=0 309 309 Do 310 i2 ++311 length_buf ++310 i2=i2+1 311 length_buf=length_buf+1 312 312 Loop While UsingStr[i2]=Asc("#") 313 313 … … 315 315 '通常時 316 316 FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" ")) 317 i3 += length_buf - length_num317 i3=i3+(length_buf-length_num) 318 318 319 319 If sign Then 320 320 buffer[i3]=Asc("-") 321 i3 ++322 323 length_num --321 i3=i3+1 322 323 length_num=length_num-1 324 324 End If 325 325 … … 330 330 End If 331 331 332 i3 +=length_num332 i3=i3+length_num 333 333 Else 334 334 '表示桁が足りないとき 335 335 FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#")) 336 i3 +=length_buf336 i3=i3+length_buf 337 337 End If 338 338 339 339 If UsingStr[i2]=Asc(".") Then 340 340 buffer[i3]=UsingStr[i2] 341 i2 ++342 i3 ++341 i2=i2+1 342 i3=i3+1 343 343 344 344 i4=dec … … 349 349 buffer[i3]=temp2[i4] 350 350 End If 351 i3 ++352 i4 ++353 354 i2 ++351 i3=i3+1 352 i4=i4+1 353 354 i2=i2+1 355 355 Wend 356 356 End If 357 357 ElseIf UsingStr[i2]=Asc("@") Then 358 i2 ++1358 i2=i2+1 359 359 360 360 lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum]) 361 i3 +=lstrlen(_System_UsingStrData[ParmNum])361 i3=i3+lstrlen(_System_UsingStrData[ParmNum]) 362 362 ElseIf UsingStr[i2]=Asc("&") Then 363 363 i4=0 364 364 Do 365 i4 ++366 i2 ++365 i4=i4+1 366 i2=i2+1 367 367 Loop While UsingStr[i2]=Asc(" ") 368 368 369 369 If UsingStr[i2]=Asc("&") Then 370 i4 ++371 i2 ++370 i4=i4+1 371 i2=i2+1 372 372 i5=lstrlen(_System_UsingStrData[ParmNum]) 373 373 If i4<=i5 Then … … 377 377 End If 378 378 memcpy(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum],i5) 379 i3 +=i4379 i3=i3+i4 380 380 Else 381 i2 -=i4381 i2=i2-i4 382 382 buffer[i3]=Asc("&") 383 i2 ++384 i3 ++383 i2=i2+1 384 i3=i3+1 385 385 Continue 386 386 End If 387 387 End If 388 388 389 ParmNum ++389 ParmNum=ParmNum+1 390 390 Wend 391 391 392 392 _System_GetUsingFormat=Left$(buffer,lstrlen(buffer)) 393 393 End Function 394 395 394 Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String) 396 395 Dim dwAccessByte As DWord 397 396 Dim buf As String 398 397 399 FileNumber --398 FileNumber=FileNumber-1 400 399 buf=_System_GetUsingFormat(UsingStr) 401 400 … … 404 403 405 404 Dim _System_FieldSize(255) As Long 406 407 405 Macro FIELD(FileNumber As Long, FieldSize As Long) 408 FileNumber --406 FileNumber=FileNumber-1 409 407 410 408 _System_FieldSize(FileNumber)=FieldSize 411 409 End Macro 412 413 410 Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 414 411 Dim dwAccessByte As Long 415 412 416 FileNumber --417 RecodeNumber --413 FileNumber=FileNumber-1 414 RecodeNumber=RecodeNumber-1 418 415 419 416 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 424 421 End If 425 422 End Macro 426 427 423 Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String) 428 424 Dim dwAccessByte As Long 429 425 430 FileNumber --431 RecodeNumber --426 FileNumber=FileNumber-1 427 RecodeNumber=RecodeNumber-1 432 428 433 429 SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN) … … 435 431 End Macro 436 432 437 Macro CHDIR( ByRefpath As String)433 Macro CHDIR(path As String) 438 434 SetCurrentDirectory(path) 439 435 End Macro 440 441 Macro MKDIR(ByRef path As String) 436 Macro MKDIR(path As String) 442 437 CreateDirectory(path,ByVal 0) 443 438 End Macro 444 445 Macro KILL(ByRef path As String) 439 Macro KILL(path As String) 446 440 DeleteFile(path) 447 441 End Macro
Note:
See TracChangeset
for help on using the changeset viewer.