[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-559-g13dd8e2
Benoit Sonntag
sonntag at icps.u-strasbg.fr
Wed Dec 30 18:22:24 UTC 2009
The following commit has been merged in the master branch:
commit 13dd8e21a78fc7828d58dc8c88556da44c428db1
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date: Wed Dec 30 19:21:56 2009 +0100
Nico: Bug expression binary ok
diff --git a/lib/internal/portable/io/output_stream.li b/lib/internal/portable/io/output_stream.li
index 5d732d2..8a8dd4e 100644
--- a/lib/internal/portable/io/output_stream.li
+++ b/lib/internal/portable/io/output_stream.li
@@ -19,99 +19,99 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=OUTPUT_STREAM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Standard Output Stream.";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
- is_connected:BOOLEAN <- deferred;
-
+
- put_character c:CHARACTER <-
( ? {is_connected};
deferred;
);
-
+
- put_string s:ABSTRACT_STRING <-
// Output `s' to current output device.
( ? {is_connected};
? {s!=NULL};
-
+
(s.lower).to (s.count) do {i:INTEGER;
put_character (s.item i);
- };
+ };
);
-
+
- put_integer i:INTEGER <-
// Output `i' to current output device.
( ? {is_connected};
-
+
tmp_string.clear;
i.append_in tmp_string;
put_string tmp_string;
);
-
+
- put_integer_format (i, s:INTEGER) <-
// Output `i' to current output device using at most
// `s' character.
( ? {is_connected};
-
+
tmp_string.clear;
i.append_in_format (tmp_string,s);
put_string tmp_string;
);
-
+
//
// Other features:
//
-
+
- put_boolean b:BOOLEAN <-
// Output `b' to current output device according
// to the Eiffel format.
( ? {is_connected};
-
+
put_string (b.to_string);
);
-
+
- put_pointer p:POINTER <-
// Output a viewable version of `p'.
( ? {is_connected};
-
+
tmp_string.clear;
p.append_in tmp_string;
put_string tmp_string;
);
-
+
- put_new_line <-
// Output a newline character.
( ? {is_connected};
-
+
put_character '\n';
);
-
+
- put_spaces nb:INTEGER <-
// Output `nb' spaces character.
( ? {nb >= 0};
-
+
1.to nb do { count:INTEGER;
put_character ' ';
};
);
-
+
- file_exists path:ABSTRACT_STRING :BOOLEAN<-
(
DIRECTORY.scan_current_working_directory;
- DIRECTORY.has path
+ DIRECTORY.has path
);
-
+
- append_file file_name:STRING <-
(
+ c:CHARACTER;
@@ -129,18 +129,18 @@ Section Public
);
- flush <-
- // forces a write of unwritten character (write my have been
+ // forces a write of unwritten character (write my have been
// delayed, flush writes buffered characters)
(
deferred;
);
-
+
Section Private
-
+
- basic_io_putc c:CHARACTER <- SYSTEM_IO.print_char c;
-
+
- basic_error_putc c:CHARACTER <- SYSTEM_IO.print_error_char c;
-
+
- tmp_file_read:TEXT_FILE_READ := TEXT_FILE_READ.create;
-
+
- tmp_string:STRING := STRING.create 512;
diff --git a/lib/standard/string/string.li b/lib/standard/string/string.li
index afa02e5..f3e7187 100644
--- a/lib/standard/string/string.li
+++ b/lib/standard/string/string.li
@@ -19,58 +19,58 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := STRING;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "String library.";
-
+
Section Inherit
-
+
- inherit_abstract_string:ABSTRACT_STRING := ABSTRACT_STRING;
-
+
- parent_arrayed:ARRAYED := ARRAYED;
-
+
Section Public //ABSTRACT_STRING, ABSTRACT_ENTRY
-
+
+ storage:NATIVE_ARRAY(CHARACTER);
-
+
Section Public
-
+
+ count:INTEGER;
+ capacity:INTEGER;
-
+
//
// General :
//
-
+
- set_storage tab:NATIVE_ARRAY(CHARACTER) <-
( ? {tab != NULL};
storage := tab;
);
-
+
//
// Creation / Modification :
//
-
+
- create needed_capacity:INTEGER :SELF <-
( + result:SELF;
- result := SELF.clone;
+ result := SELF.clone;
result.make needed_capacity;
result
);
-
+
- create_from_string str:ABSTRACT_STRING :SELF <-
( + result:SELF;
-
+
result := create (str.count);
- result.copy str;
+ result.copy str;
result
);
-
+
- make needed_capacity:INTEGER <-
// Initialize the string to have at least `needed_capacity'
// characters of storage.
@@ -82,56 +82,56 @@ Section Public
};
};
count := 0;
-
+
//? {needed_capacity <= capacity};
//? {count = 0};
);
-
+
- make_empty <-
// Create an empty string
(
make 0;
- );
-
-
+ );
+
+
- create_filled (c:CHARACTER,n:INTEGER) :SELF <-
( + result:SELF;
result := SELF.clone;
result.make_filled (c,n);
result
);
-
+
- make_filled (c:CHARACTER,n:INTEGER) <-
// Initialize string with `n` copies of `c`
[
-? {n >= 0};
]
- (
+ (
make n;
count := n;
- fill_with c;
+ fill_with c;
)
[
+? {count = n};
+? {occurrences c = count};
];
-
+
- twin:STRING <-
(
create_from_string Self
);
-
+
//
// Modification :
//
-
+
- resize new_count:INTEGER <-
- // Resize self. When `new_count' is greater than `count',
+ // Resize self. When `new_count' is greater than `count',
// new positions are initialized with the default value of CHARACTER
[
-? { new_count >= 0 };
]
- (
+ (
(new_count <= count).if {
}.elseif { capacity < new_count } then {
(capacity = 0).if {
@@ -142,12 +142,12 @@ Section Public
capacity := new_count;
} else {
storage.clear count to (new_count - 1);
- };
+ };
count := new_count;
)
- [
+ [
+? {count = new_count};
- +? {capacity >= Old capacity};
+ +? {capacity >= Old capacity};
];
- set_capacity new_capacity:INTEGER <-
@@ -155,8 +155,8 @@ Section Public
( + old_capacity:INTEGER;
? { new_capacity >= 0 };
old_capacity := capacity;
-
- (new_capacity > capacity).if {
+
+ (new_capacity > capacity).if {
(capacity = 0).if {
storage := NATIVE_ARRAY(CHARACTER).create new_capacity;
} else {
@@ -164,10 +164,10 @@ Section Public
};
capacity := new_capacity;
};
-
- ? {(new_capacity > old_capacity) ->> {new_capacity = capacity}};
+
+ ? {(new_capacity > old_capacity) ->> {new_capacity = capacity}};
);
-
+
- clear <-
// Clear out the current STRING.
// Note: internal `storage' memory is neither released nor shrunk.
@@ -175,10 +175,10 @@ Section Public
count := 0;
? {count = 0};
);
-
+
- copy other:ABSTRACT_STRING<-
// Copy `other' onto Current.
- (
+ (
count := other.count;
(count > 0).if {
(capacity < count).if {
@@ -189,30 +189,30 @@ Section Public
};
? {count = other.count};
);
-
+
- fill_with c:CHARACTER <-
// Replace every character with `c'.
(
storage.set_all_with c until (count - 1);
-
+
? {occurrences c = count};
);
-
+
- replace_all old_char:CHARACTER with new_char:CHARACTER <-
// Replace all occurrences of the element `old_char' by `new_character'
- (
+ (
storage.fast_replace_all old_char with new_char until (count - 1);
)
[
+? { count = Old count };
+? { occurrences old_char = 0};
];
-
+
- append other:ABSTRACT_STRING <-
// Append `other' to Current.
( + other_count, needed_capacity:INTEGER;
? {other != NULL};
-
+
other_count := other.count;
needed_capacity := count + other_count;
(capacity < needed_capacity).if {
@@ -227,36 +227,36 @@ Section Public
storage.copy (other.storage) to count until other_count;
count := needed_capacity;
);
-
+
- Self:SELF '+=' Right other:ABSTRACT_STRING :STRING_BUFFER <-
(
append other;
Self
);
-
+
- prepend other:ABSTRACT_STRING <-
// Prepend `other' to Current
( + i, j: INTEGER;
? {other!=NULL};
-
+
i := count;
j := other.count;
resize (i + j);
((i > 0) && {j > 0}).if {
storage.move 0 to (i - 1) by j;
};
- storage.copy_from (other.storage) until (j - 1);
+ storage.copy_from (other.storage) until (j - 1);
);
-
+
- insert_string s:ABSTRACT_STRING to i:INTEGER <-
// Insert `s' at index `i', shifting characters from index `i'
// to `count' rightwards.
(
+ j,k:INTEGER;
-
+
? { s != NULL };
? { i.in_range 1 to (count + 1)};
-
+
j := count;
k := s.count;
resize (j + k);
@@ -265,21 +265,21 @@ Section Public
};
storage.copy (s.storage) to (i - 1) until k;
);
-
+
- replace_substring s:ABSTRACT_STRING from start:INTEGER to end:INTEGER <-
// Replace the substring from start to end, inclusive, with s
(
+ remove_len,insert_len, difference, old_count: INTEGER;
-
+
? {s != NULL};
? { end <= count};
? {start.in_range 1 to (end + 1)};
-
+
old_count := count;
remove_len := end - start + 1;
insert_len := s.count;
difference := insert_len - remove_len;
-
+
(difference > 0).if {
resize (old_count + difference);
(end < old_count).if { // something to move ?
@@ -293,10 +293,10 @@ Section Public
};
storage.copy (s.storage) to (start - 1) until (s.count);
);
-
+
- replace_all_substring motif:ABSTRACT_STRING with txt:ABSTRACT_STRING <-
( + idx:INTEGER;
-
+
idx := lower;
{
idx := substring_index (motif,idx);
@@ -305,37 +305,37 @@ Section Public
};
}.do_while {idx != 0};
);
-
+
- put ch:CHARACTER to index:INTEGER<-
// Put `ch' at position `index'.
( ? {valid_index index};
-
+
storage.put ch to (index - 1);
-
+
? {item index = ch};
);
-
+
- swap i1:INTEGER with i2: INTEGER <-
( + tmp,old_i1,old_i2: CHARACTER;
? {valid_index i1};
? {valid_index i2};
-
+
old_i1:=item i1;
old_i2:=item i2;
tmp := item i1;
put (item i2) to i1;
put tmp to i2;
-
+
? {item i1 = old_i2};
? {item i2 = old_i1};
);
-
+
- insert ch:CHARACTER to index:INTEGER <-
// Insert `ch' after position `index'.
( + i:INTEGER;
? {0 <= index};
? {index <= count};
-
+
i:=count;
extend ' ';
{i = index}.until_do {
@@ -343,13 +343,13 @@ Section Public
i := i - 1;
};
put ch to (index + 1);
-
+
? {item (index + 1) = ch};
);
- insert ch:CHARACTER to index:INTEGER on nb:INTEGER <-
// Insert `ch' after position `index'.
- (
+ (
? {0 <= index};
? {index <= count};
@@ -357,7 +357,7 @@ Section Public
insert ch to index;
};
);
-
+
- shrink min_index:INTEGER to max_index:INTEGER <-
// Keep only the slice [`min_index' .. `max_index'] or nothing
// when the slice is empty.
@@ -365,7 +365,7 @@ Section Public
? {1 <= min_index};
? {max_index <= count};
? {min_index <= max_index + 1};
-
+
(max_index < min_index).if {
count := 0;
} else {
@@ -376,41 +376,41 @@ Section Public
count := max_index - min_index + 1
};
};
-
+
? {count = max_index - min_index + 1};
);
-
+
- remove index:INTEGER <-
// Remove character at position `index'.
( + old_count:INTEGER;
? {valid_index index};
-
+
old_count:=count;
remove_between index to index;
-
+
? {count = old_count - 1};
);
-
+
- add_first ch: CHARACTER <-
// Add `ch' at first position.
( + old_count: INTEGER;
-
+
old_count:=count;
add_last(' ');
count.downto 2 do { i:INTEGER;
put (item (i - 1)) to i;
};
put ch to 1;
-
+
? {count = 1 + old_count};
? {item 1 = ch};
);
-
+
- add_last ch:CHARACTER <-
// Append `ch' to string
( + new_capacity:INTEGER;
//+ old_count:INTEGER;
-
+
//old_count:=count;
(capacity <= count).if {
(capacity = 0).if {
@@ -424,15 +424,15 @@ Section Public
};
storage.put ch to count;
count := count + 1;
-
+
//? {count = 1 + old_count};
//? {item count = ch};
);
-
- - append_character c:CHARACTER <- add_last c;
+
+ - append_character c:CHARACTER <- add_last c;
- extend c:CHARACTER <- add_last c;
-
+
- to_lower <-
// Convert all characters to lower case.
(
@@ -440,7 +440,7 @@ Section Public
put (item i.to_lower) to i;
};
);
-
+
- to_upper <-
// Convert all characters to upper case.
(
@@ -448,7 +448,7 @@ Section Public
put (item i.to_upper) to i;
};
);
-
+
- keep_head n:INTEGER <-
// Remove all characters except for the first `n'.
// Do nothing if `n' >= `count'.
@@ -459,10 +459,10 @@ Section Public
( n < count).if {
remove_last (count - n);
};
-
+
? { count = n.min old_count};
);
-
+
- keep_tail n:INTEGER <-
// Remove all characters except for the last `n'.
// Do nothing if `n' >= `count'.
@@ -473,10 +473,10 @@ Section Public
( n < count).if {
remove_first (count - n);
};
-
+
? { count = n.min old_count};
);
-
+
- remove_first n:INTEGER <-
// Remove `n' first characters.
// If `n' >= `count', remove all.
@@ -491,17 +491,17 @@ Section Public
remove_between 1 to n;
};
};
-
+
? { count = 0.max(old_count - n)};
);
-
+
- remove_between start:INTEGER to end:INTEGER <-
// Remove all characters from `strt_index' to `end_index' inclusive.
(
+ len,old_count:INTEGER;
? { end <= count };
? { start.in_range 1 to (end + 1)};
-
+
old_count := count;
len := end - start + 1;
(len > 0).if {
@@ -512,20 +512,20 @@ Section Public
};
? { count = (old_count - (end - start + 1))};
);
-
+
- remove_suffix s:ABSTRACT_STRING <-
// Remove the suffix `s' of current string.
(
?{ has_suffix s};
remove_last (s.count);
);
-
+
- remove_last n:INTEGER <-
( + old_count:INTEGER;
// Remove `n' last characters. If `n' >= `count', remove all.
?{ n >= 0 };
old_count:=count;
-
+
(n > count).if {
count := 0;
} else {
@@ -534,19 +534,19 @@ Section Public
? { count = 0.max(old_count - n) };
);
-
+
- remove_tail n:INTEGER <-
(
remove_last n;
);
-
+
- remove_prefix s:ABSTRACT_STRING <-
// Remove the prefix `s' of current string.
(
?{ has_prefix s};
remove_first (s.count);
);
-
+
- left_adjust <-
// Remove leading blanks.
(+ i: INTEGER;
@@ -565,25 +565,25 @@ Section Public
};
? { is_empty || {item count != ' '}};
);
-
+
- extend_multiple c:CHARACTER by n:INTEGER <-
// Extend Current with `n' times character `c'.
(
+ old_count:INTEGER;
? { n >= 0};
old_count := count;
- (n - 1).downto 0 do { i:INTEGER;
+ (n - 1).downto 0 do { i:INTEGER;
append_character c;
};
-
+
? { count = n + old_count};
);
-
+
- precede_multiple c:CHARACTER by n:INTEGER <-
// Prepend `n' times character `c' to Current.
(
+ old_count:INTEGER;
-
+
? { n >= 0 };
old_count := count;
(n > 0).if {
@@ -594,10 +594,10 @@ Section Public
storage.move 0 to (old_count - 1) by n;
storage.set_all_with c until (n - 1);
};
- };
+ };
? { count = n + old_count};
);
-
+
- extend_to_count c:CHARACTER until needed_count:INTEGER <-
// Extend Current with `c' until `needed_count' is reached.
// Do nothing if `needed_count' is already greater or equal
@@ -607,10 +607,10 @@ Section Public
(needed_count - count).downto 1 do { i:INTEGER;
append_character(c);
};
-
+
? { count >= needed_count};
);
-
+
- precede_to_count c:CHARACTER until needed_count:INTEGER <-
// Prepend `c' to Current until `needed_count' is reached.
// Do nothing if `needed_count' is already greater or equal
@@ -627,7 +627,7 @@ Section Public
? { count >= needed_count };
);
-
+
- reverse <-
// Reverse the string.
(
@@ -640,7 +640,7 @@ Section Public
i2 := i2 - 1;
};
);
-
+
- remove_all_occurrences ch:CHARACTER <-
// Remove all occurrences of `ch'.
(
@@ -654,7 +654,7 @@ Section Public
};
count := j - 1;
);
-
+
- extend_unless ch:CHARACTER <-
// Extend `Current' (using `extend') with `ch' unless `ch' is
// already the `last' character.
@@ -664,11 +664,11 @@ Section Public
( (count = 0) || {item count != ch}).if {
append_character ch;
};
-
+
? { last = ch };
? { count >= old_count };
);
-
+
- make_from_string model:ABSTRACT_STRING <-
// Initialize from the characters of `model'.
// Useful in proper descendants of STRING.
@@ -685,40 +685,40 @@ Section Public
? { count = model.count};
);
-
+
- set_count new_count:INTEGER <-
[
-? { new_count <= capacity };
]
- (
+ (
count := new_count;
);
-
+
//
// Interfacing with C string :
//
-
+
- to_external:NATIVE_ARRAY(CHARACTER) <-
// Gives C access to the internal `storage' (may be dangerous).
// To be compatible with C, a null character is added at the end
// of the internal `storage'. This extra null character is not
// part of the Eiffel STRING.
- (
+ (
// Append 0 terminal.
- (capacity > count).if {
+ (capacity > count).if {
storage.put '\0' to count;
} else {
add_last '\0';
count := count - 1;
- };
-
+ };
+
storage
)
- [
+ [
+? {count = Old count};
+? {Result.is_not_null};
];
-
+
- from_external p:NATIVE_ARRAY(CHARACTER) <-
// Internal `storage' is set using `p' (may be dangerous because
// the external C string `p' is not duplicated).
@@ -727,7 +727,7 @@ Section Public
// is not part of the Eiffel STRING.
// Also consider `from_external_copy' to choose the most appropriate.
( ? {p.is_not_null};
-
+
count := 0;
{p.item count = '\0'}.until_do {
count := count + 1;
@@ -736,11 +736,11 @@ Section Public
storage := p;
capacity := count + 1;
};
-
+
? {capacity >= (count + 1)};
? {p = to_external};
);
-
+
- from_external_copy p:NATIVE_ARRAY(CHARACTER) <-
// Internal `storage' is set using a copy of `p'.
// Assume `p' has a null character at the end in order to
@@ -756,32 +756,32 @@ Section Public
i := i + 1;
};
);
-
+
//
// Guru section.
//
-
+
- element_sizeof:INTEGER <- 1;
-
- - to_native_array_uinteger_8:NATIVE_ARRAY(UINTEGER_8) <-
+
+ - to_native_array_uinteger_8:NATIVE_ARRAY(UINTEGER_8) <-
(
CONVERT(NATIVE_ARRAY(CHARACTER),NATIVE_ARRAY(UINTEGER_8)).on storage
);
-
+
- add_last_buffer buf:FAST_ARRAY(UINTEGER_8) from beg:INTEGER to end:INTEGER <-
(
beg.to end do { j:INTEGER;
add_last (buf.item j.to_character);
};
);
-
+
- item_byte idx:INTEGER offset ofs:INTEGER :UINTEGER_8 <-
- (
+ (
? {ofs = 0};
? {idx <= upper};
item idx.to_uinteger_8
);
-
+
- restore_after_external <-
(
count := 0;
diff --git a/src/item/itm_expression.li b/src/item/itm_expression.li
index bc0e45f..8b4adb6 100644
--- a/src/item/itm_expression.li
+++ b/src/item/itm_expression.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_EXPRESSION;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "operator list message";
-
+
Section Inherit
-
+
- parent_itm_code:ITM_CODE := ITM_CODE;
-
+
Section Public
-
+
- position:POSITION <- value_list.first.position;
-
+
//
// Data
//
@@ -44,7 +44,7 @@ Section Public
//
// Constructor
- //
+ //
- create v:FAST_ARRAY(ITM_CODE) :SELF <-
( + result:SELF;
@@ -52,9 +52,9 @@ Section Public
result.make v;
result
);
-
+
- make v:FAST_ARRAY(ITM_CODE) <-
- (
+ (
value_list := v;
);
@@ -69,7 +69,7 @@ Section Public
+ left,right:EXPR;
+ instr:INSTR;
+ val_list:FAST_ARRAY(INSTR);
- + val:EXPR;
+ + val:EXPR;
+ typ:TYPE;
+ slo:SLOT;
+ nam,op_name:STRING_CONSTANT;
@@ -80,12 +80,12 @@ Section Public
+ l_arg:FAST_ARRAY(EXPR);
+ result:EXPR;
+ itm_op:ITM_OPERATOR;
-
+
val_list := ALIAS_ARRAY(INSTR).new;
// Search unary message.
- idx := -1;
+ idx := -1;
low := value_list.lower;
- {
+ {
// Search first message.
{
idx := idx + 1;
@@ -95,7 +95,10 @@ Section Public
semantic_error (itm_op.position,"Operator postfix not found.");
};
val := value_list.item idx.to_run_expr;
- typ := val.static_type.raw;
+ typ := val.static_type.raw;
+ (typ = TYPE_VOID).if {
+ semantic_error (val.position,"Expression type `Void'.");
+ };
// Post-fix.
idx_post := idx + 1;
continue := TRUE;
@@ -107,7 +110,7 @@ Section Public
((idx_post = value_list.upper) || {itm_op != NULL}).if {
itm_op ?= value_list.item idx_post;
slo := typ.get_slot (operator (ALIAS_STR.slot_postfix) name (itm_op.name));
- (slo != NULL).if {
+ (slo != NULL).if {
site := NODE.new_read (itm_op.position) slot slo receiver val self val intern FALSE;
list_current.add_last site;
val := site.result_expr;
@@ -116,7 +119,7 @@ Section Public
};
};
};
- // Pre-fix.
+ // Pre-fix.
idx_pre := idx - 1;
continue := TRUE;
{(idx_pre >= low) && {continue}}.while_do {
@@ -127,12 +130,12 @@ Section Public
((idx_pre = low) || {itm_op != NULL}).if {
itm_op ?= value_list.item idx_pre;
slo := typ.get_slot (operator (ALIAS_STR.slot_prefix) name (itm_op.name));
- (slo = NULL).if {
+ (slo = NULL).if {
error_slot (itm_op.position) name "prefix" operator (itm_op.name) in typ;
};
site := NODE.new_read (itm_op.position) slot slo receiver val self val intern FALSE;
list_current.add_last site;
- val := site.result_expr;
+ val := site.result_expr;
idx_pre := idx_pre - 1;
continue := TRUE;
};
@@ -141,9 +144,12 @@ Section Public
idx := idx_post;
(idx < value_list.upper).if {
// Infix.
- typ := val.static_type.raw;
+ typ := val.static_type.raw;
+ (typ = TYPE_VOID).if {
+ semantic_error (val.position,"Expression type `Void'.");
+ };
itm_op ?= value_list.item idx;
- op_name := itm_op.name;
+ op_name := itm_op.name;
(op_name = ALIAS_STR.symbol_equal).if {
instr := EXPR_EQUAL.create (itm_op.position) with NULL and NULL;
}.elseif {op_name = ALIAS_STR.symbol_not_equal} then {
@@ -156,11 +162,11 @@ Section Public
};
instr := NODE.new_read_partial (itm_op.position) slot slo;
};
- val_list.add_last instr;
+ val_list.add_last instr;
};
low := idx_post + 1;
}.do_while {idx <= value_list.upper};
-
+
{val_list.count = 1}.until_do {
// Search max level.
max_lev := -1;
@@ -176,14 +182,14 @@ Section Public
max_pri := ALIAS_STR.keyword_right;
max_pos := j;
};
- } else {
+ } else {
// Other:
slo := site.data.slot;
- (
+ (
(slo.priority > max_lev) ||
{
- (slo.priority = max_lev) &&
- {slo.associativity = max_pri} &&
+ (slo.priority = max_lev) &&
+ {slo.associativity = max_pri} &&
{max_pri = ALIAS_STR.keyword_right}
}
).if {
@@ -193,7 +199,7 @@ Section Public
};
};
};
-
+
n_t ?= val_list.item max_pos;
left ?= val_list.item (max_pos - 1);
right ?= val_list.item (max_pos + 1);
@@ -202,7 +208,7 @@ Section Public
extern ?= val_list.item max_pos;
extern.set_left left and_right right;
loc := type_boolean.default.get_temporary (extern.position);
- instr:= loc.write (extern.position) value extern;
+ instr:= loc.write (extern.position) value extern;
list_current.add_last instr;
val := loc.read (instr.position);
} else {
@@ -215,35 +221,35 @@ Section Public
list_current.add_last n_t;
val := n_t.result_expr;
};
-
+
// Delete operator.
val_list.remove max_pos;
val_list.remove max_pos;
//
- val_list.put val to (max_pos - 1);
+ val_list.put val to (max_pos - 1);
};
result ?= val_list.first;
-
- // Free Array Temporary.
+
+ // Free Array Temporary.
ALIAS_ARRAY(INSTR).free val_list;
-
+
result
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
(value_list.lower).to (value_list.upper) do { i:INTEGER;
value_list.item i.append_in buffer;
};
);
-
-Section Private
-
+
+Section Private
+
- error_slot p:POSITION name s:STRING_CONSTANT operator op:STRING_CONSTANT in t:TYPE <-
(
string_tmp.copy "Slot ";
@@ -252,7 +258,7 @@ Section Private
string_tmp.append op;
string_tmp.append "' not found in ";
string_tmp.append (t.name);
- string_tmp.add_last '.';
+ string_tmp.add_last '.';
semantic_error (p,string_tmp);
);
diff --git a/src/item/itm_read.li b/src/item/itm_read.li
index 93a16d0..be614d6 100644
--- a/src/item/itm_read.li
+++ b/src/item/itm_read.li
@@ -19,25 +19,25 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_READ;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "For local access variable or send message without argument";
-
+
// BSBS: Optim: Penser à faire un ITM_READ_ARG3 pour tous les `if then else'
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
-Section Public
-
+
+Section Public
+
- is_affect:POSITION; // Nothing (it's good with 0).
-
+
//
// Data
//
@@ -54,7 +54,7 @@ Section Public
result.make p name n;
result
);
-
+
- make p:POSITION name n:STRING_CONSTANT <-
(
position := p;
@@ -64,16 +64,16 @@ Section Public
//
// Runnable
//
-
+
- to_run_expr:EXPR <-
( + result:EXPR;
- + loc:LOCAL;
-
+ + loc:LOCAL;
+
loc := lookup name;
(loc != NULL).if {
//
// Local Access.
- //
+ //
(loc.style = '-').if {
loc.set_ensure_count 1;
name := loc.intern_name;
@@ -84,41 +84,41 @@ Section Public
} else {
//
// Slot Access without argument.
- //
+ //
result := to_run_with NULL args NULL;
};
result
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append name;
buffer.append "()";
);
-
+
Section ITM_READ, SLOT_DATA
-
+
- to_run_with first_itm:ITM_CODE args larg:FAST_ARRAY(ITM_CODE) :EXPR <-
( + rec:EXPR;
//
+ itm_list:ITM_LIST;
+ itm_read:ITM_READ;
+ is_resend,implicit_self:BOOLEAN;
-
+
//
// Compute `rec'.
- //
-
+ //
+
(first_itm = NULL).if {
// Implicit Self.
rec := lookup (ALIAS_STR.variable_self).read position;
implicit_self := TRUE;
- } else {
- rec := first_itm.to_run_expr;
+ } else {
+ rec := first_itm.to_run_expr;
// Resend detect.
itm_list ?= first_itm;
(itm_list != NULL).if {
@@ -127,26 +127,26 @@ Section ITM_READ, SLOT_DATA
itm_read ?= first_itm;
};
is_resend := (
- (itm_read != NULL) &&
+ (itm_read != NULL) &&
{position.prototype.search_parent (itm_read.name)}
);
};
to_run_with_self (rec,implicit_self,is_resend) args larg
);
-
- - to_run_with_self (r:EXPR,implicit_self,is_resend:BOOLEAN)
+
+ - to_run_with_self (r:EXPR,implicit_self,is_resend:BOOLEAN)
args larg:FAST_ARRAY(ITM_CODE) :EXPR <-
( + args:FAST_ARRAY(EXPR);
+ rec_type:TYPE;
+ rec:EXPR;
+ em:EXPR_MULTIPLE;
+ pos_null:POSITION;
- //
+ //
+ slot_msg:SLOT;
+ is_block_value:BOOLEAN;
//
+ base:NODE;
-
+
rec := r;
//
// Detect slot.
@@ -157,39 +157,39 @@ Section ITM_READ, SLOT_DATA
// BSBS: Ce cas ne doit jamais arriver !
// il se déclenche avec parent.msg.truc lorsque msg du parent n'a pas de type de retour
// Mais que le profil général en a un...
- semantic_error (position,"Call on Void");
+ semantic_error (position,"Call on Void");
};
-
+
(
- (rec_type.is_block) &&
+ (rec_type.is_block) &&
{name = ALIAS_STR.slot_value}
).if {
// { ... }.value
is_block_value := TRUE;
} else {
- slot_msg := rec_type.get_slot name;
- (slot_msg = NULL).if {
+ slot_msg := rec_type.get_slot name;
+ (slot_msg = NULL).if {
string_tmp.copy "Slot `";
string_tmp.append name;
string_tmp.append "' not found in `";
- rec_type.append_name_in string_tmp;
- string_tmp.append "'.";
+ rec_type.append_name_in string_tmp;
+ string_tmp.append "'.";
semantic_error (position,string_tmp);
- };
+ };
// Verification
(verify).if {
(
- ((larg = NULL) && {slot_msg.argument_list.count != 1}) ||
+ ((larg = NULL) && {slot_msg.argument_list.count != 1}) ||
{(larg != NULL) && {larg.count != slot_msg.argument_list.count-1}}
).if {
- POSITION.put_error semantic text "Incorrect number argument.";
+ POSITION.put_error semantic text "Incorrect number argument.";
slot_msg.position.put_position;
position.put_position;
POSITION.send_error;
};
last_position := slot_msg.position;
(
- (profil_slot != NULL) &&
+ (profil_slot != NULL) &&
{! slot_msg.id_section.access rec_type with (profil_slot.type_self.raw)}
).if {
string_tmp.copy "Type ";
@@ -212,18 +212,18 @@ Section ITM_READ, SLOT_DATA
rec := em.expr_list.first;
};
(larg != NULL).if {
- (larg.lower).to (larg.upper) do { j:INTEGER;
+ (larg.lower).to (larg.upper) do { j:INTEGER;
add_arg (larg.item j.to_run_expr) to (j+1) in args for slot_msg block is_block_value;
};
};
-
+
//
// Send message.
//
(is_block_value).if {
- // { ... }.value
- args := ALIAS_ARRAY(EXPR).copy args;
- args.put (args.first.my_copy) to 0;
+ // { ... }.value
+ args := ALIAS_ARRAY(EXPR).copy args;
+ args.put (args.first.my_copy) to 0;
//rec := slot_msg.slot_data_intern.read position with rec;
base := NODE.new_block position receiver rec with args;
}.elseif {args.count = 1} then {
@@ -232,7 +232,7 @@ Section ITM_READ, SLOT_DATA
args.put (lookup (ALIAS_STR.variable_self).read position) to 0;
args.first.remove;
};
-
+
((verify) && {is_all_warning} && {name == "deferred"}).if {
string_tmp.copy "Deferred in `";
profil_slot.slot.pretty_name_in string_tmp;
@@ -240,10 +240,10 @@ Section ITM_READ, SLOT_DATA
rec.static_type.append_name_in string_tmp;
warning_error (position,string_tmp);
};
-
- base := NODE.new_read position slot slot_msg
+
+ base := NODE.new_read position slot slot_msg
receiver rec self (args.first) intern implicit_self;
-
+
ALIAS_ARRAY(EXPR).free args;
} else {
// Classic message with arguments.
@@ -253,22 +253,22 @@ Section ITM_READ, SLOT_DATA
args.put (args.first.my_copy) to 0;
};
args := ALIAS_ARRAY(EXPR).copy args;
- base := NODE.new_read position slot slot_msg
+ base := NODE.new_read position slot slot_msg
receiver rec with args intern implicit_self;
};
list_current.add_last base;
-
+
(larg != NULL).if {
ALIAS_ARRAY(ITM_CODE).free larg;
};
-
- ? {base.result_expr != NULL};
- base.result_expr
+
+ ? {base.result_expr != NULL};
+ base.result_expr
);
-
+
Section Private
-
- - add_arg e:EXPR to idx:INTEGER
+
+ - add_arg e:EXPR to idx:INTEGER
in args:FAST_ARRAY(EXPR) for slot:SLOT block is_block_value:BOOLEAN <-
( + em:EXPR_MULTIPLE;
+ count:INTEGER;
@@ -276,7 +276,7 @@ Section Private
+ ts:ITM_TYPE_SIMPLE;
+ t:TYPE_FULL;
+ ex:EXPR;
-
+
em ?= e;
(em != NULL).if {
count := em.cardinality;
@@ -285,7 +285,7 @@ Section Private
count := 1;
args.add_last e;
};
- (verify).if {
+ (verify).if {
(! is_block_value).if {
itm_arg := slot.argument_list.item idx;
(itm_arg.count != count).if {
@@ -298,16 +298,16 @@ Section Private
string_tmp.append ", call #";
count.append_in string_tmp;
string_tmp.add_last ')';
- POSITION.put_error semantic text string_tmp;
+ POSITION.put_error semantic text string_tmp;
itm_arg.position.put_position;
- e.position.put_position;
+ e.position.put_position;
POSITION.send_error;
};
(args.count > 1).if {
(itm_arg.lower).to (itm_arg.upper) do { i:INTEGER;
- ts ?= itm_arg.item i;
+ ts ?= itm_arg.item i;
((ts != NULL) && {ts = ITM_TYPE_SIMPLE.type_self}).if {
- ex := args.item (args.upper - itm_arg.upper + i);
+ ex := args.item (args.upper - itm_arg.upper + i);
t := ex.static_type;
((! t.is_expanded) && {! t.is_strict}).if {
string_tmp.copy "Type expression (";
@@ -327,4 +327,3 @@ Section Private
};
};
);
-
\ No newline at end of file
diff --git a/src/lisaac.li b/src/lisaac.li
index f0f1547..ea35cbc 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -828,7 +828,7 @@ Section Public
" For a type set of ".print;
i.print;
" types, the number's argument is ".print;
- tmp.print;
+ tmp.print;
tmp2 := tmp2 + tmp;
'\n'.print;
};
@@ -837,21 +837,21 @@ Section Public
tmp2.print;
'\n'.print;
//
- "Number's function vs polymorphic argument's number:\n".print;
+ "Number's function vs polymorphic argument's number:\n".print;
(PROFIL.nb_func_arg.lower1).to (PROFIL.nb_func_arg.upper1) do { nb_arg:INTEGER;
" For a function with ".print;
nb_arg.print;
" arguments:\n".print;
tmp2 := 0;
(PROFIL.nb_func_arg.lower2).to (PROFIL.nb_func_arg.upper2) do { nb_arg_poly:INTEGER;
- tmp := PROFIL.nb_func_arg.item (nb_arg,nb_arg_poly);
+ tmp := PROFIL.nb_func_arg.item (nb_arg,nb_arg_poly);
(tmp != 0).if {
" ".print;
tmp.print;
" functions with ".print;
nb_arg_poly.print;
" arguments polymorphics.\n".print;
- tmp2 := tmp2 + tmp;
+ tmp2 := tmp2 + tmp;
};
};
" Total: ".print;
@@ -859,7 +859,12 @@ Section Public
'\n'.print;
};
};
-
+
+ PROFIL.list_cpa.lower.to (PROFIL.list_cpa.upper) do { i:INTEGER;
+ PROFIL.list_cpa.item i.print;
+ '\n'.print;
+ };
+
//
// Execute finality command (front end).
//
diff --git a/src/profil.li b/src/profil.li
index 0b63b63..61185a6 100644
--- a/src/profil.li
+++ b/src/profil.li
@@ -634,14 +634,16 @@ Section Public
code.display buffer;
buffer.append "\n---------------------\n";
);
-
+
//
// Statistic
//
-
+
- nb_func_arg:FAST_ARRAY2(INTEGER) := FAST_ARRAY2(INTEGER).create (8,8);
- nb_arg_size_type:FAST_ARRAY(INTEGER) := FAST_ARRAY(INTEGER).create 64;
+ - list_cpa:HASHED_SET(ABSTRACT_STRING) := HASHED_SET(ABSTRACT_STRING).create;
+
Section Private
- put_cast_self buffer:STRING <-
@@ -674,17 +676,43 @@ Section Private
};
buffer.append " */\n";
);
-
+
+ - recur_cpa buf:STRING arg n:INTEGER <-
+ ( + var:LOCAL;
+ + tmp:ABSTRACT_STRING;
+
+ (n > argument_list.upper).if {
+ tmp := list_cpa.reference_at buf;
+ (tmp = NULL).if {
+ list_cpa.add (ALIAS_STR.get buf);
+ };
+ } else {
+ var := argument_list.item n;
+ (var != NULL).if {
+ var.type_list.lower.to (var.type_list.upper) do { i:INTEGER;
+ buf.add_last ' ';
+ buf.append (var.type_list.item i.name);
+ recur_cpa buf arg (n+1);
+ buf.keep_head (Old buf.count);
+ };
+ } else {
+ recur_cpa buf arg (n+1);
+ };
+ };
+ );
+
- append_type buffer:STRING <-
( + v:VARIABLE;
+ nb_arg,nb_arg_poly,tmp:INTEGER;
+ + s:SLOT;
buffer.add_last '(';
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
v := argument_list.item j;
(v != NULL).if {
+ nb_arg := nb_arg + 1; // BSBS Ã mettre ds le if
(is_statistic).if {
- nb_arg := nb_arg + 1;
+
(v.type_list.count > 1).if {
nb_arg_poly := nb_arg_poly + 1;
};
@@ -704,15 +732,28 @@ Section Private
};
(is_statistic).if {
(
- (nb_arg > nb_func_arg.upper1) ||
+ (nb_arg > nb_func_arg.upper1) ||
{nb_arg_poly > nb_func_arg.upper2}
- ).if {
+ ).if {
warning_error (position,"Too much arguments for a statistic.");
- } else {
+ } else {
tmp := nb_func_arg.item (nb_arg,nb_arg_poly) + 1;
nb_func_arg.put tmp to (nb_arg,nb_arg_poly);
- };
+ };
+ };
+
+ string_tmp.clear;
+ nb_arg.append_in string_tmp;
+ string_tmp.add_last ' ';
+ s := slot;
+ (s != NULL).if {
+ string_tmp.append (type_self.raw.name);
+ string_tmp.add_last ' ';
+ string_tmp.append (s.name);
+ } else {
+ string_tmp.append name;
};
+ recur_cpa string_tmp arg (argument_list.lower);
(buffer.last = ',').if {
buffer.remove_last 1;
diff --git a/src/profil_block.li b/src/profil_block.li
index a5f8db6..9d8c354 100644
--- a/src/profil_block.li
+++ b/src/profil_block.li
@@ -19,66 +19,66 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PROFIL_BLOCK;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Method with costumization";
-
+
Section Inherit
-
- + parent_profil:Expanded PROFIL;
-
+
+ + parent_profil:Expanded PROFIL;
+
+ parent_type:Expanded TYPE;
-
+
Section Public
-
- - slot:SLOT <-
+
+ - slot:SLOT <-
(
- crash_with_message "PROFIL_BLOCK.slot";
+ //crash_with_message "PROFIL_BLOCK.slot";
NULL
);
-
+
- type_c:STRING_CONSTANT <- type_block.intern_name;
-
+
+ to_type_block:TYPE_BLOCK;
-
+
+ slot_self:SLOT_DATA;
+ slot_value:SLOT_DATA;
-
+
- inc_id <-
- (
+ (
slot_value.set_ensure_count (slot_value.ensure_count + 1);
);
-
+
- dec_id <-
- (
+ (
slot_value.set_ensure_count (slot_value.ensure_count - 1);
? {slot_value.ensure_count >= 0};
- );
-
+ );
+
+ context_extern:LOCAL;
-
+
+ profil_list:FAST_ARRAY(PROFIL_SLOT);
+ node_list:LINKED_LIST(NODE_TYPE);
-
+
- is_context_sensitive:BOOLEAN <- context_extern != NULL;
-
+
//
// Creation.
//
-
+
- create base:ITM_BLOCK :SELF <-
( + result:SELF;
-
+
result := clone;
result.make base;
result
);
-
+
- make base:ITM_BLOCK <-
( + list:ITM_LIST;
+ old_node_list:LINKED_LIST(NODE_TYPE);
@@ -92,21 +92,21 @@ Section Public
+ r_list:FAST_ARRAY(TYPE_FULL);
+ old_stack_top,old_bottom_index:INTEGER;
+ old_context:LOCAL;
-
+
(is_graph).if {
set_call := HASHED_DICTIONARY(INTEGER,PROFIL).create;
set_back := HASHED_SET(PROFIL).create;
- };
-
+ };
+
list := base.list;
//stack_top := stack_local .upper + 1;
-
+
PROFIL_LIST.add Self;
- type_self := ITM_TYPE_SIMPLE.type_self.to_run_for profil_slot;
+ type_self := ITM_TYPE_SIMPLE.type_self.to_run_for profil_slot;
default := TYPE_FULL.create Self with (
TYPE_FULL.expanded_bit | TYPE_FULL.default_expanded_bit
);
- //
+ //
slot_self := SLOT_DATA.clone;
slot_self.make (list.position) name (ALIAS_STR.slot_self) style '+' base NULL type type_self;
slot_self.set_intern_name (ALIAS_STR.slot_self);
@@ -115,55 +115,55 @@ Section Public
slot_value.make (list.position) name (ALIAS_STR.slot_id) style '+' base NULL type default;
slot_value.set_intern_name (ALIAS_STR.slot_id);
//
- profil_list := FAST_ARRAY(PROFIL_SLOT).create_with_capacity 2;
+ profil_list := FAST_ARRAY(PROFIL_SLOT).create_with_capacity 2;
node_list := LINKED_LIST(NODE_TYPE).create;
old_node_list := NODE.node_list;
NODE.set_node_list node_list;
-
+
// index TYPE
index := index_count;
index_count := index_count + 1;
-
+
// Name : value
- name := ALIAS_STR.get_intern (ALIAS_STR.slot_value);
-
- // Create code.
+ name := ALIAS_STR.get_intern (ALIAS_STR.slot_value);
+
+ // Create code.
old_profil := profil_current;
old_list := list_current;
profil_current := Self;
- list_current := LIST.create (list.position);
-
+ list_current := LIST.create (list.position);
+
(old_stack_top,old_bottom_index,old_context) := ITM_OBJECT.push_context;
// Add context debug.
- (debug_level_option != 0).if {
- context := TYPE_CONTEXT.default.new_local (list.position)
+ (debug_level_option != 0).if {
+ context := TYPE_CONTEXT.default.new_local (list.position)
name (ALIAS_STR.variable_context) style '+';
- context.set_ensure_count 1;
+ context.set_ensure_count 1;
list_current.add_last (PUSH.create (list.position) context context first TRUE);
};
-
- // Append arguments.
+
+ // Append arguments.
a_list := ALIAS_ARRAY(TYPE_FULL).new;
- (base.argument != NULL).if {
- argument_list := FAST_ARRAY(LOCAL).create_with_capacity (base.argument.count+1);
- argument_list.add_last NULL;
+ (base.argument != NULL).if {
+ argument_list := FAST_ARRAY(LOCAL).create_with_capacity (base.argument.count+1);
+ argument_list.add_last NULL;
base.argument.to_run_in argument_list for profil_slot;
1.to (argument_list.upper) do { j:INTEGER;
a_list.add_last (argument_list.item j.type);
};
} else {
- argument_list := FAST_ARRAY(LOCAL).create 1;
- };
+ argument_list := FAST_ARRAY(LOCAL).create 1;
+ };
var := LOCAL.create (list.position) name (ALIAS_STR.variable_self) style ' ' type type_self;
-
+
argument_list.put var to 0;
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
stack_local.add_last (argument_list.item j);
- };
+ };
a_list := ALIAS_ARRAY(TYPE_FULL).alias a_list;
//
- code := list_current;
- //
+ code := list_current;
+ //
result := list.to_run_expr;
// Result.
r_list := ALIAS_ARRAY(TYPE_FULL).new;
@@ -178,82 +178,82 @@ Section Public
r_list.add_last (var.type);
};
} else {
- rd ?= result;
- var := rd.local;
+ rd ?= result;
+ var := rd.local;
result_list.add_last var;
r_list.add_last (var.type);
- };
- };
+ };
+ };
result.remove; // BSBS: Il y a un petit gachi...
r_list := ALIAS_ARRAY(TYPE_FULL).alias r_list;
- //
- context_extern := ITM_OBJECT.context_extern;
- to_type_block := TYPE_BLOCK.get_direct a_list and_result r_list;
+ //
+ context_extern := ITM_OBJECT.context_extern;
+ to_type_block := TYPE_BLOCK.get_direct a_list and_result r_list;
ITM_OBJECT.pop_context (old_stack_top,old_bottom_index,old_context);
//
- NODE.set_node_list old_node_list;
+ NODE.set_node_list old_node_list;
profil_current := old_profil;
list_current := old_list;
);
-
+
//
// Genere Profil.
//
-
+
- is_static:BOOLEAN <- TRUE;
-
+
- genere_handler_intern buffer:STRING <-
(
(is_context_sensitive).if {
warning_error (code.position,
"Compiler limit : This block is context sensitive, and \
\evaluation too far away from the context."
- );
+ );
};
parent_profil.genere_handler_intern buffer;
);
-
+
//
// TYPE BLOCK.
//
-
+
- intern_name:STRING_CONSTANT <- name;
-
+
- write_argument args:FAST_ARRAY(EXPR) :FAST_ARRAY(WRITE) <-
( + rd:READ;
+ rec:EXPR;
-
+
rec := args.first;
rd := slot_self.read (rec.position) with rec;
args.put rd to 0;
parent_profil.write_argument args
);
-
+
- set_late_binding <-
- (
+ (
type_block.set_late_binding;
);
-
+
- link call:CALL_SLOT <-
- (
+ (
(link_count = 0).if {
NODE.node_list.append_collection node_list;
};
link_count := link_count + 1;
);
-
+
- get_expr_result:EXPR <-
( + result:EXPR;
+ lst:FAST_ARRAY(EXPR);
+ loc:LOCAL;
-
+
(result_list.count > 1).if {
- lst := FAST_ARRAY(EXPR).create_with_capacity (result_list.count);
+ lst := FAST_ARRAY(EXPR).create_with_capacity (result_list.count);
(result_list.lower).to (result_list.upper) do { k:INTEGER;
loc := result_list.item k;
lst.add_last (loc.type.get_temporary_expr (loc.position));
- };
- result := EXPR_MULTIPLE.create lst;
+ };
+ result := EXPR_MULTIPLE.create lst;
}.elseif {result_list.count = 1} then {
loc := result_list.first;
result := loc.type.get_temporary_expr (loc.position);
@@ -262,24 +262,24 @@ Section Public
};
result
);
-
+
- is_block:BOOLEAN := TRUE;
- - Self:SELF '~=' Right 60 other:TYPE :BOOLEAN <-
- (
+ - Self:SELF '~=' Right 60 other:TYPE :BOOLEAN <-
+ (
other = to_type_block
);
- - append_name_in buf:STRING <-
+ - append_name_in buf:STRING <-
(
- buf.add_last '{';
+ buf.add_last '{';
(argument_list.count > 1).if {
(argument_list.count > 2).if {
buf.add_last '(';
(argument_list.lower+1).to (argument_list.upper-1) do { j:INTEGER;
argument_list.item j.type.display buf;
buf.add_last ',';
- };
+ };
argument_list.last.type.display buf;
buf.add_last ')';
} else {
@@ -291,95 +291,95 @@ Section Public
(result_list.lower).to (result_list.upper-1) do { j:INTEGER;
result_list.item j.type.display buf;
buf.add_last ',';
- };
+ };
(result_list.is_empty).if_false {
- result_list.last.type.display buf;
+ result_list.last.type.display buf;
};
- buf.add_last '}';
+ buf.add_last '}';
// Debug
buf.append "(PROFIL_BLOCK)";
);
- prototype:PROTOTYPE <- type_block.prototype;
-
+
- subtype_list:HASHED_SET(TYPE) <- type_block.subtype_list;
- add_subtype t:TYPE <- type_block.add_subtype t;
-
+
- get_slot n:STRING_CONSTANT :SLOT <-
(
type_block.get_slot n
);
-
+
- get_local_slot n:STRING_CONSTANT :SLOT <-
(
type_block.get_local_slot n
);
-
+
- get_path_slot n:STRING_CONSTANT :SLOT <-
(
type_block.get_path_slot n
);
-
+
- genere_struct <-
(
to_type_block.genere_struct;
);
-
+
//
// Code source generation.
//
-
+
- put_id buffer:STRING <- index.append_in buffer;
-
- - put_access_id e:EXPR in buffer:STRING <-
- (
+
+ - put_access_id e:EXPR in buffer:STRING <-
+ (
e.genere buffer;
buffer.append ".__id";
);
-
- - put_value buffer:STRING <-
+
+ - put_value buffer:STRING <-
(
index.append_in buffer;
);
-
+
- put_expanded_declaration buffer:STRING <-
- (
+ (
// BSBS: A revoir car c'est un gros bordel entre PROFIL_BLOCK et TYPE_BLOCK!
buffer.append "__";
- buffer.append type_c;
- );
-
+ buffer.append type_c;
+ );
+
Section Public
/*
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
(
- "PROFIL BLOCK\n".print;
+ "PROFIL BLOCK\n".print;
NULL
);
*/
-
- - is_sub_type other:TYPE :BOOLEAN <-
+
+ - is_sub_type other:TYPE :BOOLEAN <-
( + result:BOOLEAN;
+ t:TYPE_BLOCK;
-
+
result := Self ~= other;
(result).if_false {
t ?= other;
result := (
- (t != NULL) &&
+ (t != NULL) &&
{t.argument_list = to_type_block.argument_list} &&
{to_type_block.is_sub_type_result t}
);
};
result
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
- (
+ (
buffer.append "BLOCK SEND ";
append_type buffer;
- );
+ );
diff --git a/src/tools/alias_str.li b/src/tools/alias_str.li
index 7f1a419..ca97c94 100644
--- a/src/tools/alias_str.li
+++ b/src/tools/alias_str.li
@@ -19,36 +19,36 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ALIAS_STR;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Alias string constant and keyword";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Private
-
+
- list:HASHED_SET(ABSTRACT_STRING);
-
+
- free:FAST_ARRAY(STRING) := FAST_ARRAY(STRING).create_with_capacity 5;
-
-Section Public
-
+
+Section Public
+
- keyword_section :STRING_CONSTANT := "Section";
- keyword_right :STRING_CONSTANT := "Right";
- keyword_left :STRING_CONSTANT := "Left";
- keyword_ldots :STRING_CONSTANT := "...";
- keyword_old :STRING_CONSTANT := "Old";
- - keyword_expanded :STRING_CONSTANT := "Expanded";
- - keyword_strict :STRING_CONSTANT := "Strict";
+ - keyword_expanded :STRING_CONSTANT := "Expanded";
+ - keyword_strict :STRING_CONSTANT := "Strict";
- keyword_result :STRING_CONSTANT := "Result";
-
+
- symbol_affect_immediate:STRING_CONSTANT := ":=";
- symbol_affect_cast :STRING_CONSTANT := "?=";
- symbol_affect_code :STRING_CONSTANT := "<-";
@@ -60,10 +60,10 @@ Section Public
- symbol_great_equal :STRING_CONSTANT := ">=";
- symbol_less :STRING_CONSTANT := "<";
- symbol_less_equal :STRING_CONSTANT := "<=";
-
- - operator_equal :STRING_CONSTANT;
+
+ - operator_equal :STRING_CONSTANT;
- operator_not_equal :STRING_CONSTANT;
-
+
- section_header :STRING_CONSTANT := "Header";
- section_inherit :STRING_CONSTANT := "Inherit";
- section_insert :STRING_CONSTANT := "Insert";
@@ -73,14 +73,14 @@ Section Public
- section_mapping :STRING_CONSTANT := "Mapping";
- section_directory :STRING_CONSTANT := "Directory";
- section_external :STRING_CONSTANT := "External";
-
+
- section_default :STRING_CONSTANT := "DEFAULT";
- section_common :STRING_CONSTANT := "Common";
-
+
- prototype_integer :STRING_CONSTANT := "INTEGER";
- prototype_real :STRING_CONSTANT := "REAL";
- prototype_character :STRING_CONSTANT := "CHARACTER";
- - prototype_string_constant :STRING_CONSTANT := "STRING_CONSTANT";
+ - prototype_string_constant :STRING_CONSTANT := "STRING_CONSTANT";
- prototype_string :STRING_CONSTANT := "STRING";
- prototype_native_array :STRING_CONSTANT := "NATIVE_ARRAY";
- prototype_native_array_volatile:STRING_CONSTANT := "NATIVE_ARRAY_VOLATILE";
@@ -94,7 +94,7 @@ Section Public
- prototype_generic :STRING_CONSTANT := "___GENERIC";
- prototype_type_id :STRING_CONSTANT := "___TYPE_ID";
- prototype_self :STRING_CONSTANT := "SELF";
-
+
- prototype_uinteger_64 :STRING_CONSTANT := "UINTEGER_64";
- prototype_uinteger_32 :STRING_CONSTANT := "UINTEGER_32";
- prototype_uinteger_16 :STRING_CONSTANT := "UINTEGER_16";
@@ -104,23 +104,23 @@ Section Public
- prototype_integer_16 :STRING_CONSTANT := "INTEGER_16";
- prototype_integer_8 :STRING_CONSTANT := "INTEGER_8";
- prototype_n_a_character :STRING_CONSTANT := "NATIVE_ARRAY__CHARACTER";
- - prototype_n_a_n_a_character:STRING_CONSTANT :=
+ - prototype_n_a_n_a_character:STRING_CONSTANT :=
"NATIVE_ARRAY__NATIVE_ARRAY__CHARACTER";
- prototype_system_io :STRING_CONSTANT := "SYSTEM_IO";
- prototype_lip :STRING_CONSTANT := "LIP";
-
- - variable_self :STRING_CONSTANT := "Self";
+
+ - variable_self :STRING_CONSTANT := "Self";
- variable_context :STRING_CONSTANT := "__pos";
- variable_null :STRING_CONSTANT := "NULL";
- - variable_void :STRING_CONSTANT := "VOID";
+ - variable_void :STRING_CONSTANT := "VOID";
- variable_tmp :STRING_CONSTANT := "__tmp";
-
+
- variable_lisaac :STRING_CONSTANT := "lisaac";
/*
- variable_input_file :STRING_CONSTANT := "input_file";
- variable_output_file:STRING_CONSTANT := "output_file";
- variable_target :STRING_CONSTANT := "target";
- */
+ */
- slot_name :STRING_CONSTANT := "name";
- slot_export :STRING_CONSTANT := "export";
- slot_import :STRING_CONSTANT := "import";
@@ -135,7 +135,7 @@ Section Public
- slot_language :STRING_CONSTANT := "language";
- slot_copyright :STRING_CONSTANT := "copyright";
- slot_bug_report :STRING_CONSTANT := "bug_report";
-
+
- slot_value :STRING_CONSTANT := "value";
- slot_self :STRING_CONSTANT := "self";
- slot_id :STRING_CONSTANT := "__id";
@@ -148,11 +148,11 @@ Section Public
- slot_from :STRING_CONSTANT := "from_";
- slot_storage :STRING_CONSTANT := "storage";
- slot_count :STRING_CONSTANT := "count";
-
+
// LIP file.
- slot_lip :STRING_CONSTANT := "lip";
- slot_if :STRING_CONSTANT := "if";
- - slot_else :STRING_CONSTANT := "else";
+ - slot_else :STRING_CONSTANT := "else";
- slot_print :STRING_CONSTANT := "print";
- slot_die_with_code:STRING_CONSTANT := "die_with_code";
- slot_run :STRING_CONSTANT := "run";
@@ -170,29 +170,29 @@ Section Public
- slot_inline_level :STRING_CONSTANT := "inline_level";
- slot_is_java :STRING_CONSTANT := "is_java";
- slot_is_statistic :STRING_CONSTANT := "is_statistic";
- - slot_is_quiet :STRING_CONSTANT := "is_quiet";
- - slot_is_library :STRING_CONSTANT := "is_library";
+ - slot_is_quiet :STRING_CONSTANT := "is_quiet";
+ - slot_is_library :STRING_CONSTANT := "is_library";
- slot_get_integer :STRING_CONSTANT := "get_integer";
- slot_get_string :STRING_CONSTANT := "get_string";
- slot_is_cop :STRING_CONSTANT := "is_cop";
-
+
- c_void :STRING_CONSTANT := "void";
- c_struct :STRING_CONSTANT := "struct __";
- code_empty :STRING_CONSTANT := "/* NOTHING */";
- separate :STRING_CONSTANT := "__";
-
+
- path_lisaac :STRING_CONSTANT := "__PATH_LISAAC_SYSTEM__";
- short_format :STRING_CONSTANT := "__SHORT_LISAAC_FORMAT__";
-
+
//
// Shorter.
//
-
+
- short_type_file :STRING_CONSTANT := "type_file";
- short_token :STRING_CONSTANT := "token";
- short_begin :STRING_CONSTANT := "begin";
- short_end :STRING_CONSTANT := "end";
-
+
// Syntax
- short_keyword :STRING_CONSTANT := "keyword";
- short_keyword_section:STRING_CONSTANT := "keyword_section";
@@ -217,10 +217,10 @@ Section Public
- short_warning :STRING_CONSTANT := "warning";
- short_identifier :STRING_CONSTANT := "identifier";
- short_identifier_slot:STRING_CONSTANT := "identifier_slot";
-
+
- short_prototype_comment_light:STRING_CONSTANT := "prototype_comment_light";
- short_prototype_comment:STRING_CONSTANT := "prototype_comment";
-
+
- short_title :STRING_CONSTANT := "title";
- short_table_begin :STRING_CONSTANT := "table_begin";
- short_table_item :STRING_CONSTANT := "table_item";
@@ -231,8 +231,8 @@ Section Public
- short_slot_title :STRING_CONSTANT := "slot_title";
- short_subsub_title :STRING_CONSTANT := "subsub_title";
- short_prototype_path:STRING_CONSTANT := "prototype_path";
-
-
+
+
- short_index :STRING_CONSTANT := "index";
- short_default :STRING_CONSTANT := "default";
- short_directory_list_begin:STRING_CONSTANT := "directory_list_begin";
@@ -241,7 +241,7 @@ Section Public
- short_file_list_begin :STRING_CONSTANT := "file_list_begin";
- short_file_list_item :STRING_CONSTANT := "file_list_item";
- short_file_list_end :STRING_CONSTANT := "file_list_end";
-
+
- is_integer n:STRING_CONSTANT :BOOLEAN <-
(
(n = prototype_uinteger_64) ||
@@ -254,7 +254,7 @@ Section Public
{n = prototype_integer_8 } ||
{n = prototype_integer }
);
-
+
- is_section n:STRING_CONSTANT :BOOLEAN <-
(
(n = section_inherit) ||
@@ -266,31 +266,31 @@ Section Public
{n = section_directory} ||
{n = section_external}
);
-
+
- get str:ABSTRACT_STRING :STRING_CONSTANT <-
( + result:STRING_CONSTANT;
+ tmp:ABSTRACT_STRING;
? {str != NULL};
? {list != NULL};
-
+
tmp := list.reference_at str;
(tmp = NULL).if {
result := STRING_CONSTANT.create_copy str;
list.fast_add result;
} else {
- result ?= tmp;
+ result ?= tmp;
};
? {result ~= str};
result
);
-
+
- get_intern str:ABSTRACT_STRING :STRING_CONSTANT <-
( + result:STRING_CONSTANT;
+ v,m:INTEGER;
-
+
(is_readable).if {
- tmp_name.copy str;
- tmp_name.append "__";
+ tmp_name.copy str;
+ tmp_name.append "__";
} else {
tmp_name.copy "li__";
};
@@ -304,15 +304,15 @@ Section Public
tmp_name.add_last ('0' +# (m-26));
};
v := v >> 5;
- };
+ };
result := STRING_CONSTANT.create_copy tmp_name;
list.fast_add result;
result
);
-
+
- new:STRING <-
( + result:STRING;
-
+
(free.is_empty).if {
result := STRING.create 128;
} else {
@@ -321,32 +321,32 @@ Section Public
};
result
);
-
+
- alias str:STRING :STRING_CONSTANT <-
( + result:STRING_CONSTANT;
-
+
result := get str;
free.add_last str;
str.clear;
result
);
-
+
- make <-
(
tmp_name := STRING.create 255;
-
+
list := HASHED_SET(ABSTRACT_STRING).create;
-
+
// Keyword list :
list.add keyword_section;
list.add keyword_right;
list.add keyword_left;
list.add keyword_ldots;
list.add keyword_old;
- list.add keyword_expanded;
+ list.add keyword_expanded;
list.add keyword_strict;
list.add keyword_result;
-
+
// Symbol list :
list.add symbol_affect_immediate;
list.add symbol_affect_cast;
@@ -358,21 +358,21 @@ Section Public
list.add symbol_great_equal;
list.add symbol_less;
list.add symbol_less_equal;
-
+
// Section name list :
list.add section_header;
list.add section_inherit;
list.add section_insert;
list.add section_interrupt;
- list.add section_private;
+ list.add section_private;
list.add section_public;
list.add section_mapping;
list.add section_directory;
list.add section_external;
-
+
list.add section_default;
list.add section_common;
-
+
// Les types de base :
list.add prototype_integer;
list.add prototype_real;
@@ -390,7 +390,7 @@ Section Public
list.add prototype_generic;
list.add prototype_type_id;
list.add prototype_self;
-
+
// Integers :
list.add prototype_uinteger_64;
list.add prototype_uinteger_32;
@@ -402,24 +402,24 @@ Section Public
list.add prototype_integer_8;
//
list.add prototype_n_a_character;
- list.add prototype_n_a_n_a_character;
+ list.add prototype_n_a_n_a_character;
list.add prototype_system_io;
list.add prototype_lip;
-
+
// Les variables de base :
- list.add variable_self;
+ list.add variable_self;
list.add variable_context;
list.add variable_null;
- list.add variable_void;
+ list.add variable_void;
list.add variable_tmp;
-
- list.add variable_lisaac;
+
+ list.add variable_lisaac;
/*
- list.add variable_input_file;
+ list.add variable_input_file;
list.add variable_output_file;
- list.add variable_target;
+ list.add variable_target;
*/
-
+
// Slot particulier :
list.add slot_name;
list.add slot_export;
@@ -436,8 +436,8 @@ Section Public
list.add slot_copyright;
list.add slot_bug_report;
- list.add slot_value;
- list.add slot_self;
+ list.add slot_value;
+ list.add slot_self;
list.add slot_id;
list.add slot_clone;
list.add slot_main;
@@ -451,7 +451,7 @@ Section Public
// Lip.
list.add slot_lip;
list.add slot_if;
- list.add slot_else;
+ list.add slot_else;
list.add slot_print;
list.add slot_die_with_code;
list.add slot_help_command;
@@ -470,20 +470,20 @@ Section Public
list.add slot_is_java;
list.add slot_is_statistic;
list.add slot_is_quiet;
- list.add slot_is_library;
+ list.add slot_is_library;
list.add slot_get_integer;
list.add slot_get_string;
- list.add slot_is_cop;
-
+ list.add slot_is_cop;
+
// Type C :
list.add c_void;
list.add c_struct;
list.add code_empty;
- list.add separate;
-
+ list.add separate;
+
list.add path_lisaac;
list.add short_format;
-
+
// Shorter slot :
list.add short_token;
list.add short_type_file;
@@ -493,7 +493,7 @@ Section Public
list.add short_keyword_section;
list.add short_integer;
list.add short_character;
- list.add short_string;
+ list.add short_string;
list.add short_operator;
list.add short_prototype;
list.add short_keyprototype;
@@ -512,10 +512,10 @@ Section Public
list.add short_warning;
list.add short_identifier;
list.add short_identifier_slot;
-
+
list.add short_prototype_comment_light;
list.add short_prototype_comment;
-
+
list.add short_title;
list.add short_table_begin;
list.add short_table_item;
@@ -526,7 +526,7 @@ Section Public
list.add short_slot_title;
list.add short_subsub_title;
list.add short_prototype_path;
-
+
list.add short_index;
list.add short_default;
list.add short_directory_list_begin;
@@ -534,19 +534,19 @@ Section Public
list.add short_directory_list_end;
list.add short_file_list_begin;
list.add short_file_list_item;
- list.add short_file_list_end;
+ list.add short_file_list_end;
// Operator '=' and '!=' :
operator_equal := operator slot_infix name symbol_equal;
operator_not_equal := operator slot_infix name symbol_not_equal;
);
-
-Section Private
-
+
+Section Private
+
- tmp_name:STRING;
-
+
- count_variable:INTEGER;
-
+
diff --git a/src/type/type.li b/src/type/type.li
index ae00341..986a830 100644
--- a/src/type/type.li
+++ b/src/type/type.li
@@ -19,113 +19,113 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TYPE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Type without style";
-
+
Section Inherit
-
+
- parent_hashable:HASHABLE := HASHABLE;
-
+
+ parent_any:Expanded ANY;
-
+
- parent_parameter_to_type:Expanded PARAMETER_TO_TYPE;
-
+
Section PROFIL_LIST
-
- - is_alias_struct:BOOLEAN := TRUE;
-
+
+ - is_alias_struct:BOOLEAN := TRUE;
+
Section Private
-
- - dico_type:HASHED_DICTIONARY(TYPE,STRING_CONSTANT) :=
+
+ - dico_type:HASHED_DICTIONARY(TYPE,STRING_CONSTANT) :=
HASHED_DICTIONARY(TYPE,STRING_CONSTANT).create;
-
+
- index_count:INTEGER;
-
+
Section Public
-
+
+ param_count:INTEGER;
-
+
- set_param n:INTEGER <-
(
param_count := param_count.max n;
);
-
+
+ subtype_list:HASHED_SET(TYPE);
-
+
+ default:TYPE_FULL;
-
+
+ size:INTEGER;
-
+
- position:POSITION <- prototype.position;
-
+
- parameter_to_type p:ITM_TYPE_PARAMETER :TYPE_FULL <-
- (
+ (
NULL
);
-
+
//
//
//
-
+
+ last_pass_binding:INTEGER;
-
+
- is_late_binding:BOOLEAN <- pass_count = last_pass_binding;
-
+
- set_late_binding <-
- (
+ (
last_pass_binding := pass_count;
);
-
+
//
//
//
-
+
+ itm_type:ITM_TYPE_SIMPLE;
+ prototype:PROTOTYPE;
-
+
- type_c:STRING_CONSTANT <- prototype.type_c;
-
+
+ slot_run:FAST_ARRAY(SLOT);
-
+
+ index:INTEGER;
-
+
+ intern_name:STRING_CONSTANT;
-
+
- name:STRING_CONSTANT <- prototype.name;
-
+
- hash_code:INTEGER <- intern_name.hash_code;
-
+
- key:STRING_CONSTANT <- prototype.filename;
-
+
//
// Get.
//
-
- - get (path:STRING_CONSTANT,itm_typ:ITM_TYPE_SIMPLE) :TYPE_FULL <-
- ( + result:TYPE_FULL;
+
+ - get (path:STRING_CONSTANT,itm_typ:ITM_TYPE_SIMPLE) :TYPE_FULL <-
+ ( + result:TYPE_FULL;
+ base:TYPE;
- + styl:STRING_CONSTANT;
+ + styl:STRING_CONSTANT;
+ proto:PROTOTYPE;
-
+
+ r:TYPE;
-
+
proto := load_prototype (path,itm_typ.name) generic_count 0;
base := dico_type.fast_reference_at (proto.filename);
- (base = NULL).if {
+ (base = NULL).if {
base := TYPE.clone;
dico_type.fast_put base to (proto.filename);
- base.make itm_typ with proto;
+ base.make itm_typ with proto;
};
- //
+ //
styl := itm_typ.style;
- (styl = NULL).if {
+ (styl = NULL).if {
result := base.default;
} else {
(styl = ALIAS_STR.keyword_expanded).if {
@@ -134,35 +134,35 @@ Section Public
result := base.default + TYPE_FULL.strict_bit;
};
};
-
- r := result.the_parent_type;
+
+ r := result.the_parent_type;
result
);
-
+
//
// Contract
//
-
+
- last_type_contract:TYPE;
-
+
- search_require n:STRING_CONSTANT :ITM_SLOT <-
( + j:INTEGER;
+ result:ITM_SLOT;
+ typ:TYPE;
+ ts:ITM_TYPE_SIMPLE;
-
+
j := slot_run.lower;
{
- (j <= slot_run.upper) &&
+ (j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
{result = NULL}
}.while_do {
- ts ?= slot_run.item j.result_type;
- typ := ts.to_run_for Self.raw;
-
+ ts ?= slot_run.item j.result_type;
+ typ := ts.to_run_for Self.raw;
+
/*
(typ.prototype = NULL).if {
-
+
typ.print; '\n'.print;
`/* ICI BEN FIN */`;
crash_with_message "TYPE: BUG Compiler : search_require";
@@ -184,10 +184,10 @@ Section Public
+ result:ITM_SLOT;
+ typ:TYPE;
+ ts:ITM_TYPE_SIMPLE;
-
+
j := slot_run.lower;
{
- (j <= slot_run.upper) &&
+ (j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
{result = NULL}
}.while_do {
@@ -207,17 +207,17 @@ Section Public
//
// Searching.
//
-
- - add_subtype t:TYPE <-
+
+ - add_subtype t:TYPE <-
( + j:INTEGER;
+ it:ITM_TYPE_MONO;
-
- (! subtype_list.fast_has t).if {
+
+ (! subtype_list.fast_has t).if {
subtype_list.fast_add t;
j := slot_run.lower;
{
- (j <= slot_run.upper) &&
- {slot_run.item j.id_section.is_inherit_or_insert}
+ (j <= slot_run.upper) &&
+ {slot_run.item j.id_section.is_inherit_or_insert}
}.while_do {
(slot_run.item j.id_section.is_inherit).if {
it ?= slot_run.item j.result_type;
@@ -227,18 +227,18 @@ Section Public
};
};
);
-
+
- get_slot n:STRING_CONSTANT :SLOT <-
// Static lookup algorithm.
( + result:SLOT;
+ j:INTEGER;
+ it:ITM_TYPE_MONO;
-
+
result := get_local_slot n;
(result = NULL).if {
j := slot_run.lower;
{
- (j <= slot_run.upper) &&
+ (j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
{result = NULL}
}.while_do {
@@ -249,12 +249,12 @@ Section Public
};
result
);
-
+
- get_local_slot n:STRING_CONSTANT :SLOT <-
( + j:INTEGER;
+ itm_slot:ITM_SLOT;
+ result:SLOT;
-
+
j := slot_run.lower;
{(j <= slot_run.upper) && {slot_run.item j.name != n}}.while_do {
j := j + 1;
@@ -270,29 +270,29 @@ Section Public
};
*/
itm_slot := prototype.slot_list.fast_reference_at n;
- (itm_slot != NULL).if {
+ (itm_slot != NULL).if {
verify_itm_slot_parent itm_slot;
result := SLOT.create itm_slot type Self;
slot_run.add_last result;
};
};
result
- );
-
+ );
+
- get_path_slot n:STRING_CONSTANT :SLOT <-
( + result,r:SLOT;
+ j:INTEGER;
+ it:ITM_TYPE_MONO;
+ t:TYPE_FULL;
-
+
j := slot_run.lower;
{
- (result = NULL) &&
+ (result = NULL) &&
{j <= slot_run.upper} && // BSBS NE doit jamais arriv
{slot_run.item j.id_section.is_inherit_or_insert} // BSBS NE doit jamais arriv
- }.while_do {
+ }.while_do {
it ?= slot_run.item j.result_type;
- t := it.to_run_for Self;
+ t := it.to_run_for Self;
result := t.get_slot n;
j := j + 1;
};
@@ -300,37 +300,37 @@ Section Public
r := slot_run.item (j-1);
} else {
"TYPE : ".print;
- print;
+ print;
':'.print;
- n.print;
+ n.print;
'\n'.print;
crash;
};
r
);
-
+
//
// Import / Export
//
-
+
- last_cast_name:STRING := STRING.create 32;
-
+
- is_export_to t:TYPE_FULL :BOOLEAN <-
- (
+ (
is_cast t with (ALIAS_STR.slot_to) on (prototype.export_list)
);
- is_import_to t:TYPE_FULL :BOOLEAN <-
- (
+ (
is_cast t with (ALIAS_STR.slot_from) on (prototype.import_list)
);
-
+
Section Private
-
+
- is_cast t:TYPE_FULL with msg:STRING_CONSTANT on lst:FAST_ARRAY(ITM_TYPE_MONO) :BOOLEAN <-
- ( + result:BOOLEAN;
+ ( + result:BOOLEAN;
+ j:INTEGER;
-
+
(lst != NULL).if {
j := lst.lower;
{(j <= lst.upper) && {lst.item j.to_run_for profil_slot != t}}.while_do {
@@ -340,45 +340,45 @@ Section Private
result := TRUE;
last_cast_name.copy msg;
lst.item j.append_cast_name_in last_cast_name;
- };
+ };
};
- result
+ result
);
-
+
Section Public
-
+
//
// Genere.
//
-
+
- genere_list:FAST_ARRAY(TYPE) := FAST_ARRAY(TYPE).create_with_capacity 128;
- genere_list_global:FAST_ARRAY(SLOT_DATA) := FAST_ARRAY(SLOT_DATA).create_with_capacity 256;
-
+
- add_genere_list <-
- (
+ (
((slot_run != NULL) && {(slot_run.is_empty) || {slot_run.first != NULL}}).if {
(genere_list.fast_first_index_of Self > genere_list.upper).if { // BSBS: a revoir !!
genere_list.add_last Self;
};
};
);
-
+
- add_genere_global s:SLOT_DATA <-
- (
+ (
(genere_list_global.fast_first_index_of s > genere_list_global.upper).if { // BSBS: a revoir !!
genere_list_global.add_last s;
};
- );
-
+ );
+
- genere_all_struct <-
- (
- TYPE_NULL.genere_typedef;
- (genere_list.lower).to (genere_list.upper) do { j:INTEGER;
- genere_list.item j.genere_typedef_struct;
+ (
+ TYPE_NULL.genere_typedef;
+ (genere_list.lower).to (genere_list.upper) do { j:INTEGER;
+ genere_list.item j.genere_typedef_struct;
};
TYPE_NULL.genere_struct;
- (genere_list.lower).to (genere_list.upper) do { j:INTEGER;
- genere_list.item j.genere_struct;
+ (genere_list.lower).to (genere_list.upper) do { j:INTEGER;
+ genere_list.item j.genere_struct;
};
(debug_level_option != 0).if {
TYPE_CONTEXT.genere_typedef;
@@ -387,52 +387,52 @@ Section Public
(genere_list_global.lower).to (genere_list_global.upper) do { j:INTEGER;
// In global.
genere_list_global.item j.genere output_glob;
- };
+ };
);
-
+
- id_counter_with_type:INTEGER := 4;
- id_counter_without_type:INTEGER := 0;
-
+
- slot_size:FAST_ARRAY(FAST_ARRAY(SLOT_DATA)) :=
( + result:FAST_ARRAY(FAST_ARRAY(SLOT_DATA));
-
+
result := FAST_ARRAY(FAST_ARRAY(SLOT_DATA)).create_with_capacity 5;
0.to 4 do { j:INTEGER;
result.add_last (FAST_ARRAY(SLOT_DATA).create_with_capacity 8);
};
result
- );
-
+ );
+
+ detect_recursivity_generation:BOOLEAN;
-
+
//
// Detect Alias.
//
+ alias_slot:SLOT_DATA;
-
+
- alias_type:TYPE <- alias_slot.type.raw;
-
+
- detect_alias <-
(
(dico_type.lower).to (dico_type.upper) do { j:INTEGER;
dico_type.item j.detect_alias_struct;
- };
+ };
);
- detect_alias_struct <-
[
-? {is_alias_struct};
]
- ( + slot:SLOT;
+ ( + slot:SLOT;
+ i,nb:INTEGER;
- + action:{SLOT_DATA; };
-
+ + action:{SLOT_DATA; };
+
(! is_late_binding).if {
((alias_slot = NULL) && {slot_run != NULL}).if {
-
- action := { s:SLOT_DATA;
- ((s.ensure_count > 0) || {s.id_section.is_mapping}).if {
+
+ action := { s:SLOT_DATA;
+ ((s.ensure_count > 0) || {s.id_section.is_mapping}).if {
(nb = 0).if {
((s.type.is_expanded) && {s.type.raw.type_c = NULL}).if {
alias_slot := s;
@@ -440,12 +440,12 @@ Section Public
} else {
alias_slot := NULL;
};
- nb := nb + 1;
+ nb := nb + 1;
};
};
-
+
i := slot_run.lower;
- {(i <= slot_run.upper) && {nb < 2}}.while_do {
+ {(i <= slot_run.upper) && {nb < 2}}.while_do {
slot := slot_run.item i;
((slot.style = '+') && {slot.lower_style = 0}).if {
(slot.slot_data_list != NULL).if {
@@ -453,28 +453,28 @@ Section Public
action.value (slot.slot_data_list.item k);
};
};
- action.value (slot.slot_data);
+ action.value (slot.slot_data);
};
i := i + 1;
- };
+ };
};
- ((alias_slot != NULL) && {alias_slot.ensure_count = 0}).if {
+ ((alias_slot != NULL) && {alias_slot.ensure_count = 0}).if {
alias_slot := NULL;
- };
+ };
};
);
-
+
- genere_struct <-
- ( + slot_data:SLOT_DATA;
+ ( + slot_data:SLOT_DATA;
+ slot:SLOT;
+ tab:FAST_ARRAY(SLOT_DATA);
+ action:{SLOT_DATA; };
+ tg:TYPE_GENERIC;
+ count_slot:SLOT_DATA;
+ storage_slot:SLOT_DATA;
-
-
- ((slot_run.is_empty) || {slot_run.first != NULL}).if {
+
+
+ ((slot_run.is_empty) || {slot_run.first != NULL}).if {
(detect_recursivity_generation).if {
string_tmp.copy "Compiler limit: Cyclic depending structure definition for ";
append_name_in string_tmp;
@@ -482,25 +482,25 @@ Section Public
semantic_error (position,string_tmp);
};
detect_recursivity_generation := TRUE;
-
+
// Depending.
(slot_run.lower).to (slot_run.upper) do { j:INTEGER;
slot := slot_run.item j;
-
+
((slot.style = '+') && {slot.lower_style = 0}).if {
- action := { s:SLOT_DATA;
+ action := { s:SLOT_DATA;
(
(
- (s.ensure_count > 0) ||
+ (s.ensure_count > 0) ||
{s.id_section.is_mapping}
- ) &&
+ ) &&
{s.type.raw != Self} &&
{
(s.type.raw.is_block) ||
{is_far_expanded (s.type)}
}
- ).if {
- s.type.raw.genere_struct;
+ ).if {
+ s.type.raw.genere_struct;
};
};
(slot.slot_data_list != NULL).if {
@@ -519,7 +519,7 @@ Section Public
(slot.lower_style = 0).if {
action := { s:SLOT_DATA;
(
- (s.id_section.is_mapping) ||
+ (s.id_section.is_mapping) ||
{s.ensure_count > 0}
).if {
add_slot_struct s;
@@ -538,39 +538,39 @@ Section Public
};
};
};
-
+
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
+ (prototype.name = ALIAS_STR.prototype_native_array) ||
{prototype.name = ALIAS_STR.prototype_native_array_volatile}
).if {
tg ?= Self;
tg.generic_list.first.raw.genere_struct;
- } else {
+ } else {
(type_c != NULL).if {
0.to 4 do { j:INTEGER;
tab := slot_size.item j;
// BSBS: A tester sont utilité !
(! tab.is_empty).if {
semantic_error (tab.first.position,"Slot is not possible with a type C");
- };
+ };
};
- (is_java).if_false {
- ((name = ALIAS_STR.prototype_true) ||
+ (is_java).if_false {
+ ((name = ALIAS_STR.prototype_true) ||
{name = ALIAS_STR.prototype_false}).if {
output_decl.append "#define ";
output_decl.append intern_name;
output_decl.append "__ ";
output_decl.add_last ((name = ALIAS_STR.prototype_true).to_character);
- output_decl.add_last '\n';
- } else {
+ output_decl.add_last '\n';
+ } else {
genere_typedef_type_c;
- (is_late_binding).if {
+ (is_late_binding).if {
semantic_error (tab.first.position,"Late binding is not possible with a type C");
- };
+ };
};
};
- } else {
+ } else {
output_decl.append "/* ";
output_decl.append intern_name;
output_decl.append " */\n";
@@ -583,20 +583,20 @@ Section Public
output_decl.append intern_name;
output_decl.append "__ ";
};
- string_tmp.clear;
- (is_late_binding).if {
- id_counter_with_type.append_in output_decl;
+ string_tmp.clear;
+ (is_late_binding).if {
+ id_counter_with_type.append_in output_decl;
id_counter_with_type := id_counter_with_type + 1;
(prototype.style != '-').if {
string_tmp.append " unsigned int __id;\n";
};
- (prototype.is_mapping).if {
- semantic_error (prototype.position,
+ (prototype.is_mapping).if {
+ semantic_error (prototype.position,
"Late binding is not possible with `mapping' object.");
};
- } else {
- id_counter_without_type.append_in output_decl;
- id_counter_without_type := id_counter_without_type + 1;
+ } else {
+ id_counter_without_type.append_in output_decl;
+ id_counter_without_type := id_counter_without_type + 1;
};
(is_java).if {
output_decl.add_last ';';
@@ -604,7 +604,7 @@ Section Public
output_decl.add_last '\n';
(prototype.style = '-').if {
string_tmp.append " lith_object thread;\n";
- (param_count != 0).if {
+ (param_count != 0).if {
1.to param_count do { n:INTEGER;
string_tmp.append " int param_";
(n-1).append_in string_tmp;
@@ -615,32 +615,32 @@ Section Public
4.downto 0 do { j:INTEGER;
tab := slot_size.item j;
(tab.lower).to (tab.upper) do { i:INTEGER;
- slot_data := tab.item i;
+ slot_data := tab.item i;
((prototype.is_mapping) && {slot_data.type.is_expanded_c}).if {
string_tmp.append " volatile ";
} else {
- string_tmp.append " ";
+ string_tmp.append " ";
};
slot_data.genere string_tmp;
};
tab.clear;
- };
-
- (Self = type_block).if {
+ };
+
+ (Self = type_block).if {
string_tmp.append " void *self;\n";
};
-
+
(string_tmp.is_empty).if {
string_tmp.append " void *Nothing;\n";
};
-
+
(is_java).if {
output_decl.append "static class __";
output_decl.append intern_name;
(is_late_binding).if {
output_decl.append " extends __OBJ";
};
- output_decl.append " {\n";
+ output_decl.append " {\n";
output_decl.append string_tmp;
(prototype.is_mapping).if {
semantic_error (position,"Mapping is not yet implemented for Java code.");
@@ -654,7 +654,7 @@ Section Public
output_decl.append "int pid,";
};
storage_slot := get_local_slot (ALIAS_STR.slot_storage).slot_data_intern;
- count_slot := get_local_slot (ALIAS_STR.slot_count).slot_data_intern;
+ count_slot := get_local_slot (ALIAS_STR.slot_count).slot_data_intern;
(count_slot.ensure_count != 0).if {
output_decl.append "int pcount,";
};
@@ -662,7 +662,7 @@ Section Public
output_decl.append "String pstorage,";
};
output_decl.remove_last 1;
- output_decl.append ")\n {\n ";
+ output_decl.append ")\n {\n ";
(is_late_binding).if {
output_decl.append "__id = pid;\n";
};
@@ -674,13 +674,13 @@ Section Public
output_decl.append (storage_slot.intern_name);
output_decl.append " = pstorage.toCharArray();\n";
};
- output_decl.append " };\n";
+ output_decl.append " };\n";
};
// Basic Constructor.
output_decl.append "\n public __";
output_decl.append intern_name;
output_decl.add_last '(';
- (is_late_binding).if {
+ (is_late_binding).if {
output_decl.append "int pid";
};
output_decl.append ")\n {\n ";
@@ -689,8 +689,8 @@ Section Public
} else {
output_decl.append "super();\n";
};
- output_decl.append " };\n};\n";
- }.elseif {alias_slot = NULL} then {
+ output_decl.append " };\n};\n";
+ }.elseif {alias_slot = NULL} then {
output_decl.append "struct ";
output_decl.append intern_name;
output_decl.append "_struct {\n";
@@ -700,7 +700,7 @@ Section Public
} else {
output_decl.append "};\n";
};
- };
+ };
// Prototype declaration.
(is_java).if {
output_glob.append "private static __";
@@ -727,62 +727,62 @@ Section Public
output_glob.append intern_name;
output_glob.append "__}";
};
- output_glob.append ";\n";
+ output_glob.append ";\n";
output_glob.append "#define ";
output_glob.append intern_name;
output_glob.append "__ (&";
output_glob.append intern_name;
- output_glob.append "_)\n\n";
+ output_glob.append "_)\n\n";
};
};
};
-
+
// Flag on:
slot_run.force NULL to 0;
- };
+ };
);
-
- - genere_typedef_type_c <-
- ( + tg:TYPE_GENERIC;
+
+ - genere_typedef_type_c <-
+ ( + tg:TYPE_GENERIC;
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
+ (prototype.name = ALIAS_STR.prototype_native_array) ||
{prototype.name = ALIAS_STR.prototype_native_array_volatile}
).if {
tg ?= Self;
tg.generic_list.first.raw.genere_typedef_type_c;
- } else {
- output_decl.append "typedef ";
- output_decl.append type_c;
+ } else {
+ output_decl.append "typedef ";
+ output_decl.append type_c;
output_decl.append " __";
- output_decl.append intern_name;
- output_decl.add_last ';';
+ output_decl.append intern_name;
+ output_decl.add_last ';';
output_decl.add_last '\n';
- };
+ };
);
-
+
- genere_typedef_struct <-
- ( + tg:TYPE_GENERIC;
+ ( + tg:TYPE_GENERIC;
+ t:TYPE;
-
+
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
+ (prototype.name = ALIAS_STR.prototype_native_array) ||
{prototype.name = ALIAS_STR.prototype_native_array_volatile}
).if {
tg ?= Self;
tg.generic_list.first.raw.genere_typedef_struct;
- }.elseif {type_c = NULL} then {
- output_decl.append "typedef ";
- t := Self;
+ }.elseif {type_c = NULL} then {
+ output_decl.append "typedef ";
+ t := Self;
{t.alias_slot = NULL}.until_do {
t := t.alias_type;
- };
+ };
output_decl.append "struct ";
output_decl.append (t.intern_name);
- output_decl.append "_struct";
+ output_decl.append "_struct";
output_decl.append " __";
- output_decl.append intern_name;
- output_decl.add_last ';';
- (alias_slot != NULL).if {
+ output_decl.append intern_name;
+ output_decl.add_last ';';
+ (alias_slot != NULL).if {
output_decl.append " /* ALIAS with ";
output_decl.append (alias_type.intern_name);
output_decl.append " */";
@@ -790,18 +790,18 @@ Section Public
output_decl.add_last '\n';
};
);
-
-Section Private
-
+
+Section Private
+
- add_slot_struct s:SLOT_DATA <-
- (
+ (
(prototype.is_mapping).if {
- (s.id_section.is_mapping).if {
+ (s.id_section.is_mapping).if {
slot_size.first.add_last s;
} else {
semantic_error (s.position,"Slot is not in `Mapping' section.");
};
- } else {
+ } else {
((s.type.is_expanded) && {! s.type.is_default_expanded}).if {
slot_size.item 4.add_last s;
} else {
@@ -809,22 +809,22 @@ Section Private
};
};
);
-
-Section Public
-
+
+Section Public
+
//
// Declaration generation.
//
-
+
- put_reference_declaration buffer:STRING <-
- (
+ (
buffer.append "__";
- buffer.append intern_name;
+ buffer.append intern_name;
add_genere_list;
);
-
+
- put_reference_star_declaration buffer:STRING <-
- (
+ (
(is_block).if_false { // BSBS: A mettre dans TYPE_BLOCK
(is_java).if {
buffer.append "[]";
@@ -833,35 +833,35 @@ Section Public
};
};
);
-
+
- put_expanded_declaration buffer:STRING <-
- (
+ (
((is_java) && {type_c != NULL}).if {
buffer.append type_c;
} else {
buffer.append "__";
- buffer.append intern_name;
+ buffer.append intern_name;
};
add_genere_list;
);
-
+
- put_generic_declaration buffer:STRING <-
- (
+ (
(is_block).if { // BSBS: A mettre dans TYPE_BLOCK
put_expanded_declaration buffer;
} else {
(is_java).if {
- buffer.append "__OBJ ";
+ buffer.append "__OBJ ";
} else {
- buffer.append (ALIAS_STR.c_void);
+ buffer.append (ALIAS_STR.c_void);
};
};
);
-
+
//
// Code source generation.
//
-
+
- put_id buffer:STRING <-
(
buffer.append (ALIAS_STR.separate); // <=> "__"
@@ -872,15 +872,15 @@ Section Public
- put_access_id e:EXPR in buffer:STRING <-
// For switch.
( + t:TYPE;
-
+
t := e.static_type.raw;
(t = type_boolean).if {
- e.genere buffer;
+ e.genere buffer;
}.elseif {t = type_block} then {
e.genere buffer;
//buffer.append ".__id";
} else {
- (is_java).if {
+ (is_java).if {
e.genere buffer;
buffer.append ".__id";
} else {
@@ -890,39 +890,39 @@ Section Public
};
};
);
-
+
- put_value buffer:STRING <-
(
buffer.append intern_name;
buffer.append (ALIAS_STR.separate);
add_genere_list;
);
-
+
//
// Display.
//
-
+
- append_name_in buf:STRING <-
(
buf.append name;
);
-
+
- print <-
(
string_tmp.clear;
append_name_in string_tmp;
string_tmp.print;
);
-
+
Section Public
-
+
- is_block:BOOLEAN := FALSE;
-
+
- Self:SELF '~=' Right 60 other:TYPE :BOOLEAN <- (Self = other);
-
+
- is_sub_type other:TYPE :BOOLEAN <-
( + result:BOOLEAN;
-
+
(Self = other).if {
result := TRUE;
}.elseif {other.subtype_list != NULL} then {
@@ -936,13 +936,13 @@ Section Public
+ idx:INTEGER;
+ type_parent:TYPE;
+ ts:ITM_TYPE_SIMPLE;
-
+
(n = prototype.name).if {
result := TRUE;
} else {
idx := slot_run.lower;
{
- (idx <= slot_run.upper) &&
+ (idx <= slot_run.upper) &&
{slot_run.item idx.id_section.is_inherit_or_insert} &&
{! result}
}.while_do {
@@ -956,31 +956,31 @@ Section Public
};
result
);
-
+
Section TYPE
- - load_prototype (call_path:STRING_CONSTANT,n:STRING_CONSTANT)
+ - load_prototype (call_path:STRING_CONSTANT,n:STRING_CONSTANT)
generic_count gen_count:INTEGER :PROTOTYPE <-
( + j,idx_path,idx_name,idx_name_old,idx_path_old:INTEGER;
- + entry:POINTER;
+ + entry:POINTER;
+ result:PROTOTYPE;
+ path,found,cur_found:STRING_CONSTANT;
+ cn,cp:CHARACTER;
+ read_char:{};
+ stat,found_index,cur_index:INTEGER;
+ is_only:BOOLEAN;
-
-
+
+
//call_path.print; ' '.print; n.print; '\n'.print;
-
- result := dico_name_to_prototype.fast_reference_at n;
+
+ result := dico_name_to_prototype.fast_reference_at n;
(result = NULL).if {
read_char := {
cn := n.item idx_name;
(cn = '.').if {
(
- (idx_name > n.lower+1) &&
- {n.item (idx_name-1) = '.'} &&
+ (idx_name > n.lower+1) &&
+ {n.item (idx_name-1) = '.'} &&
{n.item (idx_name-2) = '.'}
).if {
idx_name := idx_name - 2;
@@ -992,10 +992,10 @@ Section TYPE
cn := cn.to_lower;
};
};
- j := path_file.lower;
+ j := path_file.lower;
is_only := TRUE;
- {(j > path_file.upper) || {stat = 2}}.until_do {
- path := path_file.item j;
+ {(j > path_file.upper) || {stat = 2}}.until_do {
+ path := path_file.item j;
cur_found := NULL;
idx_name := n.upper;
idx_path := path.upper-3; // ".li"
@@ -1005,35 +1005,35 @@ Section TYPE
idx_name := idx_name - 1;
idx_path := idx_path - 1;
}.do_while {
- (idx_name >= n.lower) &&
- {idx_path >= path.lower} &&
+ (idx_name >= n.lower) &&
+ {idx_path >= path.lower} &&
{cn = cp}
- };
+ };
((idx_name < n.lower) && {cn = cp}).if {
((idx_path < path.lower) || {path.item idx_path = '/'}).if {
- cur_found := path;
+ cur_found := path;
};
- }.elseif {(cn = '*') && {cp = '/'}} then {
+ }.elseif {(cn = '*') && {cp = '/'}} then {
idx_name_old := idx_name+1;
idx_path_old := idx_path+1;
- {(idx_name >= n.lower) && {idx_path >= path.lower}}.while_do {
- read_char.value;
- cp := path.item idx_path;
- (cn = cp).if {
- // Nothing.
- }.elseif {(cn = '*') && {cp = '/'}} then {
+ {(idx_name >= n.lower) && {idx_path >= path.lower}}.while_do {
+ read_char.value;
+ cp := path.item idx_path;
+ (cn = cp).if {
+ // Nothing.
+ }.elseif {(cn = '*') && {cp = '/'}} then {
idx_name_old := idx_name;
idx_path_old := idx_path;
- } else {
+ } else {
idx_name := idx_name_old;
idx_path := idx_path_old;
{
idx_path := idx_path - 1;
- }.do_while {(idx_path >= path.lower) && {path.item idx_path != '/'}};
+ }.do_while {(idx_path >= path.lower) && {path.item idx_path != '/'}};
idx_path_old := idx_path;
};
idx_name := idx_name - 1;
- idx_path := idx_path - 1;
+ idx_path := idx_path - 1;
};
(idx_name < n.lower).if {
cur_found := path;
@@ -1046,18 +1046,18 @@ Section TYPE
(stat = 0).if {
stat := 1;
found := cur_found;
- found_index := cur_index;
+ found_index := cur_index;
} else {
is_only := FALSE;
(cur_index > found_index).if {
found := cur_found;
- found_index := cur_index;
+ found_index := cur_index;
};
};
- };
+ };
j := j + 1;
};
-
+
(stat = 0).if {
string_tmp.copy n;
string_tmp.append " is not found.\n";
@@ -1066,7 +1066,7 @@ Section TYPE
list_current.position.put_position;
};
POSITION.send_error;
- } else {
+ } else {
result := PROTOTYPE.prototype_dico.fast_reference_at found;
(result = NULL).if {
entry := FS_MIN.open_read found;
@@ -1085,10 +1085,10 @@ Section TYPE
(is_only).if {
dico_name_to_prototype.add result to n;
};
- };
+ };
};
- (result.generic_count != gen_count).if {
- //crash;
+ (result.generic_count != gen_count).if {
+ //crash;
POSITION.put_error semantic text "Incorrect genericity definition.";
result.position.put_position;
(last_position.code != 0).if {
@@ -1098,23 +1098,23 @@ Section TYPE
};
POSITION.send_error;
};
-
+
//result.filename.print; '\n'.print; '\n'.print;
-
+
result
);
-
+
- make itm_typ:ITM_TYPE_SIMPLE with proto:PROTOTYPE <-
- ( + mask_bit:UINTEGER_8;
-
+ ( + mask_bit:UINTEGER_8;
+
index := index_count;
index_count := index_count + 1;
prototype := proto;
string_tmp.copy name;
string_tmp.replace_all '.' with '_';
intern_name := ALIAS_STR.get_intern string_tmp;
- itm_type := itm_typ;
- slot_run := FAST_ARRAY(SLOT).create_with_capacity 10; // BSBS: A voir.
+ itm_type := itm_typ;
+ slot_run := FAST_ARRAY(SLOT).create_with_capacity 10; // BSBS: A voir.
(prototype.type_style = ALIAS_STR.keyword_expanded).if {
// Expanded.
mask_bit := TYPE_FULL.expanded_bit | TYPE_FULL.default_expanded_bit;
@@ -1123,7 +1123,7 @@ Section TYPE
mask_bit := TYPE_FULL.strict_bit | TYPE_FULL.default_strict_bit;
};
default := TYPE_FULL.create Self with mask_bit;
- prototype.init_slot_for Self;
+ prototype.init_slot_for Self;
//
subtype_list := HASHED_SET(TYPE).create;
subtype_list.fast_add TYPE_NULL;
@@ -1154,18 +1154,18 @@ Section TYPE
size := 3; // 64 bits
};
);
-
- - dico_name_to_prototype:HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT) :=
+
+ - dico_name_to_prototype:HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT) :=
HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT).create;
-
+
Section TYPE, TYPE_FULL
-
+
+ type_full_list:FAST_ARRAY(TYPE_FULL);
-
+
- get_with flg:UINTEGER_8 :TYPE_FULL <-
( + result:TYPE_FULL;
+ i:INTEGER;
-
+
(flg = default.flag).if {
result := default;
} else {
@@ -1187,9 +1187,9 @@ Section TYPE, TYPE_FULL
};
result
);
-
+
Section Private
-
+
- is_far_expanded t:TYPE_FULL :BOOLEAN <-
// BSBS: Met en non recurssif!!
( + tg:TYPE_GENERIC;
@@ -1197,7 +1197,7 @@ Section Private
(t.is_expanded).if {
result := TRUE;
}.elseif {
- (t.raw.prototype.name = ALIAS_STR.prototype_native_array) ||
+ (t.raw.prototype.name = ALIAS_STR.prototype_native_array) ||
{t.raw.prototype.name = ALIAS_STR.prototype_native_array_volatile}
} then {
tg ?= t.raw;
@@ -1205,42 +1205,42 @@ Section Private
};
result
);
-
+
Section TYPE,PROTOTYPE
-
+
- verify_itm_slot_parent ref:ITM_SLOT <-
( + idx:INTEGER;
+ type_parent:TYPE;
+ ts:ITM_TYPE_SIMPLE;
+ other:ITM_SLOT;
-
+
idx := slot_run.lower;
{
- (idx <= slot_run.upper) &&
- {slot_run.item idx.id_section.is_inherit_or_insert}
- }.while_do {
+ (idx <= slot_run.upper) &&
+ {slot_run.item idx.id_section.is_inherit_or_insert}
+ }.while_do {
ts ?= slot_run.item idx.result_type;
type_parent := ts.to_run_for Self.raw;
other := type_parent.prototype.slot_list.fast_reference_at (ref.name);
(other != NULL).if {
- ref.is_equal_profil other;
+ ref.is_equal_profil other;
};
type_parent.verify_itm_slot_parent ref;
idx := idx + 1;
};
);
-
+
- verify_cyclic_inheritance ref:TYPE <-
( + idx:INTEGER;
+ type_parent:TYPE;
+ ts:ITM_TYPE_SIMPLE;
+ s:SLOT;
-
+
idx := slot_run.lower;
{
- (idx <= slot_run.upper) &&
- {slot_run.item idx.id_section.is_inherit_or_insert}
- }.while_do {
+ (idx <= slot_run.upper) &&
+ {slot_run.item idx.id_section.is_inherit_or_insert}
+ }.while_do {
s := slot_run.item idx;
ts ?= s.result_type;
type_parent := ts.to_run_for Self.raw;
diff --git a/src/variable/slot.li b/src/variable/slot.li
index 2553778..cdcb201 100644
--- a/src/variable/slot.li
+++ b/src/variable/slot.li
@@ -19,60 +19,60 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SLOT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for slot runnable";
-
+
Section Inherit
-
+
+ parent_itm_slot:ITM_SLOT := ITM_SLOT;
-
+
Section Public
-
+
- common_slot:SLOT <- Self;
-
+
+ slot_id:SLOT_DATA;
-
+
+ receiver_type:TYPE;
-
+
//
// Creation.
//
-
+
- create s:ITM_SLOT type t:TYPE :SLOT <-
( + result:SLOT;
-
+
result := clone;
- result.make s type t
+ result.make s type t
);
-
+
- make s:ITM_SLOT type t:TYPE :SLOT <-
( + result:SLOT;
-
+
parent_itm_slot := s;
receiver_type := t;
//
(affect = '<').if {
- // Code.
- result := slot_code_intern := SLOT_CODE.create Self with value;
+ // Code.
+ result := slot_code_intern := SLOT_CODE.create Self with value;
} else {
- // Data
+ // Data
create_slot_data;
result := slot_data_intern;
- };
+ };
//
result
);
-
+
//
// Style.
//
-
+
- lower_style:INTEGER <-
( + result:INTEGER;
(slot_data_intern = NULL).if {
@@ -80,10 +80,10 @@ Section Public
};
result
);
-
- - upper_style:INTEGER <-
+
+ - upper_style:INTEGER <-
( + result:INTEGER;
- (slot_code_intern != NULL).if {
+ (slot_code_intern != NULL).if {
(slot_code_list != NULL).if {
result := slot_code_list.upper + 2;
} else {
@@ -92,11 +92,11 @@ Section Public
};
result
);
-
+
- slot_data:SLOT_DATA <-
- (
+ (
(slot_data_intern = NULL).if {
- create_slot_data;
+ create_slot_data;
(slot_id = NULL).if {
slot_id := SLOT_DATA.create common_slot type_full (TYPE_ID.get_index 1.default);
slot_id.init;
@@ -104,10 +104,10 @@ Section Public
};
slot_data_intern
);
-
+
- slot_code idx:INTEGER :SLOT_CODE <-
( + result:SLOT_CODE;
-
+
(idx = 1).if {
result := slot_code_intern;
} else {
@@ -119,7 +119,7 @@ Section Public
- add_style v:ITM_CODE :INTEGER <-
( + slot:SLOT_CODE;
+ result:INTEGER;
-
+
slot := SLOT_CODE.create common_slot with v;
(slot_code_intern = NULL).if {
slot_code_intern := slot;
@@ -136,14 +136,14 @@ Section Public
slot_id.init;
};
result := slot_code_list.upper + 2;
- };
+ };
result
);
//
// Display.
//
-
+
- display_all <-
(
(lower_style).to (upper_style) do { j:INTEGER;
@@ -152,31 +152,31 @@ Section Public
);
Section Public
-
+
+ slot_data_intern:SLOT_DATA; // Index 0
+ slot_code_intern:SLOT_CODE; // Index 1
-
+
+ slot_code_list:FAST_ARRAY(SLOT_CODE); // Index x+2
- + slot_data_list:FAST_ARRAY(SLOT_DATA); // Vector data slot
-
+ + slot_data_list:FAST_ARRAY(SLOT_DATA); // Vector data slot
+
- create_slot_data <-
( + typ:TYPE_FULL;
- + tm:ITM_TYPE_MULTI;
+ + tm:ITM_TYPE_MULTI;
+ ts:ITM_TYPE_MONO;
-
- tm ?= result_type;
- (tm != NULL).if {
+
+ tm ?= result_type;
+ (tm != NULL).if {
slot_data_list := FAST_ARRAY(SLOT_DATA).create_with_capacity (tm.count-1);
(tm.lower).to (tm.upper-1) do { k:INTEGER;
typ := tm.item k.to_run_for receiver_type;
slot_data_list.add_last (
SLOT_DATA.create common_slot type_full typ
);
- };
+ };
typ := tm.last.to_run_for receiver_type;
} else {
ts ?= result_type;
typ := ts.to_run_for receiver_type;
};
- slot_data_intern := SLOT_DATA.create common_slot type_full typ;
+ slot_data_intern := SLOT_DATA.create common_slot type_full typ;
);
\ No newline at end of file
--
Lisaac compiler
More information about the Lisaac-commits
mailing list