| |
| /pliant/language/compiler/expression/expression1.pli |
| |
| 1 |
# Copyright Hubert Tonneau hubert.tonneau@pliant.cx | |
| 2 |
# | |
| 3 |
# This program is free software; you can redistribute it and/or | |
| 4 |
# modify it under the terms of the GNU General Public License version 2 | |
| 5 |
# as published by the Free Software Foundation. | |
| 6 |
# | |
| 7 |
# This program is distributed in the hope that it will be useful, | |
| 8 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 |
# GNU General Public License for more details. | |
| 11 |
# | |
| 12 |
# You should have received a copy of the GNU General Public License | |
| 13 |
# version 2 along with this program; if not, write to the Free Software | |
| 14 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 15 |
| |
| 16 |
scope "/pliant/language/" "/pliant/install/" | |
| 17 |
module "/pliant/install/ring1.pli" | |
| 18 |
| |
| 19 |
public | |
| 20 |
| |
| 21 |
method e size -> s | |
| 22 |
arg Expression e ; arg Int s | |
| 23 |
return e:arguments:size | |
| 24 |
| |
| 25 |
method e 'size :=' i | |
| 26 |
arg_rw Expression e ; arg Int i | |
| 27 |
e:arguments 'size :=' i | |
| 28 |
| |
| 29 |
method e '' i -> ei | |
| 30 |
arg Expression e ; arg Int i ; arg_C Expression ei | |
| 31 |
return (e:arguments:i map Expression) | |
| 32 |
| |
| 33 |
method e is_pure_ident -> id | |
| 34 |
arg Expression e ; arg CBool id | |
| 35 |
id := addressof:(entry_type e:value)=addressof:Ident and e:size=0 | |
| 36 |
| |
| 37 |
method e ident -> id | |
| 38 |
arg Expression e ; arg Str id | |
| 39 |
if addressof:(entry_type e:value)<>addressof:Ident | |
| 40 |
return "" | |
| 41 |
id := cast (e:value map Ident) Str | |
| 42 |
| |
| 43 |
method e explicit_cast t -> success | |
| 44 |
arg_rw Expression e ; arg Type t ; arg CBool success | |
| 45 |
e compile | |
| 46 |
if not e:is_compiled | |
| 47 |
return false | |
| 48 |
if (addressof e:result:type)=addressof:t | |
| 49 |
return true | |
| 50 |
e uncast | |
| 51 |
success := addressof:(e cast e:result e:access t 0)<>null | |
| 52 |
| |
| 53 |
method e external_module -> m | |
| 54 |
arg Expression e ; arg_C Module m | |
| 55 |
if (addressof e:module:external)<>null | |
| 56 |
m :> e:module external | |
| 57 |
else | |
| 58 |
m :> e module | |
| 59 |
| |
| |