[SCM] Lisaac compiler branch, mildred-projects, updated. lisaac-0.12-503-g64b7bec
Mildred Ki'Lya
silkensedai at online.fr
Mon Aug 24 20:13:41 UTC 2009
The following commit has been merged in the mildred-projects branch:
commit 817362f362e3f4ab957b60cda453800a9132c50f
Merge: 95a0f7018bd0b04b7fd99ef3a6bfd3ae663c3aa6 9c9e576cac42e5fc1a72c2488939dee4fce7b8b1
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Mon Aug 24 14:52:14 2009 +0200
merge with master
diff --combined example/compile.sh
index e3d0453,9cd11f6..1ccdc53
--- a/example/compile.sh
+++ b/example/compile.sh
@@@ -1,20 -1,3 +1,20 @@@
#!/bin/bash
-for i in `find -name "*.li"` ; do cat $i | grep -q "main" && echo Compile $i && ../src2/lisaac $i ; done
+lisaac=$1
+args=
+shift
+if [ -z "$lisaac" ]; then
+ lisaac=lisaac
+ args="-O -q"
+fi
+
- #for i in `find -name "*.li"` ; do cat $i | grep -q "main" && echo Compile $i && lisaac $i -O -q ; done
++#for i in `find -name "*.li"` ; do cat $i | grep -q "main" && echo Compile $i && ../src2/lisaac $i ; done
+
+find -name "*.li" | xargs grep -- '- main *<-' | cut -d: -f1 | while read li; do
+
+ echo "$lisaac $li $@ $args"
+ "$lisaac" "$li" "$@" $args
+ res=$?
+ [ $res != 0 ] && echo "Error $res"
+
+done
diff --combined lib/base/character.li
index ac570ac,0d0c532..111e374
--- a/lib/base/character.li
+++ b/lib/base/character.li
@@@ -22,13 -22,13 +22,13 @@@ Section Heade
+ name := Expanded CHARACTER;
- - export := INTEGER_8, CHAR_UNICODE;
+ - export := UINTEGER_8, CHAR_UNICODE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "Static Character library (self is mapping on `char' C).";
- - type := `char`;
+ - type := `unsigned char`;
- default := '\0';
Section Insert
@@@ -55,26 -55,26 +55,26 @@@ Section Publi
// Sign-extended conversion.
( + result:INTEGER;
result:=code.to_integer;
- ? {result.in_range (INTEGER_8.minimum) to (INTEGER_8.maximum)};
+ ? {result.in_range (UINTEGER_8.minimum) to (UINTEGER_8.maximum)};
result
);
- - code:INTEGER_8 <-
+ - code:UINTEGER_8 <-
// ASCII code of Current.
// No Sign-extended conversion.
- ( + result:INTEGER_8;
- result:=to_integer_8;
+ ( + result:UINTEGER_8;
+ result:=to_uinteger_8;
//? {result.in_range minimum to maximum};
result
);
- - to_integer_8:INTEGER_8 <- CONVERT[CHARACTER,INTEGER_8].on Self;
+ - to_integer_8:INTEGER_8 <- CONVERT(CHARACTER,INTEGER_8).on Self;
- // Auto-cast.
//- to_char_unicode:CHAR_UNICODE <- CHAR_UNICODE.force_conversion Self;
// Auto-cast.
- - to_uinteger_8:UINTEGER_8 <- CONVERT[CHARACTER,UINTEGER_8].on Self;
+ - to_uinteger_8:UINTEGER_8 <- CONVERT(CHARACTER,UINTEGER_8).on Self;
+ // Auto-cast.
//
// Print.
@@@ -86,19 -86,19 +86,19 @@@
// Switch case :
//
- - when value:CHARACTER then block:BLOCK :CHARACTER <-
+ - when value:CHARACTER then block:{} :CHARACTER <-
(
(Self=value).if block;
Self
);
- - when value1:CHARACTER or value2:CHARACTER then block:BLOCK :CHARACTER <-
+ - when value1:CHARACTER or value2:CHARACTER then block:{} :CHARACTER <-
(
((Self = value1) || {Self = value2}).if block;
Self
);
- - when first_value:CHARACTER to last_value:CHARACTER then block:BLOCK :CHARACTER <-
+ - when first_value:CHARACTER to last_value:CHARACTER then block:{} :CHARACTER <-
( ? {first_value<=last_value};
((Self>=first_value) && {Self<=last_value}).if block;
@@@ -109,7 -109,7 +109,7 @@@
// Looping.
//
- - to limit_up:SELF do blc:BLOCK <-
+ - to limit_up:SELF do blc:{CHARACTER;} <-
(
(Self<=limit_up).if {
blc.value Self;
@@@ -117,7 -117,7 +117,7 @@@
};
);
- - downto limit_down:SELF do blc:BLOCK <-
+ - downto limit_down:SELF do blc:{CHARACTER;} <-
(
(Self>=limit_down).if {
blc.value Self;
@@@ -125,7 -125,7 +125,7 @@@
};
);
- - to limit_up:SELF by step:SELF do blc:BLOCK <-
+ - to limit_up:SELF by step:SELF do blc:{CHARACTER;} <-
(
(Self<=limit_up).if {
blc.value Self;
@@@ -133,7 -133,7 +133,7 @@@
};
);
- - downto limit_down:SELF by step:SELF do blc:BLOCK <-
+ - downto limit_down:SELF by step:SELF do blc:{CHARACTER;} <-
(
(Self>=limit_down).if {
blc.value Self;
@@@ -145,32 -145,32 +145,32 @@@
// Binary operator :
//
- - '+' other:CHARACTER :CHARACTER <- (code+other.code).to_character;
+ - Self:SELF '+' other:CHARACTER :CHARACTER <- (code+other.code).to_character;
- - '-' other:CHARACTER :CHARACTER <- (code-other.code).to_character;
+ - Self:SELF '-' other:CHARACTER :CHARACTER <- (code-other.code).to_character;
- - '-!' other:CHARACTER :INTEGER <- code - other.code;
+ - Self:SELF '-!' other:CHARACTER :INTEGER <- code - other.code;
- - '+#' other:INTEGER :CHARACTER <- (code + other).to_character;
-
- - '-#' other:INTEGER :CHARACTER <- (code - other).to_character;
+ - Self:SELF '+#' other:INTEGER :CHARACTER <- (code + other).to_character;
+
+ - Self:SELF '-#' other:INTEGER :CHARACTER <- (code - other).to_character;
- - '!==' other:CHARACTER :BOOLEAN <- (code !== other.code);
+ - Self:SELF '!==' other:CHARACTER :BOOLEAN <- (code !== other.code);
// Comparison using `code'.
- - '==' Right 60 other:CHARACTER :BOOLEAN <- (code == other.code);
+ - Self:SELF '==' Right 60 other:CHARACTER :BOOLEAN <- (code == other.code);
// Comparison using `code'.
- - '<' other:CHARACTER :BOOLEAN <- ( code < other.code );
+ - Self:SELF '<' other:CHARACTER :BOOLEAN <- ( code < other.code );
// Comparison using `code'.
- - '<=' other:CHARACTER :BOOLEAN <- ( code <= other.code );
+ - Self:SELF '<=' other:CHARACTER :BOOLEAN <- ( code <= other.code );
// Comparison using `code'.
- - '>' other:CHARACTER :BOOLEAN <- ( code > other.code );
+ - Self:SELF '>' other:CHARACTER :BOOLEAN <- ( code > other.code );
// Comparison using `code'.
- - '>=' other:CHARACTER :BOOLEAN <- ( code >= other.code );
+ - Self:SELF '>=' other:CHARACTER :BOOLEAN <- ( code >= other.code );
// Comparison using `code'.
- decimal_value:INTEGER <-
@@@ -329,7 -329,7 +329,7 @@@
);
- is_separator:BOOLEAN <-
- // True when character is a separator.
+ // True when character is a separator (' ', '\t', '\n', '\r', '\0', '\f', '\v')?
(
(Self= ' ') || {Self = '\t'} || {Self='\n'} ||
{Self='\r'} || {Self = '\0'} || {Self='\f'} || {Self='\v'}
@@@ -371,6 -371,20 +371,20 @@@
// Conversions:
//
+ - to_string:STRING <-
+ // Create a new STRING containing only this character.
+ (
+ STRING.create_filled (Self,1)
+ );
+
+ - to_string_in str:STRING <-
+ // Append this character at the end of 'str'. Thus you
+ // can save memory because no other STRING is allocated
+ // for the job.
+ (
+ str.append_character Self;
+ );
+
- to_hexadecimal:STRING <-
// Create a new STRING giving the `code' in hexadecimal.
// For example :
diff --combined lib/gui/clipping/area.li
index d5f9e09,dbedff9..8742be1
--- a/lib/gui/clipping/area.li
+++ b/lib/gui/clipping/area.li
@@@ -35,7 -35,7 +35,7 @@@ Section Inheri
- parent_inbox:INBOX := INBOX;
--Section INTERFACE
++Section INTERFACE
- set_video_support bmp:ABSTRACT_BITMAP <-
(
@@@ -459,7 -459,7 +459,7 @@@ Section Publi
(prev!=NULL).if {
(plan!=NULL).if {
-- // Modification des Plans : Les EltPs sont classé en plan croissant.
++ // Modification des Plans : Les EltPs sont class� en plan croissant.
// Recherche du dernier plan du groupe :
win:=prev;
{(win!=NULL) && {win.plan=NULL}}.while_do {
@@@ -474,7 -474,7 +474,7 @@@
pl_begin:=win.plan.next;
pl_end:=plan.next;
-- // On décroche le Groupe :
++ // On d�croche le Groupe :
pl:=pl_begin.prev;
pl.set_next pl_end;
pl_end.set_prev pl;
@@@ -506,7 -506,7 +506,7 @@@
(plan.next!=NULL).if {
plan.next.set_prev plan;
};
-- // On réaffecte les plans :
++ // On r�affecte les plans :
{pl_begin!=pl_end}.while_do {
pl_begin.set_level plan_value;
plan_value:=plan_value+1;
@@@ -601,7 -601,7 +601,7 @@@ Section ARE
// .
// list_y
- - stack_plan:FAST_ARRAY[PLAN]:= FAST_ARRAY[PLAN].create 16;
+ - stack_plan:FAST_ARRAY(PLAN):= FAST_ARRAY(PLAN).create 16;
- last_clip :CLIP;
- first_clip:CLIP;
@@@ -740,7 -740,7 +740,7 @@@
};
y1:=y1+1;
-- // On positionne les X : Décroissant Plan...
++ // On positionne les X : D�croissant Plan...
elt_x:=LIMIT_X.create x0 plan plan;
plan.set_x0 elt_x;
list_x:=elt_x.append list_x;
@@@ -845,7 -845,7 +845,7 @@@
y0:=plan.y0.value;
y1:=plan.y1.value;
-- // On active les fenêtres concerné :
++ // On active les fen�tres concern� :
// Tous ses fils.
win:=child;
{win!=NULL}.while_do {
@@@ -876,7 -876,7 +876,7 @@@
elt_y:=list_y; // A Optimiser !
cy0:=y0;
{elt_y!=NULL}.while_do {
-- // On active ou désactive des fenêtres :
++ // On active ou d�sactive des fen�tres :
{(elt_y!=NULL) && {! elt_y.plan.is_y}}.while_do {
elt_y:=elt_y.next;
};
diff --combined lib/number/integer.li
index 2cae2ed,d514c22..cfcef6f
--- a/lib/number/integer.li
+++ b/lib/number/integer.li
@@@ -26,7 -26,7 +26,7 @@@ Section Heade
// Integer:
UINTEGER_8, UINTEGER_16, UINTEGER_32, UINTEGER_64,
INTEGER_8 , INTEGER_16 , INTEGER_32 , INTEGER_64 ,
- UINTEGER_BIG,//INTEGER_BIG,
+ UINTEGER_BIG,UINTEGER,//INTEGER_BIG,
// Fixed real:
UREAL_16_16, UREAL_24_8 , UREAL_26_6 ,
REAL_16_16 , REAL_24_8 , REAL_26_6 ,
@@@ -42,7 -42,7 +42,7 @@@
Section Insert
- - parent_numeric:NUMERIC := NUMERIC;
+ - inherit_numeric:NUMERIC := NUMERIC;
Section Public
@@@ -50,19 -50,28 +50,28 @@@
// Range.
//
- - maximum:UINTEGER_64 <- 07FFFFFFFh.to_raw_uinteger_64;
-
- - minimum:INTEGER_64 <- (- 07FFFFFFFh).to_raw_integer_64;
-
+ - maximum:UINTEGER_64 <-
+ // Maximum of integer
+ 07FFFFFFFh.to_raw_uinteger_64;
+
+ - minimum:INTEGER_64 <-
+ // Minimum of integer
+ (- 07FFFFFFFh).to_raw_integer_64;
+
//
// Binary Operator.
//
- - '%' Left 100 other:SELF :SELF <- Self - ((Self / other) * other);
+ - Self:SELF '%' Left 100 other:SELF :SELF <-
+ // Modulo
+ Self - ((Self / other) * other);
- - '%#' Left 100 other:INTEGER :SELF <- Self % other;
+ - Self:SELF '%#' Left 100 other:INTEGER :SELF <-
+ // Modulo
+ Self % other;
- - '**' Right 120 exp:SELF :SELF <-
+ - Self:SELF '**' Right 120 exp:SELF :SELF <-
+ // Power
( + result:SELF;
(exp = 0).if {
@@@ -137,33 -146,51 +146,51 @@@
// Facility typing.
//
- - kb:SELF <- Self << 10;
-
- - mb:SELF <- Self << 20;
-
- - gb:SELF <- Self << 30;
-
- - tb:SELF <- Self << 40;
+ - kb:SELF <-
+ // Self in Kilobyte (ie. 1kb = 1024 bytes)
+ Self << 10;
+ - mb:SELF <-
+ // Self in megabytes
+ Self << 20;
+
+ - gb:SELF <-
+ // Self in gigabytes
+ Self << 30;
+
+ - tb:SELF <-
+ // Self in terabytes
+ Self << 40;
+
//
// Logic Operator
//
- - '&' Left 100 other:SELF :SELF <- `6`;
-
- - '|' Left 80 other:SELF :SELF <- ~(~Self & ~other);
-
- - '^' Left 80 other:SELF :SELF <- (~Self & other) | (Self & ~other);
+ - Self:SELF '&' Left 100 other:SELF :SELF <-
+ // AND operator
+ `6`;
- - '>>' Left 100 other:INTEGER :SELF <- `7`;
+ - Self:SELF '|' Left 80 other:SELF :SELF <-
+ // OR operator
+ ~(~Self & ~other);
- - '<<' Left 100 other:INTEGER :SELF <- `8`;
+ - Self:SELF '^' Left 80 other:SELF :SELF <-
+ // XOR operator
+ (~Self & other) | (Self & ~other);
+
+ - Self:SELF '>>' Left 100 other:INTEGER :SELF <-
+ // Shift right
+ `7`;
+
+ - Self:SELF '<<' Left 100 other:INTEGER :SELF <-
+ // Shift left
+ `8`;
//
// Unary operator
//
- - '~' :SELF <- -Self - SELF.one; //(-SELF.one) - Self;
+ - '~' Self:SELF :SELF <- -Self - SELF.one;
//
// Test.
@@@ -180,15 -207,16 +207,16 @@@
);
- is_power_2:BOOLEAN <-
+ // TRUE is Self is power of 2
( + val:SELF;
+ result:BOOLEAN;
- (Self != 0).if {
+ (Self != 0).if {
val := Self;
{val.is_even}.while_do {
val := val >> 1;
- };
- result := val = 1;
+ };
+ result := val = 1;
};
result
);
@@@ -198,6 -226,7 +226,7 @@@
//
- sqrt:SELF <-
+ // Square root
( + r,x:SELF;
x:=(Self + 1) >> 1;
@@@ -208,7 -237,13 +237,13 @@@
r
);
+ - Self:SELF '!' :SELF <-
+ // Factorial. Use it like "45!;" or "bar!.print;"
+ factorial;
+
- factorial:SELF <-
+ // Factorial
+ // * Require: Self >= 0
[
-? {Self >= 0};
]
@@@ -224,6 -259,8 +259,8 @@@
);
- fibonacci:SELF <-
+ // Fibonacci
+ // * Require: Self >= 0
[
-? {Self >= 0};
]
@@@ -237,12 -274,19 +274,19 @@@
result
);
- - is_odd:BOOLEAN <- (Self & 1) = 1; // Is odd ?
-
- - is_even:BOOLEAN <- ! is_odd; // Is even ?
-
+ - is_odd:BOOLEAN <-
+ // Is odd ?
+ (Self & 1) = 1;
+
+ - is_even:BOOLEAN <-
+ // Is even ?
+ ! is_odd;
+
- gcd other:SELF :SELF <-
// Great Common Divisor of `self' and `other'.
+ // * Require: Self >= 0
+ // * Require: `other' >= 0
+ // * Ensure:
[
-? {Self >= 0};
-? {other >= 0};
@@@ -260,7 -304,27 +304,27 @@@
[
+? {result == other.gcd self};
];
-
+
+
+ - is_prime : BOOLEAN <-
+ // TRUE if `Self' is prime
+ ( + diviseur : INTEGER;
+ + sqrt_s : INTEGER;
+ + result : BOOLEAN;
+ diviseur := 5;
+ sqrt_s := sqrt;
+ result := TRUE;
+ ((Self % 2 = 0) || {Self % 3 = 0}).if_false {
+ 1.to sqrt_s until {(Self % diviseur) = 0} do { cpt : INTEGER;
+ diviseur := diviseur + 2 + (((cpt-1) & 1) << 1);
+ };
+ result := result && {!((Self % diviseur) = 0)};
+ };
+ result
+ );
+
+
+
//
// Random
//
@@@ -269,7 -333,7 +333,7 @@@
// Random number between 0 to `maximum' in SELF.
( - r_seed:UINTEGER_32;
r_seed := (110351524 * r_seed + 12345) % 214748364;
- CONVERT[UINTEGER_64,SELF].on (maximum & r_seed)
+ CONVERT(UINTEGER_64,SELF).on (maximum & r_seed)
)
[
+? {Result >= 0};
@@@ -293,7 -357,7 +357,7 @@@
-? {lower < upper};
]
(
- lower + (upper-lower).random_upper
+ lower + random_upper (upper-lower)
)
[
+? {Result.in_range lower to upper};
@@@ -303,7 -367,7 +367,7 @@@
// Looping.
//
- - times action:BLOCK <-
+ - times action:{} <-
(
1.to Self do { i:INTEGER;
action.value;
@@@ -334,7 -398,7 +398,7 @@@
-? {in_range 0 to 9};
]
(
- (Self.to_integer_8 + '0'.code).to_character
+ (Self.to_uinteger_8 + '0'.code).to_character
)
[
+? {"0123456789".has Result};
@@@ -353,7 -417,7 +417,7 @@@
(Self <= 9).if {
result := digit;
} else {
- result := ('A'.code + (Self - 10).to_integer_8).to_character;
+ result := ('A'.code + (Self - 10).to_uinteger_8).to_character;
};
result
)
@@@ -361,7 -425,7 +425,7 @@@
+? {"0123456789ABCDEF".has Result};
];
- - to_character:CHARACTER <- to_integer_8.to_character;
+ - to_character:CHARACTER <- to_uinteger_8.to_character;
// Return the coresponding ASCII character.
- to_octal:SELF <-
@@@ -376,7 -440,7 +440,7 @@@
// Convert the hexadecimal view of `self' into a new allocated
// STRING. For example, if `self' is -1 the new STRING is
// "FFFFFFFF" on a 32 bit machine.
- // Note: see also `to_hexadecimal_in' to save memory.
+ // * See: `to_hexadecimal_in' to save memory.
( + result:STRING;
result := STRING.create 8;
@@@ -388,7 -452,7 +452,7 @@@
// Convert the hexadecimal view of `self' into a new allocated
// STRING. For example, if `self' is -1 the new STRING is
// "FFFFFFFF" on a 32 bit machine.
- // Note: see also `to_hexadecimal_in' to save memory.
+ // * See: `to_hexadecimal_in' to save memory.
( + result:STRING;
result := STRING.create 8;
@@@ -450,6 -514,7 +514,7 @@@
- to_binary_in buffer:STRING format s:INTEGER <-
// Append in `buffer' the equivalent of `to_binary_string'. No new STRING
// creation during the process.
+ // * Require: buffer not null
[ -? {buffer!=NULL}; ]
( + val:SELF;
+ i,old_count:INTEGER;
@@@ -477,13 -542,16 +542,16 @@@
// Hashing:
//
- - hash_code:INTEGER <- to_integer_32.hash_code; // BSBS: Il faut revoir => Depending processor
+ - hash_code:INTEGER <-
+ // Hash code
+ to_integer_32.hash_code; // BSBS: Il faut revoir => Depending processor
//
// Print
//
- print <-
+ // Print
(
(Self = 0).if {
'0'.print;
@@@ -497,6 -565,7 +565,7 @@@
- print_positif <-
// Display this number without memory.
+ // * Require: Self >= 0
[ -? {Self >=# 0}; ]
( + char:CHARACTER;
+ val:SELF;
@@@ -526,11 -595,11 +595,11 @@@
// Debug manager facility.
//
- - '?' blc:BLOCK <- blc ?# Self;
+ - Self:SELF '?' blc:{BOOLEAN} <- blc ?# Self;
Section INTEGER
- - to_raw_pointer:POINTER <- CONVERT[SELF,POINTER].on Self;
+ - to_raw_pointer:POINTER <- CONVERT(SELF,POINTER).on Self;
diff --combined make.lip
index 366dd59,bb32b29..853d8d8
--- a/make.lip
+++ b/make.lip
@@@ -32,7 -32,7 +32,7 @@@ Section Privat
+ input_file:STRING; // is input file name value without extension (auto-loading, if possible).
// Debug information.
- + debug_level:INTEGER := 0; //15;
+ + debug_level:INTEGER := 15;
+ debug_with_code:BOOLEAN := TRUE;
+ is_all_warning:BOOLEAN;
@@@ -57,51 -57,14 +57,51 @@@
+ target:STRING := "unix";
+ + lib_std :PROJECT;
+ + parent_project :PROJECT;
+
+ //
+ // Code
+ //
+
+ - default_init prj:PROJECT <-
+ // Initialize the library
+ (
+ "Initialize project ".print; Self.print;
+ prj.if { " from ".print; prj.print; };
+ "\n".print;
+
+ parent_project := prj;
+ parent_project.if {
+ lisaac := parent_project.lisaac;
+ target := parent_project.target;
+ debug_level := parent_project.debug_level;
+ debug_with_code := parent_project.debug_with_code;
+ is_all_warning := parent_project.is_all_warning;
+ is_optimization := parent_project.is_optimization;
+ inline_level := parent_project.inline_level;
+ is_java := parent_project.is_java;
+ is_cop := parent_project.is_cop;
+ is_statistic := parent_project.is_statistic;
+ is_quiet := parent_project.is_quiet;
+ };
+ );
+
+ - init prj:PROJECT <-
+ // Initialize the library
+ (
+ default_init prj;
+ );
+
//
// Directory.
//
- standard_path <-
// Standard library.
- (
- path (lisaac + "lib/*");
+ (
+ lib_std := lib_std.create("STD");
+ lib_std := lib_std.load("lib.lip");
);
//
@@@ -110,18 -73,31 +110,18 @@@
- unix_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/");
- path (lisaac + "lib_os/unix/video/");
);
- windows_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/windows/file_system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/windows/video/");
);
- dos_target <-
(
- path (lisaac + "lib_os/unix/system/");
- path (lisaac + "lib_os/unix/file_system/"); // BSBS: ??
- path (lisaac + "lib_os/dos/file_system/");
- path (lisaac + "lib_os/dos/video/");
);
- java_target <-
(
- path (lisaac + "lib_os/java/system/");
- path (lisaac + "lib_os/java/file_system/");
);
- get_target <-
@@@ -140,7 -116,7 +140,7 @@@
};
(target = "").if {
"Target code needed.\n".print;
- exit;
+ exit 1;
};
);
@@@ -162,14 -138,10 +162,10 @@@
(! is_quiet).if {
"run `".print;
cmd.print;
- "' ".print;
+ "'\n".print;
};
- (run cmd = 0).if {
- (! is_quiet).if {
- "OK\n".print;
- };
- } else {
- "Failure!\n".print;
+ (run cmd != 0).if {
+ "FAILURE!\n".print;
};
);
@@@ -222,12 -194,6 +218,12 @@@
(
general_back_end;
);
+
+ - print_info <-
+ // Print information about the project
+ (
+ info_project.print;
+ );
Section Public
@@@ -279,13 -245,11 +275,11 @@@
- i level:INTEGER <-
// Inlining level [1..5000] (default: 15)
(
- /*
((level < 1) | (level > 5000)).if {
"Incorrect inlining level.\n".print;
exit;
};
inline_level := level;
- */
);
//
@@@ -315,15 -279,7 +309,15 @@@
//
// Other.
//
-
+
+ - info <-
+ // Information about the project
+ (
+ front_end;
+ print_info;
+ exit;
+ );
+
- q <-
// Quiet operation.
(
diff --combined src/any.li
index f3d8f00,f4fe726..fb0d61a
--- a/src/any.li
+++ b/src/any.li
@@@ -78,12 -78,10 +78,12 @@@ Section Publi
- is_optimization:BOOLEAN;
- inline_level:INTEGER := 17;
- - is_java:BOOLEAN; // Fuck the Java!
+ - is_java:BOOLEAN;
- is_statistic:BOOLEAN;
- is_quiet:BOOLEAN;
+
+ - backend:BACKEND := BACKEND;
//
//
@@@ -91,7 -89,9 +91,9 @@@
- verbose_level:INTEGER;
- is_verbose:BOOLEAN <- (verbose_level != 0);
-
+
+ - is_readable:BOOLEAN;
+
//
// Other flags.
//
@@@ -126,7 -126,7 +128,7 @@@
- seq_or_and :UINTEGER_32; // || or &&
- seq_call_and_loop :UINTEGER_32; // Call or loop (or function).
- seq_call_local_and_loop:UINTEGER_32; // Call sensitive or loop.
- - seq_list:FAST_ARRAY[LIST] := FAST_ARRAY[LIST].create_with_capacity 64;
+ - seq_list:FAST_ARRAY(LIST) := FAST_ARRAY(LIST).create_with_capacity 64;
- is_seq_list l:LIST :BOOLEAN <-
( + result:BOOLEAN;
@@@ -148,8 -148,10 +150,10 @@@
- context_main:LOCAL;
- list_current:LIST;
-
- - stack_local:FAST_ARRAY[LOCAL] := FAST_ARRAY[LOCAL].create_with_capacity 64;
+
+ - current_list_level:INTEGER;
+
+ - stack_local:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 64;
- profil_slot:PROFIL_SLOT; // Principal slot.
- profil_current:PROFIL; // Sub-profil or (profil = profil_slot)
@@@ -167,48 -169,7 +171,7 @@@
//
// Output Buffer and service.
//
-
- - var_size:FAST_ARRAY[FAST_ARRAY[LOCAL]] :=
- ( + result:FAST_ARRAY[FAST_ARRAY[LOCAL]];
-
- result := FAST_ARRAY[FAST_ARRAY[LOCAL]].create_with_capacity 4;
- 0.to 3 do { j:INTEGER;
- result.add_last (FAST_ARRAY[LOCAL].create_with_capacity 32);
- };
- result
- );
-
- - add_var_size v:LOCAL <-
- ( + tab:FAST_ARRAY[LOCAL];
- + j:INTEGER;
- + t:TYPE_FULL;
-
- ? {v.style = '+'};
-
- (v.style != '+').if {
- v.intern_name.print; " style [".print; v.style.print; "] ".print;
- '\n'.print;
- warning_error (v.position,"BUG ANY.add_var_size Error");
- };
- // BSBS: C'est pas top, avec des HASHED_SET ce serait mieux...
- t := v.type;
- tab := var_size.item (v.type.size);
- j := tab.lower;
- {(j <= tab.upper) && {tab.item j.type != t}}.while_do {
- j := j + 1;
- };
- (j > tab.upper).if {
- tab.add_last v;
- } else {
- {(j <= tab.upper) && {tab.item j != v} && {tab.item j.type = t}}.while_do {
- j := j + 1;
- };
- ((j > tab.upper) || {tab.item j != v}).if {
- tab.add v to j;
- };
- };
- );
-
+
- output_decl:STRING := STRING.create 60000;
- output_glob:STRING := STRING.create 10000;
- output_code:STRING := STRING.create 4000000;
@@@ -327,6 -288,13 +290,6 @@@
- string_tmp2:STRING := STRING.create 256;
- string_tmp3:STRING := STRING.create 256;
- string_tmp4:STRING := STRING.create 256;
-
- //
- // Path directory and command front end.
- //
-
- - path_file:FAST_ARRAY(STRING_CONSTANT) :=
- FAST_ARRAY(STRING_CONSTANT).create_with_capacity 3000;
//
// Alias type.
diff --combined src/code_life/switch.li
index 8d4f26a,0705b0b..07539f0
--- a/src/code_life/switch.li
+++ b/src/code_life/switch.li
@@@ -28,7 -28,7 +28,7 @@@ Section Heade
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Switch for late binding resolution";
- // BSBS: Optim. : D�tecter les switch identique l'un apr�s l'autre
- // BSBS: Optim. : Détecter les switch identique l'un après l'autre
++ // BSBS: Optim. : Détecter les switch identique l'un après l'autre
// pour les fusionner...
Section Inherit
@@@ -54,7 -54,7 +54,7 @@@ Section Publi
+ expr:EXPR;
- + list:FAST_ARRAY[CASE];
+ + list:FAST_ARRAY(CASE);
- count:INTEGER <- list.count;
@@@ -75,7 -75,7 +75,7 @@@
( + first:CASE;
position := n.position;
expr := e;
- list := FAST_ARRAY[CASE].create_with_capacity s;
+ list := FAST_ARRAY(CASE).create_with_capacity s;
(n.first_code != NULL).if {
first := CASE.create (n.first_type) with (n.first_code);
list.add_last first;
@@@ -86,7 -86,7 +86,7 @@@
// Copy.
//
- - set_expr e:EXPR list l:FAST_ARRAY[CASE] <-
+ - set_expr e:EXPR list l:FAST_ARRAY(CASE) <-
(
expr := e;
list := l;
@@@ -94,9 -94,9 +94,9 @@@
- my_copy:SELF <-
( + result:SELF;
- + new_list:FAST_ARRAY[CASE];
+ + new_list:FAST_ARRAY(CASE);
- new_list := FAST_ARRAY[CASE].create_with_capacity (list.count);
+ new_list := FAST_ARRAY(CASE).create_with_capacity (list.count);
(list.lower).to (list.upper) do { j:INTEGER;
new_list.add_last (list.item j.my_copy);
};
@@@ -225,12 -225,19 +225,19 @@@
list.first .set_code (list.second.code);
list.second.set_code lst;
};
+ /*
+ seq_or_and := seq_or_and + 1;
+ seq_inline := seq_inline + 1;
+ */
expr := expr.execute_link;
CALL_SLOT.reset_count_no_recursive;
((list.first.id = TYPE_NULL) && {list.count = 2}).if {
list.first .code.execute_case;
- list.second.code.execute_case;
+ list.second.code.execute_case;
+ ((list.second.id.is_block) && {debug_level_option != 0}).if {
+ list.second.id.set_late_binding;
+ };
} else {
(list.lower).to (list.upper) do { j:INTEGER;
list.item j.execute;
@@@ -248,14 -255,19 +255,19 @@@
// Genere.
//
+ - bug_count:INTEGER;
+
- genere buffer:STRING <-
( + lst:LIST;
+ first_case:INTEGER;
+ typ_first:TYPE;
+ typ_id:TYPE_ID;
+ wrt:WRITE;
- + i:INTEGER;
-
+ + is_genered:BOOLEAN;
+ + c1,c2:CASE;
+ + lst_case:FAST_ARRAY(CASE);
+ + cases:FAST_ARRAY(FAST_ARRAY(CASE));
+
(
(list.first.id = TYPE_NULL) &&
{debug_level_option = 0} &&
@@@ -266,94 -278,98 +278,98 @@@
}
).if {
list.remove_first;
- };
- i := list.upper;
- {i >= list.lower}.while_do {
- (list.item i.code.is_empty).if {
- list.remove i;
- };
- i := i - 1;
- };
- //
- (list.is_empty).if_false {
- typ_first := list.first.id;
- typ_id ?= typ_first;
- ((list.count <= 2) || {typ_first = TYPE_NULL}).if {
- buffer.append "if (";
- //
- ((expr.static_type.raw.is_block) && {typ_first = TYPE_NULL}).if {
- expr.genere buffer;
- buffer.append ".__id==0";
+ };
+ typ_first := list.first.id;
+ typ_id ?= typ_first;
+ ((list.count <= 2) || {typ_first = TYPE_NULL}).if {
+ buffer.append "if (";
+ //
+ ((expr.static_type.raw.is_block) && {typ_first = TYPE_NULL}).if {
+ expr.genere buffer;
+ is_genered := TRUE;
+ buffer.append ".__id==0";
+ } else {
+ typ_first.put_access_id expr in buffer;
+ is_genered := TRUE;
+ (expr.static_type.raw != type_boolean).if {
+ buffer.append "==";
+ typ_first.put_id buffer;
} else {
- typ_first.put_access_id expr in buffer;
- (expr.static_type.raw != type_boolean).if {
- buffer.append "==";
- typ_first.put_id buffer;
- } else {
- ? {typ_first.shortname = ALIAS_STR.prototype_true};
- };
- ? {typ_first.name = ALIAS_STR.prototype_true};
++ ? {typ_first.shortname = ALIAS_STR.prototype_true};
};
- buffer.append ") ";
- //
- list.first.genere buffer;
- first_case := 1;
- //
- (list.count = 2).if {
- lst := list.second.code;
- buffer.append " else ";
-
+ };
+ buffer.append ") ";
+ //
+ list.first.genere buffer;
+ first_case := 1;
+ //
+ (list.count = 2).if {
+ lst := list.second.code;
+ (! list.second.code.is_empty).if {
+ buffer.append " else ";
buffer.append "/* ";
buffer.append (list.second.id.name);
- buffer.append " */ ";
-
+ buffer.append " */ ";
list.second.genere buffer;
- first_case := 2;
- }.elseif {list.count > 2} then {
- buffer.append " else {\n";
- indent.append " ";
- buffer.append indent;
};
+ first_case := 2;
+ }.elseif {list.count > 2} then {
+ buffer.append " else {\n";
+ indent.append " ";
+ buffer.append indent;
};
- (first_case <= list.upper).if {
+ };
+ (first_case <= list.upper).if {
+ (is_genered).if {
+ expr := expr.my_copy;
+ };
+ cases := case_fusion first_case;
+ (cases.count = 2).if {
+ (cases.first.count = 1).if {
+ c1 := cases.first.first;
+ c2 := cases.second.first;
+ }.elseif {cases.second.count = 1} then {
+ c1 := cases.second.first;
+ c2 := cases.first.first;
+ };
+ };
+ (c1 != NULL).if {
+ buffer.append "if (";
+ c1.id.put_access_id expr in buffer;
+ buffer.append "==";
+ c1.id.put_id buffer;
+ buffer.append ") ";
+ c1.genere buffer;
+ buffer.append " else /* Other types */ ";
+ c2.genere buffer;
+ } else {
polymorphic_counter := polymorphic_counter + 1;
- buffer.append "switch (";
+ buffer.append "switch (";
list.item first_case.id.put_access_id expr in buffer;
buffer.append ") {\n";
- (first_case).to (list.upper) do { j:INTEGER;
- buffer.append indent;
- buffer.append "case ";
- list.item j.id.put_id buffer;
- buffer.append ": ";
- list.item j.genere buffer;
- buffer.add_last ' ';
- buffer.append "break;\n";
- };
-
- ( + code:STRING_CONSTANT;
- buffer.append indent;
- buffer.append "default: ";
- (debug_level_option != 0).if {
- code :=
- "stack_print(top_context); \
- \print_string(\"Call on Twilight Zone\\n\"); \
- \die_with_code(1);";
- } else {
- code :=
- "print_string(\"Call on Twilight Zone\\n\
- \(Use `debug' option)\\n\"); \
- \die_with_code(1);";
+ (cases.lower).to (cases.upper) do { j:INTEGER;
+ lst_case := cases.item j;
+ (! lst_case.first.code.is_empty).if {
+ (lst_case.lower).to (lst_case.upper) do { i:INTEGER;
+ buffer.append indent;
+ buffer.append "case ";
+ lst_case.item i.id.put_id buffer;
+ buffer.append ": \n";
+ };
+ buffer.remove_last 1;
+ lst_case.first.genere buffer;
+ buffer.append " break;\n";
};
- buffer.append code;
- );
-
+ };
+ buffer.append indent;
+ buffer.add_last '}';
+ };
+ free_list_cases cases;
+ (first_case != 0).if {
+ buffer.add_last '\n';
+ indent.remove_last 2;
buffer.append indent;
buffer.add_last '}';
- (first_case != 0).if {
- buffer.add_last '\n';
- indent.remove_last 2;
- buffer.append indent;
- buffer.add_last '}';
- };
};
};
);
@@@ -363,7 -379,7 +379,7 @@@
//
- display buffer:STRING <-
- ( + line:BLOCK;
+ ( + line:{INTEGER; };
line :=
{ j:INTEGER;
@@@ -528,7 -544,7 +544,7 @@@ Section Privat
);
- concat_switch other:SWITCH <-
- ( + other_list:FAST_ARRAY[CASE];
+ ( + other_list:FAST_ARRAY(CASE);
+ code:LIST;
other.expr.remove;
@@@ -538,4 -554,75 +554,75 @@@
code.add_last (other_list.item j.code);
};
new_execute_pass;
+ );
+
+ //
+ // Case fusion manager.
+ //
+
+ - store_list_cases:FAST_ARRAY(FAST_ARRAY(FAST_ARRAY(CASE))) :=
+ FAST_ARRAY(FAST_ARRAY(FAST_ARRAY(CASE))).create_with_capacity 32;
+
+ - store_cases:FAST_ARRAY(FAST_ARRAY(CASE)) :=
+ FAST_ARRAY(FAST_ARRAY(CASE)).create_with_capacity 32;
+
+ - new_cases:FAST_ARRAY(CASE) <-
+ ( + result:FAST_ARRAY(CASE);
+ (store_cases.is_empty).if {
+ result := FAST_ARRAY(CASE).create_with_capacity 32;
+ } else {
+ result := store_cases.last;
+ store_cases.remove_last;
+ };
+ result
+ );
+
+ - new_list_cases:FAST_ARRAY(FAST_ARRAY(CASE)) <-
+ ( + result:FAST_ARRAY(FAST_ARRAY(CASE));
+ (store_list_cases.is_empty).if {
+ result := FAST_ARRAY(FAST_ARRAY(CASE)).create_with_capacity 32;
+ } else {
+ result := store_list_cases.last;
+ store_list_cases.remove_last;
+ };
+ result
+ );
+
+ - free_list_cases l:FAST_ARRAY(FAST_ARRAY(CASE)) <-
+ ( + lst:FAST_ARRAY(CASE);
+ (l.lower).to (l.upper) do { i:INTEGER;
+ lst := l.item i;
+ lst.clear;
+ store_cases.add_last lst;
+ };
+ l.clear;
+ store_list_cases.add_last l;
+ );
+
+ - case_fusion low:INTEGER :FAST_ARRAY(FAST_ARRAY(CASE)) <-
+ ( + c1,c2:CASE;
+ + lst:FAST_ARRAY(CASE);
+ + j:INTEGER;
+ + result:FAST_ARRAY(FAST_ARRAY(CASE));
+
+ result := new_list_cases;
+ (low).to (list.upper) do { i:INTEGER;
+ c1 := list.item i;
+ lst := NULL;
+ j := result.lower;
+ {(j <= result.upper) && {lst = NULL}}.while_do {
+ c2 := result.item j.first;
+ (c1 == c2).if {
+ lst := result.item j;
+ c1.code.remove;
+ };
+ j := j + 1;
+ };
+ (lst = NULL).if {
+ lst := new_cases;
+ result.add_last lst;
+ };
+ lst.add_last c1;
+ };
+ result
);
diff --combined src/constant/character_cst.li
index 80922ba,cd811bb..49ebf8a
--- a/src/constant/character_cst.li
+++ b/src/constant/character_cst.li
@@@ -38,20 -38,20 +38,20 @@@ Section Publi
// Value.
//
- + text:STRING_CONSTANT;
+ + text:CHARACTER;
//
// Creation.
//
- - create p:POSITION char car:STRING_CONSTANT :SELF<-
+ - create p:POSITION char car:CHARACTER :SELF<-
( + result:SELF;
result := clone;
result.make p char car;
result
);
- - make p:POSITION char car:STRING_CONSTANT <-
+ - make p:POSITION char car:CHARACTER <-
(
position := p;
text := car;
@@@ -64,7 -64,7 +64,7 @@@
// Comparaison.
//
- - '==' Right 60 other:EXPR :BOOLEAN <-
+ - Self:SELF '==' Right 60 other:EXPR :BOOLEAN <-
( + s:SELF;
s ?= other;
(s != NULL) && {text = s.text}
@@@ -74,13 -74,24 +74,13 @@@
// Generation.
//
- - genere buffer:STRING <-
- (
- buffer.add_last '\'';
- buffer.append text;
- buffer.add_last '\'';
- );
+ - genere buffer:STRING <- backend.append_character text in buffer;
//
// Display.
//
- - display buffer:STRING <-
- (
- buffer.add_last '\'';
- buffer.append text;
- buffer.add_last '\'';
- display_ref buffer;
- );
+ - display buffer:STRING <- BACKEND_C.append_character text in buffer;
diff --combined src/constant/native_array_character_cst.li
index a44b39e,8b8a87e..0c5f6b6
--- a/src/constant/native_array_character_cst.li
+++ b/src/constant/native_array_character_cst.li
@@@ -64,7 -64,7 +64,7 @@@ Section Publi
// Comparaison.
//
- - '==' Right 60 other:EXPR :BOOLEAN <-
+ - Self:SELF '==' Right 60 other:EXPR :BOOLEAN <-
( + p:NATIVE_ARRAY_CHARACTER_CST;
p ?= other;
(p != NULL) && {string = p.string}
@@@ -74,13 -74,24 +74,13 @@@
// Generation.
//
- - genere buffer:STRING <-
- (
- buffer.add_last '\"';
- buffer.append string;
- buffer.add_last '\"';
- );
-
+ - genere buffer:STRING <- backend.append_string string in buffer;
+
//
// Display.
//
- - display buffer:STRING <-
- (
- buffer.add_last '\"';
- buffer.append string;
- buffer.add_last '\"';
- display_ref buffer;
- );
+ - display buffer:STRING <- BACKEND_C.append_string string in buffer;
diff --combined src/constant/string_cst.li
index d62cfeb,e1c927d..ad01eb0
--- a/src/constant/string_cst.li
+++ b/src/constant/string_cst.li
@@@ -75,7 -75,7 +75,7 @@@ Section Publi
// Comparaison.
//
- - '==' Right 60 other:EXPR :BOOLEAN <-
+ - Self:SELF '==' Right 60 other:EXPR :BOOLEAN <-
( + p:STRING_CST;
p ?= other;
(p != NULL) && {string = p.string}
@@@ -86,10 -86,7 +86,10 @@@
//
- genere buffer:STRING <-
- ( + idx,count,cur:INTEGER;
+ ( + idx,count,cur:INTEGER;
+// + count_esc:INTEGER;
+// + esc_octal:BOOLEAN;
+// + esc_hexa :BOOLEAN;
- is_init:BOOLEAN;
- is_storage:BOOLEAN;
- is_count:BOOLEAN;
@@@ -113,13 -110,7 +113,13 @@@
};
output.append "__";
output.append (type_string_constant.intern_name);
- output.append " __string_";
+ ((output.count - cur) >= 78).if {
+ output.add_last '\n';
+ cur := output.count - 1;
+ } else {
+ output.add_last ' ';
+ };
+ output.append "__string_";
idx.append_in output;
output.add_last '=';
(is_java).if {
@@@ -137,20 -128,12 +137,20 @@@
output.add_last ',';
};
(is_storage).if {
+ ((output.count - cur) >= 78).if {
+ output.add_last '\n';
+ cur := output.count - 1;
+ };
output.add_last '\"';
- output.append string;
- {(output.count - cur) > 78}.while_do {
- output.insert_string "\\\n" to (cur+78);
- cur := cur + 78;
- };
+// output.append string;
+// {(output.count - cur) > 78}.while_do {
+// output.insert_string "\\\n" to (cur+78);
+// cur := cur + 78;
+// };
+ backend.append_escaped_string string
+ in output
+ split_every 78
+ starting (output.count - cur);
output.add_last '\"';
} else {
output.remove_last 1;
@@@ -179,13 -162,18 +179,13 @@@
// Display.
//
- - display buffer:STRING <-
- (
- buffer.add_last '\"';
- buffer.append string;
- buffer.add_last '\"';
- display_ref buffer;
- );
+ - display buffer:STRING <- BACKEND_C.append_string string in buffer;
+
Section Private
- - dico_string:HASHED_DICTIONARY[INTEGER,STRING_CONSTANT] :=
- HASHED_DICTIONARY[INTEGER,STRING_CONSTANT].create;
+ - dico_string:HASHED_DICTIONARY(INTEGER,STRING_CONSTANT) :=
+ HASHED_DICTIONARY(INTEGER,STRING_CONSTANT).create;
diff --combined src/item/itm_slot.li
index 97d42d6,12e28d1..e81a11a
--- a/src/item/itm_slot.li
+++ b/src/item/itm_slot.li
@@@ -74,7 -74,7 +74,7 @@@ Section Publi
result
);
- + argument_list:FAST_ARRAY[ITM_ARGUMENT];
+ + argument_list:FAST_ARRAY(ITM_ARGUMENT);
+ result_type:ITM_TYPE;
@@@ -105,7 -105,7 +105,7 @@@
result_type := t;
);
- - set_argument_list p:FAST_ARRAY[ITM_ARGUMENT] <-
+ - set_argument_list p:FAST_ARRAY(ITM_ARGUMENT) <-
(
((p.count > 1) || {p.first.count > 1}).if {
(id_section.is_interrupt).if {
@@@ -260,7 -260,7 +260,7 @@@
result
);
- - check_argument_type larg:FAST_ARRAY[EXPR] for p:PARAMETER_TO_TYPE <-
+ - check_argument_type larg:FAST_ARRAY(EXPR) for p:PARAMETER_TO_TYPE <-
( + idx:INTEGER;
+ a:ITM_ARGUMENT;
@@@ -286,6 -286,12 +286,12 @@@
result_type.append_in buffer;
);
+ - pretty_name:STRING_CONSTANT <-
+ (
+ crash_with_message "ITM_SLOT.pretty_name.";
+ NULL
+ );
+
- pretty_name_in buffer:STRING <-
( + j:INTEGER;
@@@ -358,7 -364,7 +364,7 @@@ Section Privat
+ s:ITM_SLOT;
+ n:STRING_CONSTANT;
+ sec:SECTION_;
- + larg:FAST_ARRAY[ITM_ARGUMENT];
+ + larg:FAST_ARRAY(ITM_ARGUMENT);
+ a:ITM_CODE;
// Add function for init.
@@@ -366,7 -372,7 +372,7 @@@
string_tmp.append name;
n := ALIAS_STR.get string_tmp;
sec := SECTION_.get_name (ALIAS_STR.section_public);
- larg := FAST_ARRAY[ITM_ARGUMENT].create_with_capacity 1;
+ larg := FAST_ARRAY(ITM_ARGUMENT).create_with_capacity 1;
larg.add_last (
ITM_ARG.create (v.position)
name (ALIAS_STR.variable_self)
@@@ -380,9 -386,7 +386,9 @@@
s.set_result_type result_type;
t.slot_list.fast_put s to (s.name);
(t.generic_count = 0).if {
- a := ITM_PROTOTYPE.create (v.position) type (ITM_TYPE_SIMPLE.get (t.name));
+ // TODO: Mildred: Check we really want the first PRJ_ITEM from the
+ // prototype
+ a := ITM_PROTOTYPE.create (v.position) type (ITM_TYPE_SIMPLE.get (t.name) from (t.itm_source.first));
};
ITM_READ_ARG1.create (v.position) name n arg a
);
diff --combined src/item/itm_type_generic.li
index 5d574fe,300f50c..601bbab
--- a/src/item/itm_type_generic.li
+++ b/src/item/itm_type_generic.li
@@@ -33,20 -33,19 +33,20 @@@ Section Inheri
Section Private
- - dico:FAST_ARRAY[ITM_TYPE_GENERIC] := FAST_ARRAY[ITM_TYPE_GENERIC].create_with_capacity 32;
+ - dico:FAST_ARRAY(ITM_TYPE_GENERIC) := FAST_ARRAY(ITM_TYPE_GENERIC).create_with_capacity 32;
- - create n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT with lt:FAST_ARRAY[ITM_TYPE_MONO] :SELF <-
- - create n:STRING_CONSTANT style s:STRING_CONSTANT with lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
++ - create n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT with lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
( + result:SELF;
result := clone;
- result.make n style s with lt;
+ result.make n source p style s with lt;
result
);
- - make n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT with lt:FAST_ARRAY[ITM_TYPE_MONO] <-
- - make n:STRING_CONSTANT style s:STRING_CONSTANT with lt:FAST_ARRAY(ITM_TYPE_MONO) <-
++ - make n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT with lt:FAST_ARRAY(ITM_TYPE_MONO) <-
(
name := n;
+ source := p;
style := s;
list_type := lt;
);
@@@ -55,44 -54,39 +55,44 @@@ Section Publi
- hash_code:INTEGER <- name.hash_code;
- + list_type:FAST_ARRAY[ITM_TYPE_MONO];
+ + list_type:FAST_ARRAY(ITM_TYPE_MONO);
+
+ - get n:STRING_CONSTANT project p:LIP_PROJECT style s:STRING_CONSTANT
- with lt:FAST_ARRAY[ITM_TYPE_MONO] :ITM_TYPE_SIMPLE <-
++ with lt:FAST_ARRAY(ITM_TYPE_MONO) :ITM_TYPE_SIMPLE <-
+ get n from (p.find_item_or_fail n) style s with lt;
- - get n:STRING_CONSTANT style s:STRING_CONSTANT
- with lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
+ - get n:STRING_CONSTANT from src:PRJ_ITEM style s:STRING_CONSTANT
- with lt:FAST_ARRAY[ITM_TYPE_MONO] :SELF <-
++ with lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
( + result:SELF;
+ idx:INTEGER;
-
+
idx := dico.lower;
{
(idx <= dico.upper) && {
- (dico.item idx.name != n ) ||
- {dico.item idx.style != s } ||
- {dico.item idx.list_type != lt}
+ (dico.item idx.name != n ) ||
+ {dico.item idx.source != src } ||
+ {dico.item idx.style != s } ||
+ {dico.item idx.list_type != lt }
}
}.while_do {
idx := idx + 1;
- };
+ };
(idx <= dico.upper).if {
result ?= dico.item idx;
} else {
- result := create n style s with lt;
+ result := create n source src style s with lt;
dico.add_last result;
};
result
);
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
- ( + lst:FAST_ARRAY[TYPE_FULL];
+ ( + lst:FAST_ARRAY(TYPE_FULL);
+ t:TYPE_FULL;
+ j:INTEGER;
+ result:TYPE_FULL;
- lst := ALIAS_ARRAY[TYPE_FULL].new;
+ lst := ALIAS_ARRAY(TYPE_FULL).new;
j := list_type.lower;
{
t := list_type.item j.to_run_for p;
@@@ -100,9 -94,9 +100,9 @@@
j := j + 1;
}.do_while {(j <= list_type.upper) && {t != NULL}};
(t = NULL).if {
- ALIAS_ARRAY[TYPE_FULL].free lst;
+ ALIAS_ARRAY(TYPE_FULL).free lst;
} else {
- lst := ALIAS_ARRAY[TYPE_FULL].alias lst;
+ lst := ALIAS_ARRAY(TYPE_FULL).alias lst;
result := TYPE_GENERIC.get Self with lst;
};
result
diff --combined src/item/itm_type_simple.li
index 0fd9003,bd900e1..7895dde
--- a/src/item/itm_type_simple.li
+++ b/src/item/itm_type_simple.li
@@@ -27,18 -27,6 +27,18 @@@ Section Heade
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Simple type";
+
+ // Mildred: the + slot name could be perhaps replaced by a - slot with the
+ // code: source.protopath but it will discard the exact string that was found
+ // in the source code for an expanded string.
+ //
+ // For example if name was "LIB...ABSTRACT_STRING" it would become
+ // "STRING.ABSTRACT_STRING" (the complete path w/o the project name)
+ //
+ // Same for ITM_TYPE_STYLE and ITM_TYPE_GENERIC.
+ //
+ // That will perhaps require modifications in ITM_TYPE_SELF and
+ // ITM_TYPE_PARAMETER
Section Inherit
@@@ -46,94 -34,49 +46,94 @@@
Section ITM_TYPE_SIMPLE, ITM_TYPE_SELF
- - dico:FAST_ARRAY[ITM_TYPE_SIMPLE] := FAST_ARRAY[ITM_TYPE_SIMPLE].create_with_capacity 32;
- - dico:HASHED_DICTIONARY(ITM_TYPE_SIMPLE,STRING_CONSTANT) :=
- HASHED_DICTIONARY(ITM_TYPE_SIMPLE,STRING_CONSTANT).create;
++ - dico:FAST_ARRAY(ITM_TYPE_SIMPLE) := FAST_ARRAY(ITM_TYPE_SIMPLE).create_with_capacity 32;
-Section ITM_TYPE_SIMPLE
+Section Private
- - create n:STRING_CONSTANT :SELF <-
+ - create n:STRING_CONSTANT source s:PRJ_ITEM :SELF <-
( + result:SELF;
result := clone;
- result.make n;
+ result.make n source s;
result
);
- - make n:STRING_CONSTANT <-
+ - make n:STRING_CONSTANT source s:PRJ_ITEM <-
+ [
+ -? { n != NULL };
+ ]
(
- name := n;
- dico.fast_put Self to n;
+ name := n;
+ source := s;
);
Section Public
- - type_null:ITM_TYPE_SIMPLE := ITM_TYPE_SIMPLE.get (ALIAS_STR.variable_null);
- - type_void:ITM_TYPE_SIMPLE := ITM_TYPE_SIMPLE.get (ALIAS_STR.variable_void);
+ - type_null:ITM_TYPE_SIMPLE :=
+ ( + null:ITM_TYPE_SIMPLE;
+ null := ITM_TYPE_SIMPLE.create (ALIAS_STR.variable_null) source NULL;
+ dico.add_last null;
+ null
+ );
+
+ - type_void:ITM_TYPE_SIMPLE :=
+ ( + void:ITM_TYPE_SIMPLE;
+ void := ITM_TYPE_SIMPLE.create (ALIAS_STR.variable_void) source NULL;
+ dico.add_last void;
+ void
+ );
+
- type_self:ITM_TYPE_SIMPLE := ITM_TYPE_PARAMETER.create (ALIAS_STR.prototype_self);
- - hash_code:INTEGER <- name.hash_code;
+ - hash_code:INTEGER <- [ -? { name != NULL }; ] name.hash_code;
- + name:STRING_CONSTANT;
+ + name:STRING_CONSTANT <- source.protopath;
+
+ + source:PRJ_ITEM;
- style:STRING_CONSTANT; // NULL
-
- - get n:STRING_CONSTANT :ITM_TYPE_SIMPLE <-
+
+ - get n:STRING_CONSTANT project p:LIP_PROJECT :ITM_TYPE_SIMPLE <-
+ get n from (p.find_item_or_fail n);
+
+ - get n:STRING_CONSTANT from src:PRJ_ITEM :ITM_TYPE_SIMPLE <-
[
- -? {n != NULL};
+ -? {n != NULL};
]
( + result:ITM_TYPE_SIMPLE;
-
- result := dico.fast_reference_at n;
- (result = NULL).if {
- result := create n;
- };
+ + idx:INTEGER;
+
+// ((src = NULL) && {n = ALIAS_STR.variable_null}).if {
+// result := type_null;
+// }.elseif {(src = NULL) && {n = ALIAS_STR.variable_void}} then {
+// result := type_void;
+// }.elseif {(src = NULL) && {n = ALIAS_STR.prototype_self}} then {
+// result := type_self;
+// } else {
+
+ idx := dico.lower;
+ {
+ (idx <= dico.upper) && {
+ (dico.item idx.name != n ) ||
+ {dico.item idx.source != src }
+ }
+ }.while_do {
+ idx := idx + 1;
+ };
+
+ (idx <= dico.upper).if {
+ result := dico.item idx;
+ } else {
+ result := create n source src;
+ dico.add_last result;
+ };
+
+// };
+
result
);
+
+Section Public
+ to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
( + result:TYPE_FULL;
diff --combined src/item/itm_type_style.li
index d6818a0,4b51e2a..79afea5
--- a/src/item/itm_type_style.li
+++ b/src/item/itm_type_style.li
@@@ -34,47 -34,35 +34,47 @@@ Section Inheri
Section Private
- - dico:FAST_ARRAY[ITM_TYPE_STYLE] := FAST_ARRAY[ITM_TYPE_STYLE].create_with_capacity 32;
+ - dico:FAST_ARRAY(ITM_TYPE_STYLE) := FAST_ARRAY(ITM_TYPE_STYLE).create_with_capacity 32;
- - create n:STRING_CONSTANT style s:STRING_CONSTANT :SELF <-
+ - create n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT :SELF <-
+ [
+ -? { n != NULL };
+ ]
( + result:SELF;
result := clone;
- result.make n style s;
+ result.make n source p style s;
result
- );
+ )
+ [
+ ? { Result.name != NULL };
+ ];
- - make n:STRING_CONSTANT style s:STRING_CONSTANT <-
+ - make n:STRING_CONSTANT source p:PRJ_ITEM style s:STRING_CONSTANT <-
(
- name := n;
- style := s;
+ name := n;
+ source := p;
+ style := s;
);
Section Public
+ style:STRING_CONSTANT;
+
+ - get n:STRING_CONSTANT project p:LIP_PROJECT style s:STRING_CONSTANT :ITM_TYPE_SIMPLE <-
+ get n from (p.find_item_or_fail n) style s;
- - get n:STRING_CONSTANT style s:STRING_CONSTANT :SELF <-
+ - get n:STRING_CONSTANT from src:PRJ_ITEM
+ style s:STRING_CONSTANT :SELF <-
( + result:SELF;
+ idx:INTEGER;
idx := dico.lower;
{
(idx <= dico.upper) && {
- (dico.item idx.name != n) ||
- {dico.item idx.style != s}
+ (dico.item idx.name != n ) ||
+ {dico.item idx.source != src } ||
+ {dico.item idx.style != s }
}
}.while_do {
idx := idx + 1;
@@@ -82,13 -70,10 +82,13 @@@
(idx <= dico.upper).if {
result ?= dico.item idx;
} else {
- result := create n style s;
+ result := create n source src style s;
dico.add_last result;
};
result
- );
+ )
+ [
+ ? { Result.name != NULL };
+ ];
diff --combined src/lip/lip_binary.li
index 916e199,29921aa..de7dd99
--- a/src/lip/lip_binary.li
+++ b/src/lip/lip_binary.li
@@@ -80,8 -80,10 +80,11 @@@ Section Publi
.when '+' then { result := lv + rv; }
.when '-' then { result := lv - rv; };
(result = NULL).if {
- semantic_error (position,"Incorrect type.");
+ operator.print; '\n'.print;
+ lv.print; '\n'.print;
+ rv.print; '\n'.print;
+ semantic_error (position,"Incorrect type operator.");
};
+ // TODO: Mildred: I think there should be a lv.free and rv.free there
result
);
diff --combined src/lip/lip_boolean.li
index d61c78d,f55af7e..5d49b1f
--- a/src/lip/lip_boolean.li
+++ b/src/lip/lip_boolean.li
@@@ -71,9 -71,9 +71,9 @@@ Section Publi
// Operation.
//
- - name:STRING_CONSTANT <- "BOOLEAN";
+ - name:STRING_CONSTANT <- ALIAS_STR.prototype_boolean;
- - '!' :LIP_CONSTANT <- get (! value);
+ - '!' Self:SELF :LIP_CONSTANT <- get (! value);
- copy:LIP_CONSTANT <- Self;
@@@ -82,37 -82,26 +82,37 @@@
value.print;
);
+ - append_in str:STRING <-
+ (
+ value.if {
+ str.append "TRUE";
+ } else {
+ str.append "FALSE";
+ };
+ );
+
+ - to_boolean :BOOLEAN <- value;
+
Section LIP_CONSTANT
- my_copy other:SELF :LIP_CONSTANT <- other;
- - '|#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '|#' other:SELF :LIP_CONSTANT <-
(
get (value | other.value)
);
- - '&#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
(
get (value & other.value)
);
- - '=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
(
get (value = other.value)
);
- - '!=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
(
get (value != other.value)
);
diff --combined src/lip/lip_call.li
index 57dc49b,12c52a3..0571c98
--- a/src/lip/lip_call.li
+++ b/src/lip/lip_call.li
@@@ -32,10 -32,6 +32,10 @@@ Section Inheri
+ parent_lip_code:Expanded LIP_CODE;
Section Public
+
+ + project :LIP_PROJECT;
+
+ + receiver:LIP_CODE;
+ name:STRING_CONSTANT;
@@@ -45,23 -41,20 +45,23 @@@
// Creation.
//
- - create p:POSITION name n:STRING_CONSTANT with arg:LIP_CODE :SELF <-
+ - create p:POSITION in proj:LIP_PROJECT self rec:LIP_CODE name n:STRING_CONSTANT with arg:LIP_CODE :SELF <-
( + result:SELF;
result := clone;
- result.make p name n with arg;
+ result.make p in proj self rec name n with arg;
result
);
- - make p:POSITION name n:STRING_CONSTANT with arg:LIP_CODE <-
+ - make p:POSITION in proj:LIP_PROJECT self rec:LIP_CODE name n:STRING_CONSTANT with arg:LIP_CODE <-
[
+ -? {proj != NULL};
-? {p.code != 0};
]
- (
+ (
+ project := proj;
+ receiver := rec;
position := p;
- name := n;
+ name := n;
argument := arg;
);
@@@ -71,192 -64,125 +71,197 @@@
- run <-
( + slot:LIP_SLOT_CODE;
- + val:LIP_CONSTANT;
+ + val,self:LIP_CONSTANT;
+ str:LIP_STRING;
+ path:STRING_CONSTANT;
+ is_rec:BOOLEAN;
(argument != NULL).if {
- val := argument.run_expr;
- };
- (name = ALIAS_STR.slot_exit).if {
- (val != NULL).if {
- warning_error (position,"No argument for `exit' method.");
- };
- die_with_code exit_failure_code;
- }.elseif {name = ALIAS_STR.slot_path} then {
- str ?= val;
- (str = NULL).if {
- semantic_error (position,"String argument needed.");
+ val := argument.run_expr;
+ };
+ (receiver != NULL).if {
+ self := receiver.run_expr;
+ (self = NULL).if {
+ semantic_error (position, "Incorrect type.");
};
- path := str.value;
- (path.last = '*').if {
- string_tmp.copy path;
- string_tmp.remove_last 1;
- path := ALIAS_STR.get string_tmp;
- is_rec := TRUE;
- };
- load_directory path is_recursive is_rec;
- }.elseif {name = ALIAS_STR.slot_run} then {
- str ?= val;
- (str = NULL).if {
- semantic_error (position,"String argument needed.");
- };
- string_tmp.clear;
- str.append_in string_tmp;
- ENVIRONMENT.execute_command string_tmp;
- } else {
- slot := get_method name;
- (slot = NULL).if {
- string_tmp.copy "Slot `";
- string_tmp.append name;
- string_tmp.append "' not found.";
- semantic_error (position,string_tmp);
+ };
+ (self = NULL).if {
+ //
+ // Call with no receiver
+ //
+ (name = ALIAS_STR.slot_exit).if {
+ (val != NULL).if {
+ warning_error (position,"No argument for `exit' method.");
+ };
+ die_with_code exit_failure_code;
+ }.elseif {(name = ALIAS_STR.slot_path) ||
+ {name = ALIAS_STR.slot_public_path} ||
+ {name = ALIAS_STR.slot_private_path}
+ } then {
+ str ?= val;
+ (str = NULL).if {
+ semantic_error (position,"String argument needed.");
+ };
+ path := str.value;
+ (path.last = '*').if {
+ string_tmp.copy path;
+ string_tmp.remove_last 1;
+ path := ALIAS_STR.get string_tmp;
+ is_rec := TRUE;
+ };
+ project.load_directory path
+ base_path (stack_base_directory.last)
+ is_recursive is_rec
+ public (name != ALIAS_STR.slot_private_path);
+ }.elseif {name = ALIAS_STR.slot_run} then {
+ str ?= val;
+ (str = NULL).if {
+ semantic_error (position,"String argument needed.");
+ };
+ string_tmp.clear;
+ str.append_in string_tmp;
+ ENVIRONMENT.execute_command string_tmp;
+ } else {
+ slot := project.get_method name;
+ (slot = NULL).if {
+ error_slot_not_found "Code slot" name name;
+ };
+ (slot.run_with val).if_false {
+ semantic_error (position,"Invalid argument.");
+ };
};
- (slot.run_with val).if_false {
- semantic_error (position,"Invalid argument.");
+ } else {
+ //
+ // Call with a receiver
+ //
+ (self.name = ALIAS_STR.prototype_project).if {
+ + prj :LIP_VALUEPROJECT;
+ + result:LIP_CONSTANT;
+ prj ?= self;
+ (prj = NULL).if {
+ semantic_error(position, "Call on project NULL");
+ } else {
+ result := prj.call name arg val from project position position;
+ (result = NULL).if {
+ error_slot_not_found "Code slot" name name project (prj.name) send TRUE;
+ }
+ }
+ }.elseif {name = ALIAS_STR.slot_print} then {
+ self.print;
+ } else {
+ error_slot_not_found "Slot" name name;
};
};
(val != NULL).if {
val.free;
};
+ (self != NULL).if {
+ self.free;
+ };
);
- run_expr:LIP_CONSTANT <-
( + slot:LIP_SLOT_DATA;
+ str:LIP_STRING;
- + val:LIP_CONSTANT;
+ + val,self:LIP_CONSTANT;
+ result:LIP_CONSTANT;
+ res:INTEGER;
(argument != NULL).if {
val := argument.run_expr;
- };
- (name = ALIAS_STR.slot_run).if {
- str ?= val;
- (str = NULL).if {
- semantic_error (position,"String argument needed.");
- };
- string_tmp.clear;
- str.append_in string_tmp;
- res := ENVIRONMENT.execute_command string_tmp;
- result := LIP_INTEGER.get res;
- }.elseif {name = ALIAS_STR.slot_get_integer} then {
- {
+ };
+ (receiver != NULL).if {
+ self := receiver.run_expr;
+ (self = NULL).if {
+ semantic_error (position, "Incorrect type.");
+ };
+ };
+ (self = NULL).if {
+ //
+ // Call with no receiver
+ //
+ (name = ALIAS_STR.slot_run).if {
+ str ?= val;
+ (str = NULL).if {
+ semantic_error (position,"String argument needed.");
+ };
+ string_tmp.clear;
+ str.append_in string_tmp;
+ res := ENVIRONMENT.execute_command string_tmp;
+ result := LIP_INTEGER.get res;
+ }.elseif { name = ALIAS_STR.slot_info_project} then {
+ result := LIP_STRING.get (project.info_project);
+ }.elseif {name = ALIAS_STR.variable_lisaac} then {
+ result := LIP_STRING.get (LISAAC.path_lisaac);
+ }.elseif {name = ALIAS_STR.slot_get_integer} then {
- IO.read_integer;
- result := LIP_INTEGER.get (IO.last_integer);
++ {
++ IO.read_line;
++ (IO.last_string.is_integer).if_false {
++ "Error INTEGER needed.\n".print;
++ };
++ }.do_until {IO.last_string.is_integer};
++ result := LIP_INTEGER.get (IO.last_string.to_integer);
+ }.elseif {name = ALIAS_STR.slot_get_string} then {
IO.read_line;
- (IO.last_string.is_integer).if_false {
- "Error INTEGER needed.\n".print;
+ result := LIP_STRING.get (ALIAS_STR.get (IO.last_string));
+ } else {
+ slot := project.get_data name;
+ ((slot = NULL) && {!stack.is_empty}).if {
+ slot := stack.last;
+ ((slot != NULL) && {slot.name != name}).if {
+ slot := NULL;
+ };
};
- }.do_until {IO.last_string.is_integer};
- result := LIP_INTEGER.get (IO.last_string.to_integer);
- }.elseif {name = ALIAS_STR.slot_get_string} then {
- IO.read_line;
- result := LIP_STRING.get (ALIAS_STR.get (IO.last_string));
- } else {
- slot := get_data name;
- (slot = NULL).if {
- slot := stack.last;
(slot = NULL).if {
- string_tmp.copy "Slot `";
- string_tmp.append name;
- string_tmp.append "' not found.";
- semantic_error (position,string_tmp);
+ error_slot_not_found "Data slot" name name;
};
- };
- result := slot.get_value;
+ result := slot.get_value;
+ };
+ } else {
+ //
+ // Call with a receiver
+ //
+ (self.name = ALIAS_STR.prototype_project).if {
+ + prj :LIP_VALUEPROJECT;
+ prj ?= self;
+ (prj = NULL).if {
+ semantic_error(position, "Call on project NULL");
+ } else {
+ result := prj.call name arg val from project position position;
+ (result = NULL).if {
+ error_slot_not_found "Data slot" name name project (prj.name) send TRUE;
+ }
+ }
+ } else {
+ error_slot_not_found "Slot" name name;
+ };
};
(val != NULL).if {
val.free;
};
+ (self != NULL).if {
+ self.free;
+ };
result
);
-
- - load_directory path:ABSTRACT_STRING is_recursive is_rec:BOOLEAN <-
- ( + entry:ENTRY;
- + dir:DIRECTORY;
-
- entry := FILE_SYSTEM.get_entry path;
- ((entry != NULL) && {entry.is_directory} && {entry.open}).if {
- dir ?= entry;
- (dir.lower).to (dir.upper) do { j:INTEGER;
- entry := dir.item j;
- (entry.name.has_suffix ".li").if {
- path_file.add_last (entry.path);
- }.elseif {(is_rec) && {entry.is_directory}} then {
- load_directory (entry.path) is_recursive TRUE;
- };
- };
- } else {
- string_tmp.copy "Incorrect directory `";
- string_tmp.append path;
- string_tmp.append "'.";
- warning_error (position,string_tmp);
+
+ - error_slot_not_found type:STRING_CONSTANT name name:STRING_CONSTANT <-
+ error_slot_not_found type name name project NULL send TRUE;
+
+ - error_slot_not_found type:STRING_CONSTANT name name:STRING_CONSTANT project prj:STRING_CONSTANT send send:BOOLEAN <-
+ (
+ string_tmp.copy type;
+ string_tmp.append " `";
+ string_tmp.append name;
+ string_tmp.append "' not found";
+ (prj != NULL).if {
+ string_tmp.append " in project `";
+ string_tmp.append prj;
+ string_tmp.append "'";
+ };
+ string_tmp.append ".";
+ send.if {
+ semantic_error (position, string_tmp);
};
- );
+ );
+
diff --combined src/lip/lip_code.li
index 082de55,ce2578f..b6df4fb
--- a/src/lip/lip_code.li
+++ b/src/lip/lip_code.li
@@@ -27,18 -27,148 +27,18 @@@ Section Heade
- author := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
- comment := "The main prototype";
+ // TODO: Mildred: Make it possible to create many different LIP_CODE so that
+ // we can load different .lip file separately.
+
Section Inherit
+ parent_itm_object:Expanded ITM_OBJECT;
Section Public
- - stack:FAST_ARRAY[LIP_SLOT_DATA] := FAST_ARRAY[LIP_SLOT_DATA].create_with_capacity 8;
- - list_parent:FAST_ARRAY(STRING_CONSTANT) := FAST_ARRAY(STRING_CONSTANT).create_with_capacity 1;
-
- - list_method:FAST_ARRAY(LIP_SLOT_CODE) := FAST_ARRAY(LIP_SLOT_CODE).create_with_capacity 32;
-
- - list_data:HASHED_DICTIONARY(LIP_SLOT_DATA,STRING_CONSTANT) :=
- HASHED_DICTIONARY(LIP_SLOT_DATA,STRING_CONSTANT).create;
-
+ - stack:FAST_ARRAY(LIP_SLOT_DATA) := FAST_ARRAY(LIP_SLOT_DATA).create_with_capacity 8;
-
- - get_data n:STRING_CONSTANT :LIP_SLOT_DATA <-
- (
- list_data.fast_reference_at n
- );
-
- - get_method n:STRING_CONSTANT :LIP_SLOT_CODE <-
- ( + j:INTEGER;
- + result:LIP_SLOT_CODE;
-
- j := list_method.lower;
- {(j <= list_method.upper) && {list_method.item j.name != n}}.while_do {
- j := j + 1;
- };
- (j <= list_method.upper).if {
- result := list_method.item j;
- };
- result
- );
-
- - print_usage <-
- ( + slot:LIP_SLOT_CODE;
- + is_ok:BOOLEAN;
-
- (list_method.lower).to (list_method.upper) do { j:INTEGER;
- slot := list_method.item j;
- (slot.section = ALIAS_STR.section_public).if {
- is_ok := TRUE;
- slot.print;
- };
- };
- (is_ok).if_false {
- "\t Sorry, no option (see `make.lip').\n".print;
- };
- );
-
- - get_integer n:STRING_CONSTANT :INTEGER <-
- ( + d:LIP_SLOT_DATA;
- + int:LIP_INTEGER;
- + result:INTEGER;
-
- d := get_data n;
- (d = NULL).if {
- "Warning: Slot `".print;
- n.print;
- "' not found.\n".print;
- } else {
- int ?= d.value;
- (int = NULL).if {
- semantic_error (d.position,"INTEGER type is needed.");
- };
- result := int.value;
- };
- result
- );
-
- - get_boolean n:STRING_CONSTANT :BOOLEAN <-
- ( + d:LIP_SLOT_DATA;
- + bool:LIP_BOOLEAN;
- + result:BOOLEAN;
-
- d := get_data n;
- (d = NULL).if {
- "Warning: Slot `".print;
- n.print;
- "' not found.\n".print;
- } else {
- bool ?= d.value;
- (bool = NULL).if {
- semantic_error (d.position,"BOOLEAN type is needed.");
- };
- result := bool.value;
- };
- result
- );
-
- - get_string n:STRING_CONSTANT :STRING_CONSTANT <-
- ( + d:LIP_SLOT_DATA;
- + str:LIP_STRING;
- + result:STRING_CONSTANT;
-
- d := get_data n;
- (d = NULL).if {
- "Warning: Slot `".print;
- n.print;
- "' not found.\n".print;
- } else {
- str ?= d.value;
- (str = NULL).if {
- semantic_error (d.position,"STRING type is needed.");
- };
- result := str.value;
- };
- result
- );
-
- - put_string v:STRING_CONSTANT to n:STRING_CONSTANT <-
- ( + d:LIP_SLOT_DATA;
- + str:LIP_STRING;
-
- d := get_data n;
- (d = NULL).if {
- "Warning: Slot `".print;
- n.print;
- "' not found.\n".print;
- } else {
- str ?= d.value;
- (str = NULL).if {
- semantic_error (d.position,"STRING type is needed.");
- };
- str.set_value v;
- };
- );
-
- - put_boolean v:BOOLEAN to n:STRING_CONSTANT <-
- ( + d:LIP_SLOT_DATA;
-
- d := get_data n;
- (d = NULL).if {
- "Warning: Slot `".print;
- n.print;
- "' not found.\n".print;
- } else {
- (d.set_value (LIP_BOOLEAN.get v)).if_false {
- semantic_error (d.position,"BOOLEAN type is needed.");
- };
- };
- );
+
- - stack_base_directory:FAST_ARRAY[STRING_CONSTANT] := FAST_ARRAY[STRING_CONSTANT].create_with_capacity 8;
++ - stack_base_directory:FAST_ARRAY(STRING_CONSTANT) := FAST_ARRAY(STRING_CONSTANT).create_with_capacity 8;
//
// Run.
diff --combined src/lip/lip_constant.li
index 2e3178a,5577718..ca85267
--- a/src/lip/lip_constant.li
+++ b/src/lip/lip_constant.li
@@@ -52,11 -52,11 +52,11 @@@ Section Publi
- free <- deferred;
- - '-' :LIP_CONSTANT <- NULL;
+ - '-' Self:SELF :LIP_CONSTANT <- NULL;
- - '!' :LIP_CONSTANT <- NULL;
+ - '!' Self:SELF :LIP_CONSTANT <- NULL;
- - '|' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '|' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -66,7 -66,7 +66,7 @@@
result
);
- - '&' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '&' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -76,7 -76,7 +76,7 @@@
result
);
- - '+' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '+' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -86,7 -86,7 +86,7 @@@
result
);
- - '-' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '-' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -96,7 -96,7 +96,7 @@@
result
);
- - '>' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '>' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -106,7 -106,7 +106,7 @@@
result
);
- - '<' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '<' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -116,7 -116,7 +116,7 @@@
result
);
- - '==' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '==' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -126,7 -126,7 +126,7 @@@
result
);
- - '>=' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '>=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -136,7 -136,7 +136,7 @@@
result
);
- - '<=' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '<=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -146,7 -146,7 +146,7 @@@
result
);
- - '!==' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '!==' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@@ -157,32 -157,28 +157,32 @@@
);
- print <- deferred;
+
+ - append_in str:STRING <- deferred;
+
+ - to_boolean :BOOLEAN <- FALSE;
Section LIP_CONSTANT
- my_copy other:SELF :LIP_CONSTANT <- NULL;
- - '|#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '|#' other:SELF :LIP_CONSTANT <- NULL;
- - '&#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <- NULL;
- - '+#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '+#' other:SELF :LIP_CONSTANT <- NULL;
- - '-#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '-#' other:SELF :LIP_CONSTANT <- NULL;
- - '>#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '>#' other:SELF :LIP_CONSTANT <- NULL;
- - '<#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '<#' other:SELF :LIP_CONSTANT <- NULL;
- - '=#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <- NULL;
- - '>=#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '>=#' other:SELF :LIP_CONSTANT <- NULL;
- - '<=#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '<=#' other:SELF :LIP_CONSTANT <- NULL;
- - '!=#' other:SELF :LIP_CONSTANT <- NULL;
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <- NULL;
diff --combined src/lip/lip_if.li
index cff5d00,533ba48..d898c03
--- a/src/lip/lip_if.li
+++ b/src/lip/lip_if.li
@@@ -35,24 -35,24 +35,24 @@@ Section Publi
+ condition:LIP_CODE;
- + then:FAST_ARRAY[LIP_CODE];
+ + then:FAST_ARRAY(LIP_CODE);
- + else:FAST_ARRAY[LIP_CODE];
+ + else:FAST_ARRAY(LIP_CODE);
//
// Creation.
//
- - create p:POSITION if rec:LIP_CODE then the:FAST_ARRAY[LIP_CODE]
- else els:FAST_ARRAY[LIP_CODE] :SELF <-
+ - create p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE)
+ else els:FAST_ARRAY(LIP_CODE) :SELF <-
( + result:SELF;
result := clone;
result.make p if rec then the else els;
result
);
- - make p:POSITION if rec:LIP_CODE then the:FAST_ARRAY[LIP_CODE]
- else els:FAST_ARRAY[LIP_CODE] <-
+ - make p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE)
+ else els:FAST_ARRAY(LIP_CODE) <-
(
position := p;
condition := rec;
@@@ -65,13 -65,13 +65,13 @@@
//
- run <-
- ( + val:LIP_BOOLEAN;
+ ( + val:LIP_CONSTANT;
- val ?= condition.run_expr;
+ val := condition.run_expr;
(val = NULL).if {
- semantic_error (position,"BOOLEAN needed.");
+ semantic_error (position,"BOOLEAN value needed.");
};
- (val.value).if {
+ (val.to_boolean).if {
(then.lower).to (then.upper) do { i:INTEGER;
then.item i.run;
};
diff --combined src/lip/lip_integer.li
index ad60adf,18c1d6e..d7c0f94
--- a/src/lip/lip_integer.li
+++ b/src/lip/lip_integer.li
@@@ -33,7 -33,7 +33,7 @@@ Section Inheri
Section Private
- - storage:FAST_ARRAY[LIP_INTEGER] := FAST_ARRAY[LIP_INTEGER].create_with_capacity 10;
+ - storage:FAST_ARRAY(LIP_INTEGER) := FAST_ARRAY(LIP_INTEGER).create_with_capacity 10;
- set_value v:INTEGER <-
(
@@@ -69,15 -69,15 +69,15 @@@ Section Publi
// Operation.
//
- - name:STRING_CONSTANT <- "INTEGER";
+ - name:STRING_CONSTANT <- ALIAS_STR.prototype_integer;
- - '-' :LIP_CONSTANT <-
+ - '-' Self:SELF :LIP_CONSTANT <-
(
value := - value;
Self
);
- - '!' :LIP_CONSTANT <-
+ - '!' Self:SELF :LIP_CONSTANT <-
(
value := ~ value;
Self
@@@ -92,13 -92,6 +92,13 @@@
(
value.print;
);
+
+ - append_in str:STRING <-
+ (
+ str.append (value.to_string);
+ );
+
+ - to_boolean :BOOLEAN <- value != 0;
Section LIP_CONSTANT
@@@ -108,70 -101,70 +108,70 @@@
Self
);
- - '|#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '|#' other:SELF :LIP_CONSTANT <-
(
value := value | other.value;
other.free;
Self
);
- - '&#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
(
value := value & other.value;
other.free;
Self
);
- - '+#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '+#' other:SELF :LIP_CONSTANT <-
(
value := value + other.value;
other.free;
Self
);
- - '-#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '-#' other:SELF :LIP_CONSTANT <-
(
value := value - other.value;
other.free;
Self
);
- - '>#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '>#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value > other.value)
);
- - '<#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '<#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value < other.value)
);
- - '=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value = other.value)
);
- - '>=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '>=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value >= other.value)
);
- - '<=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '<=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value <= other.value)
);
- - '!=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
diff --combined src/lip/lip_slot_code.li
index eb75c33,709f447..5021c83
--- a/src/lip/lip_slot_code.li
+++ b/src/lip/lip_slot_code.li
@@@ -29,7 -29,7 +29,7 @@@ Section Heade
Section Inherit
- - parent_lip_code:Expanded LIP_CODE;
+ + parent_lip_code: Expanded LIP_CODE;
Section Public
@@@ -39,10 -39,8 +39,11 @@@
+ argument:LIP_SLOT_DATA;
- + code:FAST_ARRAY[LIP_CODE];
++
+ + code:FAST_ARRAY(LIP_CODE);
-
+
+ + base_directory:STRING_CONSTANT;
+
+ comment:STRING_CONSTANT;
// + comment_chapter:STRING_CONSTANT;
@@@ -63,43 -61,36 +64,43 @@@
// Creation.
//
- - create p:POSITION section sec:STRING_CONSTANT
+ - create p:POSITION
+ in proj:LIP_PROJECT
+ dir d:STRING_CONSTANT
+ section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
- code c:FAST_ARRAY[LIP_CODE] :LIP_SLOT_CODE <-
+ code c:FAST_ARRAY(LIP_CODE) :LIP_SLOT_CODE <-
( + result:LIP_SLOT_CODE;
- result := get_method n;
+ result := proj.get_method n;
(result != NULL).if {
((arg = NULL) ^ (result.argument = NULL)).if {
semantic_error (result.position,"Incorrect redefinition.");
};
- ALIAS_ARRAY[LIP_CODE].free c;
+ ALIAS_ARRAY(LIP_CODE).free c;
} else {
result := clone;
- result.make p section sec name n argument arg code c;
+ result.make p in proj dir d section sec name n argument arg code c;
};
result
);
- - make p:POSITION section sec:STRING_CONSTANT
+ - make p:POSITION
+ in proj:LIP_PROJECT
+ dir d:STRING_CONSTANT
+ section sec:STRING_CONSTANT
name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
- code c:FAST_ARRAY[LIP_CODE] <-
+ code c:FAST_ARRAY(LIP_CODE) <-
(
- position := p;
- section := sec;
- name := n;
- argument := arg;
- code := c;
- list_method.add_last Self;
+ position := p;
+ section := sec;
+ name := n;
+ argument := arg;
+ code := c;
+ base_directory := d;
+ proj.list_method.add_last Self;
);
//
@@@ -113,17 -104,15 +114,17 @@@
(result).if {
(argument != NULL).if {
? { val != NULL };
- result := argument.set_value val;
- stack.add_last argument;
+ result := argument.set_value val;
+ stack.add_last argument;
} else {
stack.add_last NULL;
};
(result).if {
+ stack_base_directory.add_last base_directory;
(code.lower).to (code.upper) do { j:INTEGER;
code.item j.run;
- };
+ };
+ stack_base_directory.remove_last;
};
stack.remove_last;
};
@@@ -137,15 -126,13 +138,15 @@@
- print <-
(
" -".print;
- name.print;
+ string_tmp.copy name;
+ string_tmp.replace_all '_' with '-';
+ string_tmp.print;
(argument != NULL).if {
" <".print;
argument.print;
">".print;
};
- " :\n".print;
+ ":\n".print;
(comment != NULL).if {
'\t'.print;
(comment.lower).to (comment.upper) do { i:INTEGER;
diff --combined src/lip/lip_slot_data.li
index 4d8b049,d52391b..479bc12
--- a/src/lip/lip_slot_data.li
+++ b/src/lip/lip_slot_data.li
@@@ -41,46 -41,30 +41,46 @@@ Section Publi
// Creation.
//
- - create p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
- argument is_arg:BOOLEAN :SELF <-
+ - create p:POSITION in proj:LIP_PROJECT name n:STRING_CONSTANT
+ value v:LIP_CONSTANT argument is_arg:BOOLEAN :SELF <-
[
-? {v != NULL};
]
( + result:SELF;
- result := clone;
- result.make p name n value v argument is_arg;
+ + cst:LIP_CONSTANT;
+ + s:LIP_SLOT_DATA;
+
+ s := proj.get_data n;
+ (s != NULL).if {
+ (s.get_value.type_id_intern != v.type_id_intern).if {
+ POSITION.put_error semantic text "Wrong slot type (double declaration)";
+ p.put_position;
+ s.position.put_position;
+ POSITION.send_error;
+ };
+ cst := s.get_value;
+ s.set_value v;
+ cst.free;
+ result ?= s;
+ } else {
+ result := clone;
+ result.make p in proj name n value v argument is_arg;
+ };
result
- );
+ )
+ [
+ +? { Result != NULL };
+ ];
- - make p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
- argument is_arg:BOOLEAN <-
- ( + s:LIP_SLOT_DATA;
+ - make p:POSITION in proj:LIP_PROJECT name n:STRING_CONSTANT
+ value v:LIP_CONSTANT argument is_arg:BOOLEAN <-
+ (
position := p;
name := n;
value := v;
(is_arg).if_false {
- list_data.add Self to n;
- };
+ proj.list_data.add Self to n;
+ };
);
//
@@@ -92,8 -76,8 +92,8 @@@
new_val := value.copy_of v;
(new_val != NULL).if {
- value := new_val;
- }
+ value := new_val;
+ }
);
- get_value:LIP_CONSTANT <-
diff --combined src/lip/lip_string.li
index 9747a21,04f11a5..eaef9e5
--- a/src/lip/lip_string.li
+++ b/src/lip/lip_string.li
@@@ -33,7 -33,7 +33,7 @@@ Section Inheri
Section Private
- - storage:FAST_ARRAY[LIP_STRING] := FAST_ARRAY[LIP_STRING].create_with_capacity 10;
+ - storage:FAST_ARRAY(LIP_STRING) := FAST_ARRAY(LIP_STRING).create_with_capacity 10;
Section Public
@@@ -54,22 -54,22 +54,22 @@@
result := clone;
} else {
result := storage.last;
- storage.remove_last;
+ storage.remove_last;
};
result.set_value str;
result
);
- free <-
- (
+ (
storage.add_last Self;
);
-
+
//
// Operation.
//
- - name:STRING_CONSTANT <- "STRING";
+ - name:STRING_CONSTANT <- ALIAS_STR.prototype_string;
- copy:LIP_CONSTANT <-
(
@@@ -78,13 -78,12 +78,13 @@@
- print <-
(
- string_tmp.clear;
+ string_tmp.clear;
append_in string_tmp;
string_tmp.print;
);
-
- - append_in str:STRING <-
+
+ - append_in str:STRING <- str.append value;
+ /*
( + i:INTEGER;
+ car:CHARACTER;
@@@ -116,9 -115,6 +116,9 @@@
i := i + 1;
};
);
+ */
+
+ - to_boolean :BOOLEAN <- (value != NULL) && {!value.is_empty};
Section LIP_CONSTANT
@@@ -128,21 -124,21 +128,21 @@@
Self
);
- - '=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value = other.value)
);
- - '!=#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value != other.value)
);
- - '+#' other:SELF :LIP_CONSTANT <-
+ - Self:SELF '+#' other:SELF :LIP_CONSTANT <-
(
string_tmp.copy value;
string_tmp.append (other.value);
diff --combined src/lisaac.li
index fd1feca,b195518..b846a16
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@@ -32,18 -32,22 +32,18 @@@ Section Heade
// Top 5 memory record :
// 1 - LOCAL (>20MB) (il fo Aliaser les tmp !)
// 2 - READ_LOCAL (15MB)
- // 3 - LIST (13MB) (En baisse => a retester)
+ // 3 - LIST (13MB) (En baisse => a retester.)
// 4 - PROTOTYPE_CST (10MB)
// 5 - WRITE_LOCAL (10MB)
Section Inherit
- parent_any:ANY := ANY;
-
-Section Private
- - output_name:STRING_CONSTANT;
-
- - input_name:STRING_CONSTANT;
-
+Section Public
+
- path_lisaac:STRING_CONSTANT <-
- ( + path:NATIVE_ARRAY[CHARACTER];
+ ( + path:NATIVE_ARRAY(CHARACTER);
+ path_str :STRING;
+ j:INTEGER;
//COMMAND_LINE.executable_name.print; '\n'.print;
@@@ -52,12 -56,12 +52,12 @@@
(path_str != NULL).if {
string_tmp.copy path_str;
} else {
- path := `LISAAC_DIRECTORY`:NATIVE_ARRAY[CHARACTER];
+ path := `LISAAC_DIRECTORY`:NATIVE_ARRAY(CHARACTER);
string_tmp.clear;
j := 0;
{path.item j != '\0'}.while_do {
- string_tmp.add_last (path.item j);
- j := j + 1;
+ string_tmp.add_last (path.item j);
+ j := j + 1;
};
};
((string_tmp.last != '/') && {string_tmp.last != '\\'}).if {
@@@ -66,16 -70,6 +66,16 @@@
path_lisaac := ALIAS_STR.get string_tmp
);
+Section Private
+
+ - output_name:STRING_CONSTANT;
+
+ - input_name:STRING_CONSTANT;
+
+ - project :LIP_PROJECT := LIP_PROJECT.create;
+
+ - lip_recursion :INTEGER := 5;
+
//
// Command.
//
@@@ -98,13 -92,13 +98,13 @@@
- end_usage:STRING_CONSTANT :=
" \n\
\Bug report: \n\
- \\t post in : https://gna.org/bugs/?group=isaac \n\
- \\t mail to : sonntag at icps.u-strasbg.fr \n";
+ \\t post in : https://alioth.debian.org/projects/lisaac/ \n\
+ \\t mail to : sonntag at icps.u-strasbg.fr \n";
- display_usage <-
(
begin_usage.print;
- LIP_CODE.print_usage;
+ project.print_usage;
end_usage.print;
die_with_code exit_failure_code;
);
@@@ -115,7 -109,8 +115,8 @@@
- read_options <-
( + cmd:STRING;
- + j,i,f:INTEGER;
+ + j,i:INTEGER;
+ + f:POINTER;
+ lip_ok:BOOLEAN;
+ s:LIP_SLOT_CODE;
+ t:STRING_CONSTANT;
@@@ -140,15 -135,17 +141,18 @@@
.when 'p' then {
is_path_list := TRUE;
}
+ .when 'r' then {
+ is_readable := TRUE;
+ };
} else {
(lip_ok).if_false {
- load_lip "make.lip";
+ load_lip (ALIAS_STR.make_lip) fuzzy TRUE;
lip_ok := TRUE;
};
string_tmp.copy cmd;
string_tmp.remove_first 1;
- s := LIP_CODE.get_method (ALIAS_STR.get string_tmp);
+ string_tmp.replace_all '-' with '_';
+ s := project.get_method (ALIAS_STR.get string_tmp);
((s = NULL) || {s.section != ALIAS_STR.section_public}).if {
"ERROR : Option `".print;
cmd.print;
@@@ -204,12 -201,12 +208,12 @@@
"'.".print;
display_usage;
};
- load_lip cmd;
+ load_lip cmd fuzzy FALSE;
lip_ok := TRUE;
} else {
// .li
(lip_ok).if_false {
- load_lip "make.lip";
+ load_lip (ALIAS_STR.make_lip) fuzzy TRUE;
lip_ok := TRUE;
};
(input_name != NULL).if {
@@@ -229,19 -226,19 +233,19 @@@
(i > string_tmp2.lower).if {
string_tmp2.remove_last (string_tmp2.upper-i+1);
};
- LIP_CALL.load_directory (ALIAS_STR.get string_tmp) is_recursive FALSE;
input_name := ALIAS_STR.get string_tmp2;
- LIP_CODE.put_string input_name to (ALIAS_STR.slot_input_file);
+ project.load_directory (ALIAS_STR.get string_tmp) base_path (ALIAS_STR.path_current) is_recursive FALSE public TRUE weak TRUE;
+ project.put_string input_name to (ALIAS_STR.slot_input_file);
};
};
j := j+1;
};
(lip_ok).if_false {
- load_lip "make.lip";
+ load_lip (ALIAS_STR.make_lip) fuzzy TRUE;
};
// Executing `front_end':
- s := LIP_CODE.get_method (ALIAS_STR.slot_front_end);
+ s := project.get_method (ALIAS_STR.slot_front_end);
(s = NULL).if {
"Slot `front_end' not found in *.lip file.\n".print;
die_with_code exit_failure_code;
@@@ -250,8 -247,8 +254,8 @@@
(is_path_list).if {
string_tmp.clear;
- (path_file.lower).to (path_file.upper) do { n:INTEGER;
- string_tmp.append (path_file.item n);
+ (project.items.lower).to (project.items.upper) do { n:INTEGER;
+ string_tmp.append (project.items.item n.filepath);
string_tmp.add_last '\n';
};
(! FS_MIN.make_file "current_path.txt").if {
@@@ -265,26 -262,20 +269,26 @@@
};
// Loading variable.
- input_name := LIP_CODE.get_string (ALIAS_STR.slot_input_file);
- debug_level_option := LIP_CODE.get_integer (ALIAS_STR.slot_debug_level);
- debug_with_code := LIP_CODE.get_boolean (ALIAS_STR.slot_debug_with_code);
- is_all_warning := LIP_CODE.get_boolean (ALIAS_STR.slot_is_all_warning);
- is_optimization := LIP_CODE.get_boolean (ALIAS_STR.slot_is_optimization);
- inline_level := LIP_CODE.get_integer (ALIAS_STR.slot_inline_level);
- is_java := LIP_CODE.get_boolean (ALIAS_STR.slot_is_java);
- is_statistic := LIP_CODE.get_boolean (ALIAS_STR.slot_is_statistic);
- is_quiet := LIP_CODE.get_boolean (ALIAS_STR.slot_is_quiet);
+ input_name := project.get_string (ALIAS_STR.slot_input_file);
+ debug_level_option := project.get_integer (ALIAS_STR.slot_debug_level);
+ debug_with_code := project.get_boolean (ALIAS_STR.slot_debug_with_code);
+ is_all_warning := project.get_boolean (ALIAS_STR.slot_is_all_warning);
+ is_optimization := project.get_boolean (ALIAS_STR.slot_is_optimization);
+ inline_level := project.get_integer (ALIAS_STR.slot_inline_level);
+ is_java := project.get_boolean (ALIAS_STR.slot_is_java);
+ is_statistic := project.get_boolean (ALIAS_STR.slot_is_statistic);
+ is_quiet := project.get_boolean (ALIAS_STR.slot_is_quiet);
+ project.add_imports;
+ is_java.if {
+ backend := BACKEND_JAVA;
+ } else {
+ backend := BACKEND_C;
+ };
//
((input_name = NULL) || {input_name.is_empty}).if {
"ERROR : `input_file' is empty.\n".print;
display_usage;
- };
+ };
string_tmp.copy input_name;
(is_java).if {
string_tmp.append ".java";
@@@ -304,66 -295,50 +308,66 @@@
result
);
- - load_lip file_lip:ABSTRACT_STRING <-
+ - load_lip file_lip:ABSTRACT_STRING fuzzy fuzzy:BOOLEAN <-
+ // Replace LIP_PROJECT.init
+ [
+ -? { file_lip != NULL };
+ ]
( + path_lip:STRING_CONSTANT;
+ is_good:BOOLEAN;
+ count:INTEGER;
+ + recursion:INTEGER;
+
+ fuzzy.if {
+ recursion := lip_recursion;
+ } else {
+ recursion := 1;
+ };
+ // First, we load the lip passed as argument
+ // Lookup parent directory if we are in fuzzy mode
+
string_tmp.clear;
- {
+ {
string_tmp.append file_lip;
path_lip := ALIAS_STR.get string_tmp;
- (is_good := PARSER.read_lip path_lip).if_false {
+ (is_good := project.load_lip path_lip).if_false {
string_tmp.copy path_lip;
string_tmp.remove_last (file_lip.count);
string_tmp.append "../";
count := count + 1;
};
- }.do_while {(count < 5) && {! is_good}};
- (is_good).if_false {
+ }.do_while {(count < lip_recursion) && {! is_good}};
+
+ // Couldn't find it
+ // If in fuzzy mode, try last chance: built-in make.lip
+
+ (is_good & fuzzy).if_false {
string_tmp.copy path_lisaac;
- string_tmp.append "make.lip";
+ string_tmp.append (ALIAS_STR.make_lip);
path_lip := ALIAS_STR.get string_tmp;
- (is_good := PARSER.read_lip path_lip).if_false {
+ (is_good := project.load_lip path_lip).if_false {
"File `".print;
path_lip.print;
"' not found !\nIncorrect installation.\n".print;
die_with_code exit_failure_code;
};
- };
- {LIP_CODE.list_parent.is_empty}.until_do {
- path_lip := LIP_CODE.list_parent.first;
- LIP_CODE.list_parent.remove_first;
- (path_lip.is_empty).if {
- string_tmp.copy path_lisaac;
- string_tmp.append "make.lip";
- path_lip := ALIAS_STR.get string_tmp;
- };
- (PARSER.read_lip path_lip).if_false {
- "File `".print;
- path_lip.print;
- "' not found ! (see `*.lip')\n".print;
- die_with_code exit_failure_code;
- };
};
+
+ // Couldn't find anything, too bad
+ // Die
+
+ (is_good).if_false {
+ "File `".print;
+ path_lip.print;
+ "' not found !\nIncorrect installation.\n".print;
+ die_with_code exit_failure_code;
+ };
+
// Auto-load 'lisaac' variable.
- LIP_CODE.put_string path_lisaac to (ALIAS_STR.variable_lisaac);
+
+ project.put_string path_lisaac to (ALIAS_STR.variable_lisaac);
+ project.call_init NULL;
);
- put_trace_code buf:STRING <-
@@@ -387,6 -362,7 +391,7 @@@
\ print_char(*str); \n\
\ str++; \n\
\ };\n\
+ \ return(0);\n\
\}\n\
\\n";
};
@@@ -417,7 -393,7 +422,7 @@@
//
(debug_with_code).if {
- + src:HASHED_DICTIONARY[STRING,UINTEGER_32];
+ + src:HASHED_DICTIONARY(STRING,UINTEGER_32);
+ key:UINTEGER_32;
output_decl.append
@@@ -472,7 -448,7 +477,7 @@@
buf.append
"void push_first(_____CONTEXT *path,unsigned long code)\n\
- \{ int n; _____CONTEXT *c; static int mx=0;\n";
+ \{ \n";
(debug_level_option = 20).if {
buf.append
" _____CONTEXT *cur,loop;\n\
@@@ -490,10 -466,6 +495,6 @@@
" path->back = top_context;\n\
\ path->code = code;\n\
\ top_context = path;\n\
- \ \n\
- \ /*c = path; n=0;\n\
- \ while (c != NULL) { n++; c = c->back; };\n\
- \ if ((n > mx) ) { print_integer(n); print_string(\"\\n\"); mx = n; };*/ \n\
\} \n\
\ \n\
\void push(_____CONTEXT *path,unsigned long code)\n\
@@@ -563,7 -535,7 +564,7 @@@
);
- load_main_object <-
- ( + type_gen:FAST_ARRAY[ITM_TYPE_MONO];
+ ( + type_gen:FAST_ARRAY(ITM_TYPE_MONO);
+ itm_type_character:ITM_TYPE_MONO;
+ itm_type_n_a_character:ITM_TYPE_MONO;
@@@ -575,44 -547,41 +576,44 @@@
// Input.
string_tmp.copy input_name;
string_tmp.to_upper;
- type_input := ITM_TYPE_SIMPLE.get (ALIAS_STR.get string_tmp).to_run_for NULL.raw;
+ type_input := ITM_TYPE_SIMPLE.get (ALIAS_STR.get string_tmp)
+ project project.to_run_for NULL.raw;
// Other prototype.
type_true := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_true)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_false := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_false)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_boolean := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_boolean)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_integer := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_integer)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_real := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_real)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_integer_32 := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_integer_32)
- style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
+ project project style (ALIAS_STR.keyword_expanded).to_run_for NULL.raw;
type_string_constant := ITM_TYPE_SIMPLE.get (ALIAS_STR.prototype_string_constant)
- .to_run_for NULL.raw;
+ project project.to_run_for NULL.raw;
itm_type_character := ITM_TYPE_STYLE.get (ALIAS_STR.prototype_character)
- style (ALIAS_STR.keyword_expanded);
+ project project style (ALIAS_STR.keyword_expanded);
type_character := itm_type_character.to_run_for NULL.raw;
- type_block := ITM_TYPE_SIMPLE.get (ALIAS_STR.prototype_block).to_run_for NULL.raw;
+ type_block := ITM_TYPE_SIMPLE.get (ALIAS_STR.prototype_block)
+ project project.to_run_for NULL.raw;
//
- type_pointer := ITM_TYPE_SIMPLE.get (ALIAS_STR.prototype_pointer).to_run_for NULL.raw;
+ type_pointer := ITM_TYPE_SIMPLE.get (ALIAS_STR.prototype_pointer)
+ project project.to_run_for NULL.raw;
- // NATIVE_ARRAY[CHARACTER]
- type_gen := ALIAS_ARRAY[ITM_TYPE_MONO].new;
+ // NATIVE_ARRAY(CHARACTER)
+ type_gen := ALIAS_ARRAY(ITM_TYPE_MONO).new;
type_gen.add_last itm_type_character;
- type_gen := ALIAS_ARRAY[ITM_TYPE_MONO].alias type_gen;
+ type_gen := ALIAS_ARRAY(ITM_TYPE_MONO).alias type_gen;
itm_type_n_a_character := ITM_TYPE_GENERIC.get (ALIAS_STR.prototype_native_array)
- style NULL with type_gen;
+ project project style NULL with type_gen;
type_n_a_character := itm_type_n_a_character.to_run_for NULL.raw;
- // NATIVE_ARRAY[NATIVE_ARRAY[CHARACTER]]
- type_gen := ALIAS_ARRAY[ITM_TYPE_MONO].new;
+ // NATIVE_ARRAY[NATIVE_ARRAY(CHARACTER)]
+ type_gen := ALIAS_ARRAY(ITM_TYPE_MONO).new;
type_gen.add_last itm_type_n_a_character;
- type_gen := ALIAS_ARRAY[ITM_TYPE_MONO].alias type_gen;
+ type_gen := ALIAS_ARRAY(ITM_TYPE_MONO).alias type_gen;
type_n_a_n_a_character := ITM_TYPE_GENERIC.get (ALIAS_STR.prototype_native_array)
- style NULL with type_gen.to_run_for NULL.raw;
+ project project style NULL with type_gen.to_run_for NULL.raw;
//
? {type_input != NULL};
);
@@@ -662,9 -631,9 +663,9 @@@ Section Publi
string_tmp.append ".li\noutput file : ";
string_tmp.append output_name;
string_tmp.append "\npath directory :\n";
- path_file.lower.to (path_file.upper) do { j:INTEGER;
+ project.items.lower.to (project.items.upper) do { j:INTEGER;
string_tmp.append " ";
- string_tmp.append (path_file.item j);
+ string_tmp.append (project.items.item j.filepath);
string_tmp.add_last '\n';
};
string_tmp.print;
@@@ -819,6 -788,12 +820,12 @@@
};
(is_statistic).if {
+ STD_ERROR.put_string " Local counter : ";
+ STD_ERROR.put_integer (LIST.local_counter);
+ STD_ERROR.put_string "\n";
+ STD_ERROR.put_string " Context counter : ";
+ STD_ERROR.put_integer (LIST.context_counter);
+ STD_ERROR.put_string "\n";
print " Null call score : " stat null_counter for late_binding_counter;
print " Polymorphic call : " stat polymorphic_counter for late_binding_counter;
(is_optimization).if {
@@@ -830,8 -805,8 +837,8 @@@
// Execute finality command (front end).
//
// Executing `front_end':
- LIP_CODE.put_boolean is_cop to (ALIAS_STR.slot_is_cop);
- s := LIP_CODE.get_method (ALIAS_STR.slot_back_end);
+ project.put_boolean is_cop to (ALIAS_STR.slot_is_cop);
+ s := project.get_method (ALIAS_STR.slot_back_end);
(s = NULL).if {
"Warning: Slot `back_end' not found in *.lip file.\n".print;
} else {
diff --combined src/parser.li
index 5735af8,0c2e062..feeccdc
--- a/src/parser.li
+++ b/src/parser.li
@@@ -28,8 -28,6 +28,8 @@@ Section Heade
- comment := "Parser for Lisaac language.";
// You can to get current grammar with `grep "//++" parser.li'
+ // `grep "//--" parser.li' can be used to have more details
+ // `grep "////" parser.li' for lip grammar
Section Inherit
@@@ -43,8 -41,8 +43,8 @@@ Section Publi
- is_active_short:BOOLEAN;
- - short_dico:HASHED_DICTIONARY[LINKED_LIST[STRING_CONSTANT],STRING_CONSTANT] :=
- HASHED_DICTIONARY[LINKED_LIST[STRING_CONSTANT],STRING_CONSTANT].create;
+ - short_dico:HASHED_DICTIONARY(LINKED_LIST(STRING_CONSTANT),STRING_CONSTANT) :=
+ HASHED_DICTIONARY(LINKED_LIST(STRING_CONSTANT),STRING_CONSTANT).create;
- short_derive:INTEGER;
@@@ -53,7 -51,7 +53,7 @@@
- short key:STRING_CONSTANT token beg:INTEGER to end:INTEGER <-
( + pos:INTEGER;
+ add_text:ABSTRACT_STRING;
- + fmt:LINKED_LIST[STRING_CONSTANT];
+ + fmt:LINKED_LIST(STRING_CONSTANT);
(is_shorter).if {
(is_active_short).if {
@@@ -93,7 -91,7 +93,7 @@@
short_derive := short_derive - (end - begin + 1);
);
- - short_local:HASHED_SET[STRING_CONSTANT];
+ - short_local:HASHED_SET(STRING_CONSTANT);
Section Private
@@@ -102,9 -100,6 +102,9 @@@
//
- object : PROTOTYPE;
+
+ - lip_prj :LIP_PROJECT;
+ - lip_dir :STRING_CONSTANT;
- source : STRING;
@@@ -180,15 -175,7 +180,15 @@@
pos_line := old_pos_line;
pos_col := old_pos_col;
);
-
+
+ //
+ // Find prototype
+ //
+
+ // This is here because it might require current_position to raise an error
+ - find_prototype n:STRING_CONSTANT :PRJ_ITEM <-
+ object.itm_source.first.project.find_item n from (object.itm_source.first) or_fail current_position;
+
//
// Syntax parser.
//
@@@ -211,12 -198,36 +211,36 @@@
- last_comment_extern:STRING_CONSTANT;
- last_comment_slot :STRING_CONSTANT;
- skip_comment:BOOLEAN;
-
+
+ - put_new_line_comment str:STRING with cmt:STRING_CONSTANT <-
+ ( + lst:LINKED_LIST(STRING_CONSTANT);
+ + idx,idx_beg:INTEGER;
+ lst := PARSER.short_dico.fast_reference_at cmt;
+ (lst != NULL).if {
+ {(idx := str.index_of '\n' since (idx+1)) < str.upper}.while_do {
+ idx_beg := idx;
+ idx := idx + 1;
+ {
+ (idx <= str.upper) &&
+ {str.item idx <= ' ' } &&
+ {str.item idx != '\n'}
+ }.while_do {
+ idx := idx + 1;
+ };
+ (str.item idx = '\n').if {
+ str.replace_substring (lst.first) from idx_beg to (idx-1);
+ idx := idx_beg + (lst.first.count)-1;
+ };
+ };
+ };
+ );
+
- read_space:BOOLEAN <-
( + posold,pos,pos2:INTEGER;
+ level_comment:INTEGER;
+ stat:INTEGER;
+
pos := position;
posold := -1;
(is_shorter2).if {
@@@ -262,7 -273,7 +286,7 @@@
(is_shorter2).if {
(stat)
.when 0 or 1 then { string_tmp3.add_last '\n'; }
- .when 2 then { string_tmp4.add_last '\n'; };
+ .when 2 then { string_tmp4.add_last '\n'; };
};
(is_shorter).if {
// BSBS: A revoir ...
@@@ -328,9 -339,11 +352,11 @@@
(string_tmp3.is_empty).if {
last_comment_slot := NULL;
} else {
- last_comment_slot := ALIAS_STR.get string_tmp3;
+ put_new_line_comment string_tmp3 with (ALIAS_STR.short_comment_new_line_slot);
+ last_comment_slot := ALIAS_STR.get string_tmp3;
};
(string_tmp4.is_empty).if_false {
+ put_new_line_comment string_tmp4 with (ALIAS_STR.short_comment_new_line_extern);
last_comment_extern := ALIAS_STR.get string_tmp4;
};
};
@@@ -378,7 -391,7 +404,7 @@@
result
);
- //-- affect -> ":=" | "<-" | "?="
+ //-- affect -> ":=" | "<-" | "?="
- read_affect:BOOLEAN <-
(
(read_symbol (ALIAS_STR.symbol_affect_immediate)) ||
@@@ -386,7 -399,7 +412,7 @@@
{read_symbol (ALIAS_STR.symbol_affect_code)}
);
- //-- style -> '-' | '+'
+ //-- style -> '-' | '+'
- read_style:CHARACTER <-
( + result:CHARACTER;
read_character '-'.if {
@@@ -401,7 -414,7 +427,7 @@@
result
);
- //-- identifier -> 'a'-'z' {'a'-'z' | '0'-'9' | '_'}
+ //-- identifier -> 'a'-'z' {'a'-'z' | '0'-'9' | '_'}
- read_identifier:BOOLEAN <-
( + result:BOOLEAN;
+ posold,idx:INTEGER;
@@@ -477,7 -490,7 +503,7 @@@
result
);
- //-- keyword -> 'A'-'Z' 'a'-'z' {'a'-'z' | '0'-'9' | '_'}
+ //-- keyword -> 'A'-'Z' 'a'-'z' {'a'-'z' | '0'-'9' | '_'}
- read_keyword:BOOLEAN <-
( + result:BOOLEAN;
// On passe les espaces :
@@@ -547,11 -560,11 +573,11 @@@
result
);
- //-- integer -> number
- //-- number -> {'0'-'9'} ['d']
- //-- | '0'-'9' {'0'-'9' | 'A'-'F' | 'a'-'f'} 'h'
- //-- | {'0'-'7'} 'o'
- //-- | {'0' | '1'} 'b'
+ //-- integer -> number
+ //-- number -> {'0'-'9'} ['d']
+ //-- | '0'-'9' {'0'-'9' | 'A'-'F' | 'a'-'f'} 'h'
+ //-- | {'0'-'7'} 'o'
+ //-- | {'0' | '1'} 'b'
- read_integer:BOOLEAN <-
( + result:BOOLEAN;
+ pos_old:INTEGER;
@@@ -593,10 -606,10 +619,10 @@@
(last_character='d').if {
position := position+1;
};
- (! string_tmp.is_integer).if {
+ (! string_tmp.is_integer_64).if {
syntax_error (current_position,"Incorrect decimal number.");
};
- last_integer := string_tmp.to_integer;
+ last_integer := string_tmp.to_integer_64;
};
};
};
@@@ -607,9 -620,7 +633,9 @@@
);
- read_real:BOOLEAN <-
- //-- real -> '0'-'9' {'0'-'9'_} [ '.' {'0'-'9'} ] [ 'E' ['+'|'-'] '0'-'9' {'0'-'9'}
+ //-- real -> '0'-'9' {'0'-'9'_} [real_decimal] [real_exp]
+ //-- real_decimal -> '.' {'0'-'9'}
+ //-- real_exp -> 'E' ['+'|'-'] '0'-'9' {'0'-'9'}
( + result:BOOLEAN;
+ pos_old:INTEGER;
@@@ -668,17 -679,11 +694,17 @@@
};
result
);
-
+
+ //-- escape -> '\\' separator {separator} '\\'
+ //-- | '\\' escape_seq
+ //-- | '\\' integer '\\'
+ //-- escape_seq -> 'a' | 'b' | 'f' | 'n' | 'r' | 't'
+ //-- | 'v' | '\\' | '?' | '\'' | '\"' | '0'
- read_escape_character <-
( + nothing:BOOLEAN;
- + val:INTEGER;
- last_character.is_separator.if {
+ //+ val:INTEGER;
+ last_character.is_separator.if {
+ // Read escape sequence '\' {space} '\'
position := position+1;
{
(last_character = 0.to_character) ||
@@@ -705,21 -710,7 +731,21 @@@
{last_character = '\''} ||
{last_character = '\"'}
).if {
- string_tmp.add_last last_character;
+ // Read named escape sequence
+ string_tmp.remove_last 1; // remove '\\'
+ last_character
+ .when 'a' then { string_tmp.add_last '\a'; }
+ .when 'b' then { string_tmp.add_last '\b'; }
+ .when 'f' then { string_tmp.add_last '\f'; }
+ .when 'n' then { string_tmp.add_last '\n'; }
+ .when 'r' then { string_tmp.add_last '\r'; }
+ .when 't' then { string_tmp.add_last '\t'; }
+ .when 'v' then { string_tmp.add_last '\v'; }
+ .when '\\' then { string_tmp.add_last '\\'; }
+ .when '?' then { string_tmp.add_last '\?'; }
+ .when '\'' then { string_tmp.add_last '\''; }
+ .when '\"' then { string_tmp.add_last '\"'; };
+ //string_tmp.add_last last_character;
position := position+1;
}.elseif {last_character.in_range '0' to '9'} then {
(
@@@ -727,27 -718,20 +753,27 @@@
{position<source.upper} &&
{! source.item(position+1).is_hexadecimal_digit}
).if {
- string_tmp.add_last last_character;
+ // Read \0
+ string_tmp.remove_last 1; // remove '\\'
+ string_tmp.add_last '\0';
+ //string_tmp.add_last last_character;
position := position+1;
} else {
+ // Read '\' integer '\'
string_tmp2.copy string_tmp;
nothing := read_integer; // result is Always TRUE.
string_tmp.copy string_tmp2;
- (last_integer > 255).if {
+ ((last_integer > 255) || {last_integer < 0}).if {
syntax_error (current_position,
"Invalid range character number [0,255].");
};
- val := last_integer.to_integer;
- string_tmp.add_last ((val / 64).decimal_digit);
- string_tmp.add_last (((val % 64) / 8).decimal_digit);
- string_tmp.add_last ((val % 8).decimal_digit);
+ string_tmp.remove_last 1; // remove '\\'
+ string_tmp.add_last (last_integer.to_character);
+ string_tmp.println; last_integer.to_character.code.print; " ".print; last_integer.print; "\n".print;
+ // Save 3 octal digits
+ //string_tmp.add_last ((val / 64).decimal_digit);
+ //string_tmp.add_last (((val % 64) / 8).decimal_digit);
+ //string_tmp.add_last ((val % 8).decimal_digit);
(last_character='\\').if {
position := position + 1;
} else {
@@@ -760,7 -744,7 +786,7 @@@
};
);
- //-- character -> '\'' ascii '\''
+ //-- character -> '\'' ascii '\''
- read_characters:BOOLEAN <-
( + result:BOOLEAN;
+ old_pos:INTEGER;
@@@ -802,9 -786,7 +828,9 @@@
result
);
- //-- string -> '\"' ascii_string '\"'
+ //-- string -> '\"' string_char '\"'
+ //-- string_char -> escape
+ //-- | ascii
- read_string:BOOLEAN <-
( + result:BOOLEAN;
+ old_pos:INTEGER;
@@@ -839,7 -821,7 +865,7 @@@
result
);
- //-- external -> '`' ascii_c_code '`'
+ //-- external -> '`' ascii_c_code '`'
- read_external:BOOLEAN <-
( + result:BOOLEAN;
+ pos_old:INTEGER;
@@@ -874,8 -856,8 +900,8 @@@
result
);
- //-- operator -> '!' | '@' | '#' | '$' | '%' | '^' | '&' | '<' | '|'
- //-- | '*' | '-' | '+' | '=' | '~' | '/' | '?' | '\' | '>'
+ //-- operator -> '!' | '@' | '#' | '$' | '%' | '^' | '&' | '<' | '|'
+ //-- | '*' | '-' | '+' | '=' | '~' | '/' | '?' | '\' | '>'
- read_operator:BOOLEAN <-
( + result:BOOLEAN;
+ old_pos:INTEGER;
@@@ -922,7 -904,7 +948,7 @@@
- read_program:BOOLEAN <-
( + result:BOOLEAN;
+ pos_sec,old_derive:INTEGER;
- + t:FAST_ARRAY[ITM_TYPE_MONO];
+ + t:FAST_ARRAY(ITM_TYPE_MONO);
result := TRUE;
@@@ -980,8 -962,8 +1006,8 @@@
}.elseif {
(last_section.is_inherit) &&
{object.type_style = ALIAS_STR.keyword_expanded} &&
- {object.name != ALIAS_STR.prototype_true } &&
- {object.name != ALIAS_STR.prototype_false}
+ {object.shortname != ALIAS_STR.prototype_true } &&
+ {object.shortname != ALIAS_STR.prototype_false}
} then {
warning_error (current_position,
"`Section Inherit' is not possible with Expanded object (Use `Section Insert').");
@@@ -1028,7 -1010,7 +1054,7 @@@
- read_slot:BOOLEAN <-
( + result:BOOLEAN;
+ t:ITM_TYPE;
- + lt:FAST_ARRAY[ITM_TYPE_MONO];
+ + lt:FAST_ARRAY(ITM_TYPE_MONO);
+ style:CHARACTER;
+ affect:CHARACTER;
+ old_pos,old_derive:INTEGER;
@@@ -1154,9 -1136,9 +1180,9 @@@
- read_type_slot:ITM_SLOT <-
( + arg:ITM_ARGUMENT;
+ result:ITM_SLOT;
- + list_arg:FAST_ARRAY[ITM_ARGUMENT];
+ + list_arg:FAST_ARRAY(ITM_ARGUMENT);
- list_arg := ALIAS_ARRAY[ITM_ARGUMENT].new;
+ list_arg := ALIAS_ARRAY(ITM_ARGUMENT).new;
arg := read_loc_arg FALSE with_self TRUE;
(arg = NULL).if {
@@@ -1177,13 -1159,13 +1203,13 @@@
};
};
(result != NULL).if {
- list_arg := ALIAS_ARRAY[ITM_ARGUMENT].copy list_arg;
+ list_arg := ALIAS_ARRAY(ITM_ARGUMENT).copy list_arg;
result.set_argument_list list_arg;
};
result
);
- - read_slot_keyword list_arg:FAST_ARRAY[ITM_ARGUMENT] :ITM_SLOT <-
+ - read_slot_keyword list_arg:FAST_ARRAY(ITM_ARGUMENT) :ITM_SLOT <-
( + n:STRING;
+ arg:ITM_ARGUMENT;
+ result:ITM_SLOT;
@@@ -1219,7 -1201,7 +1245,7 @@@
result
);
- - read_slot_operator list_arg:FAST_ARRAY[ITM_ARGUMENT] :ITM_SLOT <-
+ - read_slot_operator list_arg:FAST_ARRAY(ITM_ARGUMENT) :ITM_SLOT <-
( + name,pretty_name:STRING_CONSTANT;
+ associativity:STRING_CONSTANT;
+ priority:INTEGER;
@@@ -1290,7 -1272,7 +1316,7 @@@
read_require;
expr := read_expr;
(expr = NULL).if {
- syntax_error (current_position,"Incorrect expression.");
+ syntax_error (current_position,"Incorrect expression for slot definition.");
};
last_slot.set_value expr type object;
read_ensure;
@@@ -1321,14 -1303,11 +1347,14 @@@
(self_first) &&
{t != ITM_TYPE_SIMPLE.type_self} &&
{
- (object.name != ALIAS_STR.prototype_block) ||
+ (object.shortname != ALIAS_STR.prototype_block) ||
{tb ?= t; tb = NULL}
}
- ).if {
- syntax_error (current_position,"Type `SELF' is needed.");
+ ).if {
+ string_tmp.copy "Type `SELF' is needed instead of `";
+ t.append_in string_tmp;
+ string_tmp.append "'";
+ syntax_error (current_position, string_tmp);
};
result := ITM_ARG.create pos name n type t;
@@@ -1356,16 -1335,16 +1382,16 @@@
);
//++ LOCAL -> { identifier [ ':' TYPE ] ',' } identifier ':' TYPE
- - read_local m:BOOLEAN :FAST_ARRAY[ITM_LOCAL] <-
+ - read_local m:BOOLEAN :FAST_ARRAY(ITM_LOCAL) <-
( + t:ITM_TYPE_MONO;
+ loc:ITM_LOCAL;
- + result:FAST_ARRAY[ITM_LOCAL];
+ + result:FAST_ARRAY(ITM_LOCAL);
+ beg:INTEGER;
+ mute:BOOLEAN;
mute := m;
(read_identifier).if {
- result := ALIAS_ARRAY[ITM_LOCAL].new;
+ result := ALIAS_ARRAY(ITM_LOCAL).new;
beg := result.lower;
{
((result.count != 0) && {! read_identifier} && {! mute}).if {
@@@ -1387,13 -1366,13 +1413,13 @@@
}.do_while {read_character ','};
(beg != result.upper + 1).if {
(mute).if {
- ALIAS_ARRAY[ITM_LOCAL].free result;
+ ALIAS_ARRAY(ITM_LOCAL).free result;
result := NULL;
} else {
syntax_error (current_position,"Incorrect local type.");
};
} else {
- result := ALIAS_ARRAY[ITM_LOCAL].copy result;
+ result := ALIAS_ARRAY(ITM_LOCAL).copy result;
(is_shorter).if {
(result.lower).to (result.upper) do { j:INTEGER;
@@@ -1409,8 -1388,8 +1435,8 @@@
- read_local_arg m:BOOLEAN with_self s:BOOLEAN :ITM_ARGUMENT <-
( + t:ITM_TYPE_MONO;
+ tm:ITM_TYPE_MULTI;
- + type:FAST_ARRAY[ITM_TYPE_MONO];
- + name:FAST_ARRAY[STRING_CONSTANT];
+ + type:FAST_ARRAY(ITM_TYPE_MONO);
+ + name:FAST_ARRAY(STRING_CONSTANT);
+ beg:INTEGER;
+ mute:BOOLEAN;
+ result:ITM_ARGUMENT;
@@@ -1421,8 -1400,8 +1447,8 @@@
((s) && {read_this_keyword (ALIAS_STR.variable_self)}) ||
{read_identifier}
).if {
- name := ALIAS_ARRAY[STRING_CONSTANT].new;
- type := ALIAS_ARRAY[ITM_TYPE_MONO].new;
+ name := ALIAS_ARRAY(STRING_CONSTANT).new;
+ type := ALIAS_ARRAY(ITM_TYPE_MONO).new;
beg := name.lower;
{
((name.count != 0) && {! read_identifier} && {! mute}).if {
@@@ -1445,30 -1424,30 +1471,30 @@@
(mute).if_false {
syntax_error (current_position,"Incorrect argument type.");
};
- ALIAS_ARRAY[STRING_CONSTANT].free name;
- ALIAS_ARRAY[ITM_TYPE_MONO].free type;
+ ALIAS_ARRAY(STRING_CONSTANT).free name;
+ ALIAS_ARRAY(ITM_TYPE_MONO).free type;
} else {
(
(s) && {
(type.first != ITM_TYPE_SIMPLE.type_self) || {
- (object.name = ALIAS_STR.prototype_block) &&
+ (object.shortname = ALIAS_STR.prototype_block) &&
{tb ?= type.first; tb = NULL}
}
}
).if {
- syntax_error (current_position,"Type `SELF' is needed.");
+ syntax_error (current_position,"Type `SELF' is needed. (local_arg)");
};
(name.count = 1).if {
// Single Argument.
result := ITM_ARG.create current_position
name (name.first)
type (type.first);
- ALIAS_ARRAY[STRING_CONSTANT].free name;
- ALIAS_ARRAY[ITM_TYPE_MONO].free type;
+ ALIAS_ARRAY(STRING_CONSTANT).free name;
+ ALIAS_ARRAY(ITM_TYPE_MONO).free type;
} else {
// Vector Arguments.
- name := ALIAS_ARRAY[STRING_CONSTANT].alias name;
- type := ALIAS_ARRAY[ITM_TYPE_MONO].alias type;
+ name := ALIAS_ARRAY(STRING_CONSTANT).alias name;
+ type := ALIAS_ARRAY(ITM_TYPE_MONO).alias type;
tm := ITM_TYPE_MULTI.get type;
result := ITM_ARGS.create current_position name name type tm;
};
@@@ -1485,8 -1464,8 +1511,8 @@@
); // read_local
//++ TYPE_LIST -> TYPE { ',' TYPE }
- - read_type_list is_section:BOOLEAN :FAST_ARRAY[ITM_TYPE_MONO] <-
- ( + lst:FAST_ARRAY[ITM_TYPE_MONO];
+ - read_type_list is_section:BOOLEAN :FAST_ARRAY(ITM_TYPE_MONO) <-
+ ( + lst:FAST_ARRAY(ITM_TYPE_MONO);
+ t:ITM_TYPE_MONO;
+ ts:ITM_TYPE_SIMPLE;
@@@ -1499,7 -1478,7 +1525,7 @@@
"For a section, the prototype name only (without '['...']').");
};
};
- lst := ALIAS_ARRAY[ITM_TYPE_MONO].new;
+ lst := ALIAS_ARRAY(ITM_TYPE_MONO).new;
lst.add_last t;
{read_character ','}.while_do {
t := read_type FALSE;
@@@ -1515,7 -1494,7 +1541,7 @@@
};
lst.add_last t;
};
- lst := ALIAS_ARRAY[ITM_TYPE_MONO].alias lst;
+ lst := ALIAS_ARRAY(ITM_TYPE_MONO).alias lst;
};
lst
);
@@@ -1525,7 -1504,7 +1551,7 @@@
- read_type is_local:BOOLEAN :ITM_TYPE_MONO <-
( + style:STRING_CONSTANT;
+ result:ITM_TYPE_MONO;
- + lst:FAST_ARRAY[ITM_TYPE_MONO];
+ + lst:FAST_ARRAY(ITM_TYPE_MONO);
+ typ_arg,typ_res:ITM_TYPE;
+ contract:ITM_LIST;
@@@ -1601,7 -1580,7 +1627,7 @@@
//++ PROTOTYPE -> cap_identifier{('.'|'...')cap_identifier}['('PARAM_TYPE{','PARAM_TYPE}')']
- read_prototype styl:STRING_CONSTANT :ITM_TYPE_MONO <-
( + nam:STRING_CONSTANT;
- + genericity:FAST_ARRAY[ITM_TYPE_MONO];
+ + genericity:FAST_ARRAY(ITM_TYPE_MONO);
+ result,t:ITM_TYPE_MONO;
+ old_pos,old_derive,sav_derive,pos_before:INTEGER;
+ continue:BOOLEAN;
@@@ -1631,12 -1610,12 +1657,12 @@@
};
}.do_while {continue};
nam := ALIAS_STR.get string_tmp2;
-
- (read_character '(').if {
+
+ (read_character '(').if {
//
// Genericity.
//
- genericity := ALIAS_ARRAY[ITM_TYPE_MONO].new;
+ genericity := ALIAS_ARRAY(ITM_TYPE_MONO).new;
{
t := read_param_type;
(t = NULL).if {
@@@ -1644,11 -1623,8 +1670,11 @@@
};
genericity.add_last t;
}.do_while {read_character ','};
- genericity := ALIAS_ARRAY[ITM_TYPE_MONO].alias genericity;
+ genericity := ALIAS_ARRAY(ITM_TYPE_MONO).alias genericity;
- result := ITM_TYPE_GENERIC.get nam style styl with genericity;
+ result := ITM_TYPE_GENERIC.get nam
+ from (find_prototype nam)
+ style styl
+ with genericity;
(read_character ')').if_false {
warning_error (current_position,"Added ')'.");
};
@@@ -1662,29 -1638,19 +1688,29 @@@
warning_error (current_position,string_tmp);
};
result := ITM_TYPE_PARAMETER.get nam;
+ }.elseif {nam = ALIAS_STR.prototype_self} then {
+ (styl != NULL).if {
+ string_tmp.copy "Style `";
+ string_tmp.append styl;
+ string_tmp.append "' ignored.";
+ warning_error (current_position,string_tmp);
+ };
+ result := ITM_TYPE_SIMPLE.type_self;
+ }.elseif {nam = ALIAS_STR.variable_null} then {
+ (styl != NULL).if {
+ string_tmp.copy "Style `";
+ string_tmp.append styl;
+ string_tmp.append "' ignored.";
+ warning_error (current_position,string_tmp);
+ };
+ result := ITM_TYPE_SIMPLE.type_null;
}.elseif {styl = NULL} then {
- result := ITM_TYPE_SIMPLE.get nam;
- } else {
- (nam = ALIAS_STR.prototype_self).if {
- string_tmp.copy "Style `";
- string_tmp.append styl;
- string_tmp.append "' ignored.";
- warning_error (current_position,string_tmp);
- result := ITM_TYPE_SIMPLE.type_self;
- } else {
- result := ITM_TYPE_STYLE.get nam style styl;
- };
- };
+ result := ITM_TYPE_SIMPLE.get nam from (find_prototype nam);
+ } else {
+ result := ITM_TYPE_STYLE.get nam
+ from (find_prototype nam)
+ style styl;
+ };
}; // if
(is_shorter).if {
sav_derive := short_derive;
@@@ -1734,15 -1700,14 +1760,15 @@@
( + result,value:ITM_CODE;
+ affect:CHARACTER;
+ again:BOOLEAN;
- + l_assignment:FAST_ARRAY[STRING_CONSTANT];
+ + l_assignment:FAST_ARRAY(STRING_CONSTANT);
+ p:INTEGER;
+ name:STRING_CONSTANT;
+ + old_pos :POSITION;
// !! AMBIGU resolution !!
save_context;
(read_character '(').if {
- l_assignment := ALIAS_ARRAY[STRING_CONSTANT].new;
+ l_assignment := ALIAS_ARRAY(STRING_CONSTANT).new;
{
again := FALSE;
(read_identifier).if {
@@@ -1767,17 -1732,12 +1793,17 @@@
};
}.do_while {again};
((! l_assignment.is_empty) && {read_character ')'} && {read_affect}).if {
- l_assignment := ALIAS_ARRAY[STRING_CONSTANT].copy l_assignment;
+ l_assignment := ALIAS_ARRAY(STRING_CONSTANT).copy l_assignment;
result := ITM_LIST_IDF.create current_position with l_assignment;
- affect := last_string.first;
+ affect := last_string.first;
+ old_pos:= current_position;
value := read_expr;
(value = NULL).if {
- syntax_error (current_position,"Incorrect expression.");
+ //syntax_error (current_position,"Incorrect expression.");
+ POSITION.put_error syntax text "Incorrect expression for multiple assignment.";
+ old_pos.put_position;
+ current_position.put_position;
+ POSITION.send_error;
};
(affect)
.when ':' then {
@@@ -1791,7 -1751,7 +1817,7 @@@
result := ITM_WRITE_CAST.create (result.position) assign result with value;
};
} else {
- ALIAS_ARRAY[STRING_CONSTANT].free l_assignment;
+ ALIAS_ARRAY(STRING_CONSTANT).free l_assignment;
};
}.elseif {read_identifier} then {
p := position - last_string.count;
@@@ -1810,20 -1770,10 +1836,20 @@@
(read_affect).if {
result := ITM_READ.create current_position name name;
- affect := last_string.first;
+ affect := last_string.first;
+ old_pos:= current_position;
value := read_expr;
(value = NULL).if {
- syntax_error (current_position,"Incorrect expression.");
+ //syntax_error (current_position,"Incorrect expression.");
+ string_tmp.copy "Incorrect expression ";
+ string_tmp.append last_string;
+ string_tmp.append " for assignment to ";
+ string_tmp.append name;
+ string_tmp.append ".";
+ POSITION.put_error syntax text string_tmp;
+ old_pos.put_position;
+ current_position.put_position;
+ POSITION.send_error;
};
(affect)
.when ':' then {
@@@ -1848,11 -1798,11 +1874,11 @@@
- read_expr_operator:ITM_CODE <-
( + result:ITM_CODE;
+ expr :ITM_CODE;
- + l_expr:FAST_ARRAY[ITM_CODE];
+ + l_expr:FAST_ARRAY(ITM_CODE);
+ itm_op:ITM_OPERATOR;
+ last_msg,first_msg:INTEGER;
- l_expr := ALIAS_ARRAY[ITM_CODE].new;
+ l_expr := ALIAS_ARRAY(ITM_CODE).new;
{read_operator}.while_do {
expr := ITM_OPERATOR.create current_position name last_string;
l_expr.add_last expr;
@@@ -1861,9 -1811,9 +1887,9 @@@
(expr = NULL).if {
// Error.
(! l_expr.is_empty).if {
- syntax_error (current_position,"Incorrect expression.");
+ syntax_error (current_position,"Incorrect message expression.");
};
- ALIAS_ARRAY[ITM_CODE].free l_expr;
+ ALIAS_ARRAY(ITM_CODE).free l_expr;
} else {
// { operator {operator} EXPR_MESSAGE } {operator}
first_msg := l_expr.count;
@@@ -1904,7 -1854,7 +1930,7 @@@
};
(l_expr.count = 1).if {
result := l_expr.first;
- ALIAS_ARRAY[ITM_CODE].free l_expr;
+ ALIAS_ARRAY(ITM_CODE).free l_expr;
}.elseif {l_expr.count = 3} then {
// Simple binary message.
itm_op ?= l_expr.second;
@@@ -1912,10 -1862,10 +1938,10 @@@
name (operator (ALIAS_STR.slot_infix) name (itm_op.name))
args (l_expr.first,l_expr.item 2);
//
- ALIAS_ARRAY[ITM_CODE].free l_expr;
+ ALIAS_ARRAY(ITM_CODE).free l_expr;
} else {
// Complex expression.
- l_expr := ALIAS_ARRAY[ITM_CODE].copy l_expr;
+ l_expr := ALIAS_ARRAY(ITM_CODE).copy l_expr;
result := ITM_EXPRESSION.create l_expr;
};
};
@@@ -1969,7 -1919,7 +1995,7 @@@
- read_expr_primary:ITM_CODE <-
( + result:ITM_CODE;
+ type :ITM_TYPE_MONO;
- + ltype:FAST_ARRAY[ITM_TYPE_MONO];
+ + ltype:FAST_ARRAY(ITM_TYPE_MONO);
+ ext :ITM_EXTERNAL_TYPE;
+ group_sav:ITM_LIST;
+ arg:ITM_ARGUMENT;
@@@ -2078,10 -2028,7 +2104,10 @@@
}.elseif {read_integer} then {
result := ITM_NUMBER.create current_position value last_integer;
}.elseif {read_characters} then {
- result := ITM_CHARACTER.create current_position char last_string;
+ (last_string.count = 1).if_false {
+ syntax_error (current_position,"Character constant with more than a character");
+ };
+ result := ITM_CHARACTER.create current_position char (last_string.first);
}.elseif {read_string} then {
result := ITM_STRING.create current_position text last_string;
};
@@@ -2089,13 -2036,13 +2115,13 @@@
);
//++ GROUP -> DEF_LOCAL {EXPR ';'} [ EXPR {',' {EXPR ';'} EXPR } ]
- - read_group:FAST_ARRAY[ITM_CODE] <-
+ - read_group:FAST_ARRAY(ITM_CODE) <-
( + e:ITM_CODE;
- + result:FAST_ARRAY[ITM_CODE];
+ + result:FAST_ARRAY(ITM_CODE);
read_def_local;
- result := ALIAS_ARRAY[ITM_CODE].new;
+ result := ALIAS_ARRAY(ITM_CODE).new;
e := read_expr;
{(e != NULL) && {read_character ';'}}.while_do {
result.add_last e;
@@@ -2119,7 -2066,7 +2145,7 @@@
e := ITM_RESULT.create e;
result.add_last e;
};
- ALIAS_ARRAY[ITM_CODE].copy result
+ ALIAS_ARRAY(ITM_CODE).copy result
);
- read_invariant:BOOLEAN <-
@@@ -2158,13 -2105,13 +2184,13 @@@
( + continue:BOOLEAN;
+ e:ITM_CODE;
+ result:ITM_LIST;
- + lst:FAST_ARRAY[ITM_CODE];
+ + lst:FAST_ARRAY(ITM_CODE);
(read_character '[').if {
result := last_group := ITM_LIST.create current_position;
read_def_local;
- lst := ALIAS_ARRAY[ITM_CODE].new;
+ lst := ALIAS_ARRAY(ITM_CODE).new;
{
e := read_expr;
(e = NULL).if {
@@@ -2187,22 -2134,22 +2213,22 @@@
e := ITM_PROTOTYPE.create current_position type (ITM_TYPE_SIMPLE.type_void);
lst.add_last e;
//
- result.set_code (ALIAS_ARRAY[ITM_CODE].copy lst);
+ result.set_code (ALIAS_ARRAY(ITM_CODE).copy lst);
};
result
);
//++ DEF_LOCAL -> { style LOCAL ';' } !! AMBIGU !!
- read_def_local <-
- ( + loc_lst:FAST_ARRAY[ITM_LOCAL];
- + local_list,static_list:FAST_ARRAY[ITM_LOCAL];
+ ( + loc_lst:FAST_ARRAY(ITM_LOCAL);
+ + local_list,static_list:FAST_ARRAY(ITM_LOCAL);
+ styl:CHARACTER;
save_context; // !! SAVE CONTEXT !!
styl := read_style;
- local_list := ALIAS_ARRAY[ITM_LOCAL].new;
- static_list := ALIAS_ARRAY[ITM_LOCAL].new;
+ local_list := ALIAS_ARRAY(ITM_LOCAL).new;
+ static_list := ALIAS_ARRAY(ITM_LOCAL).new;
{styl != ' '}.while_do {
loc_lst := read_local TRUE;
(loc_lst != NULL).if {
@@@ -2226,14 -2173,14 +2252,14 @@@
};
};
(local_list.is_empty).if {
- ALIAS_ARRAY[ITM_LOCAL].free local_list;
+ ALIAS_ARRAY(ITM_LOCAL).free local_list;
} else {
- last_group.set_local_list (ALIAS_ARRAY[ITM_LOCAL].copy local_list);
+ last_group.set_local_list (ALIAS_ARRAY(ITM_LOCAL).copy local_list);
};
(static_list.is_empty).if {
- ALIAS_ARRAY[ITM_LOCAL].free static_list;
+ ALIAS_ARRAY(ITM_LOCAL).free static_list;
} else {
- last_group.set_static_list (ALIAS_ARRAY[ITM_LOCAL].copy static_list);
+ last_group.set_static_list (ALIAS_ARRAY(ITM_LOCAL).copy static_list);
};
);
@@@ -2242,7 -2189,7 +2268,7 @@@
( + result:ITM_CODE;
+ name :STRING_CONSTANT;
+ n:STRING;
- + l_arg:FAST_ARRAY[ITM_CODE];
+ + l_arg:FAST_ARRAY(ITM_CODE);
+ arg:ITM_CODE;
+ p1,p2,old_derive,sav_derive:INTEGER;
@@@ -2257,7 -2204,7 +2283,7 @@@
n := ALIAS_STR.new;
n.copy last_string;
// Argument list.
- l_arg := ALIAS_ARRAY[ITM_CODE].new;
+ l_arg := ALIAS_ARRAY(ITM_CODE).new;
arg := read_argument;
(arg != NULL).if {
l_arg.add_last arg;
@@@ -2297,14 -2244,14 +2323,14 @@@
} else {
result := ITM_READ_ARG1.create current_position name name arg first_arg;
};
- ALIAS_ARRAY[ITM_CODE].free l_arg;
+ ALIAS_ARRAY(ITM_CODE).free l_arg;
}.elseif {l_arg.count=1} then {
result := ITM_READ_ARG2.create current_position name
name args (first_arg,(l_arg.first));
- ALIAS_ARRAY[ITM_CODE].free l_arg;
+ ALIAS_ARRAY(ITM_CODE).free l_arg;
} else {
l_arg.add_first first_arg;
- l_arg := ALIAS_ARRAY[ITM_CODE].copy l_arg;
+ l_arg := ALIAS_ARRAY(ITM_CODE).copy l_arg;
result := ITM_READ_ARGS.create current_position name name args l_arg;
};
}; // if
@@@ -2334,12 -2281,12 +2360,12 @@@
- read_slot_header first:BOOLEAN :BOOLEAN <-
( + result:BOOLEAN;
+ v:ITM_CODE;
- + cast:FAST_ARRAY[ITM_TYPE_MONO];
+ + cast:FAST_ARRAY(ITM_TYPE_MONO);
+ style:CHARACTER;
+ is_export:BOOLEAN;
+ parameter_type:ITM_TYPE_PARAMETER;
+ instr:LIP_CODE;
- + param:BLOCK;
+ + param:{ITM_TYPE_PARAMETER};
style := read_style;
(style != ' ').if {
@@@ -2503,7 -2450,7 +2529,7 @@@
};
short (ALIAS_STR.short_keyprototype) token
(position - last_string.count) to position;
- res ?= ITM_TYPE_PARAMETER.get last_string;
+ res := ITM_TYPE_PARAMETER.get last_string;
};
res
};
@@@ -2702,14 -2649,8 +2728,14 @@@
//// PROGRAM -> { 'Section' ('Inherit' | 'Public' | 'Private') { SLOT ';' } }
( + idx:INTEGER;
+ section:STRING_CONSTANT;
+ + instr:LIP_CODE;
+ + cst:LIP_CONSTANT;
+ + str:LIP_STRING;
+
+ ? { lip_prj != NULL };
+ ? { lip_prj.list_parent != NULL };
- idx := LIP_CODE.list_parent.lower;
+ idx := lip_prj.list_parent.lower;
{read_this_keyword (ALIAS_STR.keyword_section)}.while_do {
(read_this_keyword (ALIAS_STR.section_inherit)).if {
// { '+' string ':' STRING [ ':=' string ] ';' }
@@@ -2723,36 -2664,23 +2749,36 @@@
(read_word (ALIAS_STR.prototype_string)).if_false {
warning_error (current_position,"`STRING' type needed.");
};
- (read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
- (read_string).if_false {
- syntax_error (current_position,"String needed.");
+ (read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
+ instr := readlip_expr_operator;
+ (instr = NULL).if {
+ cst := readlip_expr_constant;
+ } else {
+ cst := instr.run_expr;
};
- string_tmp.copy (object.filename);
- {
- (!string_tmp.is_empty) &&
- {string_tmp.last != '/'} &&
- {string_tmp.last != '\\'}
- }.while_do {
- string_tmp.remove_last 1;
+ (cst = NULL).if {
+ syntax_error (current_position,"Incorrect expression.");
};
- string_tmp.append last_string;
+ str ?= cst;
+ ((str = NULL) || {str.value.count == 0}).if {
+ syntax_error (current_position,"Non empty string needed.");
+ };
+ string_tmp.clear;
+ (last_string.first != '/').if {
+ string_tmp.append (object.filename);
+ {
+ (!string_tmp.is_empty) &&
+ {string_tmp.last != '/'} &&
+ {string_tmp.last != '\\'}
+ }.while_do {
+ string_tmp.remove_last 1;
+ };
+ };
+ string_tmp.append (str.value);
} else {
string_tmp.clear;
};
- LIP_CODE.list_parent.add (ALIAS_STR.get string_tmp) to idx;
+ lip_prj.list_parent.add (ALIAS_STR.get string_tmp) to idx;
idx := idx + 1;
(read_character ';').if_false {
warning_error (current_position,"Added ';' is needed.");
@@@ -2775,7 -2703,7 +2801,7 @@@
);
- readlip_slot sec:STRING_CONSTANT :BOOLEAN <-
- //// SLOT -> '+' identifier ':' TYPE [ ':=' EXPR_CONSTANT ]
+ //// SLOT -> '+' identifier ':' TYPE [ ':=' EXPR_OPERATOR ]
//// | '-' identifier [ identifier ':' TYPE ] '<-' '(' { EXPR ';' } ')'
( + result:BOOLEAN;
+ t:LIP_CONSTANT;
@@@ -2783,7 -2711,7 +2809,7 @@@
+ data:LIP_SLOT_DATA;
+ slot_code:LIP_SLOT_CODE;
+ cst:LIP_CONSTANT;
- + cod:FAST_ARRAY[LIP_CODE];
+ + cod:FAST_ARRAY(LIP_CODE);
+ instr:LIP_CODE;
+ pos:POSITION;
@@@ -2804,18 -2732,13 +2830,18 @@@
(t = NULL).if {
syntax_error (current_position,"type is incorrect.");
};
- data := LIP_SLOT_DATA.create current_position name n value t argument FALSE;
+ data := LIP_SLOT_DATA.create current_position in lip_prj name n value t argument FALSE;
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if {
- cst := readlip_expr_constant;
+ instr := readlip_expr_operator;
+ (instr = NULL).if {
+ cst := readlip_expr_constant;
+ } else {
+ cst := instr.run_expr;
+ };
(cst = NULL).if {
syntax_error (current_position,"Incorrect expression.");
};
- data.set_value cst;
+ data.set_value cst;
cst.free;
};
}.elseif {read_character '-'} then {
@@@ -2835,7 -2758,7 +2861,7 @@@
(t = NULL).if {
syntax_error (current_position,"Incorrect type.");
};
- data := LIP_SLOT_DATA.create current_position name na value t argument TRUE;
+ data := LIP_SLOT_DATA.create current_position in lip_prj name na value t argument TRUE;
};
//
(read_symbol (ALIAS_STR.symbol_affect_code)).if_false {
@@@ -2846,7 -2769,7 +2872,7 @@@
warning_error (current_position,"Added '(' is needed.");
};
is_shorter2 := FALSE;
- cod := ALIAS_ARRAY[LIP_CODE].new;
+ cod := ALIAS_ARRAY(LIP_CODE).new;
{(instr := readlip_expr) != NULL}.while_do {
cod.add_last instr;
(read_character ';').if_false {
@@@ -2856,8 -2779,8 +2882,8 @@@
(read_character ')').if_false {
warning_error (current_position,"Added ')' is needed.");
};
- cod := ALIAS_ARRAY[LIP_CODE].copy cod;
+ cod := ALIAS_ARRAY(LIP_CODE).copy cod;
- slot_code := LIP_SLOT_CODE.create pos section sec
+ slot_code := LIP_SLOT_CODE.create pos in lip_prj dir lip_dir section sec
name n argument data code cod;
(sec = ALIAS_STR.section_public).if {
(last_comment_slot = NULL).if {
@@@ -2874,18 -2797,16 +2900,18 @@@
//// TYPE -> 'BOOLEAN' | 'STRING' | 'INTEGER'
( + result:LIP_CONSTANT;
- (read_cap_identifier).if {
+ (read_cap_identifier).if {
(last_string = ALIAS_STR.prototype_integer).if {
result := LIP_INTEGER.get 0;
- }.elseif {last_string = ALIAS_STR.prototype_string} then {
- result := LIP_STRING.get (ALIAS_STR.get "");
- }.elseif {last_string = ALIAS_STR.prototype_boolean} then {
+ }.elseif {last_string = ALIAS_STR.prototype_string} then {
+ result := LIP_STRING.get (ALIAS_STR.get "");
+ }.elseif {last_string = ALIAS_STR.prototype_boolean} then {
result := LIP_BOOLEAN.get FALSE;
+ }.elseif {last_string = ALIAS_STR.prototype_project} then {
+ result := LIP_VALUEPROJECT.get NULL;
} else {
syntax_error (current_position,"Incorrect type.");
- };
+ };
};
result
);
@@@ -2904,18 -2825,18 +2930,18 @@@
(val = NULL).if {
syntax_error (current_position,"Incorrect expression.");
};
- result := LIP_AFFECT.create current_position name nam value val;
+ result := LIP_AFFECT.create current_position in lip_prj name nam value val;
} else {
restore_context; // !! RESTORE CONTEXT !!
};
};
(result = NULL).if {
result := readlip_expr_operator;
- ((result != NULL) && {read_character '.'}).if {
+ ((result != NULL) && {read_character '.'}).if {
result := readlip_function result;
(result = NULL).if {
syntax_error (current_position,"Incorrect slot.");
- };
+ };
};
};
result
@@@ -2923,15 -2844,13 +2949,15 @@@
- readlip_function rec:LIP_CODE :LIP_CODE <-
//// FUNCTION -> 'if' '{' { EXPR ';' } '}' [ 'else' '{' { EXPR ';' } '}' ]
- //// | 'print'
+ //// | identifier [ EXPR_ARGUMENT ]
( + result:LIP_CODE;
- + the,els:FAST_ARRAY[LIP_CODE];
+ + the,els:FAST_ARRAY(LIP_CODE);
+ val:LIP_CODE;
+ + nam:STRING_CONSTANT;
+ + arg:LIP_CODE;
(read_word (ALIAS_STR.slot_if)).if {
- the := ALIAS_ARRAY[LIP_CODE].new;
+ the := ALIAS_ARRAY(LIP_CODE).new;
(read_character '{').if_false {
warning_error (current_position,"Added '(' is needed.");
};
@@@ -2944,9 -2863,9 +2970,9 @@@
(read_character '}').if_false {
warning_error (current_position,"Added '(' is needed.");
};
- the := ALIAS_ARRAY[LIP_CODE].copy the;
+ the := ALIAS_ARRAY(LIP_CODE).copy the;
(read_word (ALIAS_STR.slot_else)).if {
- els := ALIAS_ARRAY[LIP_CODE].new;
+ els := ALIAS_ARRAY(LIP_CODE).new;
(read_character '{').if_false {
warning_error (current_position,"Added '(' is needed.");
};
@@@ -2959,15 -2878,11 +2985,15 @@@
(read_character '}').if_false {
warning_error (current_position,"Added '(' is needed.");
};
- els := ALIAS_ARRAY[LIP_CODE].copy els;
+ els := ALIAS_ARRAY(LIP_CODE).copy els;
};
result := LIP_IF.create current_position if rec then the else els;
- }.elseif {read_word (ALIAS_STR.slot_print)} then {
- result := LIP_PRINT.create current_position message rec;
+ //}.elseif {read_word (ALIAS_STR.slot_print)} then {
+ // result := LIP_PRINT.create current_position message rec;
+ }.elseif {read_identifier} then {
+ nam := ALIAS_STR.get (STRING.create_from_string last_string); // UGLY
+ arg := readlip_expr_argument;
+ result := LIP_CALL.create current_position in lip_prj self rec name nam with arg;
};
result
);
@@@ -3053,7 -2968,7 +3079,7 @@@
- readlip_expr_unary:LIP_CODE <-
//// EXPR_UNARY -> ( '-' | '!' ) EXPR_UNARY
//// | EXPR_BASE
- //// | identifier [ EXPR_ARGUMENT ]
+ //// | identifier [ EXPR_ARGUMENT ] [ '.' FUNCTION ]
( + result:LIP_CODE;
+ is_neg:BOOLEAN;
+ type:CHARACTER;
@@@ -3072,27 -2987,16 +3098,27 @@@
};
result := LIP_UNARY.create current_position operator type with result;
}.elseif {read_identifier} then {
- nam := last_string;
+ nam := ALIAS_STR.get (STRING.create_from_string last_string); // UGLY
+ // If we don't convert last_string to STRING and back to STRING_CONSTANT
+ // the compiler *seems* to optimize out nam or reorder the nam and arg
+ // instructions. Whatever, the compiler uses last_string instead of nam in
+ // the LIP_CALL creation. Of course this doesn't work since
+ // readlip_expr_argument changes last_string
arg := readlip_expr_argument;
- result := LIP_CALL.create current_position name nam with arg;
+ result := LIP_CALL.create current_position in lip_prj self NULL name nam with arg;
+ (read_character '.').if {
+ result := readlip_function result;
+ (result = NULL).if {
+ syntax_error (current_position,"Incorrect slot.");
+ };
+ };
} else {
result := readlip_expr_base;
};
result
);
- - readlip_expr_base:LIP_CODE <-
+ - readlip_expr_base:LIP_CODE <-
//// EXPR_BASE -> '(' EXPR_OPERATOR ')'
//// | EXPR_CONSTANT
( + result:LIP_CODE;
@@@ -3116,16 -3020,13 +3142,16 @@@
);
- readlip_expr_constant:LIP_CONSTANT <-
- //// EXPR_CONSTANT-> integer
+ //// EXPR_CONSTANT-> "Self"
+ //// | integer
//// | string
//// | TRUE
//// | FALSE
( + result:LIP_CONSTANT;
- (read_integer).if {
+ (read_this_keyword (ALIAS_STR.variable_self)).if {
+ result := LIP_VALUEPROJECT.get lip_prj;
+ }.elseif {read_integer} then {
result := LIP_INTEGER.get last_integer;
}.elseif {read_string} then {
result := LIP_STRING.get last_string;
@@@ -3147,7 -3048,7 +3173,7 @@@
( + result:LIP_CODE;
(read_identifier).if {
- result := LIP_CALL.create current_position name last_string with NULL;
+ result := LIP_CALL.create current_position in lip_prj self NULL name last_string with NULL;
} else {
result := readlip_expr_base;
};
@@@ -3160,13 -3061,13 +3186,13 @@@
//|| FORMAT -> { '-' identifier ':=' SHORT_DEF ';' }
- read_format <-
- ( + def:LINKED_LIST[STRING_CONSTANT];
+ ( + def:LINKED_LIST(STRING_CONSTANT);
{read_character '-'}.while_do {
(read_identifier).if_false {
syntax_error (current_position,"Incorrect slot identifier.");
};
- def := LINKED_LIST[STRING_CONSTANT].create;
+ def := LINKED_LIST(STRING_CONSTANT).create;
(short_dico.fast_has last_string).if {
syntax_error (current_position,"Double definition slot.");
};
@@@ -3190,7 -3091,7 +3216,7 @@@
);
//|| SHORT_DEF -> { SHORT_ELT '+' } SHORT_ELT
- - read_short_def def:LINKED_LIST[STRING_CONSTANT] :BOOLEAN <-
+ - read_short_def def:LINKED_LIST(STRING_CONSTANT) :BOOLEAN <-
( + result:BOOLEAN;
read_short_elt.if {
@@@ -3268,7 -3169,7 +3294,7 @@@ Section Publi
is_active_short := TRUE;
short_derive := 0;
output_code.copy source;
- short_local := HASHED_SET[STRING_CONSTANT].create;
+ short_local := HASHED_SET(STRING_CONSTANT).create;
short (ALIAS_STR.short_begin) token 1 to 1;
};
@@@ -3282,38 -3183,20 +3308,38 @@@
object := NULL; // Parser is Free (see require test...)
);
- - read_lip path_lip:STRING_CONSTANT :BOOLEAN <-
+ - read_lip path_lip:STRING_CONSTANT on p:LIP_PROJECT :BOOLEAN <-
( + entry:POINTER;
entry := FS_MIN.open_read path_lip;
(entry != NULL).if {
FS_MIN.close entry;
- object := PROTOTYPE.create path_lip
- name path_lip generic_count 0;
-
+ object := PROTOTYPE.prototype_dico.fast_reference_at path_lip;
+ (object = NULL).if {
+ object := PROTOTYPE.create path_lip
+ name path_lip
+ source NULL
+ generic_count 0;
+ };
+
+ lip_prj := p;
source := object.source;
position := source.lower;
pos_cur := source.lower;
pos_line:=1;
pos_col :=0;
+
+ string_tmp.copy path_lip;
+ {
+ (!string_tmp.is_empty) &&
+ {string_tmp.last != '/'} &&
+ {string_tmp.last != '\\'}
+ }.while_do {
+ string_tmp.remove_last 1;
+ };
+ lip_dir := ALIAS_STR.get (string_tmp);
+
+ ? { lip_prj != NULL };
// Parse.
readlip_program;
@@@ -3334,7 -3217,7 +3360,7 @@@
object := PROTOTYPE.create fmt_name
name (ALIAS_STR.short_format)
- generic_count 0;
+ generic_count 0;
source := object.source;
position := source.lower;
diff --combined src/tools/alias_str.li
index b770e09,908dda1..6240795
--- a/src/tools/alias_str.li
+++ b/src/tools/alias_str.li
@@@ -34,9 -34,9 +34,9 @@@ Section Inheri
Section Private
- - list:HASHED_SET[ABSTRACT_STRING];
+ - list:HASHED_SET(ABSTRACT_STRING);
- - free:FAST_ARRAY[STRING] := FAST_ARRAY[STRING].create_with_capacity 5;
+ - free:FAST_ARRAY(STRING) := FAST_ARRAY(STRING).create_with_capacity 5;
Section Public
@@@ -94,7 -94,6 +94,7 @@@
- prototype_generic :STRING_CONSTANT := "___GENERIC";
- prototype_type_id :STRING_CONSTANT := "___TYPE_ID";
- prototype_self :STRING_CONSTANT := "SELF";
+ - prototype_project :STRING_CONSTANT := "PROJECT";
- prototype_uinteger_64 :STRING_CONSTANT := "UINTEGER_64";
- prototype_uinteger_32 :STRING_CONSTANT := "UINTEGER_32";
@@@ -156,15 -155,12 +156,15 @@@
- slot_exit :STRING_CONSTANT := "exit";
- slot_run :STRING_CONSTANT := "run";
- slot_path :STRING_CONSTANT := "path";
+ - slot_public_path :STRING_CONSTANT := "public_path";
+ - slot_private_path :STRING_CONSTANT := "private_path";
- slot_front_end :STRING_CONSTANT := "front_end";
- slot_back_end :STRING_CONSTANT := "back_end";
+ - slot_info_project :STRING_CONSTANT := "info_project";
- slot_input_file :STRING_CONSTANT := "input_file";
- slot_debug_level :STRING_CONSTANT := "debug_level";
- slot_debug_with_code:STRING_CONSTANT := "debug_with_code";
- - slot_is_all_warning:STRING_CONSTANT := "is_all_warning";
+ - slot_is_all_warning :STRING_CONSTANT := "is_all_warning";
- slot_is_optimization:STRING_CONSTANT := "is_optimization";
- slot_inline_level :STRING_CONSTANT := "inline_level";
- slot_is_java :STRING_CONSTANT := "is_java";
@@@ -173,13 -169,7 +173,13 @@@
- slot_get_integer :STRING_CONSTANT := "get_integer";
- slot_get_string :STRING_CONSTANT := "get_string";
- slot_is_cop :STRING_CONSTANT := "is_cop";
-
+ - slot_load :STRING_CONSTANT := "load";
+ - slot_init :STRING_CONSTANT := "init";
+ - slot_create :STRING_CONSTANT := "create";
+ - slot_public :STRING_CONSTANT := "public";
+ - slot_private :STRING_CONSTANT := "private";
+ - slot_to_string :STRING_CONSTANT := "to_string";
+
- c_void :STRING_CONSTANT := "void";
- c_struct :STRING_CONSTANT := "struct __";
- code_empty :STRING_CONSTANT := "/* NOTHING */";
@@@ -187,10 -177,7 +187,10 @@@
- path_lisaac :STRING_CONSTANT := "__PATH_LISAAC_SYSTEM__";
- short_format :STRING_CONSTANT := "__SHORT_LISAAC_FORMAT__";
-
+
+ - path_current :STRING_CONSTANT := ".";
+ - make_lip :STRING_CONSTANT := "make.lip";
+
//
// Shorter.
//
@@@ -212,6 -199,8 +212,8 @@@
- short_comment_line :STRING_CONSTANT := "comment_line";
- short_comment_slot_line :STRING_CONSTANT := "comment_slot_line";
- short_comment_header_line:STRING_CONSTANT := "comment_header_line";
+ - short_comment_new_line_slot :STRING_CONSTANT := "comment_new_line_slot";
+ - short_comment_new_line_extern:STRING_CONSTANT := "comment_new_line_extern";
- short_comment :STRING_CONSTANT := "comment";
- short_slot :STRING_CONSTANT := "slot";
- short_slot_call :STRING_CONSTANT := "slot_call";
@@@ -293,8 -282,12 +295,12 @@@
( + result:STRING_CONSTANT;
+ v,m:INTEGER;
- tmp_name.copy str;
- tmp_name.append "__";
+ (is_readable).if {
+ tmp_name.copy str;
+ tmp_name.append "__";
+ } else {
+ tmp_name.copy "__";
+ };
count_variable := count_variable + 1;
v:=count_variable;
{ v = 0 }.until_do {
@@@ -336,7 -329,7 +342,7 @@@
(
tmp_name := STRING.create 255;
- list := HASHED_SET[ABSTRACT_STRING].create;
+ list := HASHED_SET(ABSTRACT_STRING).create;
// Keyword list :
list.add keyword_section;
@@@ -391,7 -384,6 +397,7 @@@
list.add prototype_generic;
list.add prototype_type_id;
list.add prototype_self;
+ list.add prototype_project;
// Integers :
list.add prototype_uinteger_64;
@@@ -455,11 -447,8 +461,11 @@@
list.add slot_exit;
list.add slot_run;
list.add slot_path;
+ list.add slot_public_path;
+ list.add slot_private_path;
list.add slot_front_end;
list.add slot_back_end;
+ list.add slot_info_project;
list.add slot_input_file;
list.add slot_debug_level;
list.add slot_debug_with_code;
@@@ -471,13 -460,7 +477,13 @@@
list.add slot_is_quiet;
list.add slot_get_integer;
list.add slot_get_string;
- list.add slot_is_cop;
+ list.add slot_is_cop;
+ list.add slot_load;
+ list.add slot_init;
+ list.add slot_create;
+ list.add slot_public;
+ list.add slot_private;
+ list.add slot_to_string;
// Type C :
list.add c_void;
@@@ -488,9 -471,6 +494,9 @@@
list.add path_lisaac;
list.add short_format;
+ list.add path_current;
+ list.add make_lip;
+
// Shorter slot :
list.add short_token;
list.add short_type_file;
@@@ -507,6 -487,8 +513,8 @@@
list.add short_comment_line;
list.add short_comment_slot_line;
list.add short_comment_header_line;
+ list.add short_comment_new_line_slot;
+ list.add short_comment_new_line_extern;
list.add short_comment;
list.add short_slot;
list.add short_slot_call;
diff --combined src/type/prototype.li
index 56ab7cd,96967af..68af4cb
--- a/src/type/prototype.li
+++ b/src/type/prototype.li
@@@ -34,30 -34,24 +34,30 @@@ Section Inheri
Section Public
- - prototype_list:FAST_ARRAY[PROTOTYPE] :=
- FAST_ARRAY[PROTOTYPE].create_with_capacity 512;
+ - prototype_list:FAST_ARRAY(PROTOTYPE) :=
+ FAST_ARRAY(PROTOTYPE).create_with_capacity 512;
// BSBS: Voir si il faut le conserver !
- - prototype_dico:HASHED_DICTIONARY[PROTOTYPE,STRING_CONSTANT] :=
- HASHED_DICTIONARY[PROTOTYPE,STRING_CONSTANT].create;
+ - prototype_dico:HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT) :=
+ HASHED_DICTIONARY(PROTOTYPE,STRING_CONSTANT).create;
Section Public
+ index:INTEGER; // in `prototype_list', for POSITION.
+
+ + itm_source :FAST_ARRAY[PRJ_ITEM] :=
+ FAST_ARRAY[PRJ_ITEM].create_with_capacity 1;
+ shortname:STRING_CONSTANT;
+ + longname:STRING_CONSTANT;
+ - name:STRING_CONSTANT <- longname;
+
//
// Slots
//
- + slot_list:HASHED_DICTIONARY[ITM_SLOT,STRING_CONSTANT];
+ + slot_list:HASHED_DICTIONARY(ITM_SLOT,STRING_CONSTANT);
+ first_slot:ITM_SLOT;
@@@ -135,15 -129,15 +135,15 @@@
// Cast information.
//
- + export_list:FAST_ARRAY[ITM_TYPE_MONO];
- + import_list:FAST_ARRAY[ITM_TYPE_MONO];
+ + export_list:FAST_ARRAY(ITM_TYPE_MONO);
+ + import_list:FAST_ARRAY(ITM_TYPE_MONO);
- - set_export_list s:FAST_ARRAY[ITM_TYPE_MONO] <-
+ - set_export_list s:FAST_ARRAY(ITM_TYPE_MONO) <-
(
export_list := s;
);
- - set_import_list s:FAST_ARRAY[ITM_TYPE_MONO] <-
+ - set_import_list s:FAST_ARRAY(ITM_TYPE_MONO) <-
(
import_list := s;
);
@@@ -158,7 -152,7 +158,7 @@@
+ generic_count:INTEGER;
- + idf_generic_list:FAST_ARRAY[ITM_TYPE_PARAMETER];
+ + idf_generic_list:FAST_ARRAY(ITM_TYPE_PARAMETER);
//
// Default value.
@@@ -175,25 -169,23 +175,25 @@@
// Creation.
//
- - create f:STRING_CONSTANT name n:STRING_CONSTANT generic_count c:INTEGER :SELF <-
+ - create f:STRING_CONSTANT name n:STRING_CONSTANT source s:PRJ_ITEM generic_count c:INTEGER :SELF <-
( + result:SELF;
result := clone;
- result.make f name n generic_count c;
+ result.make f name n source s generic_count c;
result
);
- - make f:STRING_CONSTANT name n:STRING_CONSTANT generic_count c:INTEGER <-
+ - make f:STRING_CONSTANT name n:STRING_CONSTANT source s:PRJ_ITEM generic_count c:INTEGER <-
( //+ file:STD_FILE;
//+ entry:ENTRY;
+ file:POINTER;
+ sz,idx:INTEGER;
- ? {! prototype_dico.fast_has n};
+ ? {! prototype_dico.fast_has f};
? {n != NULL};
- filename := f;
- name := n;
+ filename := f;
+ longname := n;
+ itm_source := FAST_ARRAY[PRJ_ITEM].create_with_capacity 1;
+ itm_source.add_last s;
idx := n.fast_last_index_of '.';
(idx != 0).if {
string_tmp.copy n;
@@@ -203,7 -195,7 +203,7 @@@
shortname := n;
};
generic_count := c;
- idf_generic_list := FAST_ARRAY[ITM_TYPE_PARAMETER].create_with_capacity c;
+ idf_generic_list := FAST_ARRAY(ITM_TYPE_PARAMETER).create_with_capacity c;
// Collection.
index := prototype_list.count;
@@@ -224,7 -216,7 +224,7 @@@
FS_MIN.close file;
// Init.
- slot_list := HASHED_DICTIONARY[ITM_SLOT,STRING_CONSTANT].create;
+ slot_list := HASHED_DICTIONARY(ITM_SLOT,STRING_CONSTANT).create;
position := POSITION.create Self line 1 column 0;
//
);
@@@ -461,10 -453,10 +461,10 @@@ Section PROTOTYP
{
((s.id_section.is_public) && {s.name = ALIAS_STR.slot_main}).if {
(s.result_type != ITM_TYPE_SIMPLE.type_void).if {
- semantic_error ((s.position),"Unix mode: Not value return.");
+ semantic_error (s.position,"Unix mode: Not value return.");
};
(s.argument_count != 1).if {
- semantic_error ((s.position),"Unix mode: Not argument list.");
+ semantic_error (s.position,"Unix mode: Not argument list.");
};
result := type_input.get_slot (s.name);
};
@@@ -477,7 -469,7 +477,7 @@@
result
);
- - shorter_get_all_slot_in lst:FAST_ARRAY[ITM_SLOT] <-
+ - shorter_get_all_slot_in lst:FAST_ARRAY(ITM_SLOT) <-
( + s:ITM_SLOT;
+ ps:ITM_TYPE_SIMPLE;
+ p:PROTOTYPE;
@@@ -521,7 -513,7 +521,7 @@@
};
);
- - shorter_table lst:FAST_ARRAY[ITM_SLOT] select sel:BLOCK
+ - shorter_table lst:FAST_ARRAY(ITM_SLOT) select sel:{ITM_SLOT; BOOLEAN}
title t:STRING_CONSTANT in buf:STRING <-
( + is_first_cur:BOOLEAN;
+ s:ITM_SLOT;
@@@ -572,7 -564,7 +572,7 @@@
};
);
- - shorter_detail lst:FAST_ARRAY[ITM_SLOT] select sel:BLOCK
+ - shorter_detail lst:FAST_ARRAY(ITM_SLOT) select sel:{ITM_SLOT; BOOLEAN}
title t:STRING_CONSTANT in buf:STRING <-
( + is_first:BOOLEAN;
+ s:ITM_SLOT;
@@@ -645,7 -637,7 +645,7 @@@
};
);
- - list_tmp:FAST_ARRAY[ITM_SLOT] := FAST_ARRAY[ITM_SLOT].create_with_capacity 256;
+ - list_tmp:FAST_ARRAY(ITM_SLOT) := FAST_ARRAY(ITM_SLOT).create_with_capacity 256;
- str_tmp:STRING := STRING.create 512;
- str_tmp2:STRING := STRING.create 64;
@@@ -656,7 -648,7 +656,7 @@@
+ stat,old_stat:INTEGER;
+ car:CHARACTER;
+ i:INTEGER;
- + lst:LINKED_LIST[STRING_CONSTANT];
+ + lst:LINKED_LIST(STRING_CONSTANT);
+ code_balise:STRING_CONSTANT;
cur := str.lower;
diff --combined src/type/type.li
index eb12366,e7c9c62..e45fa02
--- a/src/type/type.li
+++ b/src/type/type.li
@@@ -36,10 -36,14 +36,14 @@@ Section Inheri
- parent_parameter_to_type:Expanded PARAMETER_TO_TYPE;
- Section TYPE
+ Section PROFIL_LIST
+
+ - is_alias_struct:BOOLEAN := TRUE;
- - dico_type:HASHED_DICTIONARY[TYPE,STRING_CONSTANT] :=
- HASHED_DICTIONARY[TYPE,STRING_CONSTANT].create;
+ Section Private
+
+ - dico_type:HASHED_DICTIONARY(TYPE,STRING_CONSTANT) :=
+ HASHED_DICTIONARY(TYPE,STRING_CONSTANT).create;
- index_count:INTEGER;
@@@ -52,7 -56,7 +56,7 @@@ Section Publi
param_count := param_count.max n;
);
- + subtype_list:HASHED_SET[TYPE];
+ + subtype_list:HASHED_SET(TYPE);
+ default:TYPE_FULL;
@@@ -88,15 -92,13 +92,15 @@@
- type_c:STRING_CONSTANT <- prototype.type_c;
- + slot_run:FAST_ARRAY[SLOT];
+ + slot_run:FAST_ARRAY(SLOT);
+ index:INTEGER;
+ intern_name:STRING_CONSTANT;
-
+
- name:STRING_CONSTANT <- prototype.name;
+
+ - shortname:STRING_CONSTANT <- prototype.shortname;
- hash_code:INTEGER <- intern_name.hash_code;
@@@ -111,17 -113,19 +115,19 @@@
+ base:TYPE;
+ styl:STRING_CONSTANT;
+ proto:PROTOTYPE;
-
- proto := load_prototype itm_typ generic_count 0;
+
+ + r:TYPE;
+
- proto := load_prototype (itm_typ.name) generic_count 0;
++ proto := load_prototype itm_typ 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 {
@@@ -130,6 -134,8 +136,8 @@@
result := base.default + TYPE_FULL.strict_bit;
};
};
+
+ r := result.the_parent_type;
result
);
@@@ -151,8 -157,17 +159,17 @@@
{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";
+ };
+ */
result := typ.prototype.slot_list.fast_reference_at n;
((result = NULL) || {result.require = NULL}).if {
result := typ.search_require n;
@@@ -291,7 -306,7 +308,7 @@@
Section Private
- - is_cast t:TYPE_FULL with msg:STRING_CONSTANT on lst:FAST_ARRAY[ITM_TYPE_MONO] :BOOLEAN <-
+ - is_cast t:TYPE_FULL with msg:STRING_CONSTANT on lst:FAST_ARRAY(ITM_TYPE_MONO) :BOOLEAN <-
( + result:BOOLEAN;
+ j:INTEGER;
@@@ -315,7 -330,7 +332,7 @@@ Section Publi
// Genere.
//
- - genere_list:FAST_ARRAY[TYPE] := FAST_ARRAY[TYPE].create_with_capacity 128;
+ - genere_list:FAST_ARRAY(TYPE) := FAST_ARRAY(TYPE).create_with_capacity 128;
- add_genere_list <-
(
@@@ -345,27 -360,87 +362,87 @@@
- 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]];
+ - 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;
+ 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.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;
+ + i,nb:INTEGER;
+ + action:{SLOT_DATA; };
+
+ ((alias_slot = NULL) && {slot_run != NULL}).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;
+ };
+ } else {
+ alias_slot := NULL;
+ };
+ nb := nb + 1;
+ };
+ };
+
+ i := slot_run.lower;
+ {(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 {
+ (slot.slot_data_list.lower).to (slot.slot_data_list.upper) do { k:INTEGER;
+ action.value (slot.slot_data_list.item k);
+ };
+ };
+ action.value (slot.slot_data);
+ };
+ i := i + 1;
+ };
+ };
+ (
+ (alias_slot != NULL) &&
+ {! (is_late_binding -> alias_slot.type.raw.is_late_binding)}
+ ).if {
+ alias_slot := NULL;
+ };
+ );
+
- genere_struct <-
( + slot_data:SLOT_DATA;
+ slot:SLOT;
- + tab:FAST_ARRAY[SLOT_DATA];
- + action:BLOCK;
+ + 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 {
(detect_recursivity_generation).if {
string_tmp.copy "Compiler limit: Cyclic depending structure definition for ";
@@@ -374,6 -449,7 +451,7 @@@
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;
@@@ -446,8 -522,8 +524,8 @@@
};
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
- {prototype.name = ALIAS_STR.prototype_native_array_volatile}
+ (prototype.shortname = ALIAS_STR.prototype_native_array) ||
+ {prototype.shortname = ALIAS_STR.prototype_native_array_volatile}
).if {
tg ?= Self;
tg.generic_list.first.raw.genere_struct;
@@@ -455,21 -531,21 +533,21 @@@
(type_c != NULL).if {
0.to 4 do { j:INTEGER;
tab := slot_size.item j;
- // BSBS: A tester sont utilité !
+ // BSBS: A tester sont utilit� !
(! tab.is_empty).if {
- semantic_error ((tab.first.position),"Slot is not possible with a type C");
+ semantic_error (tab.first.position,"Slot is not possible with a type C");
};
};
(is_java).if_false {
- ((name = ALIAS_STR.prototype_true) ||
- {name = ALIAS_STR.prototype_false}).if {
+ ((shortname = ALIAS_STR.prototype_true) ||
+ {shortname = 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 ((shortname = ALIAS_STR.prototype_true).to_character);
output_decl.add_last '\n';
}.elseif {is_late_binding} then {
- semantic_error ((tab.first.position),"Late binding is not possible with a type C");
+ semantic_error (tab.first.position,"Late binding is not possible with a type C");
};
};
} else {
@@@ -485,7 -561,7 +563,7 @@@
output_decl.append intern_name;
output_decl.append "__ ";
};
- string_tmp.clear;
+ string_tmp.clear;
(is_late_binding).if {
id_counter_with_type.append_in output_decl;
id_counter_with_type := id_counter_with_type + 1;
@@@ -493,7 -569,7 +571,7 @@@
string_tmp.append " unsigned long __id;\n";
};
(prototype.is_mapping).if {
- semantic_error ((prototype.position),
+ semantic_error (prototype.position,
"Late binding is not possible with `mapping' object.");
};
} else {
@@@ -528,7 -604,7 +606,7 @@@
tab.clear;
};
- (Self = type_block).if {
+ (Self = type_block).if {
string_tmp.append " void *self;\n";
};
@@@ -592,7 -668,7 +670,7 @@@
output_decl.append "super();\n";
};
output_decl.append " };\n};\n";
- } else {
+ }.elseif {alias_slot = NULL} then {
output_decl.append "struct ";
output_decl.append intern_name;
output_decl.append "_struct {\n";
@@@ -646,10 -722,10 +724,10 @@@
- genere_typedef <-
( + tg:TYPE_GENERIC;
-
+ + t:TYPE;
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
- {prototype.name = ALIAS_STR.prototype_native_array_volatile}
+ (prototype.shortname = ALIAS_STR.prototype_native_array) ||
+ {prototype.shortname = ALIAS_STR.prototype_native_array_volatile}
).if {
tg ?= Self;
tg.generic_list.first.raw.genere_typedef;
@@@ -658,13 -734,22 +736,22 @@@
(type_c != NULL).if {
output_decl.append type_c;
} else {
+ t := Self;
+ {t.alias_slot = NULL}.until_do {
+ t := t.alias_type;
+ };
output_decl.append "struct ";
- output_decl.append intern_name;
- output_decl.append "_struct";
+ output_decl.append (t.intern_name);
+ output_decl.append "_struct";
};
output_decl.append " __";
output_decl.append intern_name;
- output_decl.append ";\n";
+ output_decl.add_last ';';
+ ((type_c = NULL) && {alias_slot != NULL}).if {
+ output_decl.append " // ALIAS with ";
+ output_decl.append (alias_type.intern_name);
+ };
+ output_decl.add_last '\n';
};
);
@@@ -795,7 -880,7 +882,7 @@@ Section Publi
- is_block:BOOLEAN := FALSE;
- - '==' Right 60 other:TYPE :BOOLEAN <- (Self = other);
+ - Self:SELF '==' Right 60 other:TYPE :BOOLEAN <- (Self = other);
- is_sub_type other:TYPE :BOOLEAN <-
( + result:BOOLEAN;
@@@ -813,16 -898,10 +900,16 @@@
+ idx:INTEGER;
+ type_parent:TYPE;
+ ts:ITM_TYPE_SIMPLE;
-
- (n = prototype.name).if {
- result := TRUE;
- } else {
+
+ idx := prototype.itm_source.lower;
+ {(idx <= prototype.itm_source.upper) && {!result}}.while_do {
+ (prototype.itm_source.item idx.match n).if {
+ result := TRUE;
+ };
+ idx := idx + 1;
+ };
+
+ result.if_false {
idx := slot_run.lower;
{
(idx <= slot_run.upper) &&
@@@ -837,17 -916,113 +924,17 @@@
idx := idx + 1;
};
};
+
result
);
Section TYPE
- - load_prototype n:STRING_CONSTANT generic_count gen_count:INTEGER :PROTOTYPE <-
- ( + j,idx_path,idx_name,idx_name_old,idx_path_old:INTEGER;
- + entry:POINTER;
- + result:PROTOTYPE;
- + path,found:STRING_CONSTANT;
- + cn,cp:CHARACTER;
- + read_char:{};
-
- 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) = '.'} &&
- {n.item (idx_name-2) = '.'}
- ).if {
- idx_name := idx_name - 2;
- cn := '*';
- } else {
- cn := '/';
- };
- } else {
- cn := cn.to_lower;
- };
- };
- j := path_file.lower;
- {(j > path_file.upper) || {result != NULL}}.until_do {
- path := path_file.item j;
- idx_name := n.upper;
- idx_path := path.upper-3; // ".li"
- {
- read_char.value;
- cp := path.item idx_path;
- idx_name := idx_name - 1;
- idx_path := idx_path - 1;
- }.do_while {
- (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 {
- found := path;
- };
- }.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_old := idx_name;
- idx_path_old := idx_path;
- } 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 != '/'}};
- idx_path_old := idx_path;
- };
- idx_name := idx_name - 1;
- idx_path := idx_path - 1;
- };
- (idx_name < n.lower).if {
- found := path;
- };
- };
- (found != NULL).if {
- result := PROTOTYPE.prototype_dico.fast_reference_at found;
- (result = NULL).if {
- entry := FS_MIN.open_read found;
- ((entry != NULL) /*&& {entry.is_file}*/).if {
- // Load prototype.
- FS_MIN.close entry;
- result := PROTOTYPE.create found name n generic_count gen_count;
- PARSER.go_on result;
- } else {
- string_tmp.copy "Cannot open `";
- string_tmp.append found;
- string_tmp.append "'.";
- semantic_error (last_position,string_tmp);
- };
- };
- dico_name_to_prototype.add result to n;
- };
- j := j + 1;
- };
- (result = NULL).if {
- string_tmp.copy n;
- string_tmp.append " is not found.";
- POSITION.put_error semantic text string_tmp;
- (list_current != NULL).if {
- list_current.position.put_position;
- };
- POSITION.send_error;
- };
- };
+ - load_prototype itm_typ:ITM_TYPE_SIMPLE generic_count gen_count:INTEGER :PROTOTYPE <-
+ ( + result:PROTOTYPE;
+
+ result := itm_typ.source.load_prototype_generic_count gen_count;
+
(result.generic_count != gen_count).if {
//crash;
POSITION.put_error semantic text "Incorrect genericity definition.";
@@@ -859,7 -1034,6 +946,7 @@@
};
POSITION.send_error;
};
+
result
);
@@@ -873,7 -1047,7 +960,7 @@@
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.
+ 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;
@@@ -884,7 -1058,7 +971,7 @@@
default := TYPE_FULL.create Self with mask_bit;
prototype.init_slot_for Self;
//
- subtype_list := HASHED_SET[TYPE].create;
+ subtype_list := HASHED_SET(TYPE).create;
subtype_list.fast_add TYPE_NULL;
add_subtype Self;
// Size.
@@@ -914,12 -1088,12 +1001,14 @@@
};
);
- /*- dico_name_to_prototype:HASHED_DICTIONARY[PROTOTYPE,STRING_CONSTANT] :=
- HASHED_DICTIONARY[PROTOTYPE,STRING_CONSTANT].create;*/
++ /*
+ - 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];
+ + type_full_list:FAST_ARRAY(TYPE_FULL);
- get_with flg:UINTEGER_8 :TYPE_FULL <-
( + result:TYPE_FULL;
@@@ -929,7 -1103,7 +1018,7 @@@
result := default;
} else {
(type_full_list = NULL).if {
- type_full_list := FAST_ARRAY[TYPE_FULL].create_with_capacity 2;
+ type_full_list := FAST_ARRAY(TYPE_FULL).create_with_capacity 2;
result := TYPE_FULL.create Self with flg;
type_full_list.add_last result;
} else {
diff --combined src/type/type_generic.li
index f7d678d,13db107..b080adc
--- a/src/type/type_generic.li
+++ b/src/type/type_generic.li
@@@ -37,8 -37,8 +37,8 @@@ Section Privat
// BSBS: Vu que les ITM_TYPE sont aliaser, il n'est pas necessary d'aliaser les TYPE !
// Mais attention au pb des TYPE_GENERIC et de leur alias de slot_run...
- - dicog_type:HASHED_DICTIONARY[TYPE_GENERIC,STRING_CONSTANT] :=
- HASHED_DICTIONARY[TYPE_GENERIC,STRING_CONSTANT].create;
+ - dicog_type:HASHED_DICTIONARY(TYPE_GENERIC,STRING_CONSTANT) :=
+ HASHED_DICTIONARY(TYPE_GENERIC,STRING_CONSTANT).create;
Section Public
@@@ -46,11 -46,11 +46,11 @@@
+ key:STRING_CONSTANT;
- + generic_list:FAST_ARRAY[TYPE_FULL];
+ + generic_list:FAST_ARRAY(TYPE_FULL);
- parameter_to_type p:ITM_TYPE_PARAMETER :TYPE_FULL <-
( + idx:INTEGER;
- + tab:FAST_ARRAY[ITM_TYPE_PARAMETER];
+ + tab:FAST_ARRAY(ITM_TYPE_PARAMETER);
+ result:TYPE_FULL;
tab := prototype.idf_generic_list;
@@@ -60,7 -60,19 +60,19 @@@
};
result
);
+
+ //
+ // Detect Alias.
+ //
+
+ - detect_alias <-
+ (
+ (dicog_type.lower).to (dicog_type.upper) do { j:INTEGER;
+ dicog_type.item j.detect_alias_struct;
+ };
+ );
+
//
// Import / Export
//
@@@ -77,12 -89,12 +89,12 @@@
Section Private
- + export_list:FAST_ARRAY[TYPE_FULL];
- + import_list:FAST_ARRAY[TYPE_FULL];
+ + export_list:FAST_ARRAY(TYPE_FULL);
+ + import_list:FAST_ARRAY(TYPE_FULL);
- is_cast t:TYPE_FULL with msg:STRING_CONSTANT
- on lst:FAST_ARRAY[TYPE_FULL]
- and lstp:FAST_ARRAY[ITM_TYPE_MONO] :BOOLEAN <-
+ on lst:FAST_ARRAY(TYPE_FULL)
+ and lstp:FAST_ARRAY(ITM_TYPE_MONO) :BOOLEAN <-
( + result:BOOLEAN;
+ j:INTEGER;
@@@ -109,13 -121,13 +121,13 @@@ Section Publi
NULL
);
- - get itm_typ:ITM_TYPE_SIMPLE with gen:FAST_ARRAY[TYPE_FULL] :TYPE_FULL <-
+ - get itm_typ:ITM_TYPE_SIMPLE with gen:FAST_ARRAY(TYPE_FULL) :TYPE_FULL <-
( + base:TYPE_GENERIC;
+ result,t:TYPE_FULL;
+ styl,k:STRING_CONSTANT;
+ proto:PROTOTYPE;
- proto := load_prototype (itm_typ.name) generic_count (gen.count);
+ proto := load_prototype itm_typ generic_count (gen.count);
string_tmp.copy (proto.filename);
(gen.lower).to (gen.upper) do { j:INTEGER;
string_tmp.add_last ' ';
@@@ -149,15 -161,15 +161,15 @@@
//
// Life Type for collection (see PUT_TO and ITEM)
// BSBS: A revoir : il n'y a que NATIVE_ARRAY qui a besoin de ca,
- // il faudrai plutot stocker ca ailleurs... ou? chépa!
+ // il faudrai plutot stocker ca ailleurs... ou? ch�pa!
//
- + put_to_list:FAST_ARRAY[PUT_TO];
+ + put_to_list:FAST_ARRAY(PUT_TO);
- add_put_to n:PUT_TO <-
(
(put_to_list = NULL).if {
- put_to_list := FAST_ARRAY[PUT_TO].create_with_capacity 16;
+ put_to_list := FAST_ARRAY(PUT_TO).create_with_capacity 16;
};
put_to_list.add_last n;
);
@@@ -203,9 -215,9 +215,9 @@@
- put_reference_declaration buffer:STRING <-
(
- (prototype.name = ALIAS_STR.prototype_native_array).if {
+ (prototype.shortname = ALIAS_STR.prototype_native_array).if {
generic_list.first.genere_declaration buffer;
- }.elseif {prototype.name = ALIAS_STR.prototype_native_array_volatile} then {
+ }.elseif {prototype.shortname = ALIAS_STR.prototype_native_array_volatile} then {
buffer.append "volatile ";
generic_list.first.genere_declaration buffer;
} else {
@@@ -216,8 -228,8 +228,8 @@@
- put_reference_star_declaration buffer:STRING <-
(
(
- (prototype.name = ALIAS_STR.prototype_native_array) ||
- {prototype.name = ALIAS_STR.prototype_native_array_volatile}
+ (prototype.shortname = ALIAS_STR.prototype_native_array) ||
+ {prototype.shortname = ALIAS_STR.prototype_native_array_volatile}
).if {
(is_java).if {
buffer.append "[]";
@@@ -238,34 -250,34 +250,34 @@@ Section Publi
);
- make itm_typ:ITM_TYPE_SIMPLE with proto:PROTOTYPE
- generic gen:FAST_ARRAY[TYPE_FULL] key k:STRING_CONSTANT <-
+ generic gen:FAST_ARRAY(TYPE_FULL) key k:STRING_CONSTANT <-
( + mask_bit:UINTEGER_8;
index := index_count;
index_count := index_count + 1;
//
string_tmp.copy (itm_typ.name);
- string_tmp.add_last '[';
+ string_tmp.add_last '(';
(gen.lower).to (gen.upper - 1) do { j:INTEGER;
gen.item j.append_name_in string_tmp;
string_tmp.add_last ',';
};
gen.last.append_name_in string_tmp;
- string_tmp.add_last ']';
+ string_tmp.add_last ')';
name := ALIAS_STR.get string_tmp;
key := k;
generic_list := gen;
string_tmp.copy name;
string_tmp.replace_all ',' with 'x';
- string_tmp.replace_all '[' with 'o';
- string_tmp.replace_all ']' with 'o';
+ string_tmp.replace_all '(' with 'o';
+ string_tmp.replace_all ')' with 'o';
string_tmp.replace_all ' ' with '_';
string_tmp.replace_all '.' with '_';
intern_name := ALIAS_STR.get_intern string_tmp;
//
prototype := proto;
itm_type := itm_typ;
- slot_run := FAST_ARRAY[SLOT].create_with_capacity 10; // BSBS: A voir.
+ 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;
@@@ -276,20 -288,20 +288,20 @@@
default := TYPE_FULL.create Self with mask_bit;
prototype.init_slot_for Self;
//
- subtype_list := HASHED_SET[TYPE].create;
+ subtype_list := HASHED_SET(TYPE).create;
subtype_list.fast_add TYPE_NULL;
add_subtype Self;
// BSBS: Size ???
// Import / Export.
(prototype.export_list != NULL).if {
- export_list := FAST_ARRAY[TYPE_FULL].create_with_capacity (prototype.export_list.count);
+ export_list := FAST_ARRAY(TYPE_FULL).create_with_capacity (prototype.export_list.count);
(prototype.export_list.lower).to (prototype.export_list.upper) do { j:INTEGER;
export_list.add_last (prototype.export_list.item j.to_run_for Self);
};
};
(prototype.import_list != NULL).if {
- import_list := FAST_ARRAY[TYPE_FULL].create_with_capacity (prototype.import_list.count);
+ import_list := FAST_ARRAY(TYPE_FULL).create_with_capacity (prototype.import_list.count);
(prototype.import_list.lower).to (prototype.import_list.upper) do { j:INTEGER;
import_list.add_last (prototype.import_list.item j.to_run_for Self);
};
--
Lisaac compiler
More information about the Lisaac-commits
mailing list