Ignore:
Timestamp:
Jun 12, 2007, 7:24:38 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

StringBuilderを追加。String不変へ。共通の文字列操作関数をActiveBasic.Strings内に配置(設計に検討の余地あり)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/basic/command.sbp

    r269 r272  
    163163Dim _System_InputDataType[_System_MAX_PARMSNUM] As DWord
    164164Sub INPUT_FromFile(FileNumber As Long)
    165     Dim i As Long ,i2 As Long, i3 As Long
    166     Dim buffer As String
     165    FileNumber--
     166   
     167    Dim i = 0 As Long
     168    Dim i2 As Long, i3 As Long
     169    Dim buffer = New System.Text.StringBuilder(GetFileSize(_System_hFile[FileNumber], 0) + 1)
    167170    Dim temp[1] As StrChar
    168171    Dim dwAccessBytes As DWord
    169172    Dim IsStr As Long
    170173
    171     FileNumber--
    172 
    173     buffer=ZeroString(GetFileSize(_System_hFile[FileNumber],0) + 1)
    174 
    175     i=0
    176174    While 1
    177175        '次のデータをサーチ
     
    226224
    227225        'データを変数に格納
    228         _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buffer, i3)
     226        _System_Input_SetArgument(_System_InputDataPtr[i], _System_InputDataType[i], buffer.ToString)
    229227
    230228
     
    234232End Sub
    235233
    236 Sub _System_Input_SetArgument(arg As VoidPtr, dataType As DWord, ByRef buf As String, bufLen As Long)
     234Sub _System_Input_SetArgument(arg As VoidPtr, dataType As DWord, buf As String)
    237235    Select Case dataType
    238236        Case _System_Type_Double
     
    253251            Dim pTempStr As *String
    254252            pTempStr = arg As *String
    255             pTempStr->ReSize(bufLen)
    256             memcpy(pTempStr->Chars, buf.Chars, SizeOf (StrChar) * pTempStr->Length)
    257             pTempStr->Chars[pTempStr->Length] = 0
     253            pTempStr[0] = buf
    258254    End Select
    259255End Sub
     
    269265Dim _System_UsingStrData[_System_MAX_PARMSNUM] As *Char     'TODO: 暫定対応(動作未確認)
    270266Dim _System_UsingDataType[_System_MAX_PARMSNUM] As DWord
     267/*
    271268Function _System_GetUsingFormat(UsingStr As String) As String
    272269    Dim i2 As Long, i3 As Long, i4 As Long, i5 As Long, ParmNum As Long
    273270    Dim temporary[255] As StrChar
    274     Dim buffer As String
    275 
    276     buffer = ZeroString(1024)
     271    Dim buffer = New System.Text.StringBuilder(1024)
    277272
    278273    ParmNum = 0
     
    334329            If length_buf>=length_num Then
    335330                '通常時
    336                 _System_FillChar(VarPtr(buffer.Chars[i3]), length_buf - length_num, &h20) 'Asc(" ")
     331                ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf - length_num, &h20) 'Asc(" ")
    337332
    338333                i3 += length_buf - length_num
     
    354349            Else
    355350                '表示桁が足りないとき
    356                 _System_FillChar(VarPtr(buffer.Chars[i3]), length_buf, &h23) 'Asc("#")
     351                ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), length_buf, &h23) 'Asc("#")
    357352                i3 += length_buf
    358353            End If
     
    395390                    i5=i4
    396391                Else
    397                     _System_FillChar(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ")
     392                    ActiveBasic.Strings.Detail.ChrFill(VarPtr(buffer.Chars[i3]), i4, &h20) 'Asc(" ")
    398393                End If
    399394                memcpy(VarPtr(buffer.Chars[i3]), _System_UsingStrData[ParmNum], SizeOf (StrChar) * i5)
     
    411406    Wend
    412407
    413     _System_GetUsingFormat = Left$(buffer, lstrlen(buffer))
     408    _System_GetUsingFormat = buffer.ToString(0, lstrlen(StrBPtr(buffer)))
    414409End Function
     410*/
    415411Sub PRINTUSING_ToFile(FileNumber As Long, UsingStr As String)
    416412    Dim dwAccessByte As DWord
Note: See TracChangeset for help on using the changeset viewer.