Last change
on this file since 604 was
604,
checked in by luba, 18 years ago
|
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.1 KB
|
Line | |
---|
1 | // $Source$ |
---|
2 | // $Revision: 604 $ |
---|
3 | // $Date: 2003-03-17 07:13:48 +0000 (Mon, 17 Mar 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 | #if 0 |
---|
21 | e_Res = Expr(e_Int.get_len(), 0); |
---|
22 | |
---|
23 | Term *p = e_Int.get_first(); |
---|
24 | Term *r = e_Res.get_first(); |
---|
25 | |
---|
26 | for (; p < e_Int.get_last(); p++, r++) { |
---|
27 | if (p->get_type() == type_int) { |
---|
28 | RF_LIB_ERROR("Invalid argument"); |
---|
29 | } |
---|
30 | else |
---|
31 | if (p->get_type() == type_short_int) { |
---|
32 | intptr_t t = ((ShortInt*)p)->to_int(); |
---|
33 | if (t < 0 || t > WCHAR_MAX) |
---|
34 | RF_LIB_ERROR("Invalid argument"); |
---|
35 | else |
---|
36 | *r = Char::to_chars(t); |
---|
37 | } |
---|
38 | else |
---|
39 | RF_LIB_ERROR("Invalid argument"); |
---|
40 | } |
---|
41 | #endif |
---|
42 | |
---|
43 | Term* p = e_Int.get_first(); |
---|
44 | for (; p < e_Int.get_last(); p++) { |
---|
45 | if (p->get_type() == type_short_int) { |
---|
46 | intptr_t t = ((ShortInt*)p)->to_int(); |
---|
47 | if (t < 0 || t > WCHAR_MAX) |
---|
48 | RF_LIB_ERROR("Invalid argument"); |
---|
49 | } |
---|
50 | else |
---|
51 | RF_LIB_ERROR("Invalid argument"); |
---|
52 | |
---|
53 | } |
---|
54 | |
---|
55 | e_Res = Char::bytes_to_chars(e_Int); |
---|
56 | |
---|
57 | RF_END |
---|
58 | } |
---|
59 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.