Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
89dc8369
Kaydet (Commit)
89dc8369
authored
Ock 27, 2012
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ByteString->rtl::OString
üst
74ded8e6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
66 deletions
+69
-66
iosys.hxx
basic/source/inc/iosys.hxx
+17
-14
iosys.cxx
basic/source/runtime/iosys.cxx
+48
-48
methods1.cxx
basic/source/runtime/methods1.cxx
+2
-2
step0.cxx
basic/source/runtime/step0.cxx
+2
-2
No files found.
basic/source/inc/iosys.hxx
Dosyayı görüntüle @
89dc8369
...
...
@@ -45,10 +45,11 @@ class SvStream;
#define SBSTRM_APPEND 0x0008
#define SBSTRM_BINARY 0x0010
class
SbiStream
{
class
SbiStream
{
SvStream
*
pStrm
;
sal_uIntPtr
nExpandOnWriteTo
;
// during writing access expand the stream to this size
Byte
String
aLine
;
rtl
::
O
String
aLine
;
sal_uIntPtr
nLine
;
short
nLen
;
// buffer length
short
nMode
;
...
...
@@ -59,11 +60,11 @@ class SbiStream {
public
:
SbiStream
();
~
SbiStream
();
SbError
Open
(
short
,
const
Byte
String
&
,
short
,
short
,
short
);
SbError
Open
(
short
,
const
rtl
::
O
String
&
,
short
,
short
,
short
);
SbError
Close
();
SbError
Read
(
ByteString
&
,
sal_uInt16
=
0
,
bool
bForceReadingPerByte
=
false
);
SbError
Read
(
rtl
::
OString
&
,
sal_uInt16
=
0
,
bool
bForceReadingPerByte
=
false
);
SbError
Read
(
char
&
);
SbError
Write
(
const
Byte
String
&
,
sal_uInt16
=
0
);
SbError
Write
(
const
rtl
::
O
String
&
,
sal_uInt16
=
0
);
bool
IsText
()
const
{
return
(
nMode
&
SBSTRM_BINARY
)
==
0
;
}
bool
IsRandom
()
const
{
return
(
nMode
&
SBSTRM_RANDOM
)
!=
0
;
}
...
...
@@ -78,28 +79,30 @@ public:
SvStream
*
GetStrm
()
{
return
pStrm
;
}
};
class
SbiIoSystem
{
class
SbiIoSystem
{
SbiStream
*
pChan
[
CHANNELS
];
ByteString
aPrompt
;
ByteString
aIn
,
aOut
;
rtl
::
OString
aPrompt
;
rtl
::
OString
aIn
;
rtl
::
OString
aOut
;
short
nChan
;
SbError
nError
;
void
ReadCon
(
ByteString
&
);
void
WriteCon
(
const
ByteString
&
);
void
ReadCon
(
rtl
::
OString
&
);
void
WriteCon
(
const
rtl
::
OString
&
);
public
:
SbiIoSystem
();
~
SbiIoSystem
();
SbError
GetError
();
void
Shutdown
();
void
SetPrompt
(
const
ByteString
&
r
)
{
aPrompt
=
r
;
}
void
SetPrompt
(
const
rtl
::
OString
&
r
)
{
aPrompt
=
r
;
}
void
SetChannel
(
short
n
)
{
nChan
=
n
;
}
short
GetChannel
()
const
{
return
nChan
;}
void
ResetChannel
()
{
nChan
=
0
;
}
void
Open
(
short
,
const
Byte
String
&
,
short
,
short
,
short
);
void
Open
(
short
,
const
rtl
::
O
String
&
,
short
,
short
,
short
);
void
Close
();
void
Read
(
ByteString
&
,
short
=
0
);
void
Read
(
rtl
::
OString
&
,
short
=
0
);
char
Read
();
void
Write
(
const
ByteString
&
,
short
=
0
);
void
Write
(
const
rtl
::
OString
&
,
short
=
0
);
short
NextChannel
();
// 0 == bad channel or no SvStream (nChannel=0..CHANNELS-1)
SbiStream
*
GetStream
(
short
nChannel
)
const
;
...
...
basic/source/runtime/iosys.cxx
Dosyayı görüntüle @
89dc8369
...
...
@@ -562,7 +562,7 @@ void UCBStream::SetSize( sal_uIntPtr nSize )
SbError
SbiStream
::
Open
(
short
nCh
,
const
Byte
String
&
rName
,
short
nStrmMode
,
short
nFlags
,
short
nL
)
(
short
nCh
,
const
rtl
::
O
String
&
rName
,
short
nStrmMode
,
short
nFlags
,
short
nL
)
{
nMode
=
nFlags
;
nLen
=
nL
;
...
...
@@ -571,7 +571,7 @@ SbError SbiStream::Open
nExpandOnWriteTo
=
0
;
if
(
(
nStrmMode
&
(
STREAM_READ
|
STREAM_WRITE
)
)
==
STREAM_READ
)
nStrmMode
|=
STREAM_NOCREATE
;
String
aStr
(
rName
,
osl_getThreadTextEncoding
()
);
String
aStr
(
rtl
::
OStringToOUString
(
rName
,
osl_getThreadTextEncoding
())
);
String
aNameStr
=
getFullPath
(
aStr
);
if
(
hasUno
()
)
...
...
@@ -642,14 +642,12 @@ SbError SbiStream::Close()
return
nError
;
}
SbError
SbiStream
::
Read
(
ByteString
&
rBuf
,
sal_uInt16
n
,
bool
bForceReadingPerByte
)
SbError
SbiStream
::
Read
(
rtl
::
OString
&
rBuf
,
sal_uInt16
n
,
bool
bForceReadingPerByte
)
{
nExpandOnWriteTo
=
0
;
if
(
!
bForceReadingPerByte
&&
IsText
()
)
{
rtl
::
OString
aBuffer
;
pStrm
->
ReadLine
(
aBuffer
);
rBuf
=
aBuffer
;
pStrm
->
ReadLine
(
rBuf
);
nLine
++
;
}
else
...
...
@@ -673,13 +671,13 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy
SbError
SbiStream
::
Read
(
char
&
ch
)
{
nExpandOnWriteTo
=
0
;
if
(
!
aLine
.
Len
()
)
if
(
aLine
.
isEmpty
()
)
{
Read
(
aLine
,
0
);
aLine
+=
'\n'
;
aLine
=
aLine
+
rtl
::
OString
(
'\n'
)
;
}
ch
=
aLine
.
GetBuffer
()
[
0
];
aLine
.
Erase
(
0
,
1
);
ch
=
aLine
[
0
];
aLine
=
aLine
.
copy
(
1
);
return
nError
;
}
...
...
@@ -705,7 +703,7 @@ void SbiStream::ExpandFile()
namespace
{
void
WriteLines
(
SvStream
&
rStream
,
const
Byte
String
&
rStr
)
void
WriteLines
(
SvStream
&
rStream
,
const
rtl
::
O
String
&
rStr
)
{
ByteString
aStr
(
rStr
);
aStr
.
ConvertLineEnd
(
rStream
.
GetLineDelimiter
()
);
...
...
@@ -714,7 +712,7 @@ namespace
}
}
SbError
SbiStream
::
Write
(
const
Byte
String
&
rBuf
,
sal_uInt16
n
)
SbError
SbiStream
::
Write
(
const
rtl
::
O
String
&
rBuf
,
sal_uInt16
n
)
{
ExpandFile
();
if
(
IsAppend
()
)
...
...
@@ -722,25 +720,26 @@ SbError SbiStream::Write( const ByteString& rBuf, sal_uInt16 n )
if
(
IsText
()
)
{
aLine
+=
rBuf
;
aLine
=
aLine
+
rBuf
;
// Get it out, if the end is an LF, but strip CRLF before,
// because the SvStrm adds a CRLF!
sal_
uInt16
nLineLen
=
aLine
.
Len
();
if
(
nLineLen
&&
aLine
.
GetBuffer
()[
--
nLineLen
]
==
0x0A
)
sal_
Int32
nLineLen
=
aLine
.
getLength
();
if
(
nLineLen
&&
aLine
[
--
nLineLen
]
==
0x0A
)
{
aLine
.
Erase
(
nLineLen
);
if
(
nLineLen
&&
aLine
.
GetBuffer
()[
--
nLineLen
]
==
0x0D
)
aLine
.
Erase
(
nLineLen
);
aLine
=
aLine
.
copy
(
0
,
nLineLen
);
if
(
nLineLen
&&
aLine
[
--
nLineLen
]
==
0x0D
)
aLine
=
aLine
.
copy
(
0
,
nLineLen
);
WriteLines
(
*
pStrm
,
aLine
);
aLine
.
Erase
();
aLine
=
rtl
::
OString
();
}
}
else
{
if
(
!
n
)
n
=
nLen
;
if
(
!
n
)
n
=
nLen
;
if
(
!
n
)
return
nError
=
SbERR_BAD_RECORD_LENGTH
;
pStrm
->
Write
(
rBuf
.
GetBuffer
(),
n
);
pStrm
->
Write
(
rBuf
.
getStr
(),
n
);
MapError
();
}
return
nError
;
...
...
@@ -774,8 +773,7 @@ SbError SbiIoSystem::GetError()
return
n
;
}
void
SbiIoSystem
::
Open
(
short
nCh
,
const
ByteString
&
rName
,
short
nMode
,
short
nFlags
,
short
nLen
)
void
SbiIoSystem
::
Open
(
short
nCh
,
const
rtl
::
OString
&
rName
,
short
nMode
,
short
nFlags
,
short
nLen
)
{
nError
=
0
;
if
(
nCh
>=
CHANNELS
||
!
nCh
)
...
...
@@ -824,9 +822,9 @@ void SbiIoSystem::Shutdown()
}
nChan
=
0
;
// anything left to PRINT?
if
(
aOut
.
Len
()
)
if
(
!
aOut
.
isEmpty
()
)
{
String
aOutStr
(
aOut
,
osl_getThreadTextEncoding
()
);
rtl
::
OUString
aOutStr
(
rtl
::
OStringToOUString
(
aOut
,
osl_getThreadTextEncoding
())
);
#if defined GCC
Window
*
pParent
=
Application
::
GetDefDialogParent
();
MessBox
(
pParent
,
WinBits
(
WB_OK
),
String
(),
aOutStr
).
Execute
();
...
...
@@ -834,11 +832,11 @@ void SbiIoSystem::Shutdown()
MessBox
(
GetpApp
()
->
GetDefDialogParent
(),
WinBits
(
WB_OK
),
String
(),
aOutStr
).
Execute
();
#endif
}
aOut
.
Erase
();
aOut
=
rtl
::
OString
();
}
void
SbiIoSystem
::
Read
(
ByteString
&
rBuf
,
short
n
)
void
SbiIoSystem
::
Read
(
rtl
::
OString
&
rBuf
,
short
n
)
{
if
(
!
nChan
)
ReadCon
(
rBuf
);
...
...
@@ -853,13 +851,13 @@ char SbiIoSystem::Read()
char
ch
=
' '
;
if
(
!
nChan
)
{
if
(
!
aIn
.
Len
()
)
if
(
aIn
.
isEmpty
()
)
{
ReadCon
(
aIn
);
aIn
+=
'\n'
;
aIn
=
aIn
+
rtl
::
OString
(
'\n'
)
;
}
ch
=
aIn
.
GetBuffer
()
[
0
];
aIn
.
Erase
(
0
,
1
);
ch
=
aIn
[
0
];
aIn
=
aIn
.
copy
(
1
);
}
else
if
(
!
pChan
[
nChan
]
)
nError
=
SbERR_BAD_CHANNEL
;
...
...
@@ -868,7 +866,7 @@ char SbiIoSystem::Read()
return
ch
;
}
void
SbiIoSystem
::
Write
(
const
ByteString
&
rBuf
,
short
n
)
void
SbiIoSystem
::
Write
(
const
rtl
::
OString
&
rBuf
,
short
n
)
{
if
(
!
nChan
)
WriteCon
(
rBuf
);
...
...
@@ -921,7 +919,7 @@ void SbiIoSystem::CloseAll(void)
***************************************************************************/
void
SbiIoSystem
::
ReadCon
(
ByteString
&
rIn
)
void
SbiIoSystem
::
ReadCon
(
rtl
::
OString
&
rIn
)
{
String
aPromptStr
(
aPrompt
,
osl_getThreadTextEncoding
()
);
SbiInputDialog
aDlg
(
NULL
,
aPromptStr
);
...
...
@@ -929,27 +927,29 @@ void SbiIoSystem::ReadCon( ByteString& rIn )
rIn
=
rtl
::
OUStringToOString
(
aDlg
.
GetInput
(),
osl_getThreadTextEncoding
());
else
nError
=
SbERR_USER_ABORT
;
aPrompt
.
Erase
();
aPrompt
=
rtl
::
OString
();
}
// output of a MessageBox, if theres a CR in the console-buffer
void
SbiIoSystem
::
WriteCon
(
const
ByteString
&
rText
)
void
SbiIoSystem
::
WriteCon
(
const
rtl
::
OString
&
rText
)
{
aOut
+=
rText
;
sal_uInt16
n1
=
aOut
.
Search
(
'\n'
);
sal_uInt16
n2
=
aOut
.
Search
(
'\r'
);
if
(
n1
!=
STRING_NOTFOUND
||
n2
!=
STRING_NOTFOUND
)
{
if
(
n1
==
STRING_NOTFOUND
)
n1
=
n2
;
else
if
(
n2
==
STRING_NOTFOUND
)
n2
=
n1
;
if
(
n1
>
n2
)
n1
=
n2
;
ByteString
s
(
aOut
.
Copy
(
0
,
n1
)
);
aOut
.
Erase
(
0
,
n1
);
while
(
aOut
.
GetBuffer
()[
0
]
==
'\n'
||
aOut
.
GetBuffer
()[
0
]
==
'\r'
)
aOut
.
Erase
(
0
,
1
);
String
aStr
(
s
,
osl_getThreadTextEncoding
()
);
sal_Int32
n1
=
aOut
.
indexOf
(
'\n'
);
sal_Int32
n2
=
aOut
.
indexOf
(
'\r'
);
if
(
n1
!=
-
1
||
n2
!=
-
1
)
{
if
(
n1
==
-
1
)
n1
=
n2
;
else
if
(
n2
==
-
1
)
n2
=
n1
;
if
(
n1
>
n2
)
n1
=
n2
;
rtl
::
OString
s
(
aOut
.
copy
(
0
,
n1
));
aOut
=
aOut
.
copy
(
n1
);
while
(
aOut
[
0
]
==
'\n'
||
aOut
[
0
]
==
'\r'
)
aOut
=
aOut
.
copy
(
1
);
String
aStr
(
rtl
::
OStringToOUString
(
s
,
osl_getThreadTextEncoding
()));
{
SolarMutexGuard
aSolarGuard
;
if
(
!
MessBox
(
GetpApp
()
->
GetDefDialogParent
(),
...
...
basic/source/runtime/methods1.cxx
Dosyayı görüntüle @
89dc8369
...
...
@@ -3209,7 +3209,7 @@ RTLFUNC(Input)
return
;
}
Byte
String
aByteBuffer
;
rtl
::
O
String
aByteBuffer
;
SbError
err
=
pSbStrm
->
Read
(
aByteBuffer
,
nByteCount
,
true
);
if
(
!
err
)
err
=
pIosys
->
GetError
();
...
...
@@ -3219,7 +3219,7 @@ RTLFUNC(Input)
StarBASIC
::
Error
(
err
);
return
;
}
rPar
.
Get
(
0
)
->
PutString
(
String
(
aByteBuffer
,
osl_getThreadTextEncoding
()
)
);
rPar
.
Get
(
0
)
->
PutString
(
rtl
::
OStringToOUString
(
aByteBuffer
,
osl_getThreadTextEncoding
())
);
}
RTLFUNC
(
Me
)
...
...
basic/source/runtime/step0.cxx
Dosyayı görüntüle @
89dc8369
...
...
@@ -1175,11 +1175,11 @@ void SbiRuntime::StepINPUT()
void
SbiRuntime
::
StepLINPUT
()
{
Byte
String
aInput
;
rtl
::
O
String
aInput
;
pIosys
->
Read
(
aInput
);
Error
(
pIosys
->
GetError
()
);
SbxVariableRef
p
=
PopVar
();
p
->
PutString
(
String
(
aInput
,
osl_getThreadTextEncoding
()
)
);
p
->
PutString
(
rtl
::
OStringToOUString
(
aInput
,
osl_getThreadTextEncoding
())
);
}
// end of program
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment