Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/basic/command.sbp

    r21 r1  
    3535
    3636Macro 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)
    3838End Macro
    3939
     
    5656'----------------
    5757
    58 Macro MSGBOX(hWnd As HWND, lpStr As String)(lpTitle As String, BoxType As DWord, ByRef retAns As DWord)
     58Macro MSGBOX(hWnd As HWND, ByRef str As String)(ByRef title As String, boxType As DWord, ByRef retAns As DWord)
    5959    If VarPtr(retAns) Then
    60         retAns=MessageBox(hWnd,lpStr,lpTitle,BoxType)
     60        retAns = MessageBox(hWnd, str, title, boxType)
    6161    Else
    62         MessageBox(hWnd,lpStr,lpTitle,BoxType)
     62        MessageBox(hWnd, str, title, boxType)
    6363    End If
    6464End Macro
    6565
    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)
     66Macro 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 className As String, id As DWord, lpFunc As DWord, dwExStyle As DWord)
    6767    If VarPtr(hWnd) Then
    68         hWnd=CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)
     68        hWnd = CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0), NULL)
    6969    Else
    70         CreateWindowEx(dwExStyle,lpClass,lpTitle,dwStyle,x,y,nWidth,nHeight,hOwner,id,GetModuleHandle(0),NULL)
     70        CreateWindowEx(dwExStyle, className.Chars, title, dwStyle, x, y, nWidth, nHeight, hOwner, id, GetModuleHandle(0), NULL)
    7171    End If
    7272End Macro
     
    7676End Macro
    7777
    78 Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(lpString As String, id As Long, hSubMenu As HMENU, state As Long)
     78Macro INSMENU(hMenu As HMENU, PosID As Long, flag As Long)(ByRef str As String, id As Long, hSubMenu As HMENU, state As Long)
    7979    Dim mii As MENUITEMINFO
    8080
    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
     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
    9598        End If
    96         mii.fState=state
    97     End If
    98 
    99     InsertMenuItem(hMenu,PosID,flag,mii)
     99    End With
     100
     101    InsertMenuItem(hMenu, PosID, flag, mii)
    100102End Macro
    101103
     
    105107'--------------
    106108
    107 Dim _System_hFile(255) As Long
    108 Macro OPEN(lpFileName As String, AccessFor As Long, FileNumber As Long)
     109Dim _System_hFile[255] As HANDLE
     110
     111Macro OPEN(ByRef fileName As String, AccessFor As Long, FileNumber As Long)
    109112    Dim dwAccess As Long
    110113    Dim bAppend As Long
    111114    Dim dwCreationDisposition As Long
    112115
    113     FileNumber=FileNumber-1
     116    FileNumber--
    114117
    115118    bAppend=0
     
    130133    End Select
    131134
    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
     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)
     138End Macro
     139
    136140Macro CLOSE()(FileNumber As Long)
    137     FileNumber=FileNumber-1
     141    FileNumber--
    138142
    139143    If _System_hFile(FileNumber) Then
    140         CloseHandle(_System_hFile(FileNumber))
    141         _System_hFile(FileNumber)=0
     144        CloseHandle(_System_hFile[FileNumber])
     145        _System_hFile(FileNumber) = 0
    142146    End If
    143147End Macro
     
    147151Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
    148152Sub INPUT_FromFile(FileNumber As Long)
    149     Dim i As Long ,i2 As Long, i3 As Long
     153    Dim i As Long, i2 As Long, i3 As Long
    150154    Dim buffer As String
    151155    Dim temp[1] As Byte
     
    153157    Dim IsStr As Long
    154158
    155     FileNumber=FileNumber-1
     159    FileNumber--
    156160
    157161    buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0))
     
    173177        IsStr=0
    174178        While 1
    175             i3=i3+1
     179            i3++
    176180
    177181            i2=ReadFile(_System_hFile[FileNumber],temp,1,VarPtr(dwAccessBytes),ByVal 0)
     
    197201                        If dwAccessBytes=0 Then Exit While
    198202                        If temp[0]=Asc(",") Then Exit While
    199                         If Not(temp[0]=32 or temp[0]=9) Then
     203                        If temp[0] <> 32 And temp[0] <> 9 Then
    200204                            SetFilePointer(_System_hFile[FileNumber],-1,0,FILE_CURRENT)
    201205                            Exit While
     
    227231                Dim pTempStr As *String
    228232                pTempStr=_System_InputDataPtr[i] As *String
    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
     233                pTempStr->Assign(buffer.Chars, i3)
    234234        End Select
    235235
    236         i=i+1
     236        i++
    237237        If _System_InputDataPtr[i]=0 Then Exit While
    238238    Wend
     
    241241Sub PRINT_ToFile(FileNumber As Long, buf As String)
    242242    Dim dwAccessByte As DWord
    243     FileNumber=FileNumber-1
     243    FileNumber--
    244244
    245245    WriteFile(_System_hFile(FileNumber),buf,Len(buf),VarPtr(dwAccessByte),ByVal NULL)
     
    263263            buffer[i3]=UsingStr[i2]
    264264            If UsingStr[i2]=0 Then Exit While
    265             i2=i2+1
    266             i3=i3+1
     265            i2++
     266            i3++
    267267        Wend
    268268
     
    274274
    275275            Dim length_num As Long, length_buf As Long
    276             Dim dblRoundOff=0 As Double
     276            Dim dblRoundOff = 0 As Double
    277277
    278278
     
    283283            i4=i2
    284284            While UsingStr[i4]=Asc("#")
    285                 i4=i4+1
     285                i4++
    286286            Wend
    287287            If UsingStr[i4]=Asc(".") Then
    288                 i4=i4+1
     288                i4++
    289289
    290290                dblRoundOff=0.5
    291291                While UsingStr[i4]=Asc("#")
    292                     i4=i4+1
     292                    i4++
    293293                    dblRoundOff=dblRoundOff/10
    294294                Wend
     
    304304
    305305            '符号が有る場合は、一文字分のスペースを考慮する
    306             If sign Then length_num=length_num+1
     306            If sign Then length_num++
    307307
    308308            length_buf=0
    309309            Do
    310                 i2=i2+1
    311                 length_buf=length_buf+1
     310                i2++
     311                length_buf++
    312312            Loop While UsingStr[i2]=Asc("#")
    313313
     
    315315                '通常時
    316316                FillMemory(StrPtr(buffer)+i3,length_buf-length_num,Asc(" "))
    317                 i3=i3+(length_buf-length_num)
     317                i3 += length_buf - length_num
    318318
    319319                If sign Then
    320320                    buffer[i3]=Asc("-")
    321                     i3=i3+1
    322 
    323                     length_num=length_num-1
     321                    i3++
     322
     323                    length_num--
    324324                End If
    325325
     
    330330                End If
    331331
    332                 i3=i3+length_num
     332                i3 += length_num
    333333            Else
    334334                '表示桁が足りないとき
    335335                FillMemory(StrPtr(buffer)+i3,length_buf,Asc("#"))
    336                 i3=i3+length_buf
     336                i3 += length_buf
    337337            End If
    338338
    339339            If UsingStr[i2]=Asc(".") Then
    340340                buffer[i3]=UsingStr[i2]
    341                 i2=i2+1
    342                 i3=i3+1
     341                i2++
     342                i3++
    343343
    344344                i4=dec
     
    349349                        buffer[i3]=temp2[i4]
    350350                    End If
    351                     i3=i3+1
    352                     i4=i4+1
    353 
    354                     i2=i2+1
     351                    i3++
     352                    i4++
     353
     354                    i2++
    355355                Wend
    356356            End If
    357357        ElseIf UsingStr[i2]=Asc("@") Then
    358             i2=i2+1
     358            i2++1
    359359
    360360            lstrcat(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum])
    361             i3=i3+lstrlen(_System_UsingStrData[ParmNum])
     361            i3 += lstrlen(_System_UsingStrData[ParmNum])
    362362        ElseIf UsingStr[i2]=Asc("&") Then
    363363            i4=0
    364364            Do
    365                 i4=i4+1
    366                 i2=i2+1
     365                i4++
     366                i2++
    367367            Loop While UsingStr[i2]=Asc(" ")
    368368
    369369            If UsingStr[i2]=Asc("&") Then
    370                 i4=i4+1
    371                 i2=i2+1
     370                i4++
     371                i2++
    372372                i5=lstrlen(_System_UsingStrData[ParmNum])
    373373                If i4<=i5 Then
     
    377377                End If
    378378                memcpy(StrPtr(buffer)+i3,_System_UsingStrData[ParmNum],i5)
    379                 i3=i3+i4
     379                i3 += i4
    380380            Else
    381                 i2=i2-i4
     381                i2 -= i4
    382382                buffer[i3]=Asc("&")
    383                 i2=i2+1
    384                 i3=i3+1
     383                i2++
     384                i3++
    385385                Continue
    386386            End If
    387387        End If
    388388
    389         ParmNum=ParmNum+1
     389        ParmNum++
    390390    Wend
    391391
    392392    _System_GetUsingFormat=Left$(buffer,lstrlen(buffer))
    393393End Function
     394
    394395Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
    395396    Dim dwAccessByte As DWord
    396397    Dim buf As String
    397398
    398     FileNumber=FileNumber-1
     399    FileNumber--
    399400    buf=_System_GetUsingFormat(UsingStr)
    400401
     
    403404
    404405Dim _System_FieldSize(255) As Long
     406
    405407Macro FIELD(FileNumber As Long, FieldSize As Long)
    406     FileNumber=FileNumber-1
     408    FileNumber--
    407409
    408410    _System_FieldSize(FileNumber)=FieldSize
    409411End Macro
     412
    410413Macro GET(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    411414    Dim dwAccessByte As Long
    412415
    413     FileNumber=FileNumber-1
    414     RecodeNumber=RecodeNumber-1
     416    FileNumber--
     417    RecodeNumber--
    415418
    416419    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    421424    End If
    422425End Macro
     426
    423427Macro PUT(FileNumber As Long, RecodeNumber As Long, ByRef lpBuffer As String)
    424428    Dim dwAccessByte As Long
    425429
    426     FileNumber=FileNumber-1
    427     RecodeNumber=RecodeNumber-1
     430    FileNumber--
     431    RecodeNumber--
    428432
    429433    SetFilePointer(_System_hFile(FileNumber),RecodeNumber*_System_FieldSize(FileNumber),NULL,FILE_BEGIN)
     
    431435End Macro
    432436
    433 Macro CHDIR(path As String)
     437Macro CHDIR(ByRef path As String)
    434438    SetCurrentDirectory(path)
    435439End Macro
    436 Macro MKDIR(path As String)
     440
     441Macro MKDIR(ByRef path As String)
    437442    CreateDirectory(path,ByVal 0)
    438443End Macro
    439 Macro KILL(path As String)
     444
     445Macro KILL(ByRef path As String)
    440446    DeleteFile(path)
    441447End Macro
Note: See TracChangeset for help on using the changeset viewer.