Last change
on this file since 1132 was
1132,
checked in by luba, 17 years ago
|
- processing of Interger args is added
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
826 bytes
|
Line | |
---|
1 | // $Source$ |
---|
2 | // $Revision: 1132 $ |
---|
3 | // $Date: 2003-08-08 14:04:12 +0000 (Fri, 08 Aug 2003) $ |
---|
4 | // $Author: luba $ |
---|
5 | |
---|
6 | #include <rf_core.hh> |
---|
7 | #include <rf_short_int.hh> |
---|
8 | |
---|
9 | |
---|
10 | namespace refal |
---|
11 | { |
---|
12 | |
---|
13 | using namespace rfrt; |
---|
14 | using namespace rftype; |
---|
15 | |
---|
16 | namespace Convert |
---|
17 | { |
---|
18 | |
---|
19 | RF_FUNC (Bytes_m_To_m_Chars, (RF_ARG e_Int), (RF_RES e_Res)) |
---|
20 | |
---|
21 | Term* p = e_Int.get_first(); |
---|
22 | for (; p < e_Int.get_last(); p++) { |
---|
23 | if (p->get_type() == type_int32) { |
---|
24 | intptr_t t = static_cast<Int32*>(p)->to_int(); |
---|
25 | if (t < 0 || t > WCHAR_MAX) |
---|
26 | RF_LIB_ERROR("Invalid argument"); |
---|
27 | } |
---|
28 | else |
---|
29 | if (p->get_type() == type_int) { |
---|
30 | Integer* P = static_cast<Integer*>(p); |
---|
31 | intptr_t l = P->to_int(); |
---|
32 | if (P->cmp(0) < 0 || uintptr_t(l) > SIZE_MAX) |
---|
33 | RF_LIB_ERROR("Invalid argument"); |
---|
34 | } |
---|
35 | else |
---|
36 | RF_LIB_ERROR("Invalid argument"); |
---|
37 | |
---|
38 | } |
---|
39 | e_Res = Char::bytes_to_chars(e_Int); |
---|
40 | |
---|
41 | RF_END |
---|
42 | } |
---|
43 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.