[SCM] Lisaac compiler branch, mildred-bugfix, updated. lisaac-0.12-557-gcaab436
Mildred Ki'Lya
silkensedai at online.fr
Mon Oct 12 21:28:48 UTC 2009
The following commit has been merged in the mildred-bugfix branch:
commit caab436e5d5aa5b446d5ec00190d32bca669a560
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Mon Oct 12 23:18:37 2009 +0200
Added comparison for Expanded
diff --git a/src/external/comparison/expr_binary_cmp.li b/src/external/comparison/expr_binary_cmp.li
index 5fbbed0..d4cd8b7 100644
--- a/src/external/comparison/expr_binary_cmp.li
+++ b/src/external/comparison/expr_binary_cmp.li
@@ -41,6 +41,11 @@ Section Public
+ right:EXPR;
- set_left l:EXPR and_right r:EXPR <-
+ [
+ ((l != NULL) && {r != NULL}).if {
+ -? { l.static_type.is_expanded_c = r.static_type.is_expanded_c };
+ };
+ ]
(
left := l;
right := r;
@@ -65,6 +70,11 @@ Section Public
//
- create p:POSITION with l:EXPR and r:EXPR :SELF <-
+ [
+ ((l != NULL) && {r != NULL}).if {
+ -? { l.static_type.is_expanded_c = r.static_type.is_expanded_c };
+ };
+ ]
( + result:SELF;
result := clone;
@@ -73,6 +83,11 @@ Section Public
);
- make p:POSITION with l:EXPR and r:EXPR <-
+ [
+ ((l != NULL) && {r != NULL}).if {
+ -? { l.static_type.is_expanded_c = r.static_type.is_expanded_c };
+ };
+ ]
(
position := p;
left := l;
@@ -160,7 +175,10 @@ Section Public
};
result
- );
+ )
+ [
+ +? { left.static_type.is_expanded_c = right.static_type.is_expanded_c };
+ ];
- exec_conservator:EXPR <- NULL;
- exec_conservator_left left_cst :INTEGER_CST :EXPR <- NULL;
@@ -177,24 +195,68 @@ Section Public
//
- genere buffer:STRING <-
+ genere buffer with (left, right);
+
+Section SELF
+
+ - genere buffer:STRING with (l,r :EXPR) <-
+ genere_direct buffer with (l, r);
+
+ - genere buffer:STRING expanded_ref (l,r :EXPR)
+ operator op:ABSTRACT_STRING :BOOLEAN <-
+ [
+ -? { ! l.static_type.is_expanded_c };
+ -? { ! r.static_type.is_expanded_c };
+ -? { l.static_type.raw = r.static_type.raw };
+ ]
+ ( + slot:SLOT;
+ + slots:FAST_ARRAY(SLOT);
+ + state :BOOLEAN;
+
+ slots := l.static_type.raw.slot_run;
+ (slots.lower).to (slots.upper) do { i:INTEGER;
+ slot := slots.item i;
+ (slot.style = '+').if {
+ slot.foreach_generated_slot_data { slot_data:SLOT_DATA;
+ state.if_false {
+ state := TRUE;
+ } else {
+ buffer.add_last ' ';
+ buffer.append op;
+ buffer.add_last ' ';
+ };
+ buffer.add_last '(';
+ /*genere buffer with (
+ slot_data.read_direct (l.position) with l,
+ slot_data.read_direct (r.position) with r
+ );*/
+ buffer.add_last ')';
+ };
+ };
+ };
+
+ state
+ );
+
+ - genere_direct buffer:STRING with (l, r :EXPR) <-
(
buffer.add_last '(';
(
- (left.static_type.raw = type_pointer) &&
- {ALIAS_STR.is_integer (right.static_type.raw.name)}
+ (l.static_type.raw = type_pointer) &&
+ {ALIAS_STR.is_integer (r.static_type.raw.name)}
).if {
buffer.append "(unsigned long)";
- }.elseif {! left.static_type.is_expanded} then {
+ }.elseif {! l.static_type.is_expanded} then {
buffer.append "(void *)"; // BSBS: A virer quand tu auras optim '=='
};
- ((left.static_type.raw = TYPE_NULL) && {right.static_type.raw.is_block}).if {
+ ((l.static_type.raw = TYPE_NULL) && {r.static_type.raw.is_block}).if {
buffer.add_last '0';
} else {
- (left.static_type.is_expanded_ref).if {
+ (l.static_type.is_expanded_ref).if {
buffer.add_last '*';
};
- left.genere buffer;
- (left.static_type.raw.is_block).if {
+ l.genere buffer;
+ (l.static_type.raw.is_block).if {
buffer.append ".__id";
};
};
@@ -203,26 +265,28 @@ Section Public
buffer.add_last ' ';
(
- (ALIAS_STR.is_integer (left.static_type.raw.name)) &&
- {right.static_type.raw = type_pointer}
+ (ALIAS_STR.is_integer (l.static_type.raw.name)) &&
+ {r.static_type.raw = type_pointer}
).if {
buffer.append "(unsigned long)";
- }.elseif {! right.static_type.is_expanded} then {
+ }.elseif {! r.static_type.is_expanded} then {
buffer.append "(void *)"; // BSBS: A virer quand tu auras optim '=='
};
- ((right.static_type.raw = TYPE_NULL) && {left.static_type.raw.is_block}).if {
+ ((r.static_type.raw = TYPE_NULL) && {l.static_type.raw.is_block}).if {
buffer.add_last '0';
} else {
- (right.static_type.is_expanded_ref).if {
+ (r.static_type.is_expanded_ref).if {
buffer.add_last '*';
};
- right.genere buffer;
- (right.static_type.raw.is_block).if {
+ r.genere buffer;
+ (r.static_type.raw.is_block).if {
buffer.append ".__id";
};
};
buffer.add_last ')';
);
+
+Section Public
//
// Display.
diff --git a/src/external/comparison/expr_equal.li b/src/external/comparison/expr_equal.li
index 03d2fba..2601d1b 100644
--- a/src/external/comparison/expr_equal.li
+++ b/src/external/comparison/expr_equal.li
@@ -80,10 +80,20 @@ Section Public
result
);
-
-
-
-
+ //
+ // Genere.
+ //
+ - genere buffer:STRING with (l,r :EXPR) <-
+ (
+ l.static_type.is_expanded_c.if {
+ ? {r.static_type.is_expanded_c};
+ genere_direct buffer with (l, r);
+ } else {
+ genere buffer expanded_ref (l, r) operator "&&".if_false {
+ buffer.add_last '1';
+ }
+ };
+ );
diff --git a/src/external/comparison/expr_not_equal.li b/src/external/comparison/expr_not_equal.li
index 69f42cd..ba5c895 100644
--- a/src/external/comparison/expr_not_equal.li
+++ b/src/external/comparison/expr_not_equal.li
@@ -82,7 +82,20 @@ Section Public
result
);
-
-
+ //
+ // Genere.
+ //
+
+ - genere buffer:STRING with (l,r :EXPR) <-
+ (
+ l.static_type.is_expanded_c.if {
+ ? {r.static_type.is_expanded_c};
+ genere_direct buffer with (l, r);
+ } else {
+ genere buffer expanded_ref (l, r) operator "||".if_false {
+ buffer.add_last '0';
+ }
+ };
+ );
diff --git a/src/item/itm_read_arg2.li b/src/item/itm_read_arg2.li
index 98caee4..1f6ae44 100644
--- a/src/item/itm_read_arg2.li
+++ b/src/item/itm_read_arg2.li
@@ -90,10 +90,10 @@ Section Public
{name = ALIAS_STR.operator_not_equal}
).if {
v1 := arg_first .to_run_expr;
+ t1 := v1.static_type;
+ t2 := v2.static_type;
v2 := arg_second.to_run_expr;
(verify).if {
- t1 := v1.static_type;
- t2 := v2.static_type;
(
(! t1.is_expanded) &&
{! t2.is_expanded} &&
@@ -111,6 +111,10 @@ Section Public
em1 ?= v1;
(em1 != NULL).if {
em2 ?= v2;
+ (em1.count != em2.count).if {
+ semantic_error(position,
+ "Comparaison vith vectors of different length.");
+ };
result := product_cmp (em1.first) with (em2.first);
(em1.lower+1).to (em1.upper) do { j:INTEGER;
v2 := product_cmp (em1.item j) with (em2.item j);
@@ -120,6 +124,17 @@ Section Public
result := EXPR_OR_OR_LOGIC.create position with result and v2;
};
};
+ }.elseif {
+ (t1.is_expanded) && {t2.is_expanded} &&
+ {(t1.is_expanded_ref) || {t2.is_expanded_ref}} &&
+ {(t1.raw != t2.raw) || { t1.is_expanded_c} || { t2.is_expanded_c}}
+ } then {
+ string_tmp.copy "Left expression `";
+ t1.display string_tmp;
+ string_tmp.append "' is incompatible with right expression `";
+ t2.display string_tmp;
+ string_tmp.append "' for comparison.";
+ semantic_error(position, string_tmp);
} else {
result := product_cmp v1 with v2;
};
@@ -129,7 +144,10 @@ Section Public
result := to_run_with arg_first args l_arg;
};
result
- );
+ )
+ [
+ -? { Result != NULL };
+ ];
Section Private
diff --git a/src/variable/slot.li b/src/variable/slot.li
index 10fd7de..45b94a9 100644
--- a/src/variable/slot.li
+++ b/src/variable/slot.li
@@ -179,4 +179,22 @@ Section Public
typ := ts.to_run_for receiver_type;
};
slot_data_intern := SLOT_DATA.create common_slot type typ;
- );
\ No newline at end of file
+ );
+
+ - foreach_generated_slot_data blc:{SLOT_DATA;} <-
+ [
+ -? { style = '+' };
+ ]
+ (
+ (lower_style = 0).if {
+ (slot_data_list != NULL).if {
+ (slot_data_list.lower).to (slot_data_list.upper) do { k:INTEGER;
+ blc.value (slot_data_list.item k);
+ };
+ };
+ blc.value (slot_data);
+ };
+ ((slot_id != NULL) && {slot_id.ensure_count > 0}).if {
+ blc.value (slot_id);
+ };
+ );
--
Lisaac compiler
More information about the Lisaac-commits
mailing list