[SCM] Lisaac compiler branch, stable, updated. lisaac-0.12-492-g71e3c02
Mildred Ki'Lya
silkensedai at online.fr
Thu Oct 8 14:04:14 UTC 2009
The following commit has been merged in the stable branch:
commit 71e3c02d51471139366444f6ad352dd670613b16
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Thu Oct 8 16:03:34 2009 +0200
remove old/ prototypes from source
diff --git a/src/item/old/itm_type_self.li b/src/item/old/itm_type_self.li
deleted file mode 100644
index 78cb998..0000000
--- a/src/item/old/itm_type_self.li
+++ /dev/null
@@ -1,47 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := ITM_TYPE_SELF;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Type Self";
-
-Section Inherit
-
- + parent_itm_type_simple:Expanded ITM_TYPE_SIMPLE;
-
-Section Public
-
- // BSBS: Voir si il est encore necessaire avec ITM_TYPE_PARAMETER
-
- - name:STRING_CONSTANT <- ALIAS_STR.prototype_self;
-
- - to_run:TYPE_FULL <-
- (
- not_yet_implemented;
- NULL
- );
-
-
-
\ No newline at end of file
diff --git a/src/type/old/type_block.li b/src/type/old/type_block.li
deleted file mode 100644
index 5809d7d..0000000
--- a/src/type/old/type_block.li
+++ /dev/null
@@ -1,249 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := TYPE_BLOCK;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Virtual type for BLOCK manager";
-
-Section Inherit
-
- + parent_type:Expanded TYPE;
-
-Section Public
-
- - list_block:FAST_ARRAY[TYPE_BLOCK] := FAST_ARRAY[TYPE_BLOCK].create_with_capacity 2048;
-
- - clean <-
- (
- (list_block.lower).to (list_block.upper) do { j:INTEGER;
- list_block.item j.remove;
- };
- );
-
-Section Public
-
- - name:STRING_CONSTANT <- ALIAS_STR.prototype_block;
-
- - is_context_sensitive:BOOLEAN <- context_extern != NULL;
-
- + context_extern:LOCAL;
-
- //
- // Creation.
- //
-
- - create base:ITM_BLOCK :SELF <-
- ( + result:SELF;
- result := clone;
- result.make base;
- result
- );
-
- - make base:ITM_BLOCK <-
- ( + var:VARIABLE;
- + loc:LOCAL;
- + instr:INSTR;
- + arg_lower:INTEGER;
- + list:ITM_LIST;
- + old_node_list:LINKED_LIST[NODE_TYPE];
-
- list_block.add_last Self;
- profil_list := FAST_ARRAY[PROFIL_SLOT].create_with_capacity 2;
- node_list := LINKED_LIST[NODE_TYPE].create;
- //
- index := index_count;
- index_count := index_count + 1;
- //
- list := base.list;
- CONTEXT.push_intern (list.position);
- //
- old_node_list := NODE.node_list;
- NODE.set_node_list node_list;
-
- // Append arguments.
- (base.argument != NULL).if {
- argument_type := ALIAS_ARRAY[TYPE_FULL].new;
- arg_lower := stack_local.upper + 1;
- base.argument.to_run stack_local;
- (arg_lower).to (stack_local.upper) do { j:INTEGER;
- var := stack_local.item j;
- var.set_style '+';
- argument_type.add_last (var.type);
- instr := var.write (var.position) value NULL;
- list_current.add_last instr;
- };
- argument_type := ALIAS_ARRAY[TYPE_FULL].alias argument_type;
- };
- //
- (debug_level_option != 0).if {
- // Debug mode : Add context local.
- loc := TYPE_CONTEXT.default.new_local (list.position)
- name (ALIAS_STR.variable_context) style '+';
- loc.set_ensure_count 1;
- stack_local.add_last loc;
- list_current.add_last (PUSH.create (list.position) context loc first TRUE);
- };
- //
- list.to_run_base FALSE;
- model_list := list_current;
- model_result := list.create_result_expr;
-
- NODE.set_node_list old_node_list;
- context_extern := ITM_OBJECT.context_extern;
- CONTEXT.pop_intern;
- //
- default := TYPE_FULL.create Self with 0;
- );
-
- - make_copy other:TYPE_BLOCK <-
- ( + old_node_list:LINKED_LIST[NODE_TYPE];
-
- list_block.add_last Self;
- profil_list := FAST_ARRAY[PROFIL_SLOT].create_with_capacity 2;
- node_list := LINKED_LIST[NODE_TYPE].create;
- //
- index := index_count;
- index_count := index_count + 1;
- //
- old_node_list := NODE.node_list;
- NODE.set_node_list node_list;
-
- argument_type := other.argument_type;
- //LOCAL.alias_on;
- model_list := other.model_list.my_copy;
- //LOCAL.alias_off;
- model_result := other.model_result.my_copy;
- context_extern := other.context_extern;
-
- NODE.set_node_list old_node_list;
- default := TYPE_FULL.create Self with 0;
- ? {node_list.count = other.node_list.count};
- );
-
-Section Public
-
- + profil_list:FAST_ARRAY[PROFIL_SLOT];
- + node_list:LINKED_LIST[NODE_TYPE];
-
- + model_list:LIST;
- + copy_list:BOOLEAN;
-
- + model_result:EXPR;
- + copy_result:BOOLEAN;
-
- + argument_type:FAST_ARRAY[TYPE_FULL];
-
- //
- // Copy.
- //
-
- - my_copy:SELF <-
- ( + result:SELF;
-
- result := TYPE_BLOCK.clone;
- result.make_copy Self;
-
- result
- );
-
- //
- // Block -> List.
- //
-
- - remove <-
- (
- (! copy_list).if {
- model_list.remove;
- model_result.remove;
- };
- );
-
- - get_list:LIST <-
- ( + result:LIST;
-
- (copy_list).if {
- //LOCAL.alias_on;
- result := model_list.my_copy;
- //LOCAL.alias_off;
- } else {
- NODE.node_list.append_collection node_list;
- result := model_list;
- copy_list := TRUE;
- };
-
- result
- );
-
- - get_result:EXPR <-
- (
- model_result
- );
-
- //
- // BUG !
- //
-
- - prototype:PROTOTYPE <- type_block.prototype;
-
- - 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; // Nothing.
-
- //
- // Code source generation.
- //
-
- - put_id buffer:STRING <- index.append_in buffer;
-
- - put_access_id e:EXPR in buffer:STRING <-
- (
- buffer.append "(int)";
- e.genere buffer;
- );
-
- - put_value buffer:STRING <-
- (
- buffer.append "(void *)";
- index.append_in buffer;
- );
-
-Section Public
-
- - is_sub_type other:TYPE :BOOLEAN <- other.name = name;
-
diff --git a/src/type/old/type_link.li b/src/type/old/type_link.li
deleted file mode 100644
index 5704cd1..0000000
--- a/src/type/old/type_link.li
+++ /dev/null
@@ -1,111 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := TYPE_LINK;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "TYPE_PARAMETER <-> TYPE_FULL";
-
-Section Inherit
-
- - parent_object:OBJECT := OBJECT;
-
-Section Private
-
- - create t:TYPE_FULL :SELF <-
- ( + result:SELF;
-
- result := clone;
- result.make t;
- result
- );
-
- - make t:TYPE_FULL <-
- (
- type_self := t;
- );
-
-Section Public
-
- + type_self:TYPE_FULL;
-
- - create_self s:EXPR :TYPE_LINK <-
- ( + t:TYPE_FULL;
- + tg:TYPE_GENERIC;
- + result:TYPE_LINK;
- + n:INTEGER;
-
- t := s.static_type;
- tg ?= t;
- (tg != NULL).if {
- n := tg.generic_list.count;
- (n = 1).if {
- result := TYPE_LINK_1.create t and
- (tg.prototype.idf_generic_list.first,tg.generic_list.first);
- }.elseif {n = 2} then {
- result := TYPE_LINK_2.create t and
- (tg.prototype.idf_generic_list.first ,tg.generic_list.first) and
- (tg.prototype.idf_generic_list.second,tg.generic_list.second);
- } else {
- result := TYPE_LINK_N.create t and
- (tg.prototype.idf_generic_list,tg);
- };
- } else {
- result := create t;
- };
- result
- );
-
- - create_for slot:SLOT self s:EXPR with larg:FAST_ARRAY[EXPR] :TYPE_LINK <-
- ( + t:TYPE_FULL;
- + tg:TYPE_GENERIC;
- + result:TYPE_LINK;
- + n:INTEGER;
-
- t := s.static_type;
- tg ?= t;
- (tg != NULL).if {
- n := tg.generic_list.count;
- };
- (larg != NULL).if {
- (larg.lower).to (larg.upper) do { j:INTEGER;
-
- };
- );
-
- //
- // Service.
- //
-
- - install <-
- (
- ITM_TYPE_SELF.set_define type_self;
- );
-
- - clean <-
- (
- ITM_TYPE_SELF.set_define TYPE_NULL;
- );
-
\ No newline at end of file
diff --git a/src/type/old/type_parameter.li b/src/type/old/type_parameter.li
deleted file mode 100644
index 52ace79..0000000
--- a/src/type/old/type_parameter.li
+++ /dev/null
@@ -1,80 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := TYPE_PARAMETER;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Type parameter.";
-
-Section Inherit
-
- + parent_type_full:TYPE_FULL := TYPE_FULL;
-
-Section Public
-
- - fix:TYPE_FULL <- parent_type_full;
-
- - is_parameter_type:BOOLEAN <- TRUE;
-
- + parameter_name:STRING_CONSTANT;
-
- //
- // Creation.
- //
-
- - create n:STRING_CONSTANT :SELF <-
- ( + result:SELF;
-
- result := clone;
- result.make n;
- result
- );
-
- - make n:STRING_CONSTANT <-
- (
- parameter_name := n;
- );
-
- //
- // Set type.
- //
-
- - set_define t:TYPE_FULL <-
- (
- parent_type_full := t;
- );
-
- //
- // Display.
- //
-
- - append_name_in buffer:STRING <-
- (
- buffer.append parameter_name;
- buffer.add_last ':';
- parent_type_full.append_name_in buffer;
- );
-
-
-
diff --git a/src/variable/old/argument.li b/src/variable/old/argument.li
deleted file mode 100644
index c0e4535..0000000
--- a/src/variable/old/argument.li
+++ /dev/null
@@ -1,85 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := ARGUMENT;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Argument runnable";
-
-Section Inherit
-
- + parent_itm_object:Expanded ITM_OBJECT;
-
-Section Public
-
- + name:STRING_CONSTANT;
-
- + type:TYPE_FULL;
-
- //
- // Creation.
- //
-
- - create p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL :SELF <-
- [
- -? {t != NULL};
- ]
- ( + result:SELF;
-
- result := clone;
- result.make p name n type t;
- result
- );
-
- - make p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL <-
- (
- position := p;
- name := n;
- type := t;
- );
-
- //
- // To profil
- //
-
- - to_local:LOCAL <-
- (
- LOCAL.create position name name style ' ' type (type.fix)
- );
-
- //
- // Display.
- //
-
- - print <-
- (
- string_tmp.clear;
- string_tmp.append name;
- string_tmp.add_last ':';
- type.append_name_in string_tmp;
- string_tmp.print;
- );
-
-
\ No newline at end of file
diff --git a/src/variable/old/slot.li b/src/variable/old/slot.li
deleted file mode 100644
index 253acd2..0000000
--- a/src/variable/old/slot.li
+++ /dev/null
@@ -1,256 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// 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_object:ITM_OBJECT := ITM_OBJECT;
-
-Section Public
-
- - common_slot:SLOT <- Self;
-
- + base_slot:ITM_SLOT;
-
- - name:STRING_CONSTANT <- base_slot.name;
- - id_section:SECTION_ <- base_slot.id_section;
- - priority_and_level:INTEGER <- base_slot.priority_and_level;
- - priority:INTEGER <- base_slot.priority;
- - associativity:STRING_CONSTANT <- base_slot.associativity;
- - style:CHARACTER <- base_slot.style;
-
- + receiver_type:TYPE;
-
- + slot_id:SLOT_DATA;
-
-// + arguments:FAST_ARRAY[ARGUMENT];
-// + results_type:FAST_ARRAY[TYPE_FULL];
-// + result_type:TYPE_FULL;
-
- //
- // Result / Argument manager.
- //
-/*
- - get_expr_result:EXPR <-
- ( + result:EXPR;
- + lst:FAST_ARRAY[EXPR];
- + typ:TYPE_FULL;
-
- (id_section.is_interrupt).if {
- typ := type_pointer.default;
- result := typ.get_temporary_expr position;
- } else {
- (results_type != NULL).if {
- lst := FAST_ARRAY[EXPR].create_with_capacity (results_type.count+1);
- (results_type.lower).to (results_type.upper) do { k:INTEGER;
- lst.add_last (results_type.item k.get_temporary_expr position);
- };
- lst.add_last (result_type.get_temporary_expr position);
- result := EXPR_MULTIPLE.create lst;
- } else {
- result := result_type.get_temporary_expr position;
- };
- };
- result
- );
-
- - check_argument_type_for larg:FAST_ARRAY[EXPR] <-
- ( + new_expr:EXPR;
-
- (larg.lower + 1).to (larg.upper) do { i:INTEGER;
- new_expr := larg.item i.check_type (arguments.item i.type) with position;
- larg.put new_expr to i;
- };
- );
-*/
- //
- // Creation.
- //
-
- - create s:ITM_SLOT type t:TYPE :SLOT <-
- ( + result:SLOT;
-
- result := clone;
- result.make s type t
- );
-
- - make s:ITM_SLOT type t:TYPE :SLOT <-
- ( + styl:SLOT;
- + item_lst:FAST_ARRAY[ITM_ARGUMENT];
- + typ:TYPE_FULL;
- + type_multiple:ITM_TYPE_MULTI;
- + type_mono:ITM_TYPE_MONO;
- + old_data:DTA_RD;
-
- base_slot := s;
- receiver_type := t;
- position := s.position;
- //
-/* old_data := data_current;
- data_current := data_tmp;
- data_current.set_generic t;
- data_current.set_self (t.default);
- // Arguments.
- item_lst := base_slot.argument_list;
- arguments := FAST_ARRAY[ARGUMENT].create_with_capacity (base_slot.argument_count);
- (item_lst.lower).to (item_lst.upper) do { j:INTEGER;
- item_lst.item j.to_run arguments;
- };
- // Result(s).
- type_multiple ?= base_slot.type;
- (type_multiple != NULL).if {
- results_type := FAST_ARRAY[TYPE_FULL].create_with_capacity (type_multiple.count - 1);
- 0.to (type_multiple.upper - 1) do { k:INTEGER;
- typ := type_multiple.item k.to_run;
- results_type.add_last typ;
- };
- result_type := type_multiple.last.to_run;
- } else {
- type_mono ?= base_slot.type;
- result_type := type_mono.to_run;
- };
- */
- //
- (s.affect = '<').if {
- // Code.
- styl := slot_code_intern := SLOT_CODE.create Self with (base_slot.value);
- } else {
- // Data
- create_slot_data;
- styl := slot_data_intern;
- };
-// data_current := old_data;
- //
- styl
- );
-
- //
- // Style.
- //
-
- - lower_style:INTEGER <-
- ( + result:INTEGER;
- (slot_data_intern = NULL).if {
- result := 1;
- };
- result
- );
-
- - upper_style:INTEGER <-
- ( + result:INTEGER;
- (slot_code_intern != NULL).if {
- (slot_code_list != NULL).if {
- result := slot_code_list.upper + 2;
- } else {
- result := 1;
- };
- };
- result
- );
-
- - slot_data:SLOT_DATA <-
- (
- (slot_data_intern = NULL).if {
- create_slot_data;
- (slot_id = NULL).if {
- slot_id := SLOT_DATA.create common_slot type (TYPE_ID.get_index 1.default);
- slot_id.init;
- };
- };
- slot_data_intern
- );
-
- - slot_code idx:INTEGER :SLOT_CODE <-
- ( + result:SLOT_CODE;
-
- (idx = 1).if {
- result := slot_code_intern;
- } else {
- result := slot_code_list.item (idx-2);
- };
- result
- );
-
- - 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;
- slot_id := SLOT_DATA.create common_slot type (TYPE_ID.get_index 0.default);
- slot_id.init;
- result := 1;
- } else {
- (slot_code_list = NULL).if {
- slot_code_list := FAST_ARRAY[SLOT_CODE].create_with_capacity 1;
- };
- slot_code_list.add_last slot;
- (slot_id = NULL).if {
- slot_id := SLOT_DATA.create common_slot type (TYPE_ID.get_index 1.default);
- slot_id.init;
- };
- result := slot_code_list.upper + 2;
- };
- result
- );
-
- //
- // Display.
- //
-
- - display_all <-
- (
- (lower_style).to (upper_style) do { j:INTEGER;
- item_style j.display_all;
- };
- );
-
-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
-
- - create_slot_data <-
- ( + typ:TYPE_FULL;
-
- (results_type != NULL).if {
- slot_data_list := FAST_ARRAY[SLOT_DATA].create_with_capacity (results_type.count);
- (results_type.lower).to (results_type.upper) do { k:INTEGER;
- typ := results_type.item k;
- slot_data_list.add_last (
- SLOT_DATA.create common_slot type typ
- );
- };
- };
- slot_data_intern := SLOT_DATA.create common_slot type result_type;
- );
\ No newline at end of file
diff --git a/src/variable/old/slot_code.li b/src/variable/old/slot_code.li
deleted file mode 100644
index c81b613..0000000
--- a/src/variable/old/slot_code.li
+++ /dev/null
@@ -1,297 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := SLOT_CODE;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Slot with method";
-
-Section Inherit
-
- + parent_slot:SLOT := SLOT;
-
-Section Public
-
- - common_slot:SLOT <- parent_slot;
-
- - position:POSITION <- base_slot.position;
-
- + index:INTEGER;
-
- //
- // Static and Dynamic profil.
- //
-
- + value:ITM_CODE;
-
- //
- // Dynamic profil.
- //
-
- + profil:FAST_ARRAY[PROFIL_SLOT];
-
- - get_profil args:FAST_ARRAY[EXPR] self type_self:TYPE_FULL :(PROFIL, FAST_ARRAY[WRITE]) <-
- ( + result:PROFIL_SLOT;
- + res_lst:FAST_ARRAY[WRITE];
- + pro:PROFIL_SLOT;
- + j,i:INTEGER;
- + loc:LOCAL;
- + typ:TYPE_FULL;
- + typ_block:PROFIL_BLOCK;
- + typ_list:TYPES_TMP;
- + pro_list:FAST_ARRAY[PROFIL_SLOT];
- + is_new:BOOLEAN;
-
- // Block Detect.
- j := args.lower;
- {(j <= args.upper) && {(typ = NULL) || {! (typ.raw == type_block)}}}.while_do {
- typ := args.item j.static_type;
- (typ.raw == type_block).if {
- typ_list := TYPES_TMP.new;
- args.item j.get_type typ_list;
- (typ_list.first = TYPE_NULL).if {
- (typ_list.count > 1).if {
- typ_block ?= typ_list.second;
- } else {
- typ := NULL;
- };
- } else {
- typ_block ?= typ_list.first;
- };
- typ_list.free;
- };
- j := j + 1;
- };
-
- (typ_block != NULL).if {
- pro_list := typ_block.profil_list;
- i := pro_list.lower;
- {(i <= pro_list.upper) && {result = NULL}}.while_do {
- pro := pro_list.item i;
- (
- (pro.slot = Self) && {
- (pro.type_self = NULL) || {pro.type_self == type_self}
- } // BSBS: il fo aussi tester les args comme plus bas...
- ).if {
- result := pro; // Rmq. : It's limit for dispatching (See...)
- };
- i := i + 1;
- };
-
- (result = NULL).if {
- result := PROFIL_SLOT.clone;
- result.set_context_sensitive;
- typ_block.profil_list.add_last result;
- is_new := TRUE;
- };
- } else {
- // Select classic Profil (no block).
- j := profil.lower;
- {(j <= profil.upper) && {result = NULL}}.while_do {
- pro := profil.item j;
- ((pro.type_self = NULL) || {pro.type_self == type_self}).if {
- result := pro;
- i := args.lower + 1;
- {(i <= args.upper) && {result != NULL}}.while_do {
- typ := args.item i.static_type;
- loc := pro.argument_list.item i;
- (
- (loc != NULL) &&
- {(typ.is_expanded) || {loc.type.is_expanded }} &&
- {typ !== loc.type} && {loc.type.raw != type_boolean}
- ).if {
- result := NULL;
- };
- i := i + 1;
- };
- };
- j := j + 1;
- };
- (result = NULL).if {
- result := PROFIL_SLOT.clone;
- profil.add_last result;
- ((id_section.is_external) && {profil.count > 1}).if {
- semantic_error (position,"Polymorphic External slot is not possible.");
- };
- is_new := TRUE;
- };
- };
- (is_new).if {
- res_lst := result.make Self with (type_self, args) verify (profil.count = 1);
- } else {
- res_lst := result.write_argument args;
- };
- result, res_lst
- );
-
- //
- // Constructeur.
- //
-
- - create base:SLOT with val:ITM_CODE :SLOT_CODE <-
- ( + result:SELF;
- result := clone;
- result.make base with val;
- result
- );
-
- - make base:SLOT with val:ITM_CODE <-
- (
- parent_slot := base;
- value := val;
- profil := FAST_ARRAY[PROFIL_SLOT].create_with_capacity 1;
- );
-
- //
- // Execute.
- //
-
- + last_type_contract:TYPE;
- + is_require:BOOLEAN;
-
- - previous_contract:ITM_LIST <-
- ( + slot:ITM_SLOT;
- + contract:ITM_LIST;
-
- (is_require).if {
- slot := last_type_contract.search_require name;
- } else {
- slot := last_type_contract.search_ensure name;
- };
- (slot != NULL).if {
- (is_require).if {
- contract := slot.require;
- } else {
- contract := slot.ensure;
- };
- last_type_contract := last_type_contract.last_type_contract;
- };
- contract
- );
-
- - create_code is_first:BOOLEAN <-
- ( + contract:ITM_LIST;
- + slot:ITM_SLOT;
- + instr:INSTR;
-
- verify := is_first;
-
- // Require
- is_require := TRUE;
- contract := base_slot.require;
- last_type_contract := receiver_type;
- (contract = NULL).if {
- slot := receiver_type.search_require name;
- (slot != NULL).if {
- (verify).if {
- base_slot.is_equal_profil slot;
- };
- contract := slot.require;
- last_type_contract := receiver_type.last_type_contract;
- };
- };
- (contract != NULL).if {
- list_current.add_last (contract.to_run_contract);
- };
-
- // Body.
- value.to_run_extern;
-
- // Ensure
- is_require := FALSE;
- contract := base_slot.ensure;
- last_type_contract := receiver_type;
- (contract = NULL).if {
- slot := receiver_type.search_ensure name;
- (slot != NULL).if {
- (verify).if {
- base_slot.is_equal_profil slot;
- };
- contract := slot.ensure;
- last_type_contract := receiver_type.last_type_contract;
- };
- };
- (contract != NULL).if {
- list_current.add_last (contract.to_run_contract);
- };
- // Result.
- (profil_slot.result_last != NULL).if {
- instr := profil_slot.result_last.read position;
- } else {
- (id_section.is_interrupt).if {
- list_current.add_first (
- EXTERNAL_C.create position text "__BEGIN_INTERRUPT__" access NULL
- persistant TRUE type (TYPE_VOID.default)
- );
- list_current.add_last (
- EXTERNAL_C.create position text "__END_INTERRUPT__" access NULL
- persistant TRUE type (TYPE_VOID.default)
- );
- };
- instr := PROTOTYPE_CST.create position type (TYPE_VOID.default);
- };
- list_current.add_last instr;
- );
-
- - remove_profil prof:PROFIL_SLOT <-
- ( + idx:INTEGER;
-
- idx := profil.fast_first_index_of prof;
- (idx <= profil.upper).if { // Else, This profil is in BLOCK
- profil.remove idx;
- };
- );
-
- //
- // Display.
- //
-
- - display buffer:STRING <-
- (
- buffer.append name;
- (argument_list.lower).to (argument_list.upper) do { j:INTEGER;
- buffer.add_last ' ';
- argument_list.item j.display buffer;
- };
- buffer.add_last ' ';
- buffer.add_last ':';
- type.display buffer;
- );
-
- - display_all <-
- ( + prof:PROFIL;
-
- string_tmp.clear;
- (profil != NULL).if {
- (profil.upper).downto (profil.lower) do { k:INTEGER;
- prof := profil.item k;
- prof.display_all string_tmp;
- };
- };
- string_tmp.print;
- );
-
-
-
\ No newline at end of file
diff --git a/src/variable/old/slot_data.li b/src/variable/old/slot_data.li
deleted file mode 100644
index d651a4a..0000000
--- a/src/variable/old/slot_data.li
+++ /dev/null
@@ -1,500 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Compiler //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := SLOT_DATA;
-
- - copyright := "2003-2007 Benoit Sonntag";
-
-
- - author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment := "Slot with data style";
-
-Section Inherit
-
- + parent_variable:Expanded VARIABLE;
-
- + parent_slot:SLOT := SLOT;
-
-Section Public
-
- // BUG COMPILO 0.11
-
- - id_section:SECTION_ <-
- ( + result:SECTION_;
-
- (parent_slot != NULL).if {
- result := parent_slot.id_section;
- } else {
- result := SECTION_.get_name (ALIAS_STR.section_private);
- };
- result
- );
-
- - receiver_type:TYPE <-
- ( + result:TYPE;
-
- (parent_slot != NULL).if {
- result := parent_slot.receiver_type;
- } else {
- result := type_block;
- };
- result
- );
-
-
- //
-
- - common_slot:SLOT <- parent_slot;
-
- //
- // Sequence optimizer
- //
-
- + last_write:WRITE;
- + last_seq_index:UINTEGER_32;
- + last_seq_or_and:UINTEGER_32;
- + last_seq_call_and_loop:UINTEGER_32;
- + last_seq_call_local_and_loop:UINTEGER_32;
-
- + last_list_current:LIST;
- + last_index:INTEGER;
-
- - is_invariant rec:EXPR :BOOLEAN <-
- (
- ((rec = NULL) || {rec.is_invariant}) &&
- {last_write != NULL} &&
- {loop_seq_call_and_loop = seq_call_and_loop} &&
- {last_seq_index <= loop_seq_index}
- );
-
- - reset_last_write w:WRITE <-
- (
- (last_write = w).if {
- last_write := NULL;
- };
- );
-
- - set_read <-
- (
- last_index := -1;
- );
-
- - get_last_index:INTEGER <- last_index;
-
- - set_write w:WRITE <-
- (
- /* A FAIRE
- (
- (! PROFIL.mode_recursive) &&
- {style = '-'} &&
- {last_write != NULL} &&
- {last_index < list_current.index} &&
- {last_sequence = sequence_global}
- ).if {
- ? {list_current.item last_index = last_write};
- list_current.put (last_write.value) to last_index;
- unwrite last_write;
- new_execute_pass;
- };
- */
- last_write := w;
- last_seq_index := seq_index;
- last_seq_or_and := seq_or_and;
- last_seq_call_and_loop := seq_call_and_loop;
- last_seq_call_local_and_loop:= seq_call_local_and_loop;
- //
- last_list_current := list_current;
- last_index := list_current.index;
- );
-
- - get_last_value rec:EXPR :EXPR <-
- ( + result:EXPR;
- + val:EXPR;
- + rd:READ;
- + rd_loc:READ_LOCAL;
- + wrt_slot:WRITE_SLOT;
- + l:LOCAL;
- + g:SLOT_DATA;
- + is_rec_ok:BOOLEAN;
- + my_require_count:INTEGER;
- + pb:PROFIL_BLOCK;
- + i:INSTR;
-
- ((! PROFIL.mode_recursive) && {loop_invariant = NULL} && {last_write != NULL}).if {
-
- my_require_count := require_count;
- (rec != NULL).if {
- // Block exception.
- pb ?= rec.static_type.raw;
- ((pb != NULL) && {require_list != NULL}).if {
- rd_loc ?= rec;
- l := rd_loc.local;
- wrt_slot ?= require_first;
- rd_loc ?= wrt_slot.receiver;
- (rd_loc.local = l).if {
- my_require_count := 1;
- } else {
- my_require_count := 0;
- };
- (require_list.lower).to (require_list.upper) do { j:INTEGER;
- wrt_slot ?= require_list.item j;
- rd_loc ?= wrt_slot.receiver;
- (rd_loc.local = l).if {
- my_require_count := my_require_count + 1;
- };
- };
- };
- };
-
- (
- (
- (last_seq_call_and_loop = seq_call_and_loop) &&
- {is_seq_list last_list_current}
- ) || {my_require_count = 1}
- ).if {
- // Receiver test.
- (rec = NULL).if {
- is_rec_ok := TRUE;
- }.elseif {rec.is_constant} then {
- wrt_slot ?= last_write;
- is_rec_ok := rec == wrt_slot.receiver;
- } else {
- rd ?= rec;
- (rd != NULL).if {
- l ?= rd.variable;
- g ?= rd.variable;
- wrt_slot ?= last_write;
- rd ?= wrt_slot.receiver;
- is_rec_ok := (rd != NULL) && {
- (
- {l = rd.variable} && {is_seq_list last_list_current} && {
- (
- (l.last_seq != NULL) && {l.last_seq.last_write != NULL} &&
- {l.last_seq.last_seq_index < last_seq_index} &&
- {last_seq_call_local_and_loop = seq_call_local_and_loop}
- ) || {l.require_count <= 1} || {l.style = ' '}
- }
- ) ||
- {
- {g = rd.variable} && {g.style = '-'} && {
- (
- (g.last_write != NULL) && {g.last_seq_index < last_seq_index} &&
- {last_seq_call_and_loop = seq_call_and_loop} &&
- {is_seq_list (g.last_list_current)}
- ) || {g.require_count = 1}
- }
- }
- };
- };
- };
- (is_rec_ok).if {
- val := last_write.value;
- rd ?= val;
- (rd = NULL).if {
- l := NULL;
- g := NULL;
- } else {
- l ?= rd.variable;
- g ?= rd.variable;
- };
- (
- ( // Constant propagation.
- val.is_constant
- ) ||
- { // Local propagation.
- (l != NULL) && {is_seq_list last_list_current} && {
- (
- (l.last_seq != NULL) && {l.last_seq.last_write != NULL} &&
- {l.last_seq.last_seq_index < last_seq_index} &&
- {last_seq_call_local_and_loop = seq_call_local_and_loop}
- ) || {l.require_count <= 1} || {l.style = ' '}
- }
- } ||
- { // Global propagation.
- (g != NULL) && {g.style = '-'} && {
- (
- (g.last_write != NULL) && {g.last_seq_index < last_seq_index} &&
- {last_seq_call_and_loop = seq_call_and_loop} &&
- {is_seq_list (g.last_list_current)}
- ) || {g.require_count = 1}
- }
- }
- ).if {
- (rec != NULL).if {
- rec.remove;
- };
- result := val.my_copy;
- }.elseif {
- // Propagation step by step.
- (last_seq_or_and = seq_or_and) &&
- {ensure_count = 1} &&
- {list_current.index > list_current.lower} &&
- {list_current.item (list_current.index - 1) = last_write}
- } then {
- (rec != NULL).if {
- rec.remove;
- wrt_slot ?= last_write;
- wrt_slot.receiver.remove;
- };
- unwrite last_write;
- list_current.put NOP to (list_current.index - 1);
- result := val;
- }.elseif {
- (rec != NULL) && {is_seq_list last_list_current} &&
- {my_require_count = 1} && {ensure_count = 1} &&
- {last_index.in_range (last_list_current.lower) to (last_list_current.upper)} &&
- {last_list_current.item last_index = last_write}
- } then {
- // Local conversion.
- l := type.get_temporary position;
- i := l.write (last_write.position) value val;
- last_list_current.put i to last_index;
- result := l.read (rec.position);
- //
- rec.remove;
- wrt_slot ?= last_write;
- wrt_slot.receiver.remove;
- unwrite last_write;
- };
- };
- };
- };
- result
- );
-
- //
- // Constructeur.
- //
-
- - create b:SLOT type t:TYPE_FULL :SELF <-
- (
- create (b.position) name (b.name) style (b.style) base b type t
- );
-
- - create pos:POSITION name n:STRING_CONSTANT
- style s:CHARACTER base b:SLOT type t:TYPE_FULL :SELF <-
- // BSBS: N'est plus utilise' !!!
- ( + result:SELF;
- result := clone;
- result.make pos name n style s base b type t;
- result
- );
-
- - make pos:POSITION name n:STRING_CONSTANT style s:CHARACTER base b:SLOT type t:TYPE_FULL <-
- ( + tmp:TYPES_TMP;
- parent_slot := b;
- //
- position := pos;
- name := n;
- style := s;
- intern_name := ALIAS_STR.get_intern name;
- //
- type := t;
- (is_static).if {
- tmp := TYPES_TMP.new;
- tmp.add (type.raw);
- type_list := tmp.to_types;
- } else {
- type_list := TYPES_TMP.types_empty;
- };
- ? {type != NULL};
- );
-
- //
- // Context
- //
-
- + value:LIST;
-
- - init <-
- ( + self_var:LOCAL;
- + val,rec:EXPR;
- + wrt:WRITE;
-
- // BSBS: Dois être differe et linear => mettre a plat!!!
- // Il faut le rentrer dans le model des NODEs...
- ((value = NULL) && {(base_slot.affect != '<') || {Self = slot_id}}).if {
- // Context.
- //old_data := data_current;
- //(old_data = data_tmp).if {
- // crash_with_message "SLOT_DATA : Context en cascade !!! (à faire)";
- //};
- //data_current := data_tmp;
- //data_current.set_self (receiver_type.default.to_strict);
- //data_current.set_generic receiver_type;
- //
- not_yet_implemented;
- value := list_current;
- (Self = slot_id).if {
- val := PROTOTYPE_CST.create position type type;
- } else {
- // Self argument.
- self_var := LOCAL.create position name (ALIAS_STR.variable_self)
- style '+' type (receiver_type.default);
- stack_local.add_last self_var;
- val := PROTOTYPE_CST.create position type (receiver_type.default);
- wrt := self_var.write position value val;
- list_current.add_last wrt;
- // Code.
- (base_slot.value = NULL).if {
- val := type.default_value position;
- } else {
- val := base_slot.value.to_run_expr;
- };
- val := val.check_type type with position;
- };
- (style = '+').if {
- rec := PROTOTYPE_CST.create position type (receiver_type.default);
- };
- (debug_level_option != 0).if {
- list_current.add_last (
- PUSH.create position context context_main first FALSE
- );
- };
- wrt := write position with rec value val;
- list_current.add_last wrt;
- list_current.add_last (PROTOTYPE_CST.create position type (TYPE_VOID.default)); // BSBS: Alias
- // Context.
- //data_current := old_data;
- };
- );
-
- //
- // Execute.
- //
-
- - execute <-
- ( + lst:FAST_ARRAY[SLOT];
- + slot:SLOT_DATA;
- + s:SLOT;
- + val:LIST;
- + old_list_current:LIST;
- //+ old_profil_current:PROFIL_SLOT;
- + insert_index:INTEGER;
-
- val := value;
- value := NULL;
- insert_index := list_main.index;
- list_main.add val to insert_index;
-
- (type.is_expanded).if {
- lst := type.slot_run;
- (lst != NULL).if {
- (lst.lower).to (lst.upper) do { j:INTEGER;
- s := lst.item j;
- (s.style = '+').if {
- slot := s.slot_data_intern;
- ((slot != NULL) && {slot.value != NULL}).if {
- slot.execute;
- };
- slot := s.slot_id;
- ((slot != NULL) && {slot.value != NULL}).if {
- slot.execute;
- };
- };
- };
- };
- };
-
- old_list_current := list_current;
- //old_profil_current := profil_current;
- list_current := NULL;
- //profil_current := NULL;
-
- val.execute_link;
- list_main.inc_index;
-
- list_current := old_list_current;
- //profil_current := old_profil_current;
- );
-
- //
- // Genere
- //
-
- - genere buffer:STRING <-
- (
- type.genere_declaration buffer;
- buffer.add_last ' ';
- type.genere_star_declaration buffer;
- buffer.append intern_name;
- buffer.append ";\n";
- );
-
- //
- // Display.
- //
-
- - display buffer:STRING <-
- (
- buffer.append intern_name;
- buffer.add_last ' ';
- buffer.add_last ':';
- type.display buffer;
- );
-
- - display_all <-
- (
- string_tmp.clear;
- display string_tmp;
- string_tmp.print;
- );
-
-Section VARIABLE
-
- - new_read p:POSITION with r:EXPR :READ <-
- ( + result:READ;
- (style = '-').if {
- ? {r = NULL};
- result := READ_GLOBAL.create p with Self;
- } else {
- ? {r != NULL};
- result := READ_SLOT.create p with (r,Self);
- };
- result
- );
-
- - new_write p:POSITION with r:EXPR value v:EXPR :WRITE <-
- ( + result:WRITE;
- (style = '-').if {
- ? {r = NULL};
- result := WRITE_GLOBAL.create p with v in Self;
- } else {
- ? {r != NULL};
- result := WRITE_SLOT.create p with v in (r,Self);
- };
- result
- );
-
- /*
- - new_access r:EXPR :ACCESS <-
- ( + result:ACCESS;
-
- (style = '-').if {
- result := ACCESS_GLOBAL.create Self;
- } else {
- result := ACCESS_SLOT.create Self with r;
- };
- result
- );
-*/
-
\ No newline at end of file
--
Lisaac compiler
More information about the Lisaac-commits
mailing list