Changeset 119 for Include/basic


Ignore:
Timestamp:
Feb 23, 2007, 11:00:24 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Unicode (#50) 前準備
Byte→Char (#51) 型名は殆ど完了、ただし中身までは手を付けていないものが多い

Location:
Include/basic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Include/basic/command.sbp

    r110 r119  
    66
    77
    8 Const _System_Type_Char = 1
     8Const _System_Type_SByte = 1
    99Const _System_Type_Byte = 2
    1010Const _System_Type_Integer = 3
     
    1616Const _System_Type_Single = 9
    1717Const _System_Type_Double = 10
    18 Const _System_Type_String = 11
     18Const _System_Type_Char =   11
     19Const _System_Type_String = 13
     20Const _System_Type_VoidPtr =    14
    1921Const _System_MAX_PARMSNUM = 32-1
    2022
  • Include/basic/function.sbp

    r110 r119  
    514514    End If
    515515End Sub
    516 Function _ecvt(value As Double, count As Long, ByRef dec As Long, ByRef sign As Long) As BytePtr
    517     Dim temp As BytePtr
     516Function _ecvt(value As Double, count As Long, ByRef dec As Long, ByRef sign As Long) As *Char
     517    Dim temp As *Char
    518518    Dim i As Long, i2 As Long
    519519
     
    540540    dec=1
    541541    While value<0.999999999999999  'value<1
    542         value=value*10
    543         dec=dec-1
     542        value *= 10
     543        dec--
    544544    Wend
    545545    While 9.99999999999999<=value  '10<=value
    546         value=value/10
    547         dec=dec+1
     546        value /= 10
     547        dec++
    548548    Wend
    549549
     
    555555    _System_ecvt_buffer[i]=0
    556556
    557     i=i-1
     557    i--
    558558    If value>=5 Then
    559559        '切り上げ処理
     
    562562
    563563    For i=0 To count-1
    564         _System_ecvt_buffer[i]=_System_ecvt_buffer[i]+&H30
     564        _System_ecvt_buffer[i] += &H30
    565565    Next
    566566    _System_ecvt_buffer[i]=0
     
    713713End Function
    714714
    715 Function Val(buf As BytePtr) As Double
     715Function Val(buf As *Char) As Double
    716716    Dim i As Long, i2 As Long, i3 As Long, i4 As Long
    717717    Dim temporary As String
    718     Dim TempPtr As BytePtr
     718    Dim TempPtr As *Char
    719719    Dim dbl As Double
    720720    Dim i64data As Int64
     
    10241024End Function
    10251025
     1026Function _System_IsSurrogatePair(wcHigh As WCHAR, wcLow As WCHAR) As Boolean
     1027    If &hD800 <= wcHigh And wcHigh < &hDC00 Then
     1028        If &hDC00 <= wcLow And wcLow < &hE000 Then
     1029            Return True
     1030        End If
     1031    End If
     1032    Return False
     1033End Function
    10261034
    10271035#endif '_INC_FUNCTION
  • Include/basic/prompt.sbp

    r110 r119  
    9999
    100100                temporary[0]=_PromptSys_Buffer[i][i2]
     101#ifdef UNICODE
     102                If _System_IsSurrogatePair(_PromptSys_Buffer[i][i2], _PromptSys_Buffer[i][i2+1]) Then
     103#else
    101104                If IsDBCSLeadByte(temporary[0]) Then
     105#endif
    102106                    temporary[1]=_PromptSys_Buffer[i][i2+1]
    103107                    temporary[2]=0
     108                    i2++
    104109                Else
    105110                    temporary[1]=0
     
    107112                TextOut(hDC,i2*_PromptSys_FontSize.cx,i*_PromptSys_FontSize.cy,_
    108113                    temporary,lstrlen(temporary))
    109 
    110                 If IsDBCSLeadByte(temporary[0]) Then i2++
    111114            Next
    112115        End If
     
    172175    Dim CompForm As COMPOSITIONFORM
    173176    Dim hGlobal As HGLOBAL
    174     Dim pTemp As BytePtr
    175177
    176178    Select Case message
     
    246248                    hGlobal=GetClipboardData(CF_TEXT)
    247249                    If hGlobal=0 Then PromptProc=0:Exit Function
    248                     pTemp=GlobalLock(hGlobal) As *Byte
    249 
     250                    Dim pTemp=GlobalLock(hGlobal) As *Byte
     251#ifdef UNICODE
     252                    Dim tempSizeW = MultiByteToWideChar(CP_ACP, 0, pTemp, -1, 0, 0) + 1
     253                    TempStr=ZeroString(tempSizeW)
     254                    MultiByteToWideChar(CP_ACP, 0, pTemp, -1, StrPtr(TempStr), tempSizeW)
     255#else
    250256                    TempStr=ZeroString(lstrlen(pTemp)+1)
    251257                    lstrcpy(StrPtr(TempStr),pTemp)
    252 
     258#endif
    253259                    lstrcpy((VarPtr(_PromptSys_InputStr[0])+_PromptSys_InputLen) As *Byte,pTemp)
    254260                    _PromptSys_InputLen=_PromptSys_InputLen+lstrlen(pTemp)
     
    337343    _PromptSys_hWnd=CreateWindowEx(WS_EX_CLIENTEDGE,"PROMPT","BASIC PROMPT",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,0,0,GetModuleHandle(0),0)
    338344    ShowWindow(_PromptSys_hWnd,SW_SHOW)
     345    UpdateWindow(_PromptSys_hWnd)
    339346
    340347    Dim msg As MSG, iResult As Long
     
    455462            Case _System_Type_Integer,_System_Type_Word
    456463                SetWord(_System_InputDataPtr[i],Val(buf))
    457             Case _System_Type_Char,_System_Type_Byte
     464            Case _System_Type_SByte,_System_Type_Byte
    458465                SetByte(_System_InputDataPtr[i],Val(buf))
    459 
     466            Case _System_Type_Char
     467#ifdef UNICODE
     468                SetWord(_System_InputDataPtr[i], buf[0])
     469#else
     470                SetByte(_System_InputDataPtr[i], buf[0])
     471#endif
    460472            Case _System_Type_String
     473            *INPUT_FromPrompt_Type_String
    461474                Dim pTempStr As *String
    462475                pTempStr=_System_InputDataPtr[i] As *String
     
    464477                memcpy(pTempStr->Chars, buf.Chars, pTempStr->Length)
    465478                pTempStr->Chars[pTempStr->Length] = 0
     479            Case 13
     480                Goto *INPUT_FromPrompt_Type_String
    466481        End Select
    467482
Note: See TracChangeset for help on using the changeset viewer.