[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-608-g71e51e5
Mildred Ki'Lya
silkensedai at online.fr
Thu Mar 4 19:39:49 UTC 2010
The following commit has been merged in the master branch:
commit 71e51e5f2ad5ce7f3e94d9a55e22399ff78f282c
Author: Mildred Ki'Lya <silkensedai at online.fr>
Date: Thu Mar 4 20:37:26 2010 +0100
Clean spaces at end of line
diff --git a/install_lisaac.li b/install_lisaac.li
index f0d1fbe..f90a820 100644
--- a/install_lisaac.li
+++ b/install_lisaac.li
@@ -20,58 +20,58 @@
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := INSTALL_LISAAC;
- comment := "Configure the system file and the PATH";
-
+
- external := `#include <unistd.h>`;
-
+
Section Inherit
-
+
- parent_object:OBJECT <- OBJECT;
-
-Section Private
-
+
+Section Private
+
- is_release:BOOLEAN := FALSE;
-
+
//
- // Independance File System
+ // Independance File System
//
-
- - open_read n:ABSTRACT_STRING :POINTER <-
+
+ - open_read n:ABSTRACT_STRING :POINTER <-
( + buf:NATIVE_ARRAY(CHARACTER);
string_tmp.copy n;
buf := string_tmp.to_external;
- `fopen((char*)@buf,"rb")`:(POINTER)
+ `fopen((char*)@buf,"rb")`:(POINTER)
);
- - open_write n:ABSTRACT_STRING :POINTER <-
+ - open_write n:ABSTRACT_STRING :POINTER <-
( + buf:NATIVE_ARRAY(CHARACTER);
string_tmp.copy n;
buf := string_tmp.to_external;
`fopen((char*)@buf,"wb")`:(POINTER)
);
-
- - read f:POINTER in buf:STRING size sz:INTEGER :INTEGER <-
+
+ - read f:POINTER in buf:STRING size sz:INTEGER :INTEGER <-
( + ptr:NATIVE_ARRAY(CHARACTER);
+ result:INTEGER;
- ptr := buf.to_external;
+ ptr := buf.to_external;
result := `fread((void *)(@ptr),(size_t)(1), (size_t)(@sz),(FILE*)(@f))`:(INTEGER);
buf.from_external ptr;
result
);
- - write f:POINTER with buf:STRING size sz:INTEGER :INTEGER <-
+ - write f:POINTER with buf:STRING size sz:INTEGER :INTEGER <-
( + ptr:NATIVE_ARRAY(CHARACTER);
+ result:INTEGER;
- ptr := buf.to_external;
+ ptr := buf.to_external;
result := `fwrite((void *)(@ptr),(size_t)(1), (size_t)(@sz),(FILE*)(@f))`:(INTEGER);
result
);
-
+
- close p:POINTER <- `fclose((FILE*)(@p))`;
-
+
- file_size p:POINTER :INTEGER <-
( + result:INTEGER;
`fseek((FILE*)(@p),0,SEEK_END)`;
@@ -84,31 +84,31 @@ Section Private
( + p:NATIVE_ARRAY(CHARACTER);
+ stream:POINTER;
+ result:BOOLEAN;
-
+
p := new_path.to_external;
stream := `fopen((char*)@p,"w+b")`:POINTER;
(result := (stream != NULL)).if {
- close stream;
+ close stream;
};
result
);
-
+
//
// Tools management.
//
-
+
- string_tmp:STRING := STRING.create 256;
- string_tmp2:STRING := STRING.create 256;
-
+
- error st:ABSTRACT_STRING <-
(
"Error: ".print;
st.print;
die_with_code exit_failure_code;
);
-
- - step_count:INTEGER;
-
+
+ - step_count:INTEGER;
+
- title str:ABSTRACT_STRING count mx:INTEGER <-
(
step_count := step_count + 1;
@@ -129,11 +129,11 @@ Section Private
'='.print;
};
'\n'.print;
- );
-
+ );
+
- question str:ABSTRACT_STRING :CHARACTER <-
( + result:CHARACTER;
-
+
str.print;
" (y/n) ".print;
{(result != 'y') && {result != 'n'}}.while_do {
@@ -142,7 +142,7 @@ Section Private
IO.read_character;
result
);
-
+
- menu t:ABSTRACT_STRING text txt:ABSTRACT_STRING count n:INTEGER :INTEGER <-
( + result,tmp:INTEGER;
'\n'.print;
@@ -156,7 +156,7 @@ Section Private
tmp := IO.last_string.to_integer;
(tmp.in_range 0 to n).if {
result := tmp;
- } else {
+ } else {
"Incorrect range [0-".print;
n.print;
"]\n".print;
@@ -167,26 +167,26 @@ Section Private
}.do_while {result = -1};
result
);
-
- - update file:ABSTRACT_STRING idf id:STRING_CONSTANT
+
+ - update file:ABSTRACT_STRING idf id:STRING_CONSTANT
with new_text:ABSTRACT_STRING confirmation conf:BOOLEAN <-
( + index:INTEGER;
+ old_buffer,input:STRING;
+ std_file:POINTER;
+ size_file:INTEGER;
-
+
" A `".print;
file.print;
-
+
std_file := open_read file;
- (std_file != NULL).if {
+ (std_file != NULL).if {
// Update file.
size_file := file_size std_file;
input := STRING.create (size_file + new_text.count);
read std_file in input size size_file;
- close std_file;
- //
- index := input.first_substring_index id;
+ close std_file;
+ //
+ index := input.first_substring_index id;
(index != 0).if {
// Update configuration.
old_buffer := STRING.create 200;
@@ -208,25 +208,25 @@ Section Private
" New value is:\n".print;
};
} else {
- "' file has been updated with:\n".print;
+ "' file has been updated with:\n".print;
index := input.upper + 1;
};
new_text.print;
- // Append configuration.
- input.insert_string new_text to index;
+ // Append configuration.
+ input.insert_string new_text to index;
} else {
// Creation file.
- "' file has been created with:\n".print;
- new_text.print;
+ "' file has been created with:\n".print;
+ new_text.print;
input := new_text;
(! make_file file).if {
error "Not create file!";
};
- };
-
- ((! conf) || {question " Confirmation ?" = 'y'}).if {
- (conf).if {
- '\n'.print;
+ };
+
+ ((! conf) || {question " Confirmation ?" = 'y'}).if {
+ (conf).if {
+ '\n'.print;
};
std_file := open_write file;
(std_file = NULL).if {
@@ -236,8 +236,8 @@ Section Private
close std_file;
};
);
-
- - execute str:ABSTRACT_STRING :BOOLEAN <-
+
+ - execute str:ABSTRACT_STRING :BOOLEAN <-
( + result:BOOLEAN;
(ENVIRONMENT.execute_command str != 0).if {
"Error: execute `".print;
@@ -247,60 +247,60 @@ Section Private
result := TRUE;
};
result
- );
-
+ );
+
//
// Global variable.
//
-
+
- path_current:STRING;
- path_home :STRING;
- shell :STRING;
- system :STRING_CONSTANT;
- - file :STRING;
+ - file :STRING;
- comment :STRING_CONSTANT;
- path :STRING_CONSTANT;
- path_next :STRING_CONSTANT;
-
+
//
// Constant for environment variable & path.
//
-
+
- system_unix_bash:STRING_CONSTANT := "Unix - bash";
- system_unix_tcsh:STRING_CONSTANT := "Unix - tcsh";
- system_unix_zsh :STRING_CONSTANT := "Unix - zsh";
- system_unix_bsd :STRING_CONSTANT := "Unix - BSD or Mac";
- system_windows :STRING_CONSTANT := "Windows - DOS";
- system_unknown :STRING_CONSTANT := "Unknown";
-
+
- file_bashrc :STRING_CONSTANT := "/.bashrc";
- file_cshrc :STRING_CONSTANT := "/.cshrc";
- file_zshenv :STRING_CONSTANT := "/.zshenv";
- file_profile :STRING_CONSTANT := "/.profile";
- file_autoexec :STRING_CONSTANT := "C:\\autoexec.bat";
- file_msdos_sys:STRING_CONSTANT := "C:\\msdos.sys";
-
+
- comment_windows :STRING_CONSTANT := "\r\nREM **** LISAAC COMPILER ****\r\n";
- comment_unix :STRING_CONSTANT := "\n# **** LISAAC COMPILER ****\n";
-
+
- path_bash :STRING_CONSTANT := "export PATH=";
- path_tcsh :STRING_CONSTANT := "set path=(";
- path_windows:STRING_CONSTANT := "set path=";
-
+
- path_bash_next :STRING_CONSTANT := "/bin:$PATH\n\n";
- path_tcsh_next :STRING_CONSTANT := "/bin $path)\n\n";
- path_windows_next:STRING_CONSTANT := "\\bin;%path%\r\n\r\n";
-
+
//
// Detect system and install environment variables.
//
-
+
- detect_system <-
- ( + std_file :POINTER;
-
+ ( + std_file :POINTER;
+
//
// Detect system
- //
+ //
(shell != NULL).if {
file := STRING.create_from_string path_home;
(shell.is_empty).if {
@@ -310,14 +310,14 @@ Section Private
// Unix - bash
file.append file_bashrc;
system := system_unix_bash;
- comment := comment_unix;
+ comment := comment_unix;
path := path_bash;
path_next := path_bash_next;
}.elseif {shell.has_substring "tcsh"} then {
// Unix - tcsh
file.append file_cshrc;
system := system_unix_tcsh;
- comment := comment_unix;
+ comment := comment_unix;
path := path_tcsh;
path_next := path_tcsh_next;
}.elseif {shell.has_substring "zsh"} then {
@@ -331,7 +331,7 @@ Section Private
// Unknown
" Shell not recognized: ".print;
shell.print;
- '\n'.print;
+ '\n'.print;
system := system_unknown;
};
} else {
@@ -342,36 +342,36 @@ Section Private
close std_file;
file := STRING.create_from_string file_autoexec;
system := system_windows;
- comment := comment_windows;
+ comment := comment_windows;
path := path_windows;
path_next := path_windows_next;
} else {
// Unknown
system := system_unknown;
- };
- };
-
+ };
+ };
+
" System detect: ".print;
system.print;
);
-
+
- install_make_lip <-
(
- (system != system_unknown).if {
+ (system != system_unknown).if {
(system = system_windows).if {
- ENVIRONMENT.execute_command "copy make.lip.sample make.lip";
- update "make.lip" idf " + target" with
- " + target:STRING := \"windows\";\n" confirmation FALSE;
+ ENVIRONMENT.execute_command "copy make.lip.sample make.lip";
+ update "make.lip" idf " + target" with
+ " + target:STRING := \"windows\";\n" confirmation FALSE;
//
- "\n Note: Use `mingw' for Windows.\n".print;
+ "\n Note: Use `mingw' for Windows.\n".print;
} else {
- ENVIRONMENT.execute_command "cp make.lip.sample make.lip";
- update "make.lip" idf " + target" with
- " + target:STRING := \"unix\";\n" confirmation FALSE;
- };
+ ENVIRONMENT.execute_command "cp make.lip.sample make.lip";
+ update "make.lip" idf " + target" with
+ " + target:STRING := \"unix\";\n" confirmation FALSE;
+ };
(is_release).if_false {
"\n Directory for library repository: ".print;
- IO.read_line;
+ IO.read_line;
'\n'.print;
string_tmp2.copy " + lib_extra:STRING := \"";
string_tmp2.append (IO.last_string);
@@ -381,26 +381,26 @@ Section Private
string_tmp2.append "/*";
};
string_tmp2.append "\";\n";
- update "make.lip" idf " + lib_extra" with
+ update "make.lip" idf " + lib_extra" with
string_tmp2 confirmation TRUE;
- update "make.lip" idf " + lib_unstable" with
+ update "make.lip" idf " + lib_unstable" with
" + lib_unstable:STRING := \"\";\n" confirmation FALSE;
};
};
- '\n'.print;
+ '\n'.print;
);
-
- - install_variable <-
+
+ - install_variable <-
( + new_text :STRING;
-
+
title "Fix target variable in `make.lip'." count 5;
install_make_lip;
//
// Installation environment variable
//
-
+
title "Installation of environment variables." count 5;
-
+
(system = system_unknown).if {
// Fail.
" Auto-install fail !\n\
@@ -410,20 +410,20 @@ Section Private
"\\bin;%path%\n\n".print;
} else {
// Creation environment variables.
- new_text := STRING.create_from_string comment;
+ new_text := STRING.create_from_string comment;
new_text.append path;
new_text.append path_current;
new_text.append path_next;
update file idf comment with new_text confirmation TRUE;
};
-
+
//
// Installation Library path
//
-
+
title "Installation of Lisaac library path." count 5;
new_text := STRING.create_from_string path_current;
- (system = system_windows).if {
+ (system = system_windows).if {
new_text.replace_all '\\' with '/';
};
new_text.prepend "#define LISAAC_DIRECTORY \"";
@@ -433,28 +433,28 @@ Section Private
update "src/path.h" idf "#define LISAAC_DIRECTORY" with new_text confirmation FALSE;
'\n'.print;
);
-
+
//
// Install Editor.
//
-
+
- lisaac_mode_comment :STRING_CONSTANT := ";; **** LISAAC MODE ****";
- lisaac_mode_path :STRING_CONSTANT := "\n(setq load-path (cons \"";
- - lisaac_mode_path_end:STRING_CONSTANT := "/editor/emacs/\" load-path))\n";
- - lisaac_mode :STRING_CONSTANT :=
+ - lisaac_mode_path_end:STRING_CONSTANT := "/editor/emacs/\" load-path))\n";
+ - lisaac_mode :STRING_CONSTANT :=
"(add-to-list 'auto-mode-alist '(\"\\\\.li\\\\'\" . lisaac-mode))\n\
\(add-to-list 'auto-mode-alist '(\"\\\\.lip\\\\'\" . lisaac-mode))\n\
\(autoload 'lisaac-mode \"lisaac-mode\" \"Major mode for Lisaac Programs\" t)\n\n";
-
+
- lisaac_vim:STRING_CONSTANT :=
"\nsyntax on \n\
\filetype plugin on \n\
\filetype indent on \n\
\au BufNewFile,BufRead *.li setf lisaac\n";
-
+
- install_emacs <-
( + file_name, new_text:STRING;
-
+
file_name := STRING.create 100;
(path_home = NULL).if {
file_name.copy "C:";
@@ -474,21 +474,21 @@ Section Private
);
- install_kate <-
- (
+ (
(system = system_windows).if {
" Sorry, not Kate editor for windows.".print;
} else {
- ENVIRONMENT.execute_command "mkdir -p ~/.kde/share/apps/katepart/syntax";
+ ENVIRONMENT.execute_command "mkdir -p ~/.kde/share/apps/katepart/syntax";
string_tmp.copy "cp -f editor/kate/lisaac_v2.xml ~/.kde/share/apps/katepart/syntax/.";
" `".print;
string_tmp.print;
"'\t".print;
- (ENVIRONMENT.execute_command string_tmp != 0).if {
+ (ENVIRONMENT.execute_command string_tmp != 0).if {
"\n Sorry, auto-install fail !\n\
\ You can to read the `editor/kate/README' file.".print;
} else {
- "OK.".print;
- };
+ "OK.".print;
+ };
};
);
@@ -499,22 +499,22 @@ Section Private
// TODO: Fix this since gvim exists on windows system
(system = system_windows).if {
" Sorry, not Vim editor for windows.\n\n".print;
- } else {
+ } else {
ENVIRONMENT.execute_command "mkdir -p ~/.vim/syntax";
ENVIRONMENT.execute_command "mkdir -p ~/.vim/indent";
- ENVIRONMENT.execute_command "mkdir -p ~/.vim/backup";
- ENVIRONMENT.execute_command "mkdir -p ~/.vim/temp";
-
+ ENVIRONMENT.execute_command "mkdir -p ~/.vim/backup";
+ ENVIRONMENT.execute_command "mkdir -p ~/.vim/temp";
+
// Syntax hilightning support
string_tmp.copy "cp -f editor/vim/syntax/lisaac.vim ~/.vim/syntax/";
" `".print;
string_tmp.print;
"'\t".print;
- (ENVIRONMENT.execute_command string_tmp != 0).if {
+ (ENVIRONMENT.execute_command string_tmp != 0).if {
"\n Sorry, auto-install fail !\n\
\ You can read the `editor/vim/install_vim_plugin.sh' file.\n".print;
} else {
- "OK.\n".print;
+ "OK.\n".print;
};
// Syntax indentation support
@@ -522,11 +522,11 @@ Section Private
" `".print;
string_tmp.print;
"'\t".print;
- (ENVIRONMENT.execute_command string_tmp != 0).if {
+ (ENVIRONMENT.execute_command string_tmp != 0).if {
"\n Sorry, auto-install fail !\n\
\ You can read the `editor/vim/install_vim_plugin.sh' file.\n".print;
} else {
- "OK.\n".print;
+ "OK.\n".print;
};
// Install ~/.vimrc file
@@ -534,7 +534,7 @@ Section Private
"\n It is recommanded to install the default vimrc file provided by the \n\
\ lisaac installer. \n\n\
\ If you choose not doing this action, your vimrc will only be updated \n\
- \ Do you want to install the default config provided by lisaac installer ?";
+ \ Do you want to install the default config provided by lisaac installer ?";
(char = 'n').if {
file_name := STRING.create 100;
(path_home = NULL).if {
@@ -542,57 +542,57 @@ Section Private
} else {
file_name.copy path_home;
};
- file_name.append "/.vimrc";
+ file_name.append "/.vimrc";
update file_name idf lisaac_vim with lisaac_vim confirmation TRUE;
} else {
string_tmp.copy "cp -f editor/vim/vimrc ~/.vimrc";
" `".print;
string_tmp.print;
"'\t".print;
- (ENVIRONMENT.execute_command string_tmp != 0).if {
+ (ENVIRONMENT.execute_command string_tmp != 0).if {
"\n Sorry, auto-install fail !\n\
\ You can read the `editor/vim/install_vim_plugin.sh' file.\n".print;
} else {
- "OK.\n".print;
+ "OK.\n".print;
};
};
};
);
-
+
- install_hippoedit <-
(
(system = system_windows).if {
- string_tmp.copy
+ string_tmp.copy
"copy editor/hippoedit/lisaac_spec.xml \"C:\\Program Files\\HippoEDIT\\data\\syntax\"";
//
" Execute: `".print;
string_tmp.print;
- "'\t".print;
- (ENVIRONMENT.execute_command string_tmp != 0).if {
+ "'\t".print;
+ (ENVIRONMENT.execute_command string_tmp != 0).if {
"Fail!".print;
} else {
- "Ok.".print;
+ "Ok.".print;
};
} else {
" Sorry, Hippoedit editor is only for Windows.".print;
};
);
-
+
- install_eclipse <-
- (
+ (
" Prerequisite: you need the Eclipse package installed.\n\
\ Use the Eclipse Update Manager to install the Lisaac Mode with the URL:\n\
\ http://isaacproject.u-strasbg.fr/eclipse/update/\n\n\
- \ Please, read `editor/eclipse/README' file for further information.\n".print;
+ \ Please, read `editor/eclipse/README' file for further information.\n".print;
);
-
-
+
+
//
// Install Compiler
//
-
+
- compile_file n:STRING_CONSTANT <-
- (
+ (
string_tmp.copy "gcc -U_FORTIFY_SOURCE -O2 bin/";
string_tmp.append n;
string_tmp.append ".c -o bin/";
@@ -607,13 +607,13 @@ Section Private
".c' file.\n".print;
};
'\n'.print;
- );
-
+ );
+
- compile_shorter is_root:BOOLEAN <-
( + rm,compile:STRING_CONSTANT;
-
+
" Compile `shorter' tools for your system (please wait ...)\n".print;
- (is_root).if {
+ (is_root).if {
compile := "lisaac src/make.lip -shorter -q -boost -o bin/shorter -gcc -Ibin/.";
} else {
(system = system_windows).if {
@@ -624,69 +624,69 @@ Section Private
compile := "bin/lisaac src/make.lip -shorter -q -boost -o bin/shorter -gcc -Isrc/.";
};
};
- (ENVIRONMENT.execute_command compile = 0).if {
- " Shorter ok!\n".print;
+ (ENVIRONMENT.execute_command compile = 0).if {
+ " Shorter ok!\n".print;
(rm != NULL).if {
- ENVIRONMENT.execute_command rm;
+ ENVIRONMENT.execute_command rm;
};
} else {
" Sorry, `shorter' not ready...\n".print;
};
'\n'.print;
);
-
+
//
// Build lib doc.
//
-
+
- build_lib <-
- (
- string_tmp.clear;
+ (
+ string_tmp.clear;
(system = system_windows).if {
- ENVIRONMENT.execute_command "mkdir doc\\html";
+ ENVIRONMENT.execute_command "mkdir doc\\html";
string_tmp.copy "bin\\shorter -d -f belinda -o doc\\html";
// BSBS: A ajouter internal mais sur le meme run shorter
} else {
- ENVIRONMENT.execute_command "mkdir -p doc/html";
+ ENVIRONMENT.execute_command "mkdir -p doc/html";
string_tmp.copy "bin/shorter -d -f belinda -o doc/html";
- };
+ };
" Execute: `".print;
string_tmp.print;
"'\t".print;
(ENVIRONMENT.execute_command string_tmp = 0).if {
" OK\n\n\
- \ Note: you'll find this documentation in `doc/html/index.html'\n".print;
+ \ Note: you'll find this documentation in `doc/html/index.html'\n".print;
} else {
" Fail!\n".print;
};
);
-
+
- user_install <-
( + choice,choice2:INTEGER;
-
+
{
- choice := menu "Menu." text
+ choice := menu "Menu." text
"1- Compiler & Shorter Installation.\n\
- \2- Editor Installation.\n\
+ \2- Editor Installation.\n\
\3- Build the librarie documentation (HTML).\n\
\0- Exit." count 3;
-
- choice
- .when 1 then {
+
+ choice
+ .when 1 then {
step_count := 0;
-
- install_variable;
-
- title "Compilation of Lisaac compiler." count 5;
+
+ install_variable;
+
+ title "Compilation of Lisaac compiler." count 5;
"*---------------------------------------------------------*\n\
\| Note: You need at least 768MB of memory. |\n\
\*---------------------------------------------------------*\n".print;
compile_file "lisaac";
-
- title "Compilation of Shorter tool." count 5;
-
+
+ title "Compilation of Shorter tool." count 5;
+
compile_shorter FALSE;
-
+
"Welcome to the Lisaac World ! \n\
\============================= \n\
\ Installation successfull. \n\
@@ -709,23 +709,23 @@ Section Private
\5- eFTE.\n\
\6- Eclipse.\n\
\0- Exit menu." count 6;
- choice2
+ choice2
.when 1 then {
title "Installation of `lisaac-mode' for Emacs." count 0;
- install_emacs;
+ install_emacs;
}
.when 2 then {
title "Installation of `lisaac.vim' for Vim." count 0;
- install_vim;
+ install_vim;
}
.when 3 then {
title "Installation of `lisaac_v2.xml' for Kate." count 0;
- install_kate;
+ install_kate;
}
.when 4 then {
title "Installation of `lisaac_spec.xml' for Hippoedit." count 0;
install_hippoedit;
- }
+ }
.when 5 then {
title "Installation of eFTE mode." count 0;
" Note: eFTE Lisaac mode is native.\n\
@@ -738,17 +738,17 @@ Section Private
}.do_while {choice2 != 0};
}
.when 3 then {
- title "Build the librarie documentation with Shorter (HTML format)." count 0;
+ title "Build the librarie documentation with Shorter (HTML format)." count 0;
build_lib;
};
}.do_while {choice != 0};
);
-
+
- path_bin:ABSTRACT_STRING := "/usr/bin";
- path_lib:ABSTRACT_STRING := "/usr/lib/lisaac";
- path_doc:ABSTRACT_STRING := "/usr/share/lisaac";
- path_man:ABSTRACT_STRING := "/usr/share/man/man1";
-
+
- ask_path msg:ABSTRACT_STRING default val:ABSTRACT_STRING :ABSTRACT_STRING <-
( + result:STRING;
+ car:CHARACTER;
@@ -758,31 +758,31 @@ Section Private
"] ? (y/n) ".print;
car := IO.read_character;
IO.read_character;
- (car.to_lower = 'y').if {
- result := val;
- } else {
+ (car.to_lower = 'y').if {
+ result := val;
+ } else {
"\n new path : ".print;
- IO.read_word;
+ IO.read_word;
result := IO.last_string;
result.remove_first 1;
};
result
- );
-
+ );
+
- system_install <-
( + path:ABSTRACT_STRING;
+ create:{ (ABSTRACT_STRING,ABSTRACT_STRING,ABSTRACT_STRING,BOOLEAN); };
-
+
// path.h
string_tmp2.copy "#define LISAAC_DIRECTORY \"";
string_tmp2.append path_lib;
string_tmp2.append "\"\n";
- update "bin/path.h" idf "#define LISAAC_DIRECTORY"
+ update "bin/path.h" idf "#define LISAAC_DIRECTORY"
with string_tmp2 confirmation FALSE;
// compile
compile_file "lisaac";
//
- create := { (msg,cpy,dft:ABSTRACT_STRING,ask:BOOLEAN);
+ create := { (msg,cpy,dft:ABSTRACT_STRING,ask:BOOLEAN);
(ask).if {
path := ask_path msg default dft;
} else {
@@ -792,9 +792,9 @@ Section Private
string_tmp.append path;
execute string_tmp;
string_tmp.copy cpy;
- string_tmp.append path;
- execute string_tmp;
- };
+ string_tmp.append path;
+ execute string_tmp;
+ };
//
create.value (" binary path","cp bin/lisaac ",path_bin,TRUE);
//
@@ -819,35 +819,35 @@ Section Private
\| `install_lisaac' in user mode. |\n\
\*---------------------------------------------------------*\n".print;
);
-
+
Section Public
-
+
- main <-
( + cwd:NATIVE_ARRAY(CHARACTER);
- + choice:INTEGER;
+ + choice:INTEGER;
"\t\t================================\n\
- \\t\t= Auto-Install Lisaac Compiler =\n\
+ \\t\t= Auto-Install Lisaac Compiler =\n\
\\t\t================================\n\n".print;
string_tmp.clear;
cwd := string_tmp.to_external;
`getcwd(@cwd,255)`;
string_tmp.from_external cwd;
-
+
path_current := STRING.create (string_tmp.count);
- path_current.copy string_tmp;
+ path_current.copy string_tmp;
path_home := ENVIRONMENT.get_environment_variable "HOME";
shell := ENVIRONMENT.get_environment_variable "SHELL";
-
+
title "Detection system." count 0;
detect_system;
-
+
(system != system_windows).if {
- choice := menu "Menu." text
+ choice := menu "Menu." text
"1- User installation.\n\
\2- System installation (root).\n\
\0- Exit." count 2;
choice
- .when 1 then {
+ .when 1 then {
user_install;
}
.when 2 then {
@@ -855,6 +855,6 @@ Section Public
};
} else {
user_install;
- };
+ };
"\nBye.\n\n".print;
);
diff --git a/lib/internal/os_support/dos/file_system/entry.li b/lib/internal/os_support/dos/file_system/entry.li
index dd87406..7728c3f 100644
--- a/lib/internal/os_support/dos/file_system/entry.li
+++ b/lib/internal/os_support/dos/file_system/entry.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ENTRY;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:= "http://IsaacOS.com";
- - author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
+ - author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
- comment := "Entry ANSI";
-
+
Section Inherit
-
+
+ parent_abstract_entry:Expanded ABSTRACT_ENTRY;
-
-Section Public
-
+
+Section Public
+
//
// Physical implementation.
//
@@ -61,35 +61,35 @@ Section Public
`}`;
result
);
-
+
- physical_remove_directory:BOOLEAN <-
( + p:NATIVE_ARRAY(CHARACTER);
p := path.to_external;
`rmdir(@p)`:(INTEGER) = 0
);
-
+
- physical_remove_file:BOOLEAN <-
( + p:NATIVE_ARRAY(CHARACTER);
p := path.to_external;
`remove(@p)`:(INTEGER) = 0
);
-
+
- physical_rename old_path:ABSTRACT_STRING with new_path:ABSTRACT_STRING :BOOLEAN <-
( + old_p,new_p:NATIVE_ARRAY(CHARACTER);
old_p := old_path.to_external;
new_p := new_path.to_external;
`rename(@old_p, at new_p)`:(INTEGER) = 0
);
-
+
//
// Time / Date: Unix -> Lisaac
//
-
+
- to_date t:POINTER :DATE <-
( + result:DATE;
+ wd,md,m:UINTEGER_8;
+ y:UINTEGER_16;
-
+
y := `((struct tm *)@t)->tm_year`:UINTEGER_16 + 1900;
m := `((struct tm *)@t)->tm_mon` :UINTEGER_8 + 1;
md := `((struct tm *)@t)->tm_mday`:UINTEGER_8;
@@ -97,15 +97,15 @@ Section Public
(! wd.in_range 1 to 7).if { // Bug in UNIX ?
wd := 1;
};
- result := DATE.create (y,m,md,wd)
+ result := DATE.create (y,m,md,wd)
);
- to_time t:POINTER :TIME <-
(
- TIME.create
+ TIME.create
((`((struct tm *)@t)->tm_hour`:UINTEGER_8),
(`((struct tm *)@t)->tm_min` :UINTEGER_8),
(`((struct tm *)@t)->tm_sec` :UINTEGER_8),
0)
);
-
+
diff --git a/lib/internal/os_support/dos/video/bitmap_8.li b/lib/internal/os_support/dos/video/bitmap_8.li
index fd51051..58bb746 100644
--- a/lib/internal/os_support/dos/video/bitmap_8.li
+++ b/lib/internal/os_support/dos/video/bitmap_8.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := BITMAP_8;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Bitmap 8 bits";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
-
+
Section Inherit
-
+
+ parent_bitmap:Expanded BITMAP;
-
+
Section Public
-
+
- pixel_geometry:PIXEL := PIXEL_8;
-
-Section Private
-
+
+Section Private
+
//
// Data.
//
-
+
// Mapping memory bitmap.
+ image:FAST_ARRAY(BMP_LINE_8);
-
+
- get_line y:INTEGER :BMP_LINE <-
(
image.item y
);
-
+
//
- // Creation.
+ // Creation.
//
- make (w,h:INTEGER) <-
@@ -65,13 +65,13 @@ Section Private
image.put (BMP_LINE_8.create w) to y;
};
clipping_off;
- );
-
+ );
+
- make (w,h:INTEGER) at offset_begin:UINTEGER_32 bytes_per_line lx:INTEGER <-
( + offset:UINTEGER_32;
-
+
width := w;
- height := h;
+ height := h;
image := FAST_ARRAY(BMP_LINE_8).create h;
offset:=offset_begin;
0.to (image.upper) do { y:INTEGER;
@@ -80,8 +80,8 @@ Section Private
};
clipping_off;
);
-
-
+
+
diff --git a/lib/internal/os_support/dos/video/bmp_line_8.li b/lib/internal/os_support/dos/video/bmp_line_8.li
index c941f5a..4e87d37 100644
--- a/lib/internal/os_support/dos/video/bmp_line_8.li
+++ b/lib/internal/os_support/dos/video/bmp_line_8.li
@@ -19,68 +19,68 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := BMP_LINE_8;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Bitmap line 8 bits";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
Section Inherit
-
+
+ parent_bmp_line:Expanded BMP_LINE;
-
+
Section Private
-
+
+ storage:MAP_NATIVE_ARRAY(PIXEL_8);
-
+
- get_storage:NATIVE_ARRAY(UINTEGER_8) <- NATIVE_ARRAY(UINTEGER_8).force_conversion storage;
-
+
- make n:INTEGER <-
- (
+ (
capacity := n;
- upper := n - 1;
- storage := MAP_NATIVE_ARRAY(PIXEL_8).calloc n;
+ upper := n - 1;
+ storage := MAP_NATIVE_ARRAY(PIXEL_8).calloc n;
);
-
+
- make_with_capacity n:INTEGER <-
(
capacity := n;
upper := -1;
- storage := MAP_NATIVE_ARRAY(PIXEL_8).calloc n;
+ storage := MAP_NATIVE_ARRAY(PIXEL_8).calloc n;
);
-
+
- make n:INTEGER at offset:UINTEGER_32 <-
- (
+ (
capacity := n;
- upper := n - 1;
- storage := MAP_NATIVE_ARRAY(PIXEL_8).force_conversion offset;
+ upper := n - 1;
+ storage := MAP_NATIVE_ARRAY(PIXEL_8).force_conversion offset;
);
Section Public
-
+
- pixel_geometry:PIXEL := PIXEL_8;
-
+
//
// Put.
//
-
- - put (r,g,b:UINTEGER_8) from idx_begin:INTEGER to idx_end:INTEGER <-
- ( + pixel:PIXEL_8;
+
+ - put (r,g,b:UINTEGER_8) from idx_begin:INTEGER to idx_end:INTEGER <-
+ ( + pixel:PIXEL_8;
? {idx_begin<=idx_end};
? {idx_begin>=0};
? {idx_end.in_range 0 to upper};
-
+
PIXEL_24.color (r,g,b);
pixel := PIXEL_24.to_pixel_8;
idx_begin.to idx_end do { n:INTEGER;
storage.item n.copy pixel;
};
);
-
+
- put bmp:BMP_LINE offset ofs:INTEGER from idx_begin:INTEGER to idx_end:INTEGER <-
( + offset:INTEGER;
+ pixel:PIXEL_8;
@@ -88,8 +88,8 @@ Section Public
? {idx_begin >= 0};
? {idx_end.in_range 0 to upper};
? {ofs >= 0};
- ? {(ofs + (idx_end - idx_begin)) <= bmp.upper};
-
+ ? {(ofs + (idx_end - idx_begin)) <= bmp.upper};
+
offset := ofs;
idx_begin.to idx_end do { n:INTEGER;
pixel := bmp.item_8 offset;
@@ -97,15 +97,15 @@ Section Public
offset := offset + 1;
};
);
-
+
//
// Get.
//
-
+
- item n:INTEGER :PIXEL <-
( ? {n.in_range 0 to upper};
storage.item n
);
-
+
diff --git a/lib/internal/os_support/dos/video/event_system.li b/lib/internal/os_support/dos/video/event_system.li
index 60c1b8b..325d290 100644
--- a/lib/internal/os_support/dos/video/event_system.li
+++ b/lib/internal/os_support/dos/video/event_system.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EVENT_SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "X11 - Event System";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
-Section Public
- - make <-
+Section Public
+
+ - make <-
(
// Nothing.
);
-
+
- get_event <-
- (
+ (
KEYBOARD.get_scan;
MOUSE.get_new_event;
);
-
-
+
+
diff --git a/lib/internal/os_support/dos/video/keyboard.li b/lib/internal/os_support/dos/video/keyboard.li
index 166a033..a0d6353 100644
--- a/lib/internal/os_support/dos/video/keyboard.li
+++ b/lib/internal/os_support/dos/video/keyboard.li
@@ -23,22 +23,22 @@ Section Header
+ name := KEYBOARD;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:="http://IsaacOS.com";
- author :="Boutet Jerome (boutet at loria.fr),Sonntag Benoit (bsonntag at loria.fr)";
- comment :="Keyboard for DOS - AZERTY";
- - version := 1;
+ - version := 1;
- date :="2003/04";
-
+
Section Inherit
-
+
+ parent_input_keyboard:Expanded INPUT_KEYBOARD;
Section Private
-
- + e_code:BOOLEAN; // TRUE If extended mode
-
+
+ + e_code:BOOLEAN; // TRUE If extended mode
+
// Lower case.
- cmin:STRING_CONSTANT := "\0d\&\"\39d\(-_
)=\1d\\2d\azertyuiop^$\3d\^qsdfghjklmý^*wxcvbn,;:!^*^ ";
// Upper case.
@@ -46,27 +46,27 @@ Section Private
- cmm:STRING_CONSTANT := "\27d\\8d\\9d\\13d\"; // 0:Echap 1:Del 2:Tab 3:Enter
- caltgr:STRING_CONSTANT := "'~#{[|`\\^@]}";
-
+
// Num keyb.
- keynum0:STRING_CONSTANT := "789-456+1230."; // from 70-82
- keynum1:STRING_CONSTANT := "BUA\0d\LMR\0d\ELZIS"; // Without NumLock
-
+
// Extended keyboard from 88 to 102
- - ext_key:STRING_CONSTANT := "\55d\\28d\\52d\\27d\\70d\\78d\\81d\\82d\\76d\\74d\\71d\\79d\\80d\\72d\\54d\";
+ - ext_key:STRING_CONSTANT := "\55d\\28d\\52d\\27d\\70d\\78d\\81d\\82d\\76d\\74d\\71d\\79d\\80d\\72d\\54d\";
- buf_extk:STRING_CONSTANT := "\13d\BEISRLUDZAH";
-Section Public
-
+Section Public
+
- old_scan:UINTEGER_8;
-
+
//
// Get Character (Interrupt #21)
//
- get_scan <-
( + cu,scancode,tmp:UINTEGER_8;
-
- scancode:=SYSTEM.itemb 60h;
+
+ scancode:=SYSTEM.itemb 60h;
(scancode != old_scan).if {
old_scan := scancode;
cu:=getcode (scancode-1);
@@ -76,7 +76,7 @@ Section Public
"Reboot ...\n".print;
die_with_code exit_failure_code;
};
-
+
tmp:=(p_end+1)&003h;
buffer_event.item p_end.make ((cmd.to_uinteger_16<<8)|cu);
(((tmp+2)&3)!=p_beg).if {
@@ -86,30 +86,30 @@ Section Public
};
};
);
-
+
Section Private
-
+
- send_cmd (comm,dta:UINTEGER_8) <-
- // Send a command to keyboard
+ // Send a command to keyboard
(
// Empty buffer
{ ((SYSTEM.itemb 64h) & 2) != 0}.while_do {
- SYSTEM.itemb 60h;
- };
+ SYSTEM.itemb 60h;
+ };
// Send command
- SYSTEM.putb comm to 60h;
+ SYSTEM.putb comm to 60h;
// Waiting for answer
- { ((SYSTEM.itemb 64h) & 1) == 0}.while_do {};
+ { ((SYSTEM.itemb 64h) & 1) == 0}.while_do {};
// Read answer
- SYSTEM.itemb 60h;
+ SYSTEM.itemb 60h;
// Send data
- SYSTEM.putb dta to 60h;
+ SYSTEM.putb dta to 60h;
// Waiting for answer
- { ((SYSTEM.itemb 64h) & 1) == 0}.while_do {};
+ { ((SYSTEM.itemb 64h) & 1) == 0}.while_do {};
// Read answer
- SYSTEM.itemb 60h;
+ SYSTEM.itemb 60h;
);
-
+
- light <-
(
send_cmd (0EDh,(((cmd & 80h)>>7)|((cmd & 40h)>>5)|((cmd & 20h)>>3)));
@@ -117,7 +117,7 @@ Section Private
- keyup cu:UINTEGER_8 :UINTEGER_8 <-
( + result:UINTEGER_8;
- cmd := cmd & 0F7h; // Deactivate the cmd bit
+ cmd := cmd & 0F7h; // Deactivate the cmd bit
bin_code.put ((bin_code.item (cu>>3)) & ~(1<<(cu&7))) to (cu>>3);
// Analyze: for deactivate the cmd
((cu == 28) || {cu == 89}).if {
@@ -128,9 +128,9 @@ Section Private
cmd := cmd & (~02h);
}.elseif { cu == 55 } then {
// Alt
- cmd := cmd & (~04h);
+ cmd := cmd & (~04h);
result := ascii_code;
- ascii_code := 0;
+ ascii_code := 0;
}.elseif { (cu == 41) || { cu == 53} } then {
// Shift 1 or Shift 2
cmd := cmd & (~10h);
@@ -150,7 +150,7 @@ Section Private
cmd := cmd | 02h;
}.elseif { cu == 55 } then {
// Alt
- cmd := cmd | 04h;
+ cmd := cmd | 04h;
}.elseif { (cu == 41) || { cu == 53} } then {
// Shift 1 or Shift 2
cmd := cmd | 10h;
@@ -189,7 +189,7 @@ Section Private
} else {
cmd := cmd | 08h;
result := cmm.item (cu2+1).to_uinteger_8;
- };
+ };
};
}.elseif {cu <= 67} then {
cmd := cmd | 08h; // F1 to F10 = cmd
@@ -221,11 +221,11 @@ Section Private
result := '/'.to_uinteger_8;
} else {
cmd := cmd | 08h;
- result := buf_extk.item (cu-90).to_uinteger_8;
+ result := buf_extk.item (cu-90).to_uinteger_8;
};
result
);
-
+
- getcode cu:UINTEGER_8 :UINTEGER_8 <-
// Translate Scan Code -> cmd.ASCII
( + j:INTEGER;
@@ -264,8 +264,8 @@ Section Private
};
result
);
-
-
+
+
diff --git a/lib/internal/os_support/dos/video/mouse.li b/lib/internal/os_support/dos/video/mouse.li
index a333ee3..10c6d01 100644
--- a/lib/internal/os_support/dos/video/mouse.li
+++ b/lib/internal/os_support/dos/video/mouse.li
@@ -23,77 +23,77 @@ Section Header
+ name := MOUSE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:="http://IsaacOS.com";
- author :="Sonntag Benoit (bsonntag at loria.fr)";
- comment :="Mouse for DOS.";
-
+
- external := `union REGS __in_mouse;`;
-
+
Section Inherit
+ parent_input:Expanded INPUT;
-
+
+ parent_window:Expanded AREA;
-
+
Section Public
- set (x,y:INTEGER) with (left_new,right_new:BOOLEAN) <-
( + tmp:UINTEGER_8;
+ x_new, y_new:INTEGER;
-
+
y_new := y.max y_minimum.min y_maximum;
x_new := x.max x_minimum.min x_maximum;
-
+
tmp:=(p_end+1)&003h;
buffer_event.item p_end.make (x_new,y_new) button (left_new,right_new);
(((tmp+2)&3)!=p_beg).if {
p_end:=tmp;
};
-
+
get_event;
-
+
// Update status.
x_current:=x_new;
y_current:=y_new;
right:=right_new;
- left :=left_new;
+ left :=left_new;
);
-
+
Section Public
-
+
+ x_minimum:INTEGER;
+ x_maximum:INTEGER;
-
+
+ y_minimum:INTEGER;
+ y_maximum:INTEGER;
-
+
+ x_current:INTEGER;
- + y_current:INTEGER;
-
+ + y_current:INTEGER;
+
+ right:BOOLEAN;
+ left:BOOLEAN;
-
+
Section Private
-
+
+ buffer_event:MAP_FAST_ARRAY(EVENT_MOUSE);
- p_beg:UINTEGER_8; // Pointer on the buffer (beginning)
- p_end:UINTEGER_8; // Pointer on the buffer (end)
-
+
Section Public
-
+
//
// Creation / Initialisation.
//
-
+
- make <-
(
//
// Mouse hardware configuration.
//
//display_on;
-
+
x_maximum := VIDEO.x_max;
y_maximum := VIDEO.y_max;
@@ -104,38 +104,38 @@ Section Public
0.to 3 do { j:INTEGER;
buffer_event.item j.set_prev (buffer_event.item ((j-1)&3));
};
-
+
mask := FAST_ARRAY(UINTEGER_16).create 16;
make (INTERFACE.screen) from (x_current,y_current) size (16,16);
);
-
+
- get_event <-
( + p:INTEGER;
+ evt:EVENT_MOUSE;
-
+
p := p_beg;
{ p != p_end }.while_do {
evt := buffer_event.item p;
(list_client.lower).to (list_client.upper) do { j:INTEGER;
list_client.item j.receive (buffer_event.item p);
- };
+ };
p := (p + 1) & 03h;
- };
+ };
);
-
+
- acknowledge <-
(
p_beg := (p_beg+1) & 03h;
);
-
+
- display_on <- `__in_mouse.w.ax=0x01; int386(0x33,&__in_mouse,&__in_mouse)`;
- display_off <- `__in_mouse.w.ax=0x02; int386(0x33,&__in_mouse,&__in_mouse)`;
-
+
- get_new_event <-
( + b,x,y:INTEGER;
+ new_r,new_l,is_move:BOOLEAN;
-
+
`__in_mouse.w.ax=0x03; int386(0x33,&__in_mouse,&__in_mouse)`;
b:=`__in_mouse.w.bx`:INTEGER;
x:=`__in_mouse.w.cx`:INTEGER / 2;
@@ -151,14 +151,14 @@ Section Public
set (x,y) with (new_l,new_r);
};
);
-
+
//
// Display.
//
-
+
// BSBS: A refaire avec une bitmap en dehors contenant le dessin avec une couleur de mask!!
- // Plus simple, plus puissant, plus rapide !
-
+ // Plus simple, plus puissant, plus rapide !
+
+ mask:FAST_ARRAY(UINTEGER_16);
- pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
@@ -172,42 +172,42 @@ Section Public
parent_window.pixel_hard (x,y) color col;
);
-
+
- line_h_hard (x0,y0:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
( + m:UINTEGER_16;
? {x0<16};
? {y0<16};
? {x1<16};
-
+
m:=mask.item y0;
x0.to x1 do { xx:INTEGER;
m:=m | (1<<xx);
};
-
+
mask.put m to y0;
parent_window.line_h_hard (x0,y0) until x1 color col;
);
- - slave_pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
+ - slave_pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
( + m:UINTEGER_16;
-
+
m:=mask.item y;
((m & (1<<x))=0).if {
parent_window.pixel_hard (x,y) color col;
};
);
-
- - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER color col:UINTEGER_32 <-
+
+ - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER color col:UINTEGER_32 <-
( + m:UINTEGER_16;
-
+
m:=mask.item y;
x1.to x2 do { xx:INTEGER;
((m & (1<<xx))=0).if {
parent_window.pixel_hard (xx,y) color col;
};
};
- );
-
+ );
+
- slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER image line:BMP_LINE offset ofs:INTEGER <-
( + m:UINTEGER_16;
+ col:UINTEGER_32;
@@ -216,17 +216,17 @@ Section Public
m:=mask.item y;
x1.to x2 do { xx:INTEGER;
((m & (1<<xx))=0).if {
- col := line.get_color ofs_img;
+ col := line.get_color ofs_img;
parent_window.pixel_hard (xx,y) color col;
- };
+ };
ofs_img := ofs_img + 1;
};
);
-
+
- draw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
(
clipping (x0,y0) to (x1,y1);
-
+
color white;
poly_move_to (1,1);
poly_line_to (9,9);
@@ -234,10 +234,10 @@ Section Public
poly_line_to (8,14);
poly_line_to (5,14);
poly_line_to (5,9);
- poly_line_to (1,9);
- poly_move_to (1,1);
+ poly_line_to (1,9);
+ poly_move_to (1,1);
poly_trace;
-
+
color red;
line_v (0,0) until 10;
line_h (1,10) until 4;
@@ -247,12 +247,11 @@ Section Public
line_h (7,10) until 10;
line (1,0) to (10,9);
);
-
+
- get_object (x,y:INTEGER) :AREA <-
(
NULL
);
-
-
-
-
\ No newline at end of file
+
+
+
diff --git a/lib/internal/os_support/dos/video/pixel_8.li b/lib/internal/os_support/dos/video/pixel_8.li
index 4082c09..a671974 100644
--- a/lib/internal/os_support/dos/video/pixel_8.li
+++ b/lib/internal/os_support/dos/video/pixel_8.li
@@ -19,44 +19,44 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PIXEL_8;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Pixel 8 bits (RR-VVV-BBB)";
-
+
- bibliography:= "http://IsaacOS.com";
-
+
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
-
+
Section Inherit
-
+
- parent_pixel:PIXEL := PIXEL;
-
+
Section Mapping
-
+
+ real_color:UINTEGER_8;
-
+
Section Public
-
+
- red:UINTEGER_8 <- real_color & 11000000b;
-
+
- green:UINTEGER_8 <- (real_color & 00111000b) << 2;
-
+
- blue:UINTEGER_8 <- real_color << 5;
-
+
- color col:UINTEGER_32 <-
(
real_color := (((col >> 16).to_uinteger_8) &11000000b) | ((((col & 00FF00h) >> 10).to_uinteger_8)&00111000b) | (((col & 0000FFh).to_uinteger_8) >>5);
);
-
+
- color_rgb (r,g,b:UINTEGER_8) <-
(
real_color := (r &11000000b) | (g&00111000b) | (b >>5);
);
-
- - size:UINTEGER_8 := 8;
+
+ - size:UINTEGER_8 := 8;
- red_size:UINTEGER_8 := 2;
- red_pos:UINTEGER_8 := 6;
- green_size:UINTEGER_8 := 3;
@@ -65,14 +65,14 @@ Section Public
- blue_pos:UINTEGER_8 := 0;
- reserved_size:UINTEGER_8 :=0;
- reserved_pos:UINTEGER_8 :=0;
-
- - copy other:SELF <-
+
+ - copy other:SELF <-
(
real_color := other.real_color;
);
-
+
- to_pixel_8:PIXEL_8 <- Self;
-
+
diff --git a/lib/internal/os_support/dos/video/video.li b/lib/internal/os_support/dos/video/video.li
index a6d344c..13ad3e8 100644
--- a/lib/internal/os_support/dos/video/video.li
+++ b/lib/internal/os_support/dos/video/video.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := VIDEO;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Driver video - For DOS -";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
-
- - external :=
+
+ - external :=
`
-#include <stdio.h>
+#include <stdio.h>
#include <dos.h>
#include <dpmi.h>
#include <pc.h>
@@ -40,7 +40,7 @@ Section Header
unsigned short __desc_video;
void __init_video_320x200()
{ union REGS in;
-
+
__desc_video=__dpmi_allocate_ldt_descriptors(1);
__djgpp_map_physical_memory((void *)0xA0000, 64000,0xA0000);
__dpmi_set_segment_base_address(__desc_video,0xA0000);
@@ -51,47 +51,47 @@ void __init_video_320x200()
};
void __init_video_text()
{ union REGS in;
-
+
in.w.ax=0x03;
int86(0x10,&in,&in);
};
`;
-
-
+
+
Section Inherit
-
+
+ parent_bitmap:Expanded BITMAP;
-
+
Section Public
-
+
- message str:ABSTRACT_STRING <-
(
str.print;
);
-
+
- is_active:BOOLEAN;
- make (w,h:INTEGER) <-
- (
+ (
? {w = 320};
? {h = 200};
-
+
// Init BITMAP:
width := w;
height := h;
-
+
//
// Init mode 320x200.
//
`__init_video_320x200()`;
-
+
//
// Init palette.
//
SYSTEM.putb 0 to 3C8h;
0.to 255 do { j:INTEGER;
+ r,g,b,c:UINTEGER_8;
-
+
c:=j.to_uinteger_8;
r:=(c&11000000b)>>2;
g:=(c&00111000b);
@@ -106,7 +106,7 @@ Section Public
- pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
( + col8:UINTEGER_8;
+ ofs:INTEGER;
- col8 :=
+ col8 :=
(((col >> 16).to_uinteger_8) & 11000000b) | // Red
(((col >> 10).to_uinteger_8) & 00111000b) | // Green
(((col >> 5).to_uinteger_8) & 00000111b); // Blue
@@ -115,7 +115,7 @@ Section Public
`_farpokeb(__desc_video, at ofs, at col8)`;
//MOUSE.display_on;
);
-
+
- line_h_hard (x,y:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
( + col8:UINTEGER_8;
+ ofs:INTEGER;
@@ -140,7 +140,7 @@ Section Public
col8 := (((col >> 16).to_uinteger_8) &11000000b) | ((((col & 00FF00h) >> 10).to_uinteger_8)&00111000b) | (((col & 0000FFh).to_uinteger_8) >>5);
`_farpokeb(__desc_video, at j, at col8)`;
ofs_img2:=ofs_img2+1;
- };
+ };
//MOUSE.display_on;
);
diff --git a/lib/internal/os_support/unix/file_system/directory_unix.li b/lib/internal/os_support/unix/file_system/directory_unix.li
index 7ef87ae..c30be62 100644
--- a/lib/internal/os_support/unix/file_system/directory_unix.li
+++ b/lib/internal/os_support/unix/file_system/directory_unix.li
@@ -19,72 +19,72 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=DIRECTORY_UNIX;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:="http://IsaacOS.com";
-
+
- author :="Benoit Sonntag (bsonntag at loria.fr)";
-
+
- comment :="Directory management";
-
- - external :=
+
+ - external :=
`
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
`;
-
+
Section Inherit
-
+
+ parent_entry_unix:Expanded ENTRY_UNIX;
-
+
+ parent_directory:Expanded DIRECTORY;
-
+
Section Public
-
+
- is_open:BOOLEAN <- ( list != NULL);
-
+
//
// Scanning
//
-
+
- open:BOOLEAN <-
( + p,n:NATIVE_ARRAY(CHARACTER);
+ dir,dirent:POINTER;
+ new_entry:ENTRY;
+ result:BOOLEAN;
+ i:INTEGER;
-
+
(list = NULL).if {
list := LINKED_LIST(ENTRY).create;
} else {
list.clear;
};
-
+
p := path.to_external;
- dir := `opendir(@p)`:POINTER;
+ dir := `opendir(@p)`:POINTER;
(dir != NULL).if {
- result := TRUE;
+ result := TRUE;
{
dirent := `readdir(@dir)`:POINTER;
(dirent != NULL).if {
- n := `((struct dirent *)@dirent)->d_name`:NATIVE_ARRAY(CHARACTER);
+ n := `((struct dirent *)@dirent)->d_name`:NATIVE_ARRAY(CHARACTER);
string_tmp.clear;
i := 0;
- {n.item i = '\0'}.until_do {
+ {n.item i = '\0'}.until_do {
string_tmp.add_last (n.item i);
i := i + 1;
};
(string_tmp !== ".".to_string).if {
string_tmp.add_first '/';
- string_tmp.prepend path;
- reduce_path string_tmp;
- new_entry := get_entry string_tmp;
- (new_entry = NULL).if {
- "WARNING: ".print; string_tmp.print; " no readable!\n".print;
+ string_tmp.prepend path;
+ reduce_path string_tmp;
+ new_entry := get_entry string_tmp;
+ (new_entry = NULL).if {
+ "WARNING: ".print; string_tmp.print; " no readable!\n".print;
//result := FALSE;
} else {
(new_entry.path.count >= path.count).if {
@@ -98,41 +98,41 @@ Section Public
};
result
);
-
+
Section DIRECTORY
-
+
- physical_get_entry new_path:ABSTRACT_STRING :ENTRY <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:ENTRY;
-
+
pe := new_path.to_external;
// #ifdef __MINGW_H ( voir sous winmerde )
`#ifndef __USE_LARGEFILE64
`;
- `{ struct stat t`;
- (`stat(@pe,&t)`:INTEGER = 0).if {
+ `{ struct stat t`;
+ (`stat(@pe,&t)`:INTEGER = 0).if {
(`S_ISDIR(t.st_mode)`:INTEGER = 0).if {
// File.
result := FILE_UNIX.clone;
} else {
// Directory.
result := DIRECTORY_UNIX.clone;
- };
+ };
result.set_path new_path;
alias.put result to (result.path); // with { (e1,e2:ABSTRACT_STRING); e1 ~=e2 };
};
`}`;
`#else
`;
- `{ struct stat64 t`;
- (`stat64(@pe,&t)`:INTEGER = 0).if {
+ `{ struct stat64 t`;
+ (`stat64(@pe,&t)`:INTEGER = 0).if {
(`S_ISDIR(t.st_mode)`:INTEGER = 0).if {
// File.
result := FILE_UNIX.clone;
} else {
// Directory.
result := DIRECTORY_UNIX.clone;
- };
+ };
result.set_path new_path;
alias.put result to (result.path); //with { (e1,e2:ABSTRACT_STRING); e1 ~=e2 };
};
@@ -141,7 +141,7 @@ Section DIRECTORY
`;
result
);
-
+
- physical_make_directory new_path:ABSTRACT_STRING :BOOLEAN <-
( + pa:NATIVE_ARRAY(CHARACTER);
pa := new_path.to_external;
@@ -152,7 +152,7 @@ Section DIRECTORY
( + pa:NATIVE_ARRAY(CHARACTER);
+ stream:POINTER;
+ result:BOOLEAN;
-
+
pa := new_path.to_external;
stream := `fopen((char*)@pa,"w+b")`:POINTER;
(stream != NULL).if {
@@ -166,7 +166,7 @@ Section DIRECTORY
pa := p.to_external;
`remove(@pa)`:(INTEGER) = 0
);
-
+
- physical_move old_path:ABSTRACT_STRING to new_path:ABSTRACT_STRING :BOOLEAN <-
( + old_p,new_p:NATIVE_ARRAY(CHARACTER);
old_p := old_path.to_external;
diff --git a/lib/internal/os_support/unix/file_system/entry_unix.li b/lib/internal/os_support/unix/file_system/entry_unix.li
index f89d4b3..55c8a10 100644
--- a/lib/internal/os_support/unix/file_system/entry_unix.li
+++ b/lib/internal/os_support/unix/file_system/entry_unix.li
@@ -19,116 +19,116 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ENTRY_UNIX;
- copyright := "2003-2008 Benoit Sonntag";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
- comment := "Entry ANSI C";
-
+
Section Inherit
-
+
+ parent_entry:Expanded ENTRY;
-
-Section Public
-
- - access:UINTEGER_16 <-
+
+Section Public
+
+ - access:UINTEGER_16 <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:UINTEGER_16;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
+ `{ struct stat t; stat(@pe,&t)`;
result := `t.st_mode`:UINTEGER_16 & 111_111_111b;
`}`;
result
);
-
- - access_time:TIME <-
+
+ - access_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_atime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_atime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
- - access_date:DATE <-
+
+ - access_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_atime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_atime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
- - update_time:TIME <-
+
+ - update_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_mtime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_mtime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
- - update_date:DATE <-
+
+ - update_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_mtime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_mtime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
+
- create_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_ctime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_ctime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
+
- create_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_ctime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_ctime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
-Section Private
-
+
+Section Private
+
//
// Time / Date: Unix -> Lisaac
//
-
+
- to_date t:POINTER :DATE <-
( + result:DATE;
+ wd,md,m:UINTEGER_8;
+ y:UINTEGER_16;
-
+
y := `((struct tm *)@t)->tm_year`:UINTEGER_16 + 1900;
m := `((struct tm *)@t)->tm_mon` :UINTEGER_8 + 1;
md := `((struct tm *)@t)->tm_mday`:UINTEGER_8;
@@ -136,15 +136,15 @@ Section Private
(! wd.in_range 1 to 7).if { // Bug in UNIX ?
wd := 1;
};
- result := DATE.create (y,m,md,wd)
+ result := DATE.create (y,m,md,wd)
);
- to_time t:POINTER :TIME <-
(
- TIME.create
+ TIME.create
((`((struct tm *)@t)->tm_hour`:UINTEGER_8),
(`((struct tm *)@t)->tm_min` :UINTEGER_8),
(`((struct tm *)@t)->tm_sec` :UINTEGER_8),
0)
);
-
+
diff --git a/lib/internal/os_support/unix/file_system/file_system.li b/lib/internal/os_support/unix/file_system/file_system.li
index b92fd70..7a41d96 100644
--- a/lib/internal/os_support/unix/file_system/file_system.li
+++ b/lib/internal/os_support/unix/file_system/file_system.li
@@ -19,32 +19,32 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=FILE_SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment :="File System manager for Unix.";
-
+
- external := `#include <unistd.h>`; // For `getcwd'
-
-Section Inherit
-
+
+Section Inherit
+
+ parent_directory:DIRECTORY <-
- ( + cwd:NATIVE_ARRAY(CHARACTER);
+ ( + cwd:NATIVE_ARRAY(CHARACTER);
+ result:DIRECTORY;
-
+
DIRECTORY.string_tmp.clear;
cwd := DIRECTORY.string_tmp.to_external;
`getcwd(@cwd,255)`;
DIRECTORY.string_tmp.from_external cwd;
-
+
result ?= DIRECTORY_UNIX.physical_get_entry (DIRECTORY.string_tmp);
DIRECTORY.alias.put result to (result.path);
? {result != NULL};
parent_directory := result
);
-
-
+
+
diff --git a/lib/internal/os_support/unix/file_system/file_unix.li b/lib/internal/os_support/unix/file_system/file_unix.li
index 7e6be7d..afa0e95 100644
--- a/lib/internal/os_support/unix/file_system/file_unix.li
+++ b/lib/internal/os_support/unix/file_system/file_unix.li
@@ -19,102 +19,102 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FILE_UNIX;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "File management";
-
+
Section Inherit
-
+
+ parent_entry_unix:Expanded ENTRY_UNIX;
-
+
+ parent_file:Expanded FILE;
-
-Section Private
-
+
+Section Private
+
+ stream:POINTER; // Unix file pointer (FILE *).
Section Public
-
+
//
// Physical implementation.
//
-
+
- is_open:BOOLEAN <- stream != NULL;
-
+
- size:UINTEGER_32 <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:UINTEGER_32;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
+ `{ struct stat t; stat(@pe,&t)`;
result := `t.st_size`:UINTEGER_32;
`}`;
result
);
-
+
- cursor:UINTEGER_32 <-
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`ftell((FILE *)@str)`:UINTEGER_32
);
-
+
- set_cursor n:UINTEGER_32 <-
[
...
-? {stream != NULL};
-? {n <= size};
]
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`fseek((FILE*)(@str), at n,SEEK_SET)`;
- );
-
+ );
+
- open:BOOLEAN <-
[
-? {stream = NULL};
]
- ( + pa:NATIVE_ARRAY(CHARACTER);
-
+ ( + pa:NATIVE_ARRAY(CHARACTER);
+
pa := path.to_external;
- stream := `fopen((char*)@pa,"r+b")`:(POINTER);
+ stream := `fopen((char*)@pa,"r+b")`:(POINTER);
stream != NULL
- );
+ );
- open_read_only:BOOLEAN <-
- ( + pa:NATIVE_ARRAY(CHARACTER);
+ ( + pa:NATIVE_ARRAY(CHARACTER);
pa := path.to_external;
stream := `fopen((char*)@pa,"rb")`:(POINTER);
stream != NULL
- );
-
+ );
+
- close <-
[
-? {stream != NULL};
]
( + str:POINTER;
-
- str := stream;
- `fclose((FILE*)(@str))`;
+
+ str := stream;
+ `fclose((FILE*)(@str))`;
stream := NULL;
);
-
-Section FILE
-
+
+Section FILE
+
- physical_read buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
// return size read or 0 if end of input (-1 on error => exception ?)
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`fread((void *)(@buf),(size_t)(1), (size_t)(@s),(FILE*)(@str))`:(INTEGER)
);
-
+
- physical_write buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
// return size read or 0 if end of input (-1 on error => exception ?)
( + str:POINTER;
- str := stream;
+ str := stream;
`fwrite((void *)(@buf),(size_t)(1), (size_t)(@s),(FILE*)(@str))`:(INTEGER)
);
-
-
+
+
diff --git a/lib/internal/os_support/unix/system/clock.li b/lib/internal/os_support/unix/system/clock.li
index da3cb05..4407bce 100644
--- a/lib/internal/os_support/unix/system/clock.li
+++ b/lib/internal/os_support/unix/system/clock.li
@@ -23,7 +23,7 @@ Section Header
+ name := CLOCK;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:="http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
@@ -31,45 +31,45 @@ Section Header
- comment :="X11 - Clock management.";
- date :="2003/04";
-
+
- external := `#include <time.h>`;
-
-Section Inherit
-
+
+Section Inherit
+
- parent_input:INPUT := INPUT;
-
-Section Public
-
+
+Section Public
+
- date:DATE <-
- ( + wd,d,mo:UINTEGER_8;
+ ( + wd,d,mo:UINTEGER_8;
+ y:UINTEGER_16;
-
- `{
+
+ `{
struct tm *t; time_t tt;
tt = time(NULL);
- t = localtime(&tt)`;
+ t = localtime(&tt)`;
wd := `t->tm_wday`:UINTEGER_8 + 1;
d := `t->tm_mday`:UINTEGER_8;
mo := `t->tm_mon` :UINTEGER_8 + 1;
- y := `t->tm_year`:UINTEGER_16 + 1900;
+ y := `t->tm_year`:UINTEGER_16 + 1900;
`}`;
DATE.create (y,mo,d,wd)
);
-
+
- time:TIME <-
( + s,m,h:UINTEGER_8;
-
- `{
+
+ `{
struct tm *t; time_t tt;
tt = time(NULL);
- t = localtime(&tt)`;
+ t = localtime(&tt)`;
h := `t->tm_hour`:UINTEGER_8;
m := `t->tm_min` :UINTEGER_8;
- s := `t->tm_sec` :UINTEGER_8;
- `}`;
+ s := `t->tm_sec` :UINTEGER_8;
+ `}`;
TIME.create (h,m,s,0)
);
-
+
- make <-
(
// Nothing.
diff --git a/lib/internal/os_support/unix/system/float_processor.li b/lib/internal/os_support/unix/system/float_processor.li
index 1a5a13f..afa16fd 100644
--- a/lib/internal/os_support/unix/system/float_processor.li
+++ b/lib/internal/os_support/unix/system/float_processor.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_PROCESSOR;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,14 +32,14 @@ Section Inherit
- parent_object:OBJECT := OBJECT;
Section Public
-
+
- init; // Compatibility IsaacOS.
-
- - atan n:REAL :REAL <- `atanf(@n)`:REAL;
- - atan_32 n:REAL_32 :REAL_32 <- `atanf(@n)`:REAL_32;
+
+ - atan n:REAL :REAL <- `atanf(@n)`:REAL;
+ - atan_32 n:REAL_32 :REAL_32 <- `atanf(@n)`:REAL_32;
- atan_64 n:REAL_64 :REAL_64 <- `atan(@n)`:REAL_64;
- atan_80 n:REAL_80 :REAL_80 <- `atanl(@n)`:REAL_80;
-
+
- sqrt n:REAL :REAL <- `sqrtf(@n)`:REAL;
- sqrt_32 n:REAL_32 :REAL_32 <- `sqrtf(@n)`:REAL_32;
- sqrt_64 n:REAL_64 :REAL_64 <- `sqrt(@n)`:REAL_64;
@@ -65,4 +65,3 @@ Section Public
- pow_64 (n,exp:REAL_64) :REAL_64 <- `pow(@n, at exp)`:REAL_64;
- pow_80 (n,exp:REAL_80) :REAL_80 <- `powl(@n, at exp)`:REAL_80;
-
\ No newline at end of file
diff --git a/lib/internal/os_support/unix/system/processor.li b/lib/internal/os_support/unix/system/processor.li
index dea8594..57ceff1 100644
--- a/lib/internal/os_support/unix/system/processor.li
+++ b/lib/internal/os_support/unix/system/processor.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PROCESSOR;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Processor object.";
Section Public
-
+
- to_intel_ulong v:UINTEGER_64 :UINTEGER_64 <- deferred;
-
+
- to_intel_uint v:UINTEGER_32 :UINTEGER_32 <- deferred;
-
+
- to_intel_ushort v:UINTEGER_16 :UINTEGER_16 <- deferred;
-
+
- to_motorola_ulong v:UINTEGER_64 :UINTEGER_64 <-
- (
+ (
(v << 56) | ((v & 0FF00h) << 40) | ((v & 0FF0000h) << 24) | ((v & 0FF000000h) << 8) |
(v >> 56) | ((v >> 40) & 0FF00h) | ((v >> 24) & 0FF0000h) | ((v >> 8) & 0FF000000h)
);
-
+
- to_motorola_uint v:UINTEGER_32 :UINTEGER_32 <-
(
- (v << 24) | ((v & 0FF00h) << 8) | ((v >> 8) & 0FF00h) | (v >> 24)
+ (v << 24) | ((v & 0FF00h) << 8) | ((v >> 8) & 0FF00h) | (v >> 24)
);
-
+
- to_motorola_int v:INTEGER :INTEGER <-
(
// Conversion in uxxx to cut the sign
- (v << 24) | (((v & 0FF00h) << 8).to_uinteger_16) | (((v >> 8) & 0FF00h).to_uinteger_16) | ((v >> 24).to_uinteger_8)
+ (v << 24) | (((v & 0FF00h) << 8).to_uinteger_16) | (((v >> 8) & 0FF00h).to_uinteger_16) | ((v >> 24).to_uinteger_8)
);
-
+
- to_motorola_ushort v:UINTEGER_16 :UINTEGER_16 <-
(
(v << 8) | (v >> 8)
diff --git a/lib/internal/os_support/unix/system/system.li b/lib/internal/os_support/unix/system/system.li
index d17aef7..c4927cb 100644
--- a/lib/internal/os_support/unix/system/system.li
+++ b/lib/internal/os_support/unix/system/system.li
@@ -19,58 +19,58 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Generic System Object (methods).";
- external := `#include <time.h>`;
Section Public
-
+
- get_current_date:DATE <-
- ( + wd,d,mo:UINTEGER_8;
+ ( + wd,d,mo:UINTEGER_8;
+ y:UINTEGER_16;
-
- `{
+
+ `{
struct tm *t; time_t tt;
tt = time(NULL);
- t = localtime(&tt)`;
+ t = localtime(&tt)`;
wd := `t->tm_wday`:UINTEGER_8 + 1;
d := `t->tm_mday`:UINTEGER_8;
mo := `t->tm_mon` :UINTEGER_8 + 1;
- y := `t->tm_year`:UINTEGER_16 + 1900;
+ y := `t->tm_year`:UINTEGER_16 + 1900;
`}`;
DATE.create (y,mo,d,wd)
);
-
+
- get_current_time:TIME <-
( + s,m,h:UINTEGER_8;
-
- `{
+
+ `{
struct tm *t; time_t tt;
tt = time(NULL);
- t = localtime(&tt)`;
+ t = localtime(&tt)`;
h := `t->tm_hour`:UINTEGER_8;
m := `t->tm_min` :UINTEGER_8;
- s := `t->tm_sec` :UINTEGER_8;
- `}`;
+ s := `t->tm_sec` :UINTEGER_8;
+ `}`;
TIME.create (h,m,s,0)
);
//
//
//
-
+
- is_ansi:BOOLEAN := TRUE;
-
+
- exit code:INTEGER <- `exit(@code)`;
-
+
- putb value:UINTEGER_8 to port:UINTEGER_16 <-
// Write in port
- (
+ (
`{ unsigned short val;
val = @value;
asm
@@ -78,7 +78,7 @@ Section Public
"movw %0,%%dx \n\
movw %1,%%ax \n\
outb %%al,%%dx "
- : /* No output */
+ : /* No output */
:"r"(@port), "r"(val)
:"%ax","%dx"
);
@@ -102,26 +102,26 @@ Section Public
`}`;
result
);
-
+
- get_universal_time:UINTEGER_64 <-
(
`(unsigned long long)time(NULL)`:UINTEGER_64
);
// Memory Management
-
+
- memory:MEMORY := MEMORY;
-
+
- get_begin_memory:POINTER;
-
- - get_memory_capacity:UINTEGER_CPU <-
+
+ - get_memory_capacity:UINTEGER_CPU <-
( + cap:UINTEGER_CPU;
+ mem,new_mem:POINTER;
cap := 32.mb;
{
cap := cap * 2;
mem := new_mem;
- new_mem := `realloc(@mem, at cap)`:POINTER;
+ new_mem := `realloc(@mem, at cap)`:POINTER;
}.do_until {(new_mem = NULL) || {(cap >> 20) = 2048}}; // BSBS: BUG COMPILO 0.13
(new_mem = NULL).if {
cap := cap / 2;
@@ -131,10 +131,10 @@ Section Public
get_begin_memory := mem;
//
cap
- );
-
+ );
+
Section SYSTEM,MEMORY
-
+
- realloc_c (beg:UINTEGER_32,nb:INTEGER) :UINTEGER_32 <-
( + result:UINTEGER_32;
result := `(unsigned long)realloc((void *)@beg, at nb+15)`:UINTEGER_32;
diff --git a/lib/internal/os_support/unix/system/system_io.li b/lib/internal/os_support/unix/system/system_io.li
index 153aa23..3ee4020 100644
--- a/lib/internal/os_support/unix/system/system_io.li
+++ b/lib/internal/os_support/unix/system/system_io.li
@@ -19,17 +19,17 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SYSTEM_IO;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "Lower level for Input / Output";
-
+
- external := `
#include <stdio.h>
#include <stdlib.h>
-
+
/* Hardware 'print_char' */
void print_char(char car)
{
@@ -45,7 +45,7 @@ int die_with_code(int code)
`;
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
Section Public
@@ -55,14 +55,13 @@ Section Public
(
`fputc((int)@byte,stdout)`;
);
-
+
- print_error_char byte:CHARACTER <-
// Low level buffered error output.
(
`fputc((int)@byte,stderr)`;
- );
-
+ );
+
- get_char :CHARACTER <- `fgetc(stdin)`:(CHARACTER);
-
+
- eof:CHARACTER <- `EOF`:CHARACTER;
-
\ No newline at end of file
diff --git a/lib/internal/os_support/unix/video/event_system.li b/lib/internal/os_support/unix/video/event_system.li
index 3d3d7a1..5cc1298 100644
--- a/lib/internal/os_support/unix/video/event_system.li
+++ b/lib/internal/os_support/unix/video/event_system.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EVENT_SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "X11 - Event System";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
-Section Public
-
+
+Section Public
+
- x_root:INTEGER;
- y_root:INTEGER;
-
+
- sleep n:INTEGER <-
// Milisecond
(
`usleep(@n * 1000)`;
);
-
- - make <-
+
+ - make <-
( + mask:UINTEGER_32;
-
+
mask := `ExposureMask`:UINTEGER_32;
mask := mask | `KeyPressMask|KeyReleaseMask`:UINTEGER_32;
mask := mask | `ButtonPressMask|ButtonReleaseMask|PointerMotionMask`:UINTEGER_32;
mask := mask | `ClientMessage`:UINTEGER_32;
//mask := mask | `ResizeRedirectMask`:UINTEGER_32;
mask := mask | `StructureNotifyMask`:UINTEGER_32;
- `XSelectInput(display,window, at mask)`;
+ `XSelectInput(display,window, at mask)`;
);
-
+
- get_event <-
( //+ nb_ev:INTEGER;
+ type:INTEGER;
+ x0,y0,x1,y1:INTEGER;
-
- TIMER.get_event;
- `{ XEvent ev`;
- (`XPending(display)`:INTEGER != 0).if {
+
+ TIMER.get_event;
+ `{ XEvent ev`;
+ (`XPending(display)`:INTEGER != 0).if {
`XNextEvent(display,&ev)`;
type := `ev.type`:INTEGER;
-
+
type
//
// Event Window
@@ -73,7 +73,7 @@ Section Public
x0 := `ev.xexpose.x`:INTEGER;
y0 := `ev.xexpose.y`:INTEGER;
x1 := x0 + `ev.xexpose.width` :INTEGER - 1;
- y1 := y0 + `ev.xexpose.height`:INTEGER - 1;
+ y1 := y0 + `ev.xexpose.height`:INTEGER - 1;
DESK.physical_screen.redraw (x0,y0) to (x1,y1);
}
.when `ResizeRequest`:INTEGER then {
@@ -81,32 +81,32 @@ Section Public
x1 := `ev.xresizerequest.width`:INTEGER;
y1 := `ev.xresizerequest.height`:INTEGER;
`XResizeWindow(display,window, at x1, at y1)`;
-
+
VIDEO.pixel_hard (x1,10) color 0FF0000h;
-
+
DESK.resize_window (x1,y1);
}
-
+
.when `ConfigureNotify`:INTEGER then {
// Resize X Window
x1 := `ev.xconfigure.width`:INTEGER;
- y1 := `ev.xconfigure.height`:INTEGER;
+ y1 := `ev.xconfigure.height`:INTEGER;
DESK.resize_window (x1,y1);
}
-
+
//
// Event Keyboard
//
- .when `KeyPress`:INTEGER then {
+ .when `KeyPress`:INTEGER then {
KEYBOARD.key `ev.xkey.keycode`:UINTEGER_8 press TRUE;
}
.when `KeyRelease`:INTEGER then {
KEYBOARD.key `ev.xkey.keycode`:UINTEGER_8 press FALSE;
- }
+ }
//
// Event Mouse
//
- .when `ButtonPress`:INTEGER then {
+ .when `ButtonPress`:INTEGER then {
x_root := `ev.xmotion.x_root`:INTEGER;
y_root := `ev.xmotion.y_root`:INTEGER;
(`ev.xbutton.button`:INTEGER = 1).if {
@@ -132,9 +132,9 @@ Section Public
};
`}`;
);
-
-
-
+
+
+
diff --git a/lib/internal/os_support/unix/video/keyboard.li b/lib/internal/os_support/unix/video/keyboard.li
index 6466ff5..7a0adcc 100644
--- a/lib/internal/os_support/unix/video/keyboard.li
+++ b/lib/internal/os_support/unix/video/keyboard.li
@@ -23,36 +23,36 @@ Section Header
+ name := KEYBOARD;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="X11 - Keyboard Driver";
- - version := 1;
+ - version := 1;
- date :="2003/04";
-
+
Section Inherit
+ parent_input_keyboard:Expanded INPUT_KEYBOARD;
Section Private
-
+
// Lower case.
- lower_case:STRING_CONSTANT := "&é\"'(-è_çà)=\8\\9\azertyuiop^$\13\ qsdfghjklmù *wxcvbn,;:!";
// Upper case.
- upper_case:STRING_CONSTANT := "1234567890°+\8\\9\AZERTYUIOP\"£\13\ QSDFGHJKLM% µWXCVBN?./§";
-
+
// Num lock.
- num_on :STRING_CONSTANT := "789-456+1230.";
- num_off:STRING_CONSTANT := "BUA-L\0R+EDZIS";
-
+
// AltGr.
- alt_gr:STRING_CONSTANT := "¹~#{[|`\\^@]}";
-
+
// Extension key.
- ext_key:STRING_CONSTANT := "BUAL REDZIS HP";
-
+
- keyup cu:UINTEGER_8 :UINTEGER_8 <-
- ( + result,pcu:UINTEGER_8;
-
+ ( + result,pcu:UINTEGER_8;
+
// Patch 64bits
((UINTEGER_CPU.object_size = 8) && {
(cu = 111) || {cu = 113} || {cu = 114} || {cu = 116}
@@ -62,12 +62,12 @@ Section Private
} else {
pcu := cu - 12;
};
- } else {
+ } else {
pcu := cu;
- };
+ };
// End patch
-
- cmd := cmd & 0F7h; // Deactivate the cmd bit
+
+ cmd := cmd & 0F7h; // Deactivate the cmd bit
//bin_code.put ((bin_code.item (pcu>>3)) & ~(1<<(pcu&7))) to (pcu>>3);
// Analyze: for deactivate the cmd
((pcu = 37) || {pcu = 109}).if {
@@ -78,9 +78,9 @@ Section Private
cmd := cmd & (~02h);
}.elseif { pcu = 64 } then {
// Alt
- cmd := cmd & (~04h);
+ cmd := cmd & (~04h);
result := ascii_code;
- ascii_code := 0;
+ ascii_code := 0;
}.elseif { (pcu = 50) || { pcu = 62} } then {
// Shift 1 or Shift 2
cmd := cmd & (~10h);
@@ -90,7 +90,7 @@ Section Private
- keydown cu:UINTEGER_8 :UINTEGER_8 <-
( + result,pcu:UINTEGER_8;
-
+
// Patch 64bits
((UINTEGER_CPU.object_size = 8) && {
(cu = 111) || {cu = 113} || {cu = 114} || {cu = 116}
@@ -100,11 +100,11 @@ Section Private
} else {
pcu := cu - 12;
};
- } else {
+ } else {
pcu := cu;
- };
+ };
// End patch
-
+
//bin_code.put ((bin_code.item (pcu>>3)) | (~(1<<(pcu&7)))) to (pcu>>3); // Activate key
// Analyze: for activate the cmd
((pcu = 37) || {pcu = 109}).if {
@@ -115,10 +115,10 @@ Section Private
cmd := cmd | 02h;
}.elseif { pcu = 64 } then {
// Alt
- cmd := cmd | 04h;
+ cmd := cmd | 04h;
}.elseif { pcu = 65 } then {
// Space
- result := ' '.to_uinteger_8;
+ result := ' '.to_uinteger_8;
}.elseif { (pcu = 50) || { pcu = 62} } then {
// Shift 1 or Shift 2
cmd := cmd | 10h;
@@ -151,13 +151,13 @@ Section Private
};
(result <= 13).if {
cmd := cmd | 08h;
- };
+ };
}.elseif {pcu = 63} then {
result := '*'.to_uinteger_8;
}.elseif {pcu.in_range 67 to 76} then {
cmd := cmd | 08h; // F1 to F10 = cmd
result := pcu - 67 + 'a'.to_uinteger_8; // 'a' to 'j'
- }.elseif {pcu.in_range 79 to 91} then {
+ }.elseif {pcu.in_range 79 to 91} then {
((cmd & 40h) = 0).if {
// Ver num off
result := num_off.item (pcu-78).to_uinteger_8;
@@ -172,7 +172,7 @@ Section Private
result := 0;
};
};
- }.elseif {(pcu = 95) || {pcu = 96}} then {
+ }.elseif {(pcu = 95) || {pcu = 96}} then {
cmd := cmd | 08h; // F11 to F12 = cmd
result := pcu - 95 + 'k'.to_uinteger_8; // 'k' to 'l'
}.elseif {pcu = 94} then {
@@ -183,13 +183,13 @@ Section Private
};
}.elseif {pcu.in_range 97 to 111} then {
cmd := cmd | 08h;
- result := ext_key.item (pcu-96).to_uinteger_8;
+ result := ext_key.item (pcu-96).to_uinteger_8;
}.elseif {pcu = 112} then {
result := '/'.to_uinteger_8;
};
result
);
-
+
diff --git a/lib/internal/os_support/unix/video/mouse.li b/lib/internal/os_support/unix/video/mouse.li
index 9832532..40ece71 100644
--- a/lib/internal/os_support/unix/video/mouse.li
+++ b/lib/internal/os_support/unix/video/mouse.li
@@ -19,75 +19,75 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := MOUSE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "X11 - Mouse driver";
-
+
Section Inherit
-
+
+ parent_input:Expanded INPUT;
-
+
+ parent_window:Expanded AREA; // MASK
-
+
Section Public
-
+
- set (x,y:INTEGER) with (left_new,right_new:BOOLEAN) <-
( + tmp:UINTEGER_8;
+ x_new, y_new:INTEGER;
-
+
y_new := y.max y_minimum.min y_maximum;
x_new := x.max x_minimum.min x_maximum;
-
+
tmp:=(p_end+1)&003h;
buffer_event.item p_end.make (x_new,y_new) button (left_new,right_new);
(((tmp+2)&3)!=p_beg).if {
p_end:=tmp;
};
-
+
get_event;
-
+
// Update status.
x_current:=x_new;
y_current:=y_new;
right :=right_new;
- left :=left_new;
+ left :=left_new;
);
-
+
Section Public
-
+
+ x_minimum:INTEGER;
- x_maximum:INTEGER <- VIDEO.x_max;
-
+
+ y_minimum:INTEGER;
- - y_maximum:INTEGER <- VIDEO.y_max;
-
+ - y_maximum:INTEGER <- VIDEO.y_max;
+
+ x_current:INTEGER;
- + y_current:INTEGER;
-
+ + y_current:INTEGER;
+
+ right:BOOLEAN;
+ left :BOOLEAN;
-
+
Section Private
-
+
+ buffer_event:FAST_ARRAY(EVENT_MOUSE);
- p_beg:UINTEGER_8; // Pointer on the buffer (beginning)
- p_end:UINTEGER_8; // Pointer on the buffer (end)
-
+
Section Public
-
+
//
// Creation / Initialisation.
//
-
+
- make <-
( + new_event:EVENT_MOUSE;
-
+
is_actif := TRUE;
-
+
//
// Software configuration.
//
@@ -100,43 +100,43 @@ Section Public
};
};
buffer_event.first.set_prev new_event;
-
+
// MASK
mask := FAST_ARRAY(UINTEGER_16).create 16;
make (DESK.physical_screen) from (x_current,y_current) size (16,16);
);
-
+
- get_event <-
( + p:INTEGER;
+ evt:EVENT_MOUSE;
-
+
p := p_beg;
(p != p_end).if {
((x_current != x_window) || {y_current != y_window}).if {
set_position (x_current,y_current);
};
{ p != p_end }.while_do {
- evt := buffer_event.item p;
+ evt := buffer_event.item p;
(list_client.lower).to (list_client.upper) do { j:INTEGER;
list_client.item j.receive (buffer_event.item p);
- };
+ };
p := (p + 1) & 03h;
- };
+ };
};
);
-
+
- acknowledge <-
(
p_beg := (p_beg+1) & 03h;
);
-
+
//
// Display.
//
-
+
// BSBS: A refaire avec une bitmap en dehors contenant le dessin avec une couleur de mask!!
// Plus simple, plus puissant, plus rapide !
-
+
+ mask:FAST_ARRAY(UINTEGER_16);
- pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
@@ -149,42 +149,42 @@ Section Public
mask.put m to y;
parent_window.pixel_hard (x,y) color col;
);
-
+
- line_h_hard (x0,y0:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
( + m:UINTEGER_16;
? {x0<16};
? {y0<16};
? {x1<16};
-
+
m:=mask.item y0;
x0.to x1 do { xx:INTEGER;
m:=m | (1<<xx);
};
-
+
mask.put m to y0;
parent_window.line_h_hard (x0,y0) until x1 color col;
);
- - slave_pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
+ - slave_pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
( + m:UINTEGER_16;
-
+
m:=mask.item y;
((m & (1<<x))=0).if {
parent_window.pixel_hard (x,y) color col;
};
);
-
- - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER color col:UINTEGER_32 <-
+
+ - slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER color col:UINTEGER_32 <-
( + m:UINTEGER_16;
-
+
m:=mask.item y;
x1.to x2 do { xx:INTEGER;
((m & (1<<xx))=0).if {
parent_window.pixel_hard (xx,y) color col;
};
};
- );
-
+ );
+
- slave_line_h_hard (x1,y:INTEGER) until x2:INTEGER image line:ABSTRACT_BMP_LINE offset ofs:INTEGER <-
( + m:UINTEGER_16;
+ col:UINTEGER_32;
@@ -193,17 +193,17 @@ Section Public
m:=mask.item y;
x1.to x2 do { xx:INTEGER;
((m & (1<<xx))=0).if {
- col := line.get_color ofs_img;
+ col := line.get_color ofs_img;
parent_window.pixel_hard (xx,y) color col;
- };
+ };
ofs_img := ofs_img + 1;
};
);
-
+
- draw (x0,y0:INTEGER) to (x1,y1:INTEGER) <-
(
clipping (x0,y0) to (x1,y1);
-
+
color white;
poly_move_to (1,1);
poly_line_to (9,9);
@@ -211,10 +211,10 @@ Section Public
poly_line_to (8,14);
poly_line_to (5,14);
poly_line_to (5,9);
- poly_line_to (1,9);
- poly_move_to (1,1);
+ poly_line_to (1,9);
+ poly_move_to (1,1);
poly_trace;
-
+
color red;
line_v (0,0) until 10;
line_h (1,10) until 4;
@@ -224,16 +224,16 @@ Section Public
line_h (7,10) until 10;
line (1,0) to (10,9);
);
-
+
- get_object (x,y:INTEGER) :AREA <-
(
NULL
);
-
+
//
// Extern robot.
//
-
+
- extern_event_move (x,y:INTEGER) <-
(
`XTestFakeMotionEvent(display,-1, at x, at y,1)`;
@@ -242,28 +242,28 @@ Section Public
- extern_event_left_down <-
(
- `XTestFakeButtonEvent(display,1,True,1)`;
+ `XTestFakeButtonEvent(display,1,True,1)`;
`XFlush(display)`;
);
- extern_event_left_up <-
(
- `XTestFakeButtonEvent(display,1,False,1)`;
+ `XTestFakeButtonEvent(display,1,False,1)`;
`XFlush(display)`;
);
-
+
- extern_event_right_down <-
(
- `XTestFakeButtonEvent(display,3,True,1)`;
+ `XTestFakeButtonEvent(display,3,True,1)`;
`XFlush(display)`;
);
- extern_event_right_up <-
(
- `XTestFakeButtonEvent(display,3,False,1)`;
+ `XTestFakeButtonEvent(display,3,False,1)`;
`XFlush(display)`;
);
-
+
- extern_get_mouse:(INTEGER,INTEGER,BOOLEAN,BOOLEAN) <-
( + x,y,mask:INTEGER;
+ l,r:BOOLEAN;
@@ -273,11 +273,11 @@ Section Public
x := `winx`:INTEGER;
y := `winy`:INTEGER;
mask := `mask`:INTEGER;
- `}`;
+ `}`;
l := (mask & 100h)!=0;
r := (mask & 400h)!=0;
x,y,l,r
- );
+ );
diff --git a/lib/internal/os_support/unix/video/timer.li b/lib/internal/os_support/unix/video/timer.li
index 396dfb7..eea3f7b 100644
--- a/lib/internal/os_support/unix/video/timer.li
+++ b/lib/internal/os_support/unix/video/timer.li
@@ -45,17 +45,17 @@ Section Inherit
Section Public
- timer_count:UINTEGER_32;
-
+
Section Private
-
+
- buffer_event:FAST_ARRAY(EVENT_TIMER);
- p_beg:UINTEGER_8; // Pointer on the buffer (beginning)
- p_end:UINTEGER_8; // Pointer on the buffer (end)
-
+
- delay:INTEGER := 50_000;
-
+
Section Interrupt
- timer_interrupt <-
@@ -87,12 +87,12 @@ Section Interrupt
);
Section Public
-
+
- set_delay d:INTEGER <-
(
delay := d;
);
-
+
- make <-
( + hdle:POINTER;
+ new_event:EVENT_TIMER;
diff --git a/lib/internal/os_support/unix/video_ascii/bitmap_ascii.li b/lib/internal/os_support/unix/video_ascii/bitmap_ascii.li
index 4e018c3..41719fd 100644
--- a/lib/internal/os_support/unix/video_ascii/bitmap_ascii.li
+++ b/lib/internal/os_support/unix/video_ascii/bitmap_ascii.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := BITMAP_ASCII;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Bitmap for text mode";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
-
+
Section Inherit
-
+
+ parent_bitmap_generic:Expanded BITMAP;
-
+
Section Public
-
+
- pixel_geometry:PIXEL := PIXEL_ASCII;
-
-Section Public
-
+
+Section Public
+
//
// Data.
//
-
+
// Mapping memory bitmap.
+ image:FAST_ARRAY(BMP_LINE_ASCII);
-
+
- get_line y:INTEGER :BMP_LINE <-
( //? {y < height};
image.item y
);
-
+
//
- // Creation.
+ // Creation.
//
- make (w,h:INTEGER) <-
@@ -65,13 +65,13 @@ Section Public
image.put (BMP_LINE_ASCII.create w) to y;
};
clipping_off;
- );
-
+ );
+
- make (w,h:INTEGER) at offset_begin:UINTEGER_32 bytes_per_line lx:INTEGER <-
( + offset:UINTEGER_32;
-
+
width := w;
- height := h;
+ height := h;
image := FAST_ARRAY(BMP_LINE_ASCII).create h;
offset:=offset_begin;
0.to (image.upper) do { y:INTEGER;
@@ -80,7 +80,7 @@ Section Public
};
clipping_off;
);
-
+
- print <-
(
0.to (height - 1) do {h:INTEGER;
@@ -88,5 +88,5 @@ Section Public
'\n'.print;
};
);
-
+
diff --git a/lib/internal/os_support/unix/video_ascii/bmp_line_ascii.li b/lib/internal/os_support/unix/video_ascii/bmp_line_ascii.li
index 039d14c..2991a07 100644
--- a/lib/internal/os_support/unix/video_ascii/bmp_line_ascii.li
+++ b/lib/internal/os_support/unix/video_ascii/bmp_line_ascii.li
@@ -19,65 +19,65 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := BMP_LINE_ASCII;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Bitmap line for text mode";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
Section Inherit
-
+
+ parent_bmp_line:Expanded BMP_LINE;
-
+
Section Public
-
+
+ storage:MAP_NATIVE_ARRAY(PIXEL_ASCII);
-
+
- get_storage:NATIVE_ARRAY(UINTEGER_8) <- NATIVE_ARRAY(UINTEGER_8).force_conversion storage;
-
+
- make n:INTEGER <-
- (
+ (
capacity := n;
- upper := n - 1;
- storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).calloc n;
+ upper := n - 1;
+ storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).calloc n;
);
-
+
- make_with_capacity n:INTEGER <-
(
capacity := n;
upper := -1;
- storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).calloc n;
+ storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).calloc n;
);
-
+
- make n:INTEGER at offset:UINTEGER_32 <-
- (
+ (
capacity := n;
- upper := n - 1;
- storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).force_conversion offset;
+ upper := n - 1;
+ storage := MAP_NATIVE_ARRAY(PIXEL_ASCII).force_conversion offset;
);
Section Public
-
+
- pixel_geometry:PIXEL := PIXEL_ASCII;
-
+
//
// Put.
//
-
- - put col:UINTEGER_32 from idx_begin:INTEGER to idx_end:INTEGER <-
+
+ - put col:UINTEGER_32 from idx_begin:INTEGER to idx_end:INTEGER <-
( ? {idx_begin<=idx_end};
? {idx_begin>=0};
? {idx_end.in_range 0 to upper};
-
+
idx_begin.to idx_end do { n:INTEGER;
storage.item n.color col;
};
);
-
+
- put bmp:BMP_LINE offset ofs:INTEGER from idx_begin:INTEGER to idx_end:INTEGER <-
( + offset:INTEGER;
+ pixel:PIXEL_ASCII;
@@ -85,7 +85,7 @@ Section Public
? {idx_begin >= 0};
? {idx_end.in_range 0 to upper};
? {ofs >= 0};
- ? {(ofs + (idx_end - idx_begin)) <= bmp.upper};
+ ? {(ofs + (idx_end - idx_begin)) <= bmp.upper};
offset := ofs;
idx_begin.to idx_end do { n:INTEGER;
pixel := bmp.item_ascii offset;
@@ -93,17 +93,17 @@ Section Public
offset := offset + 1;
};
);
-
+
//
// Get.
//
-
+
- item n:INTEGER :PIXEL <-
( ? {n.in_range 0 to upper};
-
+
storage.item n
);
-
+
- print <-
(
0.to upper do { i:INTEGER;
diff --git a/lib/internal/os_support/unix/video_ascii/pixel_ascii.li b/lib/internal/os_support/unix/video_ascii/pixel_ascii.li
index 8ebfd96..7e491a7 100644
--- a/lib/internal/os_support/unix/video_ascii/pixel_ascii.li
+++ b/lib/internal/os_support/unix/video_ascii/pixel_ascii.li
@@ -19,79 +19,79 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PIXEL_ASCII;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Version Generic ASCII";
-
+
- bibliography:= "http://IsaacOS.com";
-
+
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
-
+
Section Inherit
-
+
- parent_pixel:PIXEL := PIXEL;
-
+
Section Mapping
-
+
+ char:CHARACTER;
-
+
Section Public
-
- - red:UINTEGER_8 <-
+
+ - red:UINTEGER_8 <-
( + result:UINTEGER_8;
-
+
char
.when ' ' then { result := 31; }
- .when '.' then { result := 63; }
+ .when '.' then { result := 63; }
.when '-' then { result := 95; }
.when '=' then { result := 127; }
.when '+' then { result := 159; }
.when '*' then { result := 191; }
- .when '%' then { result := 223; }
+ .when '%' then { result := 223; }
.when '#' then { result := 255; };
result
);
-
+
- green:UINTEGER_8 <- red;
- blue:UINTEGER_8 <- red;
-
- - color col:UINTEGER_32 :UINTEGER_32 <-
+
+ - color col:UINTEGER_32 :UINTEGER_32 <-
( + gray:UINTEGER_32;
-
+
gray := ((col >> 16)+ ((col & 00FF00h)>>8)+ ((col & 0000FFh) >> 3))/3;
gray
.when 0 to 31 then { char := ' '; }
- .when 32 to 63 then { char := '.'; }
+ .when 32 to 63 then { char := '.'; }
.when 64 to 95 then { char := '-'; }
.when 96 to 127 then { char := '='; }
.when 128 to 159 then { char := '+'; }
.when 160 to 191 then { char := '*'; }
- .when 192 to 223 then { char := '%'; }
+ .when 192 to 223 then { char := '%'; }
.when 224 to 255 then { char := '#'; };
col
);
-
- - color_rgb (r,g,b:UINTEGER_8) <-
+
+ - color_rgb (r,g,b:UINTEGER_8) <-
( + gray:INTEGER;
-
+
gray := (r.to_integer+g+b)/3;
gray
.when 0 to 31 then { char := ' '; }
- .when 32 to 63 then { char := '.'; }
+ .when 32 to 63 then { char := '.'; }
.when 64 to 95 then { char := '-'; }
.when 96 to 127 then { char := '='; }
.when 128 to 159 then { char := '+'; }
.when 160 to 191 then { char := '*'; }
- .when 192 to 223 then { char := '%'; }
+ .when 192 to 223 then { char := '%'; }
.when 224 to 255 then { char := '#'; };
);
-
- - size:UINTEGER_8 := 8;
- - red_size:UINTEGER_8 := 3;
+
+ - size:UINTEGER_8 := 8;
+ - red_size:UINTEGER_8 := 3;
- red_pos:UINTEGER_8 := 0;
- green_size:UINTEGER_8 := 3;
- green_pos:UINTEGER_8 := 3;
@@ -99,12 +99,12 @@ Section Public
- blue_pos:UINTEGER_8 := 6;
- reserved_size:UINTEGER_8 := 0;
- reserved_pos:UINTEGER_8 := 0;
-
- - copy other:SELF <-
+
+ - copy other:SELF <-
(
color_rgb ((other.red),(other.green),(other.blue));
);
-
+
- print <-
(
(char=0).if {
@@ -112,7 +112,7 @@ Section Public
};
char.print;
);
-
+
- set_char c:CHARACTER <-
(
char := c;
diff --git a/lib/internal/os_support/unix/video_ascii/video.li b/lib/internal/os_support/unix/video_ascii/video.li
index 1350ddf..a0fe153 100644
--- a/lib/internal/os_support/unix/video_ascii/video.li
+++ b/lib/internal/os_support/unix/video_ascii/video.li
@@ -19,30 +19,30 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := VIDEO;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Generic Driver video - Text mode -";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr), Jerome Boutet (boutet at loria.fr)";
-
+
Section Inherit
-
+
+ parent_bitmap:Expanded BITMAP_ASCII;
-
+
Section Public
-
+
- is_active:BOOLEAN;
-
+
- create <-
- (
+ (
make (190,80);
is_active := TRUE;
);
-
+
- display_screen <-
(
0.to (height-1) do { y:INTEGER;
@@ -66,7 +66,7 @@ Section Public
'\n'.print;
};
);
-
+
- close <-
(
? {is_active};
diff --git a/lib/internal/os_support/windows/file_system/directory_unix.li b/lib/internal/os_support/windows/file_system/directory_unix.li
index 3bd6a15..713ebd1 100644
--- a/lib/internal/os_support/windows/file_system/directory_unix.li
+++ b/lib/internal/os_support/windows/file_system/directory_unix.li
@@ -19,18 +19,18 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=DIRECTORY_UNIX;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- bibliography:="http://IsaacOS.com";
-
+
- author :="Benoit Sonntag (bsonntag at loria.fr)";
-
+
- comment :="Directory management";
-
- - external :=
+
+ - external :=
`
#include <dirent.h>
#include <sys/stat.h>
@@ -39,40 +39,40 @@ Section Header
WIN32_FIND_DATA data;
HANDLE hfile;
`;
-
+
Section Inherit
-
+
+ parent_entry_unix:Expanded ENTRY_UNIX;
-
+
+ parent_directory:Expanded DIRECTORY;
-
+
Section Public
-
+
//
// Physical implementation.
//
-
+
//
// Scanning
//
- is_open:BOOLEAN <- ( list != NULL);
-
+
//
// Scanning
//
-
+
- open:BOOLEAN <-
( + p,n:NATIVE_ARRAY(CHARACTER);
+ new_entry:ENTRY;
+ result:BOOLEAN;
+ i:INTEGER;
-
+
(list = NULL).if {
list := LINKED_LIST(ENTRY).create;
} else {
list.clear;
};
-
+
string_tmp.copy path;
string_tmp.append "\\*.*";
p := string_tmp.to_external;
@@ -80,10 +80,10 @@ Section Public
(`hfile != INVALID_HANDLE_VALUE`:BOOLEAN{TRUE,FALSE}).if {
result := TRUE;
{
- n := `data.cFileName`:NATIVE_ARRAY(CHARACTER);
+ n := `data.cFileName`:NATIVE_ARRAY(CHARACTER);
string_tmp.clear;
i := 0;
- {n.item i = '\0'}.until_do {
+ {n.item i = '\0'}.until_do {
string_tmp.add_last (n.item i);
i := i + 1;
};
@@ -107,41 +107,41 @@ Section Public
};
result
);
-
+
Section DIRECTORY
-
+
- physical_get_entry new_path:ABSTRACT_STRING :ENTRY <-
// Same UNIX
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:ENTRY;
-
+
pe := new_path.to_external;
`#ifdef __MINGW_H
`;
- `{ struct stat t`;
- (`stat(@pe,&t)`:INTEGER = 0).if {
+ `{ struct stat t`;
+ (`stat(@pe,&t)`:INTEGER = 0).if {
(`S_ISDIR(t.st_mode)`:INTEGER = 0).if {
// File.
result := FILE_UNIX.clone;
} else {
// Directory.
result := DIRECTORY_UNIX.clone;
- };
+ };
result.set_path new_path;
alias.put result to (result.path); // with { (e1,e2:ABSTRACT_STRING); e1 ~=e2 };
};
`}`;
`#else
`;
- `{ struct stat64 t`;
- (`stat64(@pe,&t)`:INTEGER = 0).if {
+ `{ struct stat64 t`;
+ (`stat64(@pe,&t)`:INTEGER = 0).if {
(`S_ISDIR(t.st_mode)`:INTEGER = 0).if {
// File.
result := FILE_UNIX.clone;
} else {
// Directory.
result := DIRECTORY_UNIX.clone;
- };
+ };
result.set_path new_path;
alias.put result to (result.path); //with { (e1,e2:ABSTRACT_STRING); e1 ~=e2 };
};
@@ -150,7 +150,7 @@ Section DIRECTORY
`;
result
);
-
+
- physical_make_directory new_path:ABSTRACT_STRING :BOOLEAN <-
( + p:NATIVE_ARRAY(CHARACTER);
p := new_path.to_external;
@@ -162,7 +162,7 @@ Section DIRECTORY
( + p:NATIVE_ARRAY(CHARACTER);
+ stream:POINTER;
+ result:BOOLEAN;
-
+
p := new_path.to_external;
stream := `fopen((char*)@p,"w+b")`:POINTER;
(stream != NULL).if {
@@ -177,7 +177,7 @@ Section DIRECTORY
pa := p.to_external;
`remove(@pa)`:(INTEGER) = 0
);
-
+
- physical_move old_path:ABSTRACT_STRING to new_path:ABSTRACT_STRING :BOOLEAN <-
// Same UNIX
( + old_p,new_p:NATIVE_ARRAY(CHARACTER);
diff --git a/lib/internal/os_support/windows/file_system/entry_unix.li b/lib/internal/os_support/windows/file_system/entry_unix.li
index f89d4b3..55c8a10 100644
--- a/lib/internal/os_support/windows/file_system/entry_unix.li
+++ b/lib/internal/os_support/windows/file_system/entry_unix.li
@@ -19,116 +19,116 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ENTRY_UNIX;
- copyright := "2003-2008 Benoit Sonntag";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
- comment := "Entry ANSI C";
-
+
Section Inherit
-
+
+ parent_entry:Expanded ENTRY;
-
-Section Public
-
- - access:UINTEGER_16 <-
+
+Section Public
+
+ - access:UINTEGER_16 <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:UINTEGER_16;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
+ `{ struct stat t; stat(@pe,&t)`;
result := `t.st_mode`:UINTEGER_16 & 111_111_111b;
`}`;
result
);
-
- - access_time:TIME <-
+
+ - access_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_atime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_atime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
- - access_date:DATE <-
+
+ - access_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_atime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_atime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
- - update_time:TIME <-
+
+ - update_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_mtime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_mtime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
- - update_date:DATE <-
+
+ - update_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_mtime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_mtime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
+
- create_time:TIME <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:TIME;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_ctime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_ctime))`:POINTER;
result := to_time tt;
`}`;
result
);
-
+
- create_date:DATE <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ tt:POINTER;
+ result:DATE;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
- tt := `localtime(&(t.st_ctime))`:POINTER;
+ `{ struct stat t; stat(@pe,&t)`;
+ tt := `localtime(&(t.st_ctime))`:POINTER;
result := to_date tt;
`}`;
result
);
-
-Section Private
-
+
+Section Private
+
//
// Time / Date: Unix -> Lisaac
//
-
+
- to_date t:POINTER :DATE <-
( + result:DATE;
+ wd,md,m:UINTEGER_8;
+ y:UINTEGER_16;
-
+
y := `((struct tm *)@t)->tm_year`:UINTEGER_16 + 1900;
m := `((struct tm *)@t)->tm_mon` :UINTEGER_8 + 1;
md := `((struct tm *)@t)->tm_mday`:UINTEGER_8;
@@ -136,15 +136,15 @@ Section Private
(! wd.in_range 1 to 7).if { // Bug in UNIX ?
wd := 1;
};
- result := DATE.create (y,m,md,wd)
+ result := DATE.create (y,m,md,wd)
);
- to_time t:POINTER :TIME <-
(
- TIME.create
+ TIME.create
((`((struct tm *)@t)->tm_hour`:UINTEGER_8),
(`((struct tm *)@t)->tm_min` :UINTEGER_8),
(`((struct tm *)@t)->tm_sec` :UINTEGER_8),
0)
);
-
+
diff --git a/lib/internal/os_support/windows/file_system/file_system.li b/lib/internal/os_support/windows/file_system/file_system.li
index b92fd70..7a41d96 100644
--- a/lib/internal/os_support/windows/file_system/file_system.li
+++ b/lib/internal/os_support/windows/file_system/file_system.li
@@ -19,32 +19,32 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=FILE_SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment :="File System manager for Unix.";
-
+
- external := `#include <unistd.h>`; // For `getcwd'
-
-Section Inherit
-
+
+Section Inherit
+
+ parent_directory:DIRECTORY <-
- ( + cwd:NATIVE_ARRAY(CHARACTER);
+ ( + cwd:NATIVE_ARRAY(CHARACTER);
+ result:DIRECTORY;
-
+
DIRECTORY.string_tmp.clear;
cwd := DIRECTORY.string_tmp.to_external;
`getcwd(@cwd,255)`;
DIRECTORY.string_tmp.from_external cwd;
-
+
result ?= DIRECTORY_UNIX.physical_get_entry (DIRECTORY.string_tmp);
DIRECTORY.alias.put result to (result.path);
? {result != NULL};
parent_directory := result
);
-
-
+
+
diff --git a/lib/internal/os_support/windows/file_system/file_unix.li b/lib/internal/os_support/windows/file_system/file_unix.li
index 6ebe4d8..d6968f6 100644
--- a/lib/internal/os_support/windows/file_system/file_unix.li
+++ b/lib/internal/os_support/windows/file_system/file_unix.li
@@ -19,102 +19,102 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FILE_UNIX;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "File management";
-
+
Section Inherit
-
+
+ parent_entry_unix:Expanded ENTRY_UNIX;
-
+
+ parent_file:Expanded FILE;
-
-Section Private
-
+
+Section Private
+
+ stream:POINTER; // Unix file pointer (FILE *).
Section Public
-
+
//
// Physical implementation.
//
-
+
- is_open:BOOLEAN <- stream != NULL;
-
+
- size:UINTEGER_32 <-
( + pe:NATIVE_ARRAY(CHARACTER);
+ result:UINTEGER_32;
pe := path.to_external;
- `{ struct stat t; stat(@pe,&t)`;
+ `{ struct stat t; stat(@pe,&t)`;
result := `t.st_size`:UINTEGER_32;
`}`;
result
);
-
+
- cursor:UINTEGER_32 <-
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`ftell((FILE *)@str)`:UINTEGER_32
);
-
+
- set_cursor n:UINTEGER_32 <-
[
...
-? {stream != NULL};
-? {n <= size};
]
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`fseek((FILE*)(@str), at n,SEEK_SET)`;
- );
-
+ );
+
- open:BOOLEAN <-
[
-? {stream = NULL};
]
- ( + pa:NATIVE_ARRAY(CHARACTER);
-
+ ( + pa:NATIVE_ARRAY(CHARACTER);
+
pa := path.to_external;
- stream := `fopen((char*)@pa,"r+b")`:(POINTER);
+ stream := `fopen((char*)@pa,"r+b")`:(POINTER);
stream != NULL
- );
+ );
- open_read_only:BOOLEAN <-
- ( + pa:NATIVE_ARRAY(CHARACTER);
+ ( + pa:NATIVE_ARRAY(CHARACTER);
pa := path.to_external;
- stream := `fopen((char*)@path_pointer,"rb")`:(POINTER);
+ stream := `fopen((char*)@path_pointer,"rb")`:(POINTER);
stream != NULL
- );
-
+ );
+
- close <-
[
-? {stream != NULL};
]
( + str:POINTER;
-
- str := stream;
- `fclose((FILE*)(@str))`;
+
+ str := stream;
+ `fclose((FILE*)(@str))`;
stream := NULL;
);
-
-Section FILE
-
+
+Section FILE
+
- physical_read buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
// return size read or 0 if end of input (-1 on error => exception ?)
- ( + str:POINTER;
- str := stream;
+ ( + str:POINTER;
+ str := stream;
`fread((void *)(@buf),(size_t)(1), (size_t)(@s),(FILE*)(@str))`:(INTEGER)
);
-
+
- physical_write buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
// return size read or 0 if end of input (-1 on error => exception ?)
( + str:POINTER;
- str := stream;
+ str := stream;
`fwrite((void *)(@buf),(size_t)(1), (size_t)(@s),(FILE*)(@str))`:(INTEGER)
);
-
-
+
+
diff --git a/lib/internal/os_support/windows/video/event_system.li b/lib/internal/os_support/windows/video/event_system.li
index 94f8e7c..201bde2 100644
--- a/lib/internal/os_support/windows/video/event_system.li
+++ b/lib/internal/os_support/windows/video/event_system.li
@@ -19,18 +19,18 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EVENT_SYSTEM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "X11 - Event System";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
-
- - external :=
-`
+
+ - external :=
+`
void (*get_event)()=NULL;
int event_num;
int event_p1;
@@ -40,9 +40,9 @@ int event_p4;
unsigned char buf[50];
-HDC hdc_glob;
+HDC hdc_glob;
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
+{
PAINTSTRUCT ps;
HDC hdc_old;
RECT rect;
@@ -54,9 +54,9 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
get_event();
return 0;
// Create
- case WM_CREATE:
+ case WM_CREATE:
return 0;
-
+
// Repaint
case WM_PAINT:
event_num = 0;
@@ -65,18 +65,18 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
event_p1 = ps.rcPaint.left;
event_p2 = ps.rcPaint.top;
event_p3 = ps.rcPaint.right;
- event_p4 = ps.rcPaint.bottom;
- get_event();
+ event_p4 = ps.rcPaint.bottom;
+ get_event();
EndPaint(hwnd, &ps);
hdc_glob = hdc_old;
return 0;
-
+
// Destroy
case WM_DESTROY:
PostQuitMessage(0);
exit(0);
return 0;
-
+
// Mouse
case WM_MOUSEMOVE:
event_num = 1;
@@ -89,7 +89,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
event_num = 2;
get_event();
return 0;
- case WM_LBUTTONUP:
+ case WM_LBUTTONUP:
event_num = 3;
get_event();
return 0;
@@ -97,13 +97,13 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
event_num = 4;
get_event();
return 0;
- case WM_RBUTTONUP:
+ case WM_RBUTTONUP:
event_num = 5;
get_event();
return 0;
-
+
// Kayboard
- case WM_KEYDOWN:
+ case WM_KEYDOWN:
//sprintf(buf,"KeyDown : %c(%d) ,%lx ",wParam,wParam,lParam);
//TextOutA(hdc_glob,10,100,buf,strlen(buf));
event_num = 10;
@@ -111,7 +111,7 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
event_p2 = lParam;
get_event();
return 0;
-
+
case WM_CHAR:
//sprintf(buf,"Char : %c(%d) ,%lx ",wParam,wParam,lParam);
//TextOutA(hdc_glob,10,120,buf,strlen(buf));
@@ -120,8 +120,8 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
event_p2 = lParam;
get_event();
return 0;
-
- case WM_KEYUP:
+
+ case WM_KEYUP:
//sprintf(buf,"KeyUp : %c(%d) ,%lx ",wParam,wParam,lParam);
//TextOutA(hdc_glob,10,140,buf,strlen(buf));
event_num = 12;
@@ -137,19 +137,19 @@ LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
`;
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
-Section Interrupt
-
+
+Section Interrupt
+
- get_physical_event <-
( + p1,p2,p3,p4:INTEGER;
-
+
p1 := `event_p1`:INTEGER;
p2 := `event_p2`:INTEGER;
p3 := `event_p3`:INTEGER;
p4 := `event_p4`:INTEGER;
-
+
`event_num`:INTEGER
//
// Event Window
@@ -199,22 +199,22 @@ Section Interrupt
TIMER.get_event;
};
);
-
-Section Public
-
+
+Section Public
+
- sleep n:INTEGER <-
// Milisecond
(
`sleep(@n)`;
);
-
- - make <-
+
+ - make <-
( + ptr:POINTER;
-
+
ptr := get_physical_event;
`get_event = @ptr`;
);
-
+
- get_event <-
(
`
@@ -223,8 +223,8 @@ Section Public
DispatchMessage(&msg_glob);
`;
);
-
-
+
+
diff --git a/lib/internal/os_support/windows/video/keyboard.li b/lib/internal/os_support/windows/video/keyboard.li
index 9dc38d6..dfd2195 100644
--- a/lib/internal/os_support/windows/video/keyboard.li
+++ b/lib/internal/os_support/windows/video/keyboard.li
@@ -23,28 +23,28 @@ Section Header
+ name := KEYBOARD;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Windows (Win32) - RSXNT - Keyboard Driver";
- - version := 2;
-
+ - version := 2;
+
Section Inherit
+ parent_input_keyboard:Expanded INPUT_KEYBOARD;
Section Private
-
+
- keyup cu:UINTEGER_8 :UINTEGER_8 <-
( + result:UINTEGER_8;
-
+
result := cu;
- cmd := cmd & 0F7h; // Deactivate the cmd bit
-
+ cmd := cmd & 0F7h; // Deactivate the cmd bit
+
cu
.when 8 then { cmd := cmd | 8; }
.when 13 then { cmd := cmd | 8; };
-
-
+
+
result
);
@@ -63,10 +63,10 @@ Section Private
.when 4Bh then { result := 'L'.to_uinteger_8; }
.when 4Dh then { result := 'R'.to_uinteger_8; };
cmd := cmd | 8;
-
+
result
);
-
+
diff --git a/lib/internal/os_support/windows/video/mouse.li b/lib/internal/os_support/windows/video/mouse.li
index 1af2510..2d4a708 100644
--- a/lib/internal/os_support/windows/video/mouse.li
+++ b/lib/internal/os_support/windows/video/mouse.li
@@ -19,82 +19,82 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := MOUSE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "X11 - Mouse driver";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Benoit Sonntag (bsonntag at loria.fr)";
-
+
Section Inherit
-
+
+ parent_input:Expanded INPUT;
-
+
Section Public
-
+
- set (x,y:INTEGER) with (left_new,right_new:BOOLEAN) <-
( + tmp:UINTEGER_8;
+ x_new, y_new:INTEGER;
-
+
y_new := y.max y_minimum.min y_maximum;
x_new := x.max x_minimum.min x_maximum;
-
+
tmp:=(p_end+1)&003h;
buffer_event.item p_end.make (x_new,y_new) button (left_new,right_new);
(((tmp+2)&3)!=p_beg).if {
p_end:=tmp;
};
-
+
get_event;
-
+
// Update status.
x_current:=x_new;
y_current:=y_new;
right:=right_new;
- left :=left_new;
+ left :=left_new;
);
-
+
Section Public
-
+
+ x_minimum:INTEGER;
+ x_maximum:INTEGER;
-
+
+ y_minimum:INTEGER;
+ y_maximum:INTEGER;
-
+
+ x_current:INTEGER;
- + y_current:INTEGER;
-
+ + y_current:INTEGER;
+
+ right:BOOLEAN;
+ left:BOOLEAN;
-
+
Section Private
-
+
+ buffer_event:FAST_ARRAY(EVENT_MOUSE);
- p_beg:UINTEGER_8; // Pointer on the buffer (beginning)
- p_end:UINTEGER_8; // Pointer on the buffer (end)
-
+
Section Public
-
+
//
// Creation / Initialisation.
//
-
+
- make <-
( + new_event:EVENT_MOUSE;
-
+
is_actif := TRUE;
//
// Mouse hardware configuration.
//
-
+
x_maximum := VIDEO.x_max;
y_maximum := VIDEO.y_max;
-
+
//
// Software configuration.
//
@@ -108,28 +108,28 @@ Section Public
};
buffer_event.first.set_prev new_event;
);
-
+
- get_event <-
( + p:INTEGER;
+ evt:EVENT_MOUSE;
-
+
p := p_beg;
{ p != p_end }.while_do {
evt := buffer_event.item p;
(list_client.lower).to (list_client.upper) do { j:INTEGER;
list_client.item j.receive (buffer_event.item p);
- };
+ };
p := (p + 1) & 03h;
- };
+ };
);
-
+
- acknowledge <-
(
p_beg := (p_beg+1) & 03h;
);
-
-
-
+
+
+
diff --git a/lib/internal/os_support/windows/video/timer.li b/lib/internal/os_support/windows/video/timer.li
index ccb93a5..d22d170 100644
--- a/lib/internal/os_support/windows/video/timer.li
+++ b/lib/internal/os_support/windows/video/timer.li
@@ -26,41 +26,41 @@ Section Header
- comment :="Windows - Timer management.";
- - version := 1;
-
-Section Inherit
-
+ - version := 1;
+
+Section Inherit
+
+ parent_input:Expanded INPUT;
-
+
Section Private
-
+
- timer_count:UINTEGER_32;
-
+
+ buffer_event:FAST_ARRAY(EVENT_TIMER);
-
+
- p_beg:UINTEGER_8; // Pointer on the buffer (beginning)
-
+
- p_end:UINTEGER_8; // Pointer on the buffer (end)
-
-Section Public
-
- - timer_interrupt <-
- ( + tmp:UINTEGER_8;
-
+
+Section Public
+
+ - timer_interrupt <-
+ ( + tmp:UINTEGER_8;
+
timer_count := timer_count + 1;
-
+
tmp:=(p_end+1)&003h;
- buffer_event.item p_end.make timer_count;
+ buffer_event.item p_end.make timer_count;
(((tmp+2)&3)!=p_beg).if {
p_end:=tmp;
- };
+ };
);
-
+
Section Public
- make <-
( + new_event:EVENT_TIMER;
-
+
is_actif := TRUE;
//
// Software configuration.
@@ -74,9 +74,9 @@ Section Public
};
};
buffer_event.first.set_prev new_event;
-
- //hdle := timer_interrupt;
-
+
+ //hdle := timer_interrupt;
+
`SetTimer(hwnd_glob, 0, 50, NULL)`;
);
@@ -88,13 +88,13 @@ Section Public
- get_event <-
( + p:INTEGER;
+ evt:EVENT_TIMER;
-
+
p := p_beg;
{ p != p_end }.while_do {
evt := buffer_event.item p;
(list_client.lower).to (list_client.upper) do { j:INTEGER;
list_client.item j.receive (buffer_event.item p);
- };
+ };
p := (p + 1) & 03h;
- };
+ };
);
diff --git a/lib/internal/os_support/windows/video/video.li b/lib/internal/os_support/windows/video/video.li
index 19ae932..ae80046 100644
--- a/lib/internal/os_support/windows/video/video.li
+++ b/lib/internal/os_support/windows/video/video.li
@@ -19,11 +19,11 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := VIDEO;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Video Driver for Windows";
- lip <-
@@ -31,12 +31,12 @@ Section Header
add_lib "-lgdi32";
);
- - external :=
+ - external :=
`
#include <windows.h>
#define main main_std
-#define __BEGIN_INTERRUPT__
+#define __BEGIN_INTERRUPT__
#define __END_INTERRUPT__
#define lstat stat
@@ -59,38 +59,38 @@ LPSTR lpCmdLine, int nCmdShow)
nCmdShow_glob = nCmdShow;
main(0,NULL);
return 0;
-};
+};
`;
Section Inherit
-
+
+ parent_bitmap:Expanded BITMAP(PIXEL_24);
-
+
Section Public
// Section VIDEO
-
- - line_tmp:ABSTRACT_BMP_LINE;
-
+
+ - line_tmp:ABSTRACT_BMP_LINE;
+
Section Public
-
+
- message str:ABSTRACT_STRING <-
( + msg:NATIVE_ARRAY(CHARACTER);
msg := str.to_external;
`MessageBox(hwnd_glob, at msg, "Message", MB_OK)`;
);
-
+
- is_active:BOOLEAN;
-
- - planes:UINTEGER_32;
-
+
+ - planes:UINTEGER_32;
+
- size_pixel:INTEGER;
-
+
- make_size (w,h:INTEGER) <-
- (
+ (
// Init BITMAP:
width := w;
height := h;
-
+
EVENT_SYSTEM.make;
`
wc_glob.style = 0;
@@ -112,14 +112,14 @@ Section Public
hdc_glob = GetDC(hwnd_glob);
ShowWindow(hwnd_glob, nCmdShow_glob);
UpdateWindow(hwnd_glob);
-
+
//pen = CreatePen(PS_SOLID,1,0x151515);
//SelectObject(hdc_glob,pen);
-
-
+
+
hdcbmp = CreateCompatibleDC(hdc_glob);
`;
-
+
planes := `GetDeviceCaps(hdc_glob, BITSPIXEL) * GetDeviceCaps(hdc_glob, PLANES)`:UINTEGER_32;
planes
@@ -128,49 +128,49 @@ Section Public
line_tmp := BMP_LINE(PIXEL_15).create w;
`Bmp = CreateBitmap(@w, 1, 1, 15, NULL)`;
}
- .when 16 then {
+ .when 16 then {
size_pixel := 2;
- line_tmp := BMP_LINE(PIXEL_16).create w;
+ line_tmp := BMP_LINE(PIXEL_16).create w;
`Bmp = CreateBitmap(@w, 1, 1, 16, NULL)`;
}
- .when 24 then {
+ .when 24 then {
size_pixel := 3;
- line_tmp := BMP_LINE(PIXEL_24).create w;
+ line_tmp := BMP_LINE(PIXEL_24).create w;
`Bmp = CreateBitmap(@w, 1, 1, 24, NULL)`;
}
- .when 32 then {
+ .when 32 then {
size_pixel := 4;
- line_tmp := BMP_LINE(PIXEL_32).create w;
+ line_tmp := BMP_LINE(PIXEL_32).create w;
`Bmp = CreateBitmap(@w, 1, 1, 32, NULL)`;
};
`SelectObject(hdcbmp, Bmp)`;
is_active := TRUE;
);
-
+
- auto_make <-
(
make_size (800,600);
);
-
+
- close <-
(
? {is_active};
is_active := FALSE;
? {! is_active};
);
-
+
Section Public
-
- //
+
+ //
// Redefine Low level Bitmap.
//
-
+
- pixel_hard (x,y:INTEGER) color col:UINTEGER_32 <-
( + real_col:UINTEGER_32;
real_col := ((col>>16) & 0000FFh) | ((col<<16) & 0FF0000h) | (col & 00FF00h);
- `SetPixel(hdc_glob, at x, at y, at real_col)`;
+ `SetPixel(hdc_glob, at x, at y, at real_col)`;
);
-
+
- line_h_hard (x0,y0:INTEGER) until x1:INTEGER color col:UINTEGER_32 <-
( + real_col:UINTEGER_32;
+ pen:UINTEGER_32;
@@ -181,21 +181,21 @@ Section Public
`LineTo(hdc_glob, at x1+1, at y0)`;
`DeleteObject((HPEN)@pen)`;
);
-
- - line_h_hard (x0,y0:INTEGER) until x1:INTEGER
+
+ - line_h_hard (x0,y0:INTEGER) until x1:INTEGER
image line:ABSTRACT_BMP_LINE offset ofs:INTEGER <-
( + len:INTEGER;
+ data:NATIVE_ARRAY(UINTEGER_8);
+ sz_pix:INTEGER;
len := x1 - x0;
VIDEO.line_tmp.put line offset ofs from 0 to len;
-
+
sz_pix := VIDEO.size_pixel;
data := VIDEO.line_tmp.get_storage;
- `SetBitmapBits(Bmp,(@len+1)*@sz_pix, at data)`;
+ `SetBitmapBits(Bmp,(@len+1)*@sz_pix, at data)`;
`BitBlt(hdc_glob, @x0, @y0, at len+1,1, hdcbmp, 0, 0, SRCCOPY)`;
);
-
+
- get_pixel_hard (x,y:INTEGER) :PIXEL <-
(
not_yet_implemented;
diff --git a/lib/internal/portable/collection/any_avl_dictionary_node.li b/lib/internal/portable/collection/any_avl_dictionary_node.li
index 19f94fd..e071b9b 100644
--- a/lib/internal/portable/collection/any_avl_dictionary_node.li
+++ b/lib/internal/portable/collection/any_avl_dictionary_node.li
@@ -19,13 +19,13 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ANY_AVL_DICTIONARY_NODE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
+
diff --git a/lib/internal/portable/collection/any_avl_set_node.li b/lib/internal/portable/collection/any_avl_set_node.li
index 813da61..e4d996e 100644
--- a/lib/internal/portable/collection/any_avl_set_node.li
+++ b/lib/internal/portable/collection/any_avl_set_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/any_hashed_bijective_dictionary_node.li b/lib/internal/portable/collection/any_hashed_bijective_dictionary_node.li
index af0abfc..b79665f 100644
--- a/lib/internal/portable/collection/any_hashed_bijective_dictionary_node.li
+++ b/lib/internal/portable/collection/any_hashed_bijective_dictionary_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/any_hashed_dictionary_node.li b/lib/internal/portable/collection/any_hashed_dictionary_node.li
index 1b29794..70698ed 100644
--- a/lib/internal/portable/collection/any_hashed_dictionary_node.li
+++ b/lib/internal/portable/collection/any_hashed_dictionary_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/any_hashed_set_node.li b/lib/internal/portable/collection/any_hashed_set_node.li
index cf89429..b3d4a4b 100644
--- a/lib/internal/portable/collection/any_hashed_set_node.li
+++ b/lib/internal/portable/collection/any_hashed_set_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/any_linked_list_node.li b/lib/internal/portable/collection/any_linked_list_node.li
index db279c0..e839bef 100644
--- a/lib/internal/portable/collection/any_linked_list_node.li
+++ b/lib/internal/portable/collection/any_linked_list_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/any_two_way_linked_list_node.li b/lib/internal/portable/collection/any_two_way_linked_list_node.li
index fac74bb..9f0a135 100644
--- a/lib/internal/portable/collection/any_two_way_linked_list_node.li
+++ b/lib/internal/portable/collection/any_two_way_linked_list_node.li
@@ -24,8 +24,7 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
\ No newline at end of file
diff --git a/lib/internal/portable/collection/arrayed_collection.li b/lib/internal/portable/collection/arrayed_collection.li
index 5b3356b..082e834 100644
--- a/lib/internal/portable/collection/arrayed_collection.li
+++ b/lib/internal/portable/collection/arrayed_collection.li
@@ -120,15 +120,15 @@ Section Public
- reverse <-
( + i,j:INTEGER;
-
+
i := lower;
- j := upper;
+ j := upper;
{i >= j}.until_do {
swap i with j;
i := i + 1;
j := j - 1;
};
- );
+ );
//
// Interfacing with C:
diff --git a/lib/internal/portable/collection/avl_constants.li b/lib/internal/portable/collection/avl_constants.li
index 8e77d3d..a636d7a 100644
--- a/lib/internal/portable/collection/avl_constants.li
+++ b/lib/internal/portable/collection/avl_constants.li
@@ -24,13 +24,13 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
Section SELF
-
+
- balanced:INTEGER := 0;
- imbalanced_left:INTEGER := -1;
diff --git a/lib/internal/portable/collection/avl_dictionary_node.li b/lib/internal/portable/collection/avl_dictionary_node.li
index ab49e46..ec45c54 100644
--- a/lib/internal/portable/collection/avl_dictionary_node.li
+++ b/lib/internal/portable/collection/avl_dictionary_node.li
@@ -24,23 +24,23 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Auxiliary class to implement AVL_DICTIONARY.";
-
+
Section Inherit
-
+
+ parent_avl_tree_node:Expanded AVL_TREE_NODE(K);
-
+
- parent_any_avl_dictionary_node:ANY_AVL_DICTIONARY_NODE := ANY_AVL_DICTIONARY_NODE;
-
+
Section Public
-
+
- key:K <- item;
-
+
- set_key i:K <- set_item i;
-
+
Section AVL_DICTIONARY, AVL_DICTIONARY_NODE
-
+
+ value:V;
- set_value v:V <-
@@ -54,7 +54,7 @@ Section AVL_DICTIONARY, AVL_DICTIONARY_NODE
- fast_at k:K :AVL_DICTIONARY_NODE(V, K) <-
// Is element `e' in the tree?
( + result:AVL_DICTIONARY_NODE(V, K);
-
+
(key = k).if {
result := Self;
}.elseif {key == k /*SAFE_EQUAL(K).test key and k*/} then {
@@ -63,7 +63,7 @@ Section AVL_DICTIONARY, AVL_DICTIONARY_NODE
}.elseif {k < key} then {
(left != NULL).if {
result := left.fast_at k;
- };
+ };
} else {
(right != NULL).if {
result := right.fast_at k;
@@ -84,7 +84,7 @@ Section AVL_DICTIONARY, AVL_DICTIONARY_NODE
- key_at v:V :K <-
( + result:K;
-
+
(v == value /*SAFE_EQUAL(V).test v and value*/).if {
result := key;
}.elseif {left != NULL} then {
@@ -97,19 +97,19 @@ Section AVL_DICTIONARY, AVL_DICTIONARY_NODE
- fast_key_at v:V :K <-
( + result:K;
-
+
(v = value).if {
result := key;
}.elseif {left != NULL} then {
- result := left.fast_key_at v;
+ result := left.fast_key_at v;
}.elseif {right != NULL} then {
result := right.fast_key_at v;
};
result
);
-
+
Section AVL_DICTIONARY_NODE
-
+
- occurrences v:V start cnt:INTEGER :INTEGER <-
( + result:INTEGER;
@@ -152,15 +152,15 @@ Section AVL_DICTIONARY
//
// Creation:
//
-
+
- create (v:V,k:K) :SELF <-
( + result:SELF;
-
+
result := clone;
result.make (v,k);
result
);
-
+
- make (v:V,k:K) <-
(
set_balance balanced;
diff --git a/lib/internal/portable/collection/avl_set_node.li b/lib/internal/portable/collection/avl_set_node.li
index bcdecdc..5441356 100644
--- a/lib/internal/portable/collection/avl_set_node.li
+++ b/lib/internal/portable/collection/avl_set_node.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := AVL_SET_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Auxiliary class to implement AVL_SET.";
-
+
// This a classic implementation of an AVL tree (balanced tree first
// designed by Adelson-Velskii and Landis, 1960)
-
+
Section Inherit
-
+
+ parent_avl_tree_node:Expanded AVL_TREE_NODE(V);
-
+
- parent_any_avl_set_node:ANY_AVL_SET_NODE := ANY_AVL_SET_NODE;
Section AVL_SET
-
+
//
// Creation:
//
-
+
- create i:V :SELF <-
( + result:SELF;
-
+
result := clone;
result.make i;
result
);
-
+
- make i:V <-
(
set_balance balanced;
@@ -60,6 +60,6 @@ Section AVL_SET
[
+? {item = i};
];
-
+
diff --git a/lib/internal/portable/collection/avl_tree.li b/lib/internal/portable/collection/avl_tree.li
index c52cd7c..2ed1b84 100644
--- a/lib/internal/portable/collection/avl_tree.li
+++ b/lib/internal/portable/collection/avl_tree.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := AVL_TREE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
// Definition of a mathematical set of comparable objects. All common
// operations on mathematical sets are available.
Section Insert
-
+
- parent_avl_constants:AVL_CONSTANTS := AVL_CONSTANTS;
Section Public
-
+
- debug_string:STRING <-
( + result:STRING;
-
+
(root = NULL).if {
result := "NULL";
} else {
@@ -48,13 +48,13 @@ Section Public
);
+ count:INTEGER;
-
+
Section Public
-
+
//
// Adding and removing:
//
-
+
- remove e:V <-
(
root := do_remove (root, e);
@@ -66,7 +66,7 @@ Section Public
);
Section SELF
-
+
+ root:AVL_TREE_NODE(V);
+ rebalance:BOOLEAN;
@@ -85,7 +85,7 @@ Section SELF
- fast_do_insert n:AVL_TREE_NODE(V) :AVL_TREE_NODE(V) <-
( + result:AVL_TREE_NODE(V);
-
+
(n = NULL).if {
result := new_node;
set_value_and_key result;
@@ -104,7 +104,7 @@ Section SELF
result := n;
};
} else {
- ? {item_memory > n.item};
+ ? {item_memory > n.item};
n.set_right (do_insert (n.right));
(rebalance).if {
result := right_grown n;
@@ -122,7 +122,7 @@ Section SELF
- do_insert n:AVL_TREE_NODE(V) :AVL_TREE_NODE(V) <-
( + result:AVL_TREE_NODE(V);
-
+
(n = NULL).if {
result := new_node;
set_value_and_key result;
@@ -144,7 +144,7 @@ Section SELF
result := n;
};
} else {
- ? {item_memory == n.item};
+ ? {item_memory == n.item};
result := n;
set_value result;
rebalance := FALSE;
@@ -164,7 +164,7 @@ Section SELF
-? {node_height (n.right) - node_height (n.left) + 1 = n.balance};
]
( + result:AVL_TREE_NODE(V);
-
+
(n.balance)
.when imbalanced_left then {
(n.left.balance = imbalanced_left).if {
@@ -205,7 +205,7 @@ Section SELF
+? {Result != NULL};
+? {Result.balance = node_height (Result.right) - node_height (Result.left)};
+? {
- rebalance = (node_height Result > 1 +
+ rebalance = (node_height Result > 1 +
Old node_height (n.right).max (node_height (n.left) - 1))
};
];
@@ -217,7 +217,7 @@ Section SELF
-? {node_height (n.right) - 1 - node_height (n.left) = n.balance};
]
( + result:AVL_TREE_NODE(V);
-
+
(n.balance)
.when imbalanced_right then {
(n.right.balance = imbalanced_right).if {
@@ -237,7 +237,7 @@ Section SELF
n.set_balance balanced;
n.right.set_balance imbalanced_right;
};
-
+
n.right.left.set_balance balanced;
n.set_right (n.right.rotate_right);
};
@@ -259,14 +259,14 @@ Section SELF
+? {Result != NULL};
+? {Result.balance = node_height (Result.right) - node_height (Result.left)};
+? {
- rebalance = (node_height Result > 1 +
+ rebalance = (node_height Result > 1 +
Old node_height (n.left).max (node_height (n.right) - 1))
};
];
- fast_do_remove (n:AVL_TREE_NODE(V),e:V) :AVL_TREE_NODE(V) <-
( + result:AVL_TREE_NODE(V);
-
+
(n = NULL).if {
rebalance := FALSE;
}.elseif {e = n.item} then {
@@ -292,7 +292,7 @@ Section SELF
result := n;
};
} else {
- ? {e > n.item};
+ ? {e > n.item};
n.set_right (do_remove (n.right, e));
(rebalance).if {
result := right_shrunk n;
@@ -303,7 +303,7 @@ Section SELF
result
)
[
- +? {Result = NULL ||
+ +? {Result = NULL ||
{Result.balance = node_height (Result.right) - node_height (Result.left)}
};
+? {rebalance = (node_height Result < Old node_height n)};
@@ -311,7 +311,7 @@ Section SELF
- do_remove (n:AVL_TREE_NODE(V),e:V) :AVL_TREE_NODE(V) <-
( + result:AVL_TREE_NODE(V);
-
+
(n = NULL).if {
rebalance := FALSE;
}.elseif {e < n.item} then {
@@ -356,7 +356,7 @@ Section SELF
-? {n2 != NULL};
]
( + result:AVL_TREE_NODE(V);
-
+
(n2.right = NULL).if {
result := n2.left;
exchange_and_discard (n1, n2);
@@ -371,7 +371,7 @@ Section SELF
result
)
[
- +? {Result = NULL ||
+ +? {Result = NULL ||
{Result.balance = node_height (Result.right) - node_height (Result.left)}};
+? {rebalance = (node_height Result < Old node_height n2)};
];
@@ -383,7 +383,7 @@ Section SELF
-? {node_height (n.right) - node_height (n.left) - 1 = n.balance};
]
( + result:AVL_TREE_NODE(V);
-
+
(n.balance)
.when imbalanced_left then {
n.set_balance balanced;
@@ -410,7 +410,7 @@ Section SELF
n.set_balance imbalanced_left;
n.right.set_balance balanced;
};
-
+
n.right.left.set_balance balanced;
n.set_right (n.right.rotate_right);
}
@@ -427,10 +427,10 @@ Section SELF
};
result
)
- [
+ [
+? {Result != NULL};
+? {Result.balance = node_height (Result.right) - node_height (Result.left)};
- +? {rebalance = (node_height Result < 1 +
+ +? {rebalance = (node_height Result < 1 +
Old node_height (n.right).max (node_height (n.left) + 1))};
];
@@ -441,7 +441,7 @@ Section SELF
-? {node_height (n.right) + 1 - node_height (n.left) = n.balance};
]
( + result:AVL_TREE_NODE(V);
-
+
(n.balance)
.when imbalanced_right then {
n.set_balance balanced;
@@ -467,7 +467,7 @@ Section SELF
.when imbalanced_left then {
n.set_balance imbalanced_right;
n.left.set_balance balanced;
- };
+ };
n.left.right.set_balance balanced;
n.set_left (n.left.rotate_left);
}
@@ -487,7 +487,7 @@ Section SELF
[
+? {Result != NULL};
+? {Result.balance = node_height (Result.right) - node_height (Result.left)};
- +? {rebalance = (node_height Result < 1 +
+ +? {rebalance = (node_height Result < 1 +
Old node_height (n.left).max (node_height (n.right) + 1))};
];
@@ -504,7 +504,7 @@ Section SELF
+? {count = Old count - 1};
+? {rebalance};
];
-
+
- clear_nodes node:AVL_TREE_NODE(V) <-
(
(node.left != NULL).if {
@@ -518,19 +518,19 @@ Section SELF
- node_height node:AVL_TREE_NODE(V) :INTEGER <-
( + result:INTEGER;
-
+
(node != NULL).if {
result := node.height;
};
result
);
-
-Section Public
-
+
+Section Public
+
//
// Looking and searching:
//
-
+
- has e:V :BOOLEAN <-
// Is element `e' in the set?
(
@@ -544,11 +544,11 @@ Section Public
);
Section SELF
-
+
//
// Iterating internals:
//
-
+
- build_map <-
[
"build_needed" -? {map_dirty};
@@ -568,13 +568,13 @@ Section SELF
// Elements in a row for iteration. See `build_map'.
+ map_dirty:BOOLEAN;
- // True when the map needs to be built again for the iterators.
+ // True when the map needs to be built again for the iterators.
// See `build_map'.
Section SELF
-
+
- new_node:AVL_TREE_NODE(V) <-
- (
+ (
a_new_node
);
@@ -583,7 +583,7 @@ Section SELF
deferred;
NULL
);
-
+
- discard_node n:AVL_TREE_NODE(V) <-
[
-? {n != NULL};
@@ -591,11 +591,11 @@ Section SELF
(
deferred;
);
-
- //
+
+ //
// invariant
//
-
+
// [
// -? {map != NULL};
// -? {(! map_dirty) -> (map.count = count)};
diff --git a/lib/internal/portable/collection/avl_tree_node.li b/lib/internal/portable/collection/avl_tree_node.li
index ac08fc3..485e159 100644
--- a/lib/internal/portable/collection/avl_tree_node.li
+++ b/lib/internal/portable/collection/avl_tree_node.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := AVL_TREE_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Auxiliary class to implement AVL_SET.";
-
- // This a classic implementation of an AVL tree (balanced tree first designed
+
+ // This a classic implementation of an AVL tree (balanced tree first designed
// by Adelson-Velskii and Landis (hence A.V.L.), 1960)
Section Insert
-
+
- parent_avl_constants:AVL_CONSTANTS := AVL_CONSTANTS;
Section Public
-
+
- out_in_tagged_out_memory <-
(
item.out_in_tagged_out_memory;
@@ -54,9 +54,9 @@ Section Public
tagged_out_memory.add_last ')';
);
-Section Public
+Section Public
//AVL_TREE_NODE, AVL_TREE
-
+
+ left:AVL_TREE_NODE(V);
+ right:AVL_TREE_NODE(V);
@@ -70,7 +70,7 @@ Section Public
- count:INTEGER <-
( + result:INTEGER;
-
+
result := 1;
(left != NULL).if {
result := result + left.count;
@@ -83,7 +83,7 @@ Section Public
- height:INTEGER <-
( + result:INTEGER;
-
+
(left != NULL).if {
result := left.height;
};
@@ -101,7 +101,7 @@ Section Public
(left != NULL).if {
left.map_in map;
};
- map.add_last Self;
+ map.add_last Self;
(right != NULL).if {
right.map_in map;
};
@@ -113,7 +113,7 @@ Section Public
- has e:V :BOOLEAN <-
// Is element `e' in the tree?
( + result:BOOLEAN;
-
+
result := item == e; //SAFE_EQUAL(V).test item and e;
(! result).if {
(e < item).if {
@@ -123,12 +123,12 @@ Section Public
};
};
result
- );
+ );
- fast_has e:V :BOOLEAN <-
// Is element `e' in the tree?
( + result:BOOLEAN;
-
+
result := item = e;
((! result) && {! item == e /*SAFE_EQUAL(V).test item and e*/}).if {
(e < item).if {
@@ -146,7 +146,7 @@ Section Public
- at e:V :AVL_TREE_NODE(V) <-
// Is element `e' in the tree?
( + result:AVL_TREE_NODE(V);
-
+
(item == e /*SAFE_EQUAL(V).test item and e*/).if {
result := Self;
}.elseif {e < item} then {
@@ -206,16 +206,16 @@ Section Public
];
Section AVL_TREE, AVL_DICTIONARY, AVL_SET
-
+
//
// Rotations:
//
-
+
- rotate_right:AVL_TREE_NODE(V) <-
// Proceeds to some reorganisation and returns the upper node.
( + result:AVL_TREE_NODE(V);
+ left_right:AVL_TREE_NODE(V);
-
+
result := left;
left_right := left.right;
left.set_right Self;
@@ -230,14 +230,14 @@ Section AVL_TREE, AVL_DICTIONARY, AVL_SET
// Proceeds to some reorganisation and returns the upper node.
( + result:AVL_TREE_NODE(V);
+ right_left:AVL_TREE_NODE(V);
-
+
result := right;
right_left := right.left;
- right.set_left Self;
+ right.set_left Self;
set_right right_left;
result
- )
+ )
[
+? {Result != NULL};
];
-
+
diff --git a/lib/internal/portable/collection/collection.li b/lib/internal/portable/collection/collection.li
index df27586..83aea61 100644
--- a/lib/internal/portable/collection/collection.li
+++ b/lib/internal/portable/collection/collection.li
@@ -205,7 +205,7 @@ Section Public
-? { other != NULL };
]
(
- (other.lower).to (other.upper) do { i:INTEGER;
+ (other.lower).to (other.upper) do { i:INTEGER;
add_last (other.item i);
};
)
@@ -227,7 +227,7 @@ Section Public
copy same;
} else {
clear;
- (other.lower).to (other.upper) do { i:INTEGER;
+ (other.lower).to (other.upper) do { i:INTEGER;
add_last (other.item i);
};
};
diff --git a/lib/internal/portable/collection/collection2.li b/lib/internal/portable/collection/collection2.li
index b1acfbf..fb78ae6 100644
--- a/lib/internal/portable/collection/collection2.li
+++ b/lib/internal/portable/collection/collection2.li
@@ -19,92 +19,92 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COLLECTION2(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Abstract definition of a 2 dimensional collection of elements of type E.";
-
- // The Lisaac standard library provides two implementations of COLLECTION2:
+
+ // The Lisaac standard library provides two implementations of COLLECTION2:
// ARRAY2 and FAST_ARRAY2.
// All implementations have exactly the same behavior. Switching from one implementation to
// another only change the memory used and the execution time.
-
+
Section Inherit
-
+
- parent_safe_equal:SAFE_EQUAL(V) := SAFE_EQUAL(V);
-
+
Section Public
-
+
//
// Indexing:
//
-
+
- lower1:INTEGER <-
// First Lower index bounds.
(
deferred;
0
);
-
+
- lower2 :INTEGER <-
// Second Lower index bounds.
(
deferred;
0
);
-
+
- line_minimum:INTEGER <- lower1;
// Equivalent of `lower1'.
- column_minimum:INTEGER <- lower2;
// Equivalent of `lower2'.
-
+
- upper1:INTEGER <-
// First Upper index bounds.
(
deferred;
0
);
-
+
- upper2 :INTEGER <-
// Second Upper index bounds.
- (
+ (
deferred;
0
);
-
+
- line_maximum:INTEGER <- upper1;
// Equivalent of `upper1'.
- column_maximum:INTEGER <- upper2;
// Equivalent of `upper2'.
-
+
//
// Reading:
//
-
+
- item (line, column:INTEGER) :V <-
[ -? { valid_index (line,column) }; ]
( + result:V;
-
+
deferred;
result
);
-
+
//
// Writing:
//
-
+
- put element:V to (line, column:INTEGER) <-
[ -? { valid_index (line,column) }; ]
(
deferred;
)
[ +? { item (line,column) = element}; ];
-
+
- force element:V to (line, column:INTEGER) <-
// Put `element' at position (`line',`column'). Collection is
// resized first when (`line',`column') is not inside current
@@ -120,63 +120,63 @@ Section Public
+? { item (line,column) = element };
+? { count >= Old count };
];
-
+
//
// Index validity:
//
-
- - valid_line line:INTEGER :BOOLEAN <-
+
+ - valid_line line:INTEGER :BOOLEAN <-
(
(lower1 <= line) && { line <= upper1}
)
[
+? { Result = ((lower1 <= line) && { line <= upper1 }) };
];
-
+
- valid_index1 line:INTEGER :BOOLEAN <-
(
valid_line line
);
-
- - valid_column column:INTEGER :BOOLEAN <-
- (
- (lower2 <= column) && {column <= upper2}
+
+ - valid_column column:INTEGER :BOOLEAN <-
+ (
+ (lower2 <= column) && {column <= upper2}
)
- [
+ [
+? { Result = ((lower2 <= column) && {column <= upper2}) };
];
-
+
- valid_index2 column:INTEGER :BOOLEAN <-
(
valid_column column
);
-
+
- valid_index (line, column:INTEGER) :BOOLEAN <-
(
- (lower1 <= line ) && {line <= upper1 } &&
+ (lower1 <= line ) && {line <= upper1 } &&
{lower2 <= column} && {column <= upper2}
)
- [
+ [
+? { Result = ((valid_line line) && {valid_column column}) };
];
-
+
//
// Counting:
//
-
+
- count1:INTEGER <-
// Size of the first dimension.
(
deferred;
0
- )
+ )
[
+? { Result = upper1 - lower1 + 1 };
];
-
+
- line_count:INTEGER <- count1;
// Equivalent of `count1'.
-
+
- count2 :INTEGER <-
// Size of the second dimension.
(
@@ -186,10 +186,10 @@ Section Public
[
+? { Result = upper2 - lower2 + 1 };
];
-
+
- column_count :INTEGER <- count2;
// Equivalent of `count2'.
-
+
- count:INTEGER <-
// Total number of elements.
(
@@ -199,7 +199,7 @@ Section Public
[
+? { Result = line_count * column_count };
];
-
+
- swap (line1, column1:INTEGER) with (line2, column2:INTEGER) <-
// Swap the element at index (`line1',`column1') with the
// the element at index (`line2',`column2').
@@ -215,7 +215,7 @@ Section Public
+? { item (line2,column2) = Old item (line1,column1) };
+? { count = Old count };
];
-
+
- set_all_with v:V <-
// Set all item with value `v'.
(
@@ -224,22 +224,22 @@ Section Public
[
+? { count = Old count };
];
-
+
- clear_all <-
// Set all items to default values.
( + value:V;
-
+
set_all_with value;
)
[
+? { count = Old count };
+? { all_default };
];
-
+
//
// Creating or initializing:
//
-
+
- from_collection2 model:COLLECTION2(V) <-
// Uses `model' to initialize Current.
[ -? { model != NULL }; ]
@@ -250,7 +250,7 @@ Section Public
+? { count1 = model.count1 };
+? { count2 = model.count2 };
];
-
+
- from_model model:COLLECTION(COLLECTION(V)) <-
// The `model' is used to fill line by line Current.
// Assume all sub-collections of `model' have the same
@@ -266,7 +266,7 @@ Section Public
+? { count1 = model.count };
+? { count2 = model.first.count };
];
-
+
- copy_collection other:COLLECTION2(V) <-
// Copy `other' to Current.
//
@@ -274,27 +274,27 @@ Section Public
[
-? { other != NULL };
]
- ( + same:SELF;
-
+ ( + same:SELF;
+
same ?= other;
(same != NULL).if {
copy same;
- } else {
+ } else {
not_yet_implemented;
};
);
-
+
//
// Looking and comparison:
//
-
+
- all_default:BOOLEAN <-
// Do all items have their type's default value?
(
deferred
FALSE
);
-
+
- Self:SELF '==' other:E :BOOLEAN <-
// Do both collections have the same `lower1', `lower2', `upper1' and `upper2', and items?
// The basic `=' is used for comparison of items.
@@ -302,10 +302,10 @@ Section Public
// See also `is_equal_map'.
( + line, column:INTEGER;
+ result:BOOLEAN;
-
+
(
- (lower1 = other.lower1) &&
- {upper1 = other.upper1} &&
+ (lower1 = other.lower1) &&
+ {upper1 = other.upper1} &&
{lower2 = other.lower2} &&
{upper2 = other.upper2}
).if {
@@ -329,10 +329,10 @@ Section Public
//
// See also `is_equal'.
( + line, column:INTEGER;
-
+
(
- (lower1 = other.lower1) &&
- {upper1 = other.upper1} &&
+ (lower1 = other.lower1) &&
+ {upper1 = other.upper1} &&
{lower2 = other.lower2} &&
{upper2 = other.upper2}
).if {
@@ -348,16 +348,16 @@ Section Public
};
};
result
- );
-
+ );
+
//
// Printing:
//
-
+
- fill_tagged_out_memory <-
( + line:INTEGER;
+v:V;
-
+
tagged_out_memory.append "lower1:";
lower1.append_in tagged_out_memory;
tagged_out_memory.append " upper1:";
@@ -367,34 +367,34 @@ Section Public
tagged_out_memory.append " upper2:";
upper2.append_in tagged_out_memory;
tagged_out_memory.append " [\n";
-
+
line := lower1;
{ (line > upper1) || { tagged_out_memory.count > 4096 }}.until_do {
tagged_out_memory.append(once "line ");
line.append_in(tagged_out_memory);
tagged_out_memory.append(once "\t:");
-
+
lower2.to upper2 do { column:INTEGER;
v := item (line,column);
(v = NULL).if {
tagged_out_memory.append(once "NULL");
} else {
v.out_in_tagged_out_memory;
- };
+ };
tagged_out_memory.add_last ' ';
- };
+ };
tagged_out_memory.add_last '\n';
line := line + 1;
- };
+ };
(valid_line line).if {
tagged_out_memory.append(once "......\n");
- };
+ };
);
-
+
//
// Miscellaneous features:
//
-
+
- occurrences elt:V :INTEGER <-
// Number of occurrences using `equal'.
//
@@ -404,7 +404,7 @@ Section Public
0
)
[ +? { Result >= 0 }; ];
-
+
- fast_occurrences elt:V :INTEGER <-
// Number of occurrences using `='.
//
@@ -414,7 +414,7 @@ Section Public
0
)
[ +? { Result >= 0 }; ];
-
+
- has x:V :BOOLEAN <-
// Search if a element x is in the array using `equal'.
//
@@ -423,14 +423,14 @@ Section Public
deferred;
FALSE
);
-
+
- fast_has x:V :BOOLEAN <-
// Search if a element x is in the array using `='.
(
deferred;
FALSE
);
-
+
- replace_all old_value:V with new_value:V <-
// Replace all occurences of the element `old_value' by `new_value'
// using `equal' for comparison.
@@ -439,11 +439,11 @@ Section Public
(
deferred;
)
- [
+ [
+? { count = Old count };
+? { occurrences old_value = 0 };
];
-
+
- fast_replace_all old_value:V with new_value:V <-
// Replace all occurences of the element `old_value' by `new_value'
// using operator `=' for comparison.
@@ -456,36 +456,35 @@ Section Public
+? { count = Old count };
+? { fast_occurrences old_value = 0 };
];
-
+
- sub_collection2 (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) :SELF <-
// Create a new object using selected area of `Current'.
[
-? { valid_index (line_min,column_min) };
-? { valid_index (line_max,column_max) };
]
- (
+ (
deferred;
NULL
)
- [
+ [
+? { result != NULL };
];
-
+
- set_area (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) with element:V <-
// Set all the elements of the selected area rectangle with `element'.
[
-? { valid_index (line_min,column_min) };
-? { valid_index (line_max,column_max) };
]
- (
+ (
line_min.to line_max do { line:INTEGER;
column_min.to column_max do { column:INTEGER;
put element to (line,column);
- };
- };
+ };
+ };
)
[
+? { count = Old count };
];
-
-
\ No newline at end of file
+
diff --git a/lib/internal/portable/collection/collection3.li b/lib/internal/portable/collection/collection3.li
index 561bd5f..47448db 100644
--- a/lib/internal/portable/collection/collection3.li
+++ b/lib/internal/portable/collection/collection3.li
@@ -19,108 +19,108 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COLLECTION3(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Abstract definition of a 3 dimensional collection of elements of type E.";
-
- // The Lisaac standard library provides two implementations of COLLECTION3: ARRAY3
- // and FAST_ARRAY3. All implementations have exactly the same behavior.
- // Switching from one implementation to another only change the memory
+
+ // The Lisaac standard library provides two implementations of COLLECTION3: ARRAY3
+ // and FAST_ARRAY3. All implementations have exactly the same behavior.
+ // Switching from one implementation to another only change the memory
// used and the execution time.
-
+
Section Inherit
-
+
- parent_safe_equal:SAFE_EQUAL(V) := SAFE_EQUAL(V);
-
+
Section Public
-
+
- lower1:INTEGER <-
// Lower index bound for dimension 1.
(
deferred;
0
);
-
+
- lower2:INTEGER <-
// Lower index bound for dimension 2.
(
deferred;
0
);
-
+
- lower3:INTEGER <-
// Lower index bound for dimension 3.
(
deferred;
0
);
-
+
- line_minimum:INTEGER <- lower1;
// Equivalent of `lower1'.
-
+
- column_minimum:INTEGER <- lower2;
// Equivalent of `lower2'.
-
+
- depth_minimum:INTEGER <- lower3;
// Equivalent of `lower3'.
-
+
- upper1:INTEGER <-
// Upper index bound for dimension 1.
(
deferred;
0
);
-
+
- upper2:INTEGER <-
// Upper index bound for dimension 2.
(
deferred;
0
);
-
+
- upper3:INTEGER <-
// Upper index bound for dimension 3.
(
deferred;
0
);
-
+
- line_maximum:INTEGER <- upper1;
// Equivalent of `upper1'.
-
+
- column_maximum:INTEGER <- upper2;
// Equivalent of `upper2'.
-
+
- depth_maximum:INTEGER <- upper3;
// Equivalent of `upper3'.
-
+
//
// Reading:
//
- item (line, column, depth:INTEGER) :V <-
[ -? { valid_index (line,column,depth) }; ]
- ( + result:V;
-
+ ( + result:V;
+
deferred;
result
);
-
+
//
// Writing:
//
- put element:V to (line, column, depth:INTEGER) <-
[ -? {valid_index (line,column,depth) }; ]
- (
+ (
deferred;
)
[ +? { item(line,column,depth) = element}; ];
-
+
- force element:V to (line, column, depth:INTEGER) <-
// Put `element' at position (`line',`column',`depth').
// Collection is resized first when (`line',`column',`depth')
@@ -138,46 +138,46 @@ Section Public
+? { item (line,column,depth) = element };
+? { count >= Old count };
];
-
+
//
// Index validity:
//
-
+
- valid_line line:INTEGER :BOOLEAN <-
(
(lower1 <= line) && {line <= upper1}
)
[ +? {Result = (lower1 <= line) && {line <= upper1}}; ];
-
+
- valid_index1 line:INTEGER :BOOLEAN <- valid_line line;
-
+
- valid_column column:INTEGER :BOOLEAN <-
(
(lower2 <= column) && {column <= upper2}
)
[ +? {Result = (lower2 <= column) && {column <= upper2}}; ];
-
+
- valid_index2 column:INTEGER :BOOLEAN <- valid_column column;
-
+
- valid_depth depth:INTEGER :BOOLEAN <-
(
(lower3 <= depth) && {depth <= upper3}
)
[ +? {Result = (lower3 <= depth) && {depth <= upper3}}; ];
-
+
- valid_index3 depth:INTEGER :BOOLEAN <- valid_depth depth;
-
+
- valid_index (line, column, depth:INTEGER) :BOOLEAN <-
(
- (lower1 <= line ) && {line <= upper1} && {lower2 <= column} &&
+ (lower1 <= line ) && {line <= upper1} && {lower2 <= column} &&
{column <= upper2} && {lower3 <= depth } && {depth <= upper3}
)
[ +? {Result = (valid_line line) && {valid_column column} && {valid_depth depth}}; ];
-
+
//
// Counting:
//
-
+
- count1:INTEGER <-
// Size of the first dimension.
(
@@ -185,10 +185,10 @@ Section Public
0
)
[ +? {Result = upper1 - lower1 + 1}; ];
-
+
- line_count:INTEGER <- count1;
// Equivalent of `count1'.
-
+
- count2:INTEGER <-
// Size of the second dimension.
(
@@ -196,10 +196,10 @@ Section Public
0
)
[ +? {Result = upper2 - lower2 + 1}; ];
-
+
- column_count:INTEGER <- count2;
// Equivalent of `count2'.
-
+
- count3:INTEGER <-
// Size of the third dimension.
(
@@ -207,10 +207,10 @@ Section Public
0
)
[ +? {Result = upper3 - lower3 + 1}; ];
-
+
- depth_count:INTEGER <- count3;
// Equivalent of `count3'.
-
+
- count:INTEGER <-
// Total number of elements.
(
@@ -226,7 +226,7 @@ Section Public
-? { valid_index (line1,column1,depth1)};
-? { valid_index (line2,column2,depth2)};
]
- (
+ (
deferred;
)
[
@@ -234,7 +234,7 @@ Section Public
+? {item(line2,column2,depth2) = Old item(line1,column1,depth1)};
+? {count = Old count};
];
-
+
- set_all_with v:V <-
// Set all item with value `v'.
(
@@ -244,23 +244,23 @@ Section Public
- clear_all <-
// Set all items to default values.
- ( + value:V;
-
+ ( + value:V;
+
set_all_with value;
)
- [
+ [
+? {count = Old count};
+? {all_default};
];
-
+
//
// Creating or initializing:
//
-
+
- from_collection3 model:COLLECTION3(V) <-
// Uses `model' to initialize self.
[ -? {model != NULL}; ]
- (
+ (
deferred;
)
[
@@ -268,13 +268,13 @@ Section Public
+? {count2 = model.count2};
+? {count3 = model.count3};
];
-
+
- from_model model:COLLECTION(COLLECTION(COLLECTION(V))) <-
// The `model' is used to fill line by line self.
// Assume all sub-collections have the same
// dimension.
[ -? { model != NULL }; ]
- (
+ (
deferred;
)
[
@@ -282,7 +282,7 @@ Section Public
+? {count2 > 0 ->> {count2 = model.first.count}};
+? {count3 > 0 ->> {count3 = model.first.first.count}};
];
-
+
//
// Looking and comparison:
//
@@ -292,7 +292,7 @@ Section Public
(
deferred;
);
-
+
- Self:SELF '==' other:COLLECTION3(V) :BOOLEAN <-
// Do both collections have the same `lower1', `lower2', `lower3', `upper1', `upper2' and
// `upper3', and items?
@@ -301,17 +301,17 @@ Section Public
// See also `is_equal_map'.
( + line, column, depth: INTEGER;
+ result:BOOLEAN;
-
+
(
- (lower1 = other.lower1) &&
- {upper1 = other.upper1} &&
- {lower2 = other.lower2} &&
+ (lower1 = other.lower1) &&
+ {upper1 = other.upper1} &&
+ {lower2 = other.lower2} &&
{upper2 = other.upper2} &&
- {lower3 = other.lower3} &&
+ {lower3 = other.lower3} &&
{upper3 = other.upper3}
- ).if {
+ ).if {
result := TRUE;
- line := upper1;
+ line := upper1;
{(! result) || {line < lower1}}.until_do {
column := upper2;
{(! result) || {column < lower2}}.until_do {
@@ -330,22 +330,22 @@ Section Public
- is_equal_map other: COLLECTION3(V) :BOOLEAN <-
// Do both collections have the same `lower1', `lower2', `lower3', `upper1', `upper2' and `upper3',
- // and items?
+ // and items?
//
// See also `=='.
( + line, column, depth:INTEGER;
+ result:BOOLEAN;
-
+
(
- (lower1 = other.lower1) &&
- {upper1 = other.upper1} &&
- {lower2 = other.lower2} &&
+ (lower1 = other.lower1) &&
+ {upper1 = other.upper1} &&
+ {lower2 = other.lower2} &&
{upper2 = other.upper2} &&
- {lower3 = other.lower3} &&
+ {lower3 = other.lower3} &&
{upper3 = other.upper3}
- ).if {
+ ).if {
result := TRUE;
- line := upper1;
+ line := upper1;
{(! result) || {line < lower1}}.until_do {
column := upper2;
{(! result) || {column < lower2}}.until_do {
@@ -361,7 +361,7 @@ Section Public
};
result
);
-
+
//
// Printing:
//
@@ -369,7 +369,7 @@ Section Public
- fill_tagged_out_memory <-
( + line:INTEGER;
+ v:V;
-
+
tagged_out_memory.append "lower1:";
lower1.append_in tagged_out_memory;
tagged_out_memory.append " upper1:";
@@ -383,18 +383,18 @@ Section Public
tagged_out_memory.append " upper3:";
upper3.append_in tagged_out_memory;
tagged_out_memory.append " [\n";
-
+
line := lower1;
{ (line > upper1) || { tagged_out_memory.count > 4096}}.until_do {
tagged_out_memory.append "line ";
line.append_in tagged_out_memory;
tagged_out_memory.append "\t:";
-
+
lower2.to upper2 do { column:INTEGER;
tagged_out_memory.append "column ";
column.append_in tagged_out_memory;
tagged_out_memory.append "\t:";
-
+
lower3.to upper3 do { depth:INTEGER;
tagged_out_memory.append "depth ";
depth.append_in tagged_out_memory;
@@ -407,23 +407,23 @@ Section Public
};
tagged_out_memory.extend ' ';
};
-
+
tagged_out_memory.extend '\n';
};
-
+
tagged_out_memory.extend '\n';
line := line + 1;
};
-
+
(valid_line line).if {
tagged_out_memory.append "......\n";
};
);
-
+
//
// Miscellaneous features:
//
-
+
- occurrences elt:V :INTEGER <-
// Number of occurrences using `equal'.
//
@@ -452,14 +452,14 @@ Section Public
deferred;
FALSE
);
-
+
- fast_has x:V :BOOLEAN <-
// Search if a element x is in the array using `='.
(
deferred;
FALSE
);
-
+
- replace_all old_value:V with new_value:V <-
// Replace all occurences of the element `old_value' by `new_value'
// using `equal' for comparison.
@@ -472,7 +472,7 @@ Section Public
+? {count = Old count};
+? {occurrences old_value = 0};
];
-
+
- fast_replace_all old_value:V with new_value:V <-
// Replace all occurences of the element `old_value' by `new_value'
// using operator `=' for comparison.
@@ -485,20 +485,20 @@ Section Public
+? {count = Old count};
+? {fast_occurrences old_value = 0};
];
-
- - sub_collection3 (line_min, column_min, depth_min:INTEGER)
+
+ - sub_collection3 (line_min, column_min, depth_min:INTEGER)
to (line_max, column_max, depth_max:INTEGER) :SELF <-
// Create a new object using selected area of `self'.
[
-? { valid_index (line_min,column_min,depth_min)};
-? { valid_index (line_max,column_max,depth_max)};
]
- (
+ (
deferred;
)
[ +? {Result != NULL}; ];
-
- - set_area (line_min, column_min, depth_min:INTEGER)
+
+ - set_area (line_min, column_min, depth_min:INTEGER)
to (line_max, column_max, depth_max:INTEGER) with element:V <-
// Set all the elements of the selected area rectangle with `element'.
[
@@ -515,4 +515,4 @@ Section Public
};
)
[ +? {count = Old count}; ];
-
+
diff --git a/lib/internal/portable/collection/dictionary.li b/lib/internal/portable/collection/dictionary.li
index a5ea380..ea8d097 100644
--- a/lib/internal/portable/collection/dictionary.li
+++ b/lib/internal/portable/collection/dictionary.li
@@ -23,27 +23,27 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Associative memory. Values of type `V' are stored using Keys of type `K'.";
-
- // To make a comparison with the well knowned ARRAY class, with a DICTIONARY,
- // index used are not only INTEGER, you can use for example a STRING to access
+
+ // To make a comparison with the well knowned ARRAY class, with a DICTIONARY,
+ // index used are not only INTEGER, you can use for example a STRING to access
// to your information.
//
// Well knowned implementations, see HASHED_DICTIONARY and AVL_DICTIONARY.
//
// See also BIJECTIVE_DICTIONARY class.
-
+
Section Inherit
-
+
+ parent_traversable:Expanded TRAVERSABLE(V);
-
+
Section Public
-
+
//
// Counting:
//
-
+
- count:INTEGER <-
// Actual `count' of stored elements.
(
@@ -53,17 +53,17 @@ Section Public
- is_empty:BOOLEAN <- count = 0;
// Is it empty?
-
+
//
// Basic access:
//
-
+
- has k:K :BOOLEAN <-
// Is there a value currently associated with key `k'?
//
// See also `fast_has', `at'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred;
@@ -74,11 +74,11 @@ Section Public
// Return the value associated to key `k'.
//
// See also `fast_at', `reference_at', `has'.
- [ ...
- -? {has k};
+ [ ...
+ -? {has k};
]
( + result:V;
-
+
deferred;
result
);
@@ -91,16 +91,16 @@ Section Public
//
// See also `fast_reference_at', `at', `has'.
[ ...
- -? {k != NULL};
+ -? {k != NULL};
// "Values are expanded." -? {(Result != NULL) -> (! Result.is_expanded_type)};
]
( + result:V;
-
- deferred;
+
+ deferred;
result
)
[ ...
- +? {(has k) ->> {Result = at k}};
+ +? {(has k) ->> {Result = at k}};
];
- fast_has k:K :BOOLEAN <-
@@ -108,8 +108,8 @@ Section Public
// Using basic `=' for comparison.
//
// See also `has', `at', `fast_at'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred;
@@ -121,10 +121,10 @@ Section Public
//
// See also `at', `reference_at', `fast_reference_at'.
[ ...
- -? {fast_has k};
+ -? {fast_has k};
]
( + result:V;
-
+
deferred;
result
);
@@ -133,55 +133,55 @@ Section Public
// Same work as `reference_at', but basic `=' is used for comparison.
//
// See also `reference_at', `at', `has'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
// BSBS: Il faut que tu init Result, sinon ca ne marche pas !!!
- //"Values are expanded." -? {(Result != NULL) ->> {! Result.is_expanded_type}};
+ //"Values are expanded." -? {(Result != NULL) ->> {! Result.is_expanded_type}};
]
- ( + result:V;
-
+ ( + result:V;
+
deferred;
result
)
[ ...
- +? {fast_has k ->> {Result = fast_at k}};
+ +? {fast_has k ->> {Result = fast_at k}};
];
-
+
//
// Modification.
//
-
+
- put v:V to k:K <-
- // Change some existing entry or `add' the new one. If there is as yet
- // no key `k' in the dictionary, enter it with item `v'. Otherwise
+ // Change some existing entry or `add' the new one. If there is as yet
+ // no key `k' in the dictionary, enter it with item `v'. Otherwise
// overwrite the item associated with key `k'.
- // As the `put' procedure actually uses `is_equal', you may consider
+ // As the `put' procedure actually uses `is_equal', you may consider
// to use `fast_put' for expanded objects as well while trying to get
// the very best performances.
//
// See also `fast_put', `add'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred;
)
[ ...
- +? {v = at k};
+ +? {v = at k};
];
- fast_put v:V to k:K <-
// Same job as `put', but uses basic `=' for comparison.
//
// See also `put', `add'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred
)
[ ...
- +? {v = fast_at k};
+ +? {v = fast_at k};
];
- add v:V to k:K <-
@@ -189,8 +189,8 @@ Section Public
// Actually, this is equivalent to call `put', but it may run a little bit faster.
//
// See also `put', `fast_put'.
- [ ...
- -? {! has k};
+ [ ...
+ -? {! has k};
]
(
deferred
@@ -199,18 +199,18 @@ Section Public
+? {count = 1 + Old count};
+? {v = at k};
];
-
+
//
// Looking and searching some value:
//
-
+
- occurrences v:V :INTEGER <-
// Number of occurrences using `is_equal' for comparison.
//
// See also `fast_occurrences', `fast_has', `has'.
- ( + i,result:INTEGER;
+ ( + i,result:INTEGER;
+ safe_equal:SAFE_EQUAL(V);
-
+
i := 1;
{i > count}.until_do {
(safe_equal.test v with (item i)).if {
@@ -221,15 +221,15 @@ Section Public
result
)
[ ...
- +? {Result >= 0};
+ +? {Result >= 0};
];
-
+
- fast_occurrences v:V :INTEGER <-
// Number of occurrences using basic `=' for comparison.
//
// See also `occurrences', `fast_has', `has'.
( + result,i:INTEGER;
-
+
i := 1;
{i > count}.until_do {
(v = item i).if {
@@ -240,19 +240,19 @@ Section Public
result
)
[ ...
- +? {Result >= 0};
+ +? {Result >= 0};
];
-
+
- key_at v:V :K <-
// Retrieve the key used for value `v' using `is_equal' for comparison.
//
// See also `fast_key_at', `at'.
- [ ...
+ [ ...
-? {occurrences v = 1};
]
- ( + i:INTEGER;
+ ( + i:INTEGER;
+ safe_equal:SAFE_EQUAL(V);
-
+
i := 1;
{safe_equal.test v with (item i)}.until_do {
i := i + 1;
@@ -271,7 +271,7 @@ Section Public
-? {fast_occurrences v = 1};
]
( + i:INTEGER;
-
+
i := 1;
{v = item i}.until_do {
i := i + 1;
@@ -280,45 +280,45 @@ Section Public
)
[ ...
+? {at Result = v};
- ];
-
+ ];
+
//
// Removing:
//
-
+
- remove k:K <-
// Remove entry `k' (which may exist or not before this call).
- // As the `remove' procedure actually uses `is_equal', you may
- // consider to use `fast_remove' for expanded objects as well
+ // As the `remove' procedure actually uses `is_equal', you may
+ // consider to use `fast_remove' for expanded objects as well
// while trying to get the very best performances.
//
// See also `fast_remove', `clear_count'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred
)
[ ...
- +? {! has k};
+ +? {! has k};
];
-
+
- fast_remove k:K <-
// Same job as `remove', but uses basic `=' for comparison.
//
// See also `remove', `clear_count'.
- [ ...
- -? {k != NULL};
+ [ ...
+ -? {k != NULL};
]
(
deferred
)
[ ...
- -? {! has k};
+ -? {! has k};
];
- clear_count <-
- // Discard all items (`is_empty' is True after that call).
+ // Discard all items (`is_empty' is True after that call).
// The internal `capacity' is not changed by this call.
//
// See also `clear_count_and_capacity', `remove'.
@@ -331,7 +331,7 @@ Section Public
];
- clear_count_and_capacity <-
- // Discard all items (`is_empty' is True after that call).
+ // Discard all items (`is_empty' is True after that call).
// The internal `capacity' may also be reduced after this call.
//
// See also `clear_count', `remove'.
@@ -341,24 +341,24 @@ Section Public
[ ...
"Is empty." +? {count = 0};
+? {capacity <= Old capacity};
- ];
+ ];
- capacity:INTEGER <-
- // Approximation of the actual internal storage `capacity'.
- // The `capacity' will grow automatically when needed
- // (i.e. `capacity' is not a limit for the number of values stored).
- // Also note that the `capacity' value may not be always accurate
- // depending of the implementation (anyway, this `capacity' value
+ // Approximation of the actual internal storage `capacity'.
+ // The `capacity' will grow automatically when needed
+ // (i.e. `capacity' is not a limit for the number of values stored).
+ // Also note that the `capacity' value may not be always accurate
+ // depending of the implementation (anyway, this `capacity' value
// is at least equals to `count').
(
deferred;
0
);
-
+
//
// To provide iterating facilities:
//
-
+
- lower:INTEGER := 1;
- upper:INTEGER <-
@@ -371,7 +371,7 @@ Section Public
- item i:INTEGER :V <-
( + result:V;
-
+
deferred;
result
)
@@ -380,7 +380,7 @@ Section Public
];
- first:V <- item lower;
-
+
- last:V <- item upper;
- key index:INTEGER :K <-
@@ -388,14 +388,14 @@ Section Public
-? {valid_index index};
]
( + result:K;
-
+
deferred;
result
)
[ ...
+? {(fast_at Result) = item index};
];
-
+
- key_map_in buffer:COLLECTION(K) <-
// Append in `buffer', all available keys (this may be useful to
// speed up the traversal).
@@ -405,7 +405,7 @@ Section Public
-? {buffer != NULL};
]
( + i:INTEGER;
-
+
i := count;
{i < lower}.until_do {
buffer.add_last (key i);
@@ -425,7 +425,7 @@ Section Public
-? {buffer != NULL};
]
( + i:INTEGER;
-
+
i := count;
{i < lower}.until_do {
buffer.add_last (item i);
@@ -435,11 +435,11 @@ Section Public
[
+? {buffer.count = count + Old buffer.count};
];
-
+
//
// Comparaison.
//
-
+
- Self:SELF '==' other:SELF :BOOLEAN <-
// Do both dictionaries have the same set of associations?
// Keys are compared with `is_equal' and values are comnpared
@@ -448,7 +448,7 @@ Section Public
// See also `is_equal_map'.
( + i:INTEGER;
+ result:BOOLEAN;
-
+
(Self = other).if {
result := TRUE;
}.elseif {count = other.count} then {
@@ -477,14 +477,14 @@ Section Public
// Both keys and values are compared with `is_equal'.
//
// See also `is_equal'.
- ( + i:INTEGER;
- + k:K;
+ ( + i:INTEGER;
+ + k:K;
+ safe_equal:SAFE_EQUAL(V);
+ result:BOOLEAN;
-
+
(Self = other).if {
result := TRUE;
- }.elseif {count = other.count} then {
+ }.elseif {count = other.count} then {
result := TRUE;
i := 1;
{(! result) || {i > count}}.until_do {
@@ -497,7 +497,7 @@ Section Public
};
} else {
result := FALSE;
- };
+ };
};
};
result
@@ -506,7 +506,7 @@ Section Public
- copy other:SELF <-
// Reinitialize by copying all associations of `other'.
( + i:INTEGER;
-
+
clear_count;
i := 1;
{i > other.count}.until_do {
@@ -518,15 +518,15 @@ Section Public
//
// Agents based features:
//
-
+
- do_all action:BLOCK <-
// Apply `action' to every (V, K) associations of `Current'.
//
// See also `for_all', `exist'.
- ( + i:INTEGER;
- + v:V;
+ ( + i:INTEGER;
+ + v:V;
+ k:K;
-
+
i := lower;
{i > upper}.until_do {
v := item i;
@@ -534,7 +534,7 @@ Section Public
action.value (v, k);
i := i + 1;
};
- );
+ );
- foreach_pair action:{(K,V);} <-
(
@@ -553,8 +553,8 @@ Section Public
- foreach_key action:{K; } until test:{K; BOOLEAN} <-
( + i:INTEGER;
+ k:K;
- i := lower;
- {(i > upper) || {test.value (k := key i)}}.until_do {
+ i := lower;
+ {(i > upper) || {test.value (k := key i)}}.until_do {
action.value k;
i := i + 1;
};
@@ -563,13 +563,13 @@ Section Public
- foreach_key action:{K; } while test:{K; BOOLEAN} <-
( + i:INTEGER;
+ k:K;
- i := lower;
- {(i <= upper) && {test.value (k := key i)}}.while_do {
+ i := lower;
+ {(i <= upper) && {test.value (k := key i)}}.while_do {
action.value k;
i := i + 1;
};
);
-
+
- foreach_value action:{V; } <-
(
lower.to upper do { i:INTEGER;
@@ -580,8 +580,8 @@ Section Public
- foreach_value action:{V; } until test:{V; BOOLEAN} <-
( + i:INTEGER;
+ v:V;
- i := lower;
- {(i > upper) || {test.value (v := item i)}}.until_do {
+ i := lower;
+ {(i > upper) || {test.value (v := item i)}}.until_do {
action.value v;
i := i + 1;
};
@@ -590,8 +590,8 @@ Section Public
- foreach_value action:{V; } while test:{V; BOOLEAN} <-
( + i:INTEGER;
+ v:V;
- i := lower;
- {(i <= upper) && {test.value (v := item i)}}.while_do {
+ i := lower;
+ {(i <= upper) && {test.value (v := item i)}}.while_do {
action.value v;
i := i + 1;
};
@@ -601,14 +601,14 @@ Section Public
// Do all (V, K) associations satisfy `test'?
//
// See also `do_all', `exist'.
- ( + i:INTEGER;
- + v:V;
+ ( + i:INTEGER;
+ + v:V;
+ k:K;
+ result:BOOLEAN;
-
+
result := TRUE;
i := lower;
- {(! result) || {i > upper}}.until_do {
+ {(! result) || {i > upper}}.until_do {
v := item i;
k := key i;
result := test.value (v, k);
@@ -621,25 +621,25 @@ Section Public
// Does at least one (V, K) association satisfy `test'?
//
// See also `for_all', `do_all'.
- ( + i:INTEGER;
- + v:V;
+ ( + i:INTEGER;
+ + v:V;
+ k:K;
+ result:BOOLEAN;
-
- i := lower;
+
+ i := lower;
{result || {i > upper}}.until_do {
v := item i;
k := key i;
- result := test.value (v, k);
+ result := test.value (v, k);
i := i + 1;
};
result
);
-
+
//
// Other features:
//
-
+
- internal_key k:K :K <-
// Retrieve the internal key object which correspond to the existing
// entry `k' (the one memorized into the `Current' dictionary).
@@ -649,7 +649,7 @@ Section Public
-? {has k};
]
( + result:K;
-
+
deferred;
result
)
@@ -660,15 +660,15 @@ Section Public
//
// Creation.
//
-
+
- create:SELF <-
( + result:SELF;
-
+
result := clone;
result.make;
result
);
-
+
- make <-
// Creates an empty dictionary.
(
@@ -681,7 +681,7 @@ Section Public
//
//
//
-
+
- key_safe_equal k1:K with k2:K :BOOLEAN <-
// Because keys are never NULL, we do not rely on the SAFE_EQUAL class.
[ ...
@@ -689,7 +689,7 @@ Section Public
-? {k2 != NULL};
]
( + result:BOOLEAN;
-
+
(k1 = k2).if {
result := TRUE;
}.elseif {k1.same_dynamic_type k2} then {
@@ -701,5 +701,5 @@ Section Public
//
// invariant
//
-
+
// [ -? {capacity >= count}; ]
diff --git a/lib/internal/portable/collection/hashed_dictionary_node.li b/lib/internal/portable/collection/hashed_dictionary_node.li
index 2ff137a..340baf9 100644
--- a/lib/internal/portable/collection/hashed_dictionary_node.li
+++ b/lib/internal/portable/collection/hashed_dictionary_node.li
@@ -19,27 +19,27 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := HASHED_DICTIONARY_NODE(V,K);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Auxilliary class to implement DICTIONARY(V,K).";
-
+
Section Inherit
-
+
- parent_any_hashed_dictionary_node:ANY_HASHED_DICTIONARY_NODE := ANY_HASHED_DICTIONARY_NODE;
-
+
Section Public
-
+
+ item:V;
-
+
+ key:K;
-
+
+ next:HASHED_DICTIONARY_NODE(V,K);
// The `next' one when some clash occurs.
-
+
- set_item i:V <-
(
item := i;
@@ -47,23 +47,23 @@ Section Public
[
+? {item = i};
];
-
+
- set_next n:HASHED_DICTIONARY_NODE(V,K) <-
(
next := n;
)
[
+? {next = n};
- ];
-
+ ];
+
- create i:V to k:K next n:HASHED_DICTIONARY_NODE(V,K) :SELF<-
( + result:SELF;
-
+
result := clone;
result.make i to k next n;
result
);
-
+
- make i:V to k:K next n:HASHED_DICTIONARY_NODE(V,K) <-
(
item := i;
diff --git a/lib/internal/portable/collection/hashed_set_node.li b/lib/internal/portable/collection/hashed_set_node.li
index d1bb53f..8c2e441 100644
--- a/lib/internal/portable/collection/hashed_set_node.li
+++ b/lib/internal/portable/collection/hashed_set_node.li
@@ -19,25 +19,25 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := HASHED_SET_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Auxilliary class to implement SET(V).";
-
+
Section Inherit
-
+
- parent_any_hashed_set_node:ANY_HASHED_SET_NODE := ANY_HASHED_SET_NODE;
-
+
Section Public
-
+
+ item:V;
-
+
+ next:HASHED_SET_NODE(V);
// The `next' one when some clash occurs.
-
+
- set_next n:HASHED_SET_NODE(V) <-
(
next := n;
@@ -45,17 +45,17 @@ Section Public
[
+? {next = n};
];
-
+
Section HASHED_SET
-
+
- create i:V next n:HASHED_SET_NODE(V) :SELF <-
( + result:SELF;
-
+
result := clone;
result.make i next n;
result
);
-
+
- make i:V next n:HASHED_SET_NODE(V) <-
(
item := i;
@@ -65,5 +65,5 @@ Section HASHED_SET
+? {item = i};
+? {next = n};
];
-
-
+
+
diff --git a/lib/internal/portable/collection/linked2_list_node.li b/lib/internal/portable/collection/linked2_list_node.li
index f039854..6190a20 100644
--- a/lib/internal/portable/collection/linked2_list_node.li
+++ b/lib/internal/portable/collection/linked2_list_node.li
@@ -19,36 +19,36 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED2_LIST_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "To implement LINKED2_LIST(V).";
-
+
Section Inherit
-
+
- parent_any_two_way_linked_list_node:ANY_TWO_WAY_LINKED_LIST_NODE := ANY_TWO_WAY_LINKED_LIST_NODE;
-
+
Section Public
-
+
+ item:V;
-
+
+ previous:LINKED2_LIST_NODE(V);
-
+
+ next:LINKED2_LIST_NODE(V);
Section LINKED2_LIST
-
+
- create i:V previous p:SELF next n:SELF :SELF<-
( + result:SELF;
-
+
result := clone;
result.make i previous p next n;
result
);
-
+
- make i:V previous p:SELF next n:SELF <-
(
item := i;
@@ -62,7 +62,7 @@ Section LINKED2_LIST
];
Section LINKED2_LIST,LINKED2_LIST_NODE
-
+
- set_item i:V <-
(
item := i;
@@ -70,7 +70,7 @@ Section LINKED2_LIST,LINKED2_LIST_NODE
[
+? {item = i};
];
-
+
- set_next n:SELF <-
(
next := n;
@@ -78,17 +78,17 @@ Section LINKED2_LIST,LINKED2_LIST_NODE
[
+? {next = n};
];
-
+
- set_all_with v:V <-
( + lnk:SELF;
-
- lnk := Self;
+
+ lnk := Self;
{lnk = NULL}.until_do {
lnk.set_item v;
lnk := lnk.next;
};
);
-
+
- set_previous p:SELF <-
(
previous := p;
diff --git a/lib/internal/portable/collection/linked_collection.li b/lib/internal/portable/collection/linked_collection.li
index f737bc1..e312262 100644
--- a/lib/internal/portable/collection/linked_collection.li
+++ b/lib/internal/portable/collection/linked_collection.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED_COLLECTION(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Common root of LINKED_LIST and TWO_WAY_LINKED_LIST..";
-
+
Section Inherit
-
+
- parent_collection:COLLECTION(V) := COLLECTION(V);
-
+
Section Public
-
+
- lower:INTEGER := 1;
// Lower index bound is frozen.
+ upper:INTEGER;
// Memorized upper index bound.
-
+
- create:SELF <-
( + result:SELF;
-
+
result := clone;
result.make;
result
);
-
+
- make <-
// Make an empty list
(
@@ -55,7 +55,7 @@ Section Public
- remove_head n:INTEGER <-
( + i:INTEGER;
-
+
i := n;
{i = 0}.until_do {
remove_first;
@@ -65,9 +65,9 @@ Section Public
- remove_tail n:INTEGER <-
( + i:INTEGER;
-
- i := n;
- {i = 0}.until_do {
+
+ i := n;
+ {i = 0}.until_do {
remove_last;
i := i - 1;
};
@@ -77,16 +77,16 @@ Section Public
(
index_of element start lower
);
-
+
- fast_first_index_of element:V :INTEGER <-
(
fast_index_of element start lower
);
-
+
//
// Implement manifest generic creation.
//
-
+
- manifest_make needed_capacity:INTEGER <-
// Manifest creation of a list of items of type E.
(
diff --git a/lib/internal/portable/collection/linked_list_node.li b/lib/internal/portable/collection/linked_list_node.li
index 2a8da56..eae68af 100644
--- a/lib/internal/portable/collection/linked_list_node.li
+++ b/lib/internal/portable/collection/linked_list_node.li
@@ -19,36 +19,36 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED_LIST_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "To implement LINKED_LIST(V). .";
-
+
Section Inherit
-
+
- parent_any_linked_list_node:ANY_LINKED_LIST_NODE := ANY_LINKED_LIST_NODE;
-
+
Section Public
-
+
+ item:V;
-
+
+ next:LINKED_LIST_NODE(V);
-
+
Section LINKED_LIST
-
+
- create i:V next n:LINKED_LIST_NODE(V) :SELF <-
( + result:SELF;
-
+
result := clone;
result.make i next n;
result
);
-
+
- make i:V next n:LINKED_LIST_NODE(V) <-
- (
+ (
item := i;
next := n;
)
@@ -56,10 +56,10 @@ Section LINKED_LIST
+? {item = i};
+? {next = n};
];
-
-
+
+
Section LINKED_LIST_NODE,LINKED_LIST
-
+
- set_item i:V <-
(
item := i;
@@ -67,7 +67,7 @@ Section LINKED_LIST_NODE,LINKED_LIST
[
+? {item = i};
];
-
+
- set_next n:LINKED_LIST_NODE(V) <-
(
next := n;
@@ -75,10 +75,10 @@ Section LINKED_LIST_NODE,LINKED_LIST
[
+? {next = n};
];
-
+
- set_all_with v:V <-
( + lnk:SELF;
-
+
lnk := Self;
{lnk = NULL}.until_do {
lnk.set_item v;
diff --git a/lib/internal/portable/collection/linked_xor_node.li b/lib/internal/portable/collection/linked_xor_node.li
index a204155..42f1857 100644
--- a/lib/internal/portable/collection/linked_xor_node.li
+++ b/lib/internal/portable/collection/linked_xor_node.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED_XOR_NODE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "To implement LINKED_XOR_LIST(V).";
-
+
Section Inherit
-
+
- parent_any_two_way_linked_list_node:ANY_TWO_WAY_LINKED_LIST_NODE := ANY_TWO_WAY_LINKED_LIST_NODE;
-
+
Section Public
-
+
+ item:V;
-
+
+ link:POINTER;
Section LINKED_XOR_LIST
-
+
- create i:V previous p:SELF next n:SELF :SELF<-
( + result:SELF;
-
+
result := clone;
result.make i previous p next n;
result
);
-
+
- make i:V previous p:SELF next n:SELF <-
(
- item := i;
+ item := i;
link := p.to_pointer ^ n.to_pointer; // BSBS: il faut admettre NULL.to_pointer (perf!)
)
[
@@ -57,7 +57,7 @@ Section LINKED_XOR_LIST
];
Section LINKED_XOR_LIST,LINKED_XOR_NODE
-
+
- set_item i:V <-
(
item := i;
@@ -65,20 +65,19 @@ Section LINKED_XOR_LIST,LINKED_XOR_NODE
[
+? {item = i};
];
-
+
- next prev:LINKED_XOR_NODE :LINKED_XOR_NODE <-
- (
+ (
CONVERT(POINTER,LINKED_XOR_NODE).on (link ^ prev.to_pointer)
);
-
+
- previous nex:LINKED_XOR_NODE :LINKED_XOR_NODE <-
(
CONVERT(POINTER,LINKED_XOR_NODE).on (link ^ nex.to_pointer)
);
-
+
- set_link p:SELF and n:SELF <-
(
link := p.to_pointer ^ n.to_pointer;
);
-
-
\ No newline at end of file
+
diff --git a/lib/internal/portable/collection/native_array.li b/lib/internal/portable/collection/native_array.li
index 8cdb50b..6989b1c 100644
--- a/lib/internal/portable/collection/native_array.li
+++ b/lib/internal/portable/collection/native_array.li
@@ -191,7 +191,7 @@ Section Public
-? {(other_upper >= other_lower) ->> {other.is_not_null}};
]
( + i:INTEGER;
-
+
i := other_upper - other_lower;
{(i >= 0) && {safe_equal (item (at + i),other.item (other_lower + i))}}.while_do {
i := i - 1;
@@ -221,15 +221,15 @@ Section Public
-? {other_upper >= other_lower - 1};
-? {(other_upper >= other_lower) ->> {other.is_not_null}};
]
- ( + i:INTEGER;
-
+ ( + i:INTEGER;
+
i := other_upper - other_lower;
{(i < 0) || {item (at + i) != other.item (other_lower + i)}}.until_do {
i := i - 1;
};
i < 0
);
-
+
- deep_memcmp other:NATIVE_ARRAY(V) until capacity:INTEGER :BOOLEAN <-
// Same jobs as `memcmp' but uses `is_deep_equal' instead `equal'.
[ ...
@@ -269,7 +269,7 @@ Section Public
( + i:INTEGER;
+ e1,e2:V;
+ result:BOOLEAN;
-
+
i := other_upper - other_lower;
result := TRUE;
{(! result) || {i < 0}}.until_do {
@@ -740,7 +740,7 @@ Section Public
};
result
);
-
+
- all_default upper:INTEGER :BOOLEAN <-
// Do all items in range [0 .. `upper'] have their type's
// default value?
@@ -769,7 +769,7 @@ Section Public
( + i:INTEGER;
+ v:V;
+ result:BOOLEAN;
-
+
result := TRUE;
i := lower;
{(i > upper) || {! result}}.until_do {
diff --git a/lib/internal/portable/collection/native_array_volatile.li b/lib/internal/portable/collection/native_array_volatile.li
index ea662a6..e5589c7 100644
--- a/lib/internal/portable/collection/native_array_volatile.li
+++ b/lib/internal/portable/collection/native_array_volatile.li
@@ -19,31 +19,31 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Strict NATIVE_ARRAY_VOLATILE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Native array of collection library.";
-
+
// This class gives access to the lowest level for arrays. As any low level array, you can
// get high performances with NATIVE_ARRAYs, but you loose most valid bounds checks (as
// you can do in plain C code for example).
-
+
Section Inherit
-
+
- parent_safe_equal:SAFE_EQUAL(V) := SAFE_EQUAL(V);
-
-Section Public
-
+
+Section Public
+
//
// Basic features:
//
-
+
- object_size:INTEGER := 0; // For detect error.
-
- - element_sizeof:INTEGER <-
+
+ - element_sizeof:INTEGER <-
// The size in number of bytes for type `E'.
( + result:INTEGER;
(V.is_expanded_type).if {
@@ -53,7 +53,7 @@ Section Public
};
result
);
-
+
- calloc_intern nb_elements:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
// Allocate a new array of 'nb_elements' of type `E'.
// The new array is initialized with default values.
@@ -63,9 +63,9 @@ Section Public
( + capacity:INTEGER;
+ p:POINTER;
+ result :NATIVE_ARRAY_VOLATILE(V);
-
- capacity := nb_elements * element_sizeof;
- //p := `malloc(@capacity)`:POINTER;
+
+ capacity := nb_elements * element_sizeof;
+ //p := `malloc(@capacity)`:POINTER;
p := MEMORY.alloc_dynamic (capacity.to_uinteger_32);
result := CONVERT(POINTER,NATIVE_ARRAY_VOLATILE(V)).on p;
result
@@ -73,7 +73,7 @@ Section Public
[ ...
+? {Result != NULL};
];
-
+
- create nb_elements:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
// Allocate a new array of `nb_elements' of type `E'.
// The new array is initialized with default values.
@@ -81,15 +81,15 @@ Section Public
-? {nb_elements > 0};
]
( + result:NATIVE_ARRAY_VOLATILE(V);
-
+
result:=calloc_intern nb_elements;
- result.clear_all (nb_elements-1);
+ result.clear_all (nb_elements-1);
result
)
[ ...
+? {Result.all_default (nb_elements-1)};
];
-
+
- realloc old_nb_elts:INTEGER with new_nb_elts:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
// Assume Current is a valid NATIVE_ARRAY_VOLATILE in range
// [0 .. `old_nb_elts'-1]. Allocate a bigger new array in
@@ -104,12 +104,12 @@ Section Public
( + new:NATIVE_ARRAY_VOLATILE(V);
+ old_ptr,new_ptr:POINTER;
+ new_cap:INTEGER;
-
- old_ptr := CONVERT(NATIVE_ARRAY_VOLATILE(V),POINTER).on Self;
+
+ old_ptr := CONVERT(NATIVE_ARRAY_VOLATILE(V),POINTER).on Self;
new_cap := new_nb_elts * element_sizeof;
//new_ptr := `realloc(@old_ptr, at new_cap)`:POINTER;
- new_ptr := MEMORY.realloc_dynamic old_ptr
- old_size ((old_nb_elts * element_sizeof).to_uinteger_32)
+ new_ptr := MEMORY.realloc_dynamic old_ptr
+ old_size ((old_nb_elts * element_sizeof).to_uinteger_32)
new_size (new_cap.to_uinteger_32);
new := CONVERT(POINTER,NATIVE_ARRAY_VOLATILE(V)).on new_ptr;
new.clear old_nb_elts to (new_nb_elts - 1);
@@ -118,20 +118,20 @@ Section Public
[ ...
+? {Result != NULL};
];
-
+
- first:V <- item 0;
-
+
- item index:INTEGER :V <-
// To read an `item'.
- // Assume that `calloc' is already done and that `index' is
+ // Assume that `calloc' is already done and that `index' is
// the range [0 .. `nb_elements'-1].
[ ...
-? {index >= 0};
]
- (
- `10`
+ (
+ `10`
);
-
+
- put element:V to index:INTEGER <-
// To write an item.
// Assume that `calloc' is already done and that `index'
@@ -139,30 +139,30 @@ Section Public
[ ...
-? {index >= 0};
]
- (
- force_put element to index;
+ (
+ force_put element to index;
)
[ ...
- +? {element = item index};
+ +? {element = item index};
];
-
+
//
// Displacement
//
-
- - Self:SELF '+' Left 80 other:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
+
+ - Self:SELF '+' Left 80 other:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
// other is in element index
( + ptr:POINTER;
-
+
ptr := to_pointer;
ptr := ptr + other * element_sizeof;
CONVERT(POINTER, NATIVE_ARRAY_VOLATILE(V)).on ptr
);
-
+
//
// Comparison:
//
-
+
- memcmp other:NATIVE_ARRAY_VOLATILE(V) until capacity:INTEGER :BOOLEAN <-
// True if all elements in range [0..capacity-1] are
// identical using `equal'. Assume Current and `other'
@@ -172,14 +172,14 @@ Section Public
-? {(capacity > 0) ->> {other.is_not_null}};
]
( + i:INTEGER;
-
+
i := capacity - 1;
{(i >= 0) && {safe_equal (item i,other.item i)}}.while_do {
i := i - 1;
};
i < 0
);
-
+
- slice_memcmp (at:INTEGER,other:NATIVE_ARRAY_VOLATILE(V),other_lower,other_upper:INTEGER) :BOOLEAN <-
// True if all elements in range [0 .. `other_upper' - `other_lower'] are identical
// to the elements in range [`other_lower' .. `other_upper'] of `other' using
@@ -192,28 +192,28 @@ Section Public
-? {(other_upper >= other_lower) ->> {other.is_not_null}};
]
( + i:INTEGER;
-
+
i := other_upper - other_lower;
{(i >= 0) && {safe_equal (item (at + i),other.item (other_lower + i))}}.while_do {
i := i - 1;
};
i < 0
);
-
+
- fast_memcmp other:NATIVE_ARRAY_VOLATILE(V) until capacity:INTEGER :BOOLEAN <-
// Same jobs as `memcmp' but uses infix `=' instead `equal'.
[ ...
-? {(capacity > 0) ->> {other.is_not_null}};
]
( + i:INTEGER;
-
+
i := capacity-1;
{(i >=0 ) && {item i = other.item i}}.while_do {
i := i - 1;
};
i < 0
);
-
+
- slice_fast_memcmp (at:INTEGER, other:NATIVE_ARRAY_VOLATILE(V), other_lower,other_upper:INTEGER) :BOOLEAN <-
// Same jobs as `slice_memcmp' but uses infix "=" instead of `is_equal'.
[ ...
@@ -222,15 +222,15 @@ Section Public
-? {other_upper >= other_lower - 1};
-? {(other_upper >= other_lower) ->> {other.is_not_null}};
]
- ( + i:INTEGER;
-
+ ( + i:INTEGER;
+
i := other_upper - other_lower;
{(i < 0) || {item (at + i) != other.item (other_lower + i)}}.until_do {
i := i - 1;
};
i < 0
);
-
+
- deep_memcmp other:NATIVE_ARRAY_VOLATILE(V) until capacity:INTEGER :BOOLEAN <-
// Same jobs as `memcmp' but uses `is_deep_equal' instead `equal'.
[ ...
@@ -239,7 +239,7 @@ Section Public
( + result:BOOLEAN; // BEN : A REVOIR, il y a + efficace...
+ e1,e2:V;
+ i:INTEGER;
-
+
result := TRUE;
i := capacity - 1;
{(result = FALSE) || {i < 0}}.until_do {
@@ -258,7 +258,7 @@ Section Public
};
result
);
-
+
- slice_deep_memcmp (at:INTEGER,other:NATIVE_ARRAY_VOLATILE(V),other_lower,other_upper:INTEGER) :BOOLEAN <-
// Same jobs as `slice_memcmp' but uses `is_deep_equal' instead of `is_equal'.
[ ...
@@ -267,10 +267,10 @@ Section Public
-? {other_upper >= other_lower - 1};
-? {(other_upper >= other_lower) ->> {other.is_not_null}};
]
- ( + i:INTEGER;
+ ( + i:INTEGER;
+ e1,e2:V;
+ result:BOOLEAN;
-
+
i := other_upper - other_lower;
result := TRUE;
{(! result) || {i < 0}}.until_do {
@@ -290,11 +290,11 @@ Section Public
};
result
);
-
+
//
// Searching:
//
-
+
- first_index_of element:V until upper:INTEGER :INTEGER <-
// Give the index of the first occurrence of `element' using
// `==' for comparison.
@@ -304,15 +304,15 @@ Section Public
-? {upper >= -1};
]
( + idx:INTEGER;
-
+
{(idx > upper) || {safe_equal (element,item idx)}}.until_do {
idx := idx + 1;
};
idx
);
-
+
- index_of (element:V,start_index:INTEGER) until upper:INTEGER :INTEGER <-
- // Using `is_equal' for comparison, gives the index of the first occurrence of `element'
+ // Using `is_equal' for comparison, gives the index of the first occurrence of `element'
// at or after `start_index'. Answer `upper + 1' when the search fail.
// See also `fast_index_of', `reverse_index_of'.
[ ...
@@ -320,7 +320,7 @@ Section Public
-? {start_index <= upper};
]
( + result:INTEGER;
-
+
result := start_index;
{(result > upper) || {safe_equal (element,item result)}}.until_do {
result := result + 1;
@@ -331,7 +331,7 @@ Section Public
+? {Result.in_range start_index to (upper + 1)};
+? {(Result <= upper) ->> {safe_equal (element,item Result)}};
];
-
+
- reverse_index_of element:V from upper:INTEGER :INTEGER <-
// Give the index of the first occurrence of `element' using
// `==' for comparison, from upper to lower.
@@ -340,7 +340,7 @@ Section Public
-? {upper >= -1};
]
( + idx:INTEGER;
-
+
idx := upper;
{(idx < 0) || {safe_equal (element,item idx)}}.until_do {
idx := idx - 1;
@@ -351,9 +351,9 @@ Section Public
+? {Result.in_range (-1) to upper};
+? {(Result > 0) ->> {safe_equal (element, item Result)}};
];
-
+
- fast_index_of (element:V,start_index:INTEGER) until upper:INTEGER :INTEGER <-
- // Using basic `=' for comparison, gives the index of the first occurrence of
+ // Using basic `=' for comparison, gives the index of the first occurrence of
// `element' at or after `start_index'. Answer `upper + 1' when the search fail.
// See also `index_of', `reverse_index_of'.
[ ...
@@ -361,9 +361,9 @@ Section Public
-? {start_index <= upper};
]
( + result:INTEGER;
-
+
result := start_index;
- {(result > upper) || {element = item result}}.until_do {
+ {(result > upper) || {element = item result}}.until_do {
result := result + 1;
};
result
@@ -372,7 +372,7 @@ Section Public
+? {Result.in_range start_index to (upper + 1)};
+? {(Result <= upper) ->> {element = item Result}};
];
-
+
- fast_reverse_index_of element:V from upper:INTEGER :INTEGER <-
// Same as `reverse_index_of' but use basic `=' for comparison.
// Search is done in reverse direction, which means from `upper' down to the
@@ -382,7 +382,7 @@ Section Public
-? {upper >= -1};
]
( + idx:INTEGER;
-
+
idx := upper;
{(idx < 0) || {element = item idx}}.until_do {
idx := idx - 1;
@@ -402,7 +402,7 @@ Section Public
-? {upper >= -1};
]
( + idx:INTEGER;
-
+
{(idx > upper) || {element = item idx}}.until_do {
idx := idx + 1;
};
@@ -411,8 +411,8 @@ Section Public
[ ...
+? {Result.in_range 0 to (upper + 1)};
+? {(Result <= upper) ->> {element = item Result}};
- ];
-
+ ];
+
- has element:V until upper:INTEGER :BOOLEAN <-
// Look for `element' using `==' for comparison.
// Also consider `has' to choose the most appropriate.
@@ -420,8 +420,8 @@ Section Public
-? {upper >= -1};
]
( + result:BOOLEAN;
- + i:INTEGER;
-
+ + i:INTEGER;
+
i := upper;
{(result) || {i < 0}}.until_do {
result := safe_equal (element,item i);
@@ -429,7 +429,7 @@ Section Public
};
result
);
-
+
- fast_has element:V until upper:INTEGER :BOOLEAN <-
// Look for `element' using basic `=' for comparison.
// Also consider `has' to choose the most appropriate.
@@ -437,18 +437,18 @@ Section Public
-? {upper >= -1};
]
( + i:INTEGER;
-
+
i := upper;
{(i < 0) || {element = item i}}.until_do {
i := i - 1;
};
i >= 0
);
-
+
//
// Removing:
//
-
+
- remove_first upper:INTEGER <-
// Assume `upper' is a valid index.
// Move range [1 .. `upper'] by 1 position left.
@@ -456,13 +456,13 @@ Section Public
-? {upper >= 0};
]
( + i:INTEGER;
-
+
{i = upper}.until_do {
put (item (i + 1)) to i;
i := i + 1;
};
);
-
+
- remove index:INTEGER until upper:INTEGER <-
// Assume `upper' is a valid index.
// Move range [`index' + 1 .. `upper'] by 1 position left.
@@ -471,18 +471,18 @@ Section Public
-? {index <= upper};
]
( + i:INTEGER;
-
+
i := index;
{i = upper}.until_do {
put (item (i + 1)) to i;
i := i + 1;
};
);
-
+
//
// Replacing:
//
-
+
- replace_all old_value:V with new_value:V until upper:INTEGER <-
// Replace all occurences of the element `old_value' by `new_value'
// using `==' for comparison.
@@ -490,14 +490,14 @@ Section Public
[ ...
-? {upper >= -1};
]
- (
+ (
upper.downto 0 do { i:INTEGER;
(safe_equal (old_value,(item i))).if {
put new_value to i;
};
};
);
-
+
- fast_replace_all old_value:V with new_value:V until upper:INTEGER <-
// Replace all occurences of the element `old_value' by `new_value'
// using basic `=' for comparison.
@@ -505,18 +505,18 @@ Section Public
[ ...
-? {upper >= -1};
]
- (
+ (
upper.downto 0 do { i:INTEGER;
(old_value = item i).if {
put new_value to i;
};
};
);
-
+
//
// Adding:
//
-
+
- copy src:NATIVE_ARRAY_VOLATILE(V) to dest:INTEGER until src_capacity:INTEGER <-
// Copy range [0 .. `src_capacity - 1'] of `src' to range
// [`dest' .. `dest + src_capacity - 1'] of `Self'.
@@ -526,7 +526,7 @@ Section Public
-? {src_capacity >= 0};
]
( + i1, i2:INTEGER;
-
+
i1 := dest;
{i2 = src_capacity}.until_do {
put (src.item i2) to i1;
@@ -534,7 +534,7 @@ Section Public
i1 := i1 + 1;
};
);
-
+
- slice_copy src:NATIVE_ARRAY_VOLATILE(V) to dest:INTEGER from src_min:INTEGER to src_max:INTEGER <-
// Copy range [`src_min' .. `src_max'] of `src' to range
// [`at' .. `at + src_max - src_min - 1'] of `Current'.
@@ -544,8 +544,8 @@ Section Public
-? {src_min <= src_max + 1};
-? {(src != Self) | (dest != src_min)};
]
- ( + i1, i2:INTEGER;
-
+ ( + i1, i2:INTEGER;
+
i1 := dest;
i2 := src_min;
{i2 > src_max}.until_do {
@@ -554,11 +554,11 @@ Section Public
i1 := i1 + 1;
};
);
-
+
//
// Other:
//
-
+
- set_all_with v:V until upper:INTEGER <-
// Set all elements in range [0 .. upper] with
// value `v'.
@@ -570,7 +570,7 @@ Section Public
put v to i;
};
);
-
+
- set_slice_with v:V from lower:INTEGER until upper:INTEGER <-
// Set all elements in range [`lower' .. `upper'] with value `v'.
[ ...
@@ -578,14 +578,14 @@ Section Public
-? {upper >= lower - 1};
]
( + i:INTEGER;
-
+
i := lower;
{i > upper}.until_do {
put v to i;
i := i + 1;
};
);
-
+
- clear_all upper:INTEGER <-
// Set all elements in range [0 .. `upper'] with
// the default value.
@@ -593,12 +593,12 @@ Section Public
-? {upper >= -1};
]
( + v:V;
-
- upper.downto 0 do { i:INTEGER;
+
+ upper.downto 0 do { i:INTEGER;
put v to i;
};
);
-
+
- clear lower:INTEGER to upper:INTEGER <-
// Set all elements in range [`lower' .. `upper'] with
// the default value
@@ -607,12 +607,12 @@ Section Public
-? {upper >= lower};
]
( + v:V;
-
+
lower.to upper do { i:INTEGER;
put v to i;
};
);
-
+
- copy_from model:NATIVE_ARRAY_VOLATILE(V) until upper:INTEGER <-
// Assume `upper' is a valid index both in Current and `model'.
[ ...
@@ -623,7 +623,7 @@ Section Public
put (model.item i) to i;
};
);
-
+
- deep_twin_from capacity:INTEGER :NATIVE_ARRAY_VOLATILE(V) <-
// To implement `deep_twin'. Allocate a new array of
// `capacity' initialized with `deep_twin'.
@@ -633,7 +633,7 @@ Section Public
]
( + element:V;
+ result:NATIVE_ARRAY_VOLATILE(V);
-
+
(capacity > 0).if {
result := calloc capacity;
(capacity - 1).downto 0 do { i:INTEGER;
@@ -645,7 +645,7 @@ Section Public
};
};
);
-
+
- move lower:INTEGER to upper:INTEGER by offset:INTEGER <-
// Move range [`lower' .. `upper'] by `offset' positions.
// Freed positions are not initialized to default values.
@@ -654,7 +654,7 @@ Section Public
-? {upper >= lower};
-? {lower + offset >= 0};
]
- (
+ (
(offset != 0).if {
(offset < 0).if {
lower.to upper do { i:INTEGER;
@@ -667,7 +667,7 @@ Section Public
};
};
);
-
+
- occurrences element:V until upper:INTEGER :INTEGER <-
// Number of occurrences of `element' in range [0..upper]
// using `equal' for comparison.
@@ -676,7 +676,7 @@ Section Public
-? {upper >= -1};
]
( + count:INTEGER;
-
+
upper.downto 0 do { i:INTEGER;
(safe_equal (element,item i)).if {
count := count + 1;
@@ -684,9 +684,9 @@ Section Public
};
count
);
-
+
- slice_occurrences element:V from lower:INTEGER until upper:INTEGER :INTEGER <-
- // Number of occurrences of `element' in range [`lower' .. `upper'] using
+ // Number of occurrences of `element' in range [`lower' .. `upper'] using
// `is_equal' for comparison.
// See also `slice_fast_occurrences' to chose the apropriate one.
[ ...
@@ -694,7 +694,7 @@ Section Public
-? {upper >= lower - 1};
]
( + i,result:INTEGER;
-
+
i := lower;
{i > upper}.until_do {
(safe_equal (element,item i)).if {
@@ -713,7 +713,7 @@ Section Public
-? {upper >= -1};
]
( + count:INTEGER;
-
+
upper.downto 0 do { i:INTEGER;
(element = item i).if {
count := count + 1;
@@ -721,7 +721,7 @@ Section Public
};
count
);
-
+
- slice_fast_occurrences element:V from lower:INTEGER until upper:INTEGER :INTEGER <-
// Number of occurrences of `element' in range [`lower' .. `upper']
// using basic "=" for comparison.
@@ -731,7 +731,7 @@ Section Public
-? {upper >= lower - 1};
]
( + i,result:INTEGER;
-
+
i := lower;
{i > upper}.until_do {
(element = item i).if {
@@ -741,7 +741,7 @@ Section Public
};
result
);
-
+
- all_default upper:INTEGER :BOOLEAN <-
// Do all items in range [0 .. `upper'] have their type's
// default value?
@@ -759,7 +759,7 @@ Section Public
};
result
);
-
+
- slice_default lower:INTEGER to upper:INTEGER :BOOLEAN <-
// Do all items in range [`lower' .. `upper'] have their type's default value?
// Note: for non Void items, the test is performed with the `is_default' predicate.
@@ -767,10 +767,10 @@ Section Public
-? {lower >= 0};
-? {upper >= lower - 1};
]
- ( + i:INTEGER;
+ ( + i:INTEGER;
+ v:V;
+ result:BOOLEAN;
-
+
result := TRUE;
i := lower;
{(i > upper) || {! result}}.until_do {
@@ -782,28 +782,28 @@ Section Public
};
result
);
-
+
//
// Interfacing with C:
//
-
+
- to_external:POINTER <- to_pointer;
// Gives access to the C pointer on the area of storage.
-
+
- is_null:BOOLEAN <- to_pointer.is_null;
-
+
- is_not_null:BOOLEAN <- to_pointer.is_not_null;
-
+
//
// Guru Section
//
-
+
- force_put element:V to index:INTEGER <-
// Used in Memory count: not to use directly without caution !
[ ...
-? {index>=0};
]
- (
- `9`;
+ (
+ `9`;
);
diff --git a/lib/internal/portable/collection/set.li b/lib/internal/portable/collection/set.li
index aa0f84f..9c3dda7 100644
--- a/lib/internal/portable/collection/set.li
+++ b/lib/internal/portable/collection/set.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SET(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Definition of a mathematical set of objects.";
// All common operations on mathematical sets are available.
// Well knowned implementations are HASHED_SET and AVL_SET.
-
+
Section Inherit
-
+
+ parent_traversable:TRAVERSABLE(V) := TRAVERSABLE(V);
-
+
+ parent_safe_equal:SAFE_EQUAL(V) := SAFE_EQUAL(V);
-
+
Section Public
//
// Counting:
//
-
+
- count:INTEGER <-
// Cardinality of the set (i.e. actual `count' of stored elements).
(
deferred;
0
);
-
+
- is_empty:BOOLEAN <- count = 0;
// Is the set empty?
-
+
//
// Adding and removing:
//
-
+
- add e:V <-
- // Add new item `e' to the set. The mathematical definition of adding
- // in a set is followed, i.e. the element `e' is added only and only
+ // Add new item `e' to the set. The mathematical definition of adding
+ // in a set is followed, i.e. the element `e' is added only and only
// if it is not yet present in the set.
- // As this `add' feature is actually using `is_equal', you may consider
- // to use `fast_add' for expanded objects as well while trying to get
+ // As this `add' feature is actually using `is_equal', you may consider
+ // to use `fast_add' for expanded objects as well while trying to get
// the very best performances.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
@@ -77,7 +77,7 @@ Section Public
- fast_add e:V <-
// Same job as `add', but uses basic `=' for comparison.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
@@ -92,7 +92,7 @@ Section Public
// Remove item `e' from the set: the mathematical definition of
// removing from a set is followed.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
@@ -106,7 +106,7 @@ Section Public
- fast_remove e:V <-
// Same job as `remove', but uses basic `=' for comparison.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
@@ -116,13 +116,13 @@ Section Public
"Not in not removed." +? {(! Old fast_has e) -> (count = Old count)};
"In then removed." +? {(Old fast_has e) -> (count = Old count - 1)};
];
-
+
- clear <- clear_count;
-
+
- clear_count <-
- // Empty the current set (`is_empty' is True after that call).
- // If possible, the actual implementation is supposed to keep
- // its internal storage area in order to refill `Current' in
+ // Empty the current set (`is_empty' is True after that call).
+ // If possible, the actual implementation is supposed to keep
+ // its internal storage area in order to refill `Current' in
// an efficient way.
//
// See also `clear_count_and_capacity' to select the most appropriate.
@@ -130,12 +130,12 @@ Section Public
deferred;
)
[ ...
- "Is empty." +? {count = 0};
+ "Is empty." +? {count = 0};
];
- clear_count_and_capacity <-
- // Empty the current set (`is_empty' is True after that call).
- // If possible, the actual implementation is supposed to release
+ // Empty the current set (`is_empty' is True after that call).
+ // If possible, the actual implementation is supposed to release
// its internal storage area for this memory to be used by other objects.
//
// See also `clear_count' to select the most appropriate.
@@ -143,36 +143,36 @@ Section Public
deferred;
)
[ ...
- "Is empty." +? {count = 0};
+ "Is empty." +? {count = 0};
];
-
+
//
// Looking and searching:
//
-
+
- has e:V :BOOLEAN <-
// Is element `e' in the set?
- // As this query is actually using `is_equal', you may consider to use
- // `fast_has' for expanded objects as well while trying to get the very
+ // As this query is actually using `is_equal', you may consider to use
+ // `fast_has' for expanded objects as well while trying to get the very
// best performances.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
FALSE
)
[ ...
- +? {Result -> ! is_empty};
+ +? {Result -> ! is_empty};
];
-
+
- fast_has e:V :BOOLEAN <-
// Is element `e' actually stored in the set?
- // Warning: this query is using basic `=' for comparison.
+ // Warning: this query is using basic `=' for comparison.
//
// See also `has' when dealing with reference types.
[ ...
- -? {e != NULL};
+ -? {e != NULL};
]
(
deferred;
@@ -182,7 +182,7 @@ Section Public
];
- reference_at e:V :V <-
- // Non Void when `e' is in the set. In such a situation, `Result' is the
+ // Non Void when `e' is in the set. In such a situation, `Result' is the
// object which is actually stored in the `Current' set (see ensure assertion).
[ ...
-? {e != NULL};
@@ -193,19 +193,19 @@ Section Public
NULL
)
[ ...
- +? {has e ->> {Result == e}};
+ +? {has e ->> {Result == e}};
];
-
+
//
// To provide iterating facilities:
//
-
+
- lower:INTEGER := 1;
- upper:INTEGER <-
( count )
[ ...
- +? {Result = count};
+ +? {Result = count};
];
- item i:INTEGER :V <-
@@ -213,25 +213,25 @@ Section Public
//
// See also `lower', `upper', `valid_index'.
//
- // SETs are intrinsically unordered, so there is no guarantee that
- // `item'(i) after performing an `add' or `remove' operation is related
+ // SETs are intrinsically unordered, so there is no guarantee that
+ // `item'(i) after performing an `add' or `remove' operation is related
// in any way to `item'(i) before that operation.
( + result:V;
-
+
deferred;
result
)
- [ ...
- +? {fast_has Result};
- ];
+ [ ...
+ +? {fast_has Result};
+ ];
- first:V <- item lower;
// The very `first' item.
//
// See also `last', `item'.
//
- // SETs are intrinsically unordered, so there is no guarantee that
- // `first' after performing an `add' or `remove' operation is related
+ // SETs are intrinsically unordered, so there is no guarantee that
+ // `first' after performing an `add' or `remove' operation is related
// in any way to `first' before that operation.
- last:V <- item upper;
@@ -239,22 +239,22 @@ Section Public
//
// See also `first', `item'.
//
- // SETs are intrinsically unordered, so there is no guarantee that
- // `last' after performing an `add' or `remove' operation is related
+ // SETs are intrinsically unordered, so there is no guarantee that
+ // `last' after performing an `add' or `remove' operation is related
// in any way to `last' before that operation.
-
+
//
// Mathematical operations:
//
-
+
- union other:SELF <-
// Make the union of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
+ e:V;
-
+
i := 1;
{i > other.count}.until_do {
e := other.item i;
@@ -265,17 +265,17 @@ Section Public
};
)
[ ...
- +? {count <= Old count + other.count};
+ +? {count <= Old count + other.count};
];
-
+
- fast_union other:SELF <-
// Make the union of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
+ e:V;
-
+
i := 1;
{i > other.count}.until_do {
e := other.item i;
@@ -286,16 +286,16 @@ Section Public
};
)
[ ...
- +? {count <= Old count + other.count};
+ +? {count <= Old count + other.count};
];
-
+
- Self:SELF '+' other:SELF :SELF <-
// Return the union of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + result:SELF;
-
+
result := twin;
result.union other;
result
@@ -308,11 +308,11 @@ Section Public
- intersection other:SELF <-
// Make the intersection of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
- ( + i:INTEGER;
+ ( + i:INTEGER;
+ e:V;
-
+
i := upper;
{i < lower}.until_do {
e := item i;
@@ -323,17 +323,17 @@ Section Public
};
)
[ ...
- +? {count <= other.count.min (Old count)};
+ +? {count <= other.count.min (Old count)};
];
- fast_intersection other:SELF <-
// Make the intersection of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
- ( + i:INTEGER;
+ ( + i:INTEGER;
+ e:V;
-
+
i := upper;
{i < lower}.until_do {
e := item i;
@@ -344,16 +344,16 @@ Section Public
};
)
[ ...
- +? {count <= other.count.min (Old count)};
+ +? {count <= other.count.min (Old count)};
];
-
+
- Self:SELF '^' other:SELF :SELF <-
// Return the intersection of the `Current' set with `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + result:SELF;
-
+
result := twin;
result.intersection other;
result
@@ -366,10 +366,10 @@ Section Public
- minus other:SELF <-
// Make the set `Current' - `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
-
+
(other = Self).if {
clear_count;
} else {
@@ -381,43 +381,43 @@ Section Public
};
)
[ ...
- +? {count <= Old count};
+ +? {count <= Old count};
];
- Self:SELF '-' other:SELF :SELF <-
// Return the set `Current' - `other'.
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + result:SELF;
-
+
result := twin;
result.minus other;
result
)
[ ...
+? {Result.count <= count};
- +? {Result.is_subset_of Self};
+ +? {Result.is_subset_of Self};
];
//
// Comparison:
//
-
+
- is_subset_of other:SELF :BOOLEAN <-
// Is the `Current' set a subset of `other'?
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
+ result:BOOLEAN;
-
+
(Self = other).if {
result := TRUE;
}.elseif {count <= other.count} then {
result := TRUE;
i := 1;
- {(! result) || {i > count}}.until_do {
+ {(! result) || {i > count}}.until_do {
result := other.has (item i);
i := i + 1;
};
@@ -425,22 +425,22 @@ Section Public
result
)
[ ...
- +? {Result -> (count <= other.count)};
+ +? {Result -> (count <= other.count)};
];
- is_disjoint_from other:SELF :BOOLEAN <-
// Is the `Current' set disjoint from `other' ?
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
+ result:BOOLEAN;
-
+
(Self != other).if {
result := TRUE;
i := 1;
(count <= other.count).if {
- {(! result) || {i > count}}.until_do {
+ {(! result) || {i > count}}.until_do {
result := ! other.has (item i);
i := i + 1;
};
@@ -454,22 +454,22 @@ Section Public
result
)
[ ...
- +? {Result = (Self ^ other).is_empty};
+ +? {Result = (Self ^ other).is_empty};
];
-
+
- fast_is_disjoint_from other:SELF :BOOLEAN <-
// Is the `Current' set disjoint from `other' ?
[ ...
- -? {other != NULL};
+ -? {other != NULL};
]
( + i:INTEGER;
+ result:BOOLEAN;
-
+
(Self != other).if {
result := TRUE;
i := 1;
(count <= other.count).if {
- {(! result) || {i > count}}.until_do {
+ {(! result) || {i > count}}.until_do {
result := ! other.fast_has (item i);
i := i + 1;
};
@@ -483,20 +483,20 @@ Section Public
result
)
[ ...
- // +? {Result = (Self ^ other).is_empty};
+ // +? {Result = (Self ^ other).is_empty};
];
-
+
- Self:SELF '==' other:SELF :BOOLEAN <-
// Is the `Current' set equal to `other'?
( + i:INTEGER;
+ result:BOOLEAN;
-
+
(Self = other).if {
result := TRUE;
}.elseif {count = other.count} then {
result := TRUE;
i := 1;
- {(! result) || {i > count}}.until_do {
+ {(! result) || {i > count}}.until_do {
result := other.has (item i);
i := i + 1;
};
@@ -510,17 +510,17 @@ Section Public
//
// Duplication.
//
-
+
- copy other:SELF <-
// Copy 'other' into the current set
( + i:INTEGER;
-
+
// Note: this naive implementation is OK because node
// recycling is implemented.
// BSBS: A revoir.
make;
i := 1;
- {i > other.count}.until_do {
+ {i > other.count}.until_do {
add (other.item i);
i := i + 1;
};
@@ -529,10 +529,10 @@ Section Public
- from_collection model:COLLECTION(V) <-
// Add all items of `model'.
[ ...
- -? {model != NULL};
+ -? {model != NULL};
]
( + i, up:INTEGER;
-
+
make
up := model.upper;
i := model.lower;
@@ -545,13 +545,13 @@ Section Public
//
// Agents based features:
//
-
+
- do_all action:BLOCK <-
// Apply `action' to every item of `Self'.
//
// See also `for_all', `exists'.
( + i:INTEGER;
-
+
i := lower;
{i > upper}.until_do {
action.value (item i);
@@ -565,7 +565,7 @@ Section Public
// See also `do_all', `exists'.
( + i:INTEGER;
+ result:BOOLEAN;
-
+
result := TRUE;
i := lower;
{(! result) || {i > upper}}.until_do {
@@ -581,7 +581,7 @@ Section Public
// See also `do_all', `for_all'.
( + i:INTEGER;
+ result:BOOLEAN;
-
+
i := lower;
{result || {i > upper}}.until_do {
result := predicate.value (item i);
@@ -593,21 +593,21 @@ Section Public
//
// Creation.
//
-
- - create:SELF <-
+
+ - create:SELF <-
( + result:SELF;
-
+
result := clone;
result.make;
result
);
-
+
- make <-
// Creation of an empty SET.
(
deferred;
)
[ ...
- +? {is_empty};
+ +? {is_empty};
];
diff --git a/lib/internal/portable/collection/simple_dictionary.li b/lib/internal/portable/collection/simple_dictionary.li
index b1304e0..22cd995 100644
--- a/lib/internal/portable/collection/simple_dictionary.li
+++ b/lib/internal/portable/collection/simple_dictionary.li
@@ -19,15 +19,15 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SIMPLE_DICTIONARY(V, K);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
// Basic dictionaries (assymmetry value / key)
// (class akin to DOUBLE_DICTIONARY)
Section Inherit
-
+
+ parent_dictionary:Expanded DICTIONARY(V,K);
diff --git a/lib/internal/portable/file_system/fs_min.li b/lib/internal/portable/file_system/fs_min.li
index d3b145b..5ee80e0 100644
--- a/lib/internal/portable/file_system/fs_min.li
+++ b/lib/internal/portable/file_system/fs_min.li
@@ -19,64 +19,64 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FS_MIN;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment := "File system minimum";
-
+
- external := `#include <unistd.h>`;
-
+
Section Inherit
-
+
- parent_object:OBJECT <- OBJECT;
-
-Section Private
-
+
+Section Private
+
- string_tmp:STRING := STRING.create 128;
-
+
Section Public
-
+
//
- // Independance File System
+ // Independance File System
//
-
- - open_read n:ABSTRACT_STRING :POINTER <-
+
+ - open_read n:ABSTRACT_STRING :POINTER <-
( + buf:NATIVE_ARRAY(CHARACTER);
string_tmp.copy n;
buf := string_tmp.to_external;
- `fopen((char*)@buf,"rb")`:(POINTER)
+ `fopen((char*)@buf,"rb")`:(POINTER)
);
- - open_write n:ABSTRACT_STRING :POINTER <-
+ - open_write n:ABSTRACT_STRING :POINTER <-
( + buf:NATIVE_ARRAY(CHARACTER);
string_tmp.copy n;
buf := string_tmp.to_external;
`fopen((char*)@buf,"wb")`:(POINTER)
);
-
- - read f:POINTER in buf:STRING size sz:INTEGER :INTEGER <-
+
+ - read f:POINTER in buf:STRING size sz:INTEGER :INTEGER <-
( + ptr:NATIVE_ARRAY(CHARACTER);
+ result:INTEGER;
- ptr := buf.to_external;
+ ptr := buf.to_external;
result := `fread((void *)(@ptr),(size_t)(1), (size_t)(@sz),(FILE*)(@f))`:(INTEGER);
ptr.put '\0' to sz;
buf.from_external ptr;
result
);
- - write f:POINTER with buf:STRING size sz:INTEGER :INTEGER <-
+ - write f:POINTER with buf:STRING size sz:INTEGER :INTEGER <-
( + ptr:NATIVE_ARRAY(CHARACTER);
+ result:INTEGER;
- ptr := buf.to_external;
+ ptr := buf.to_external;
result := `fwrite((void *)(@ptr),(size_t)(1), (size_t)(@sz),(FILE*)(@f))`:(INTEGER);
result
);
-
+
- close p:POINTER <- `fclose((FILE*)(@p))`;
-
+
- file_size p:POINTER :INTEGER <-
( + result:INTEGER;
`fseek((FILE*)(@p),0,SEEK_END)`;
@@ -89,13 +89,13 @@ Section Public
( + p:NATIVE_ARRAY(CHARACTER);
+ stream:POINTER;
+ result:BOOLEAN;
-
+
string_tmp.copy new_path;
- p := string_tmp.to_external;
+ p := string_tmp.to_external;
stream := `fopen((char*)@p,"w+b")`:POINTER;
(result := (stream != NULL)).if {
- close stream;
+ close stream;
};
result
);
-
+
diff --git a/lib/internal/portable/io/file_input_stream.li b/lib/internal/portable/io/file_input_stream.li
index 2b9eeaf..7be4525 100644
--- a/lib/internal/portable/io/file_input_stream.li
+++ b/lib/internal/portable/io/file_input_stream.li
@@ -90,8 +90,8 @@ Section Public
last_character
);
- - unread_character <-
- (
+ - unread_character <-
+ (
push_back_flag := TRUE;
);
@@ -109,7 +109,7 @@ Section Private
- raw_read_character :CHARACTER <-
(
-
+
);
// kate: hl Lisaac v0.2; indent-width 2; space-indent on; replace-tabs on;
diff --git a/lib/internal/portable/io/file_output_stream.li b/lib/internal/portable/io/file_output_stream.li
index 5eaa52a..42ff121 100644
--- a/lib/internal/portable/io/file_output_stream.li
+++ b/lib/internal/portable/io/file_output_stream.li
@@ -50,21 +50,21 @@ Section Public
result.make std_file;
result
);
-
+
Section Public
- put_character c:CHARACTER <-
// Put `c' on stream
- (
+ (
tmp.put c to 0;
file.physical_write tmp size 1;
);
- flush <- (); //file.basic_fush;
-
+
Section Private
-
+
- tmp:NATIVE_ARRAY(UINTEGER_8) := NATIVE_ARRAY(UINTEGER_8).create 1;
-
+
// kate: hl Lisaac v0.2; indent-width 2; space-indent on; replace-tabs off;
// kate: tab-width 8; remove-trailing-space on;
diff --git a/lib/internal/portable/io/input_stream.li b/lib/internal/portable/io/input_stream.li
index cb57e9b..bc9271b 100644
--- a/lib/internal/portable/io/input_stream.li
+++ b/lib/internal/portable/io/input_stream.li
@@ -19,27 +19,27 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := INPUT_STREAM;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "This abstract class is the superclass of all classes \
\representing an input stream of bytes.";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
- push_back_flag:BOOLEAN;
// True if one char is already pushed back.
-
+
- last_integer:INTEGER;
// Last integer read using `read_integer'.
-
+
- last_string:STRING :=
// Access to the unique common buffer to get for example the result
// computed by `read_line', `read_word', `newline', etc. This is a once
@@ -47,15 +47,15 @@ Section Public
(
STRING.create 1024
);
-
-
+
+
- is_connected:BOOLEAN <-
// True when the corresponding stream is connected
// to some physical input device.
(
deferred;
);
-
+
- end_of_input:BOOLEAN <-
// Has end-of-input been reached ?
// True when the last character has been read.
@@ -63,10 +63,10 @@ Section Public
? { is_connected };
deferred;
);
-
-
+
+
// To read one character at a time:
-
+
- read_character:CHARACTER <-
// Read a character and assign it to `last_character'.
( + result:CHARACTER;
@@ -75,15 +75,15 @@ Section Public
? {! push_back_flag};
result
);
-
-
+
+
- last_character:CHARACTER <-
// Last character read with `read_character'.
(
? { is_connected };
deferred;
);
-
+
- unread_character <-
// Un-read the last character read.
(
@@ -91,9 +91,9 @@ Section Public
deferred;
? { push_back_flag };
);
-
+
// Skipping separators:
-
+
- skip_separators <-
// Skip all separators (see `is_separator' of class CHARACTER) and
// make the first non-separator available in `last_character'. This
@@ -109,12 +109,12 @@ Section Public
unread_character;
};
);
-
+
- skip_separators_using separators:STRING <-
// Same job as `skip_separators' using the `separators' set.
(
? { separators != NULL };
-
+
{ end_of_input ||{!separators.has last_character}}.until_do {
read_character;
};
@@ -122,7 +122,7 @@ Section Public
unread_character;
};
);
-
+
- skip_remainder_of_line <-
// Skip all the remainder of the line including the end of
// line character itself.
@@ -142,9 +142,9 @@ Section Public
};
};
);
-
+
// To read one number at a time:
-
+
- read_integer <-
// Read an integer according to the Lisaac syntax.
// Make result available in `last_integer'.
@@ -159,9 +159,9 @@ Section Public
// state = 2 :in the number.
// state = 3 :end state.
// state = 4 :error state.
-
+
? { !end_of_input };
-
+
{ state > 2 }.until_do {
read_character;
(state = 0).if {
@@ -192,7 +192,7 @@ Section Public
state := 3;
};
};
-
+
end_of_input.if {
state.when 0 to 1 then {
state := 4;
@@ -201,7 +201,7 @@ Section Public
};
};
};
-
+
!end_of_input.if {
unread_character;
};
@@ -213,9 +213,9 @@ Section Public
last_integer := - last_integer;
};
);
-
-
- /*
+
+
+ /*
- read_real <-
// Read a REAL and make the result available in `last_real'
// and in `last_double'.
@@ -225,10 +225,10 @@ Section Public
read_double;
last_real := last_double.to_real;
);
-
+
- last_real:REAL;
// Last real read with `read_real'.
-
+
- read_double <-
// Read a DOUBLE and make the result available in `last_double'.
(
@@ -240,11 +240,11 @@ Section Public
// state = 3 :in the fractional part.
// state = 4 :end state.
// state = 5 :error state.
-
+
? { !end_of_input };
-
+
last_string.clear
-
+
{ state >= 4 }.until_do {
read_character;
( state = 0).if {
@@ -287,7 +287,7 @@ Section Public
state := 4;
};
};
-
+
end_of_input.if {
state.when 2 to 4 then {
state := 4;
@@ -296,16 +296,16 @@ Section Public
};
};
};
-
+
(! end_of_input).if {
unread_character;
};
-
+
( state = 5 ).if {
io.put_string "Error in INPUT_STREAM.read_double.\n";
crash;
};
-
+
( last_string.count > 0).if {
last_double := last_string.to_double;
} else {
@@ -315,15 +315,15 @@ Section Public
last_double := - last_double;
};
);
-
-
+
+
- last_double:DOUBLE;
// Last double read with `read_double'.
-
+
*/
-
+
// To read one line or one word at a time:
-
+
- read_line <-
// Read a complete line ended by '\n' or `end_of_input'. Make the
// result available in `last_string' common buffer. The end of line
@@ -333,8 +333,8 @@ Section Public
last_string.clear;
read_line_in last_string;
);
-
-
+
+
- read_word <-
// Read a word using `is_separator' of class CHARACTER. Result is
// available in the `last_string' common buffer. Heading separators are
@@ -343,28 +343,28 @@ Section Public
// encountered, Result can be the empty string.
(
? { !end_of_input };
-
+
skip_separators;
!end_of_input.if {
read_character;
};
-
+
last_string.clear;
{ end_of_input || { last_character.is_separator }}.until_do {
last_string.extend last_character;
read_character;
};
);
-
+
- newline <-
// Consume input until newline ('\n') is found. Corresponding
// STRING is stored in `last_string' common buffer.
(
+ stop:BOOLEAN;
-
+
last_string.clear;
stop := end_of_input;
-
+
{stop}.until_do {
read_character;
( end_of_input || { last_character = '\n' }).if {
@@ -374,7 +374,7 @@ Section Public
};
};
);
-
+
- reach_and_skip keyword:STRING <-
// Try to skip enough characters in order to reach the `keyword'
// which is skipped too. If the `keyword' is not in the remainder of
@@ -385,19 +385,19 @@ Section Public
+ stop:BOOLEAN;
+ i:INTEGER;
+ first:CHARACTER;
-
+
? { !keyword.is_empty };
-
+
last_string.clear;
first := keyword.first;
-
+
{ end_of_input || stop }.until_do {
// Reach the first character of the `keyword':
i := 2;
{ (i > last_string.count) || { last_string.item i = first }}.until_do {
i := i + 1;
};
-
+
( i <= last_string.count ).if {
last_string.remove_first (i - 1);
} else {
@@ -410,10 +410,10 @@ Section Public
};
last_string.extend last_character;
};
-
+
? { !end_of_input ->> {last_string.item 1 = first}};
? { last_string.count <= keyword.count };
-
+
// Now we need as many characters as in `keyword':
{ end_of_input || { last_string.count = keyword.count } }.until_do {
read_character;
@@ -421,17 +421,17 @@ Section Public
};
stop := last_string == keyword;
};
-
+
!end_of_input.if {
read_character;
unread_character;
};
-
+
? {!end_of_input ->> { last_string == keyword} };
);
-
+
// Other features:
-
+
- read_line_in buffer:STRING <-
// Same jobs as `read_line' but storage is directly done in `buffer'.
(
@@ -439,13 +439,13 @@ Section Public
? { buffer != NULL };
deferred;
);
-
+
- read_word_using separators:STRING <-
// Same jobs as `read_word' using `separators'.
(
? { !end_of_input };
? { separators != NULL };
-
+
skip_separators_using separators;
!end_of_input.if {
read_character;
@@ -456,24 +456,24 @@ Section Public
read_character;
};
);
-
+
- read_tail_in str:STRING <-
// Read all remaining character of the file in `str'.
(
? { str != NULL };
-
+
end_of_input.until_do {
read_character;
!end_of_input.if {
str.extend last_character;
};
};
-
+
? { end_of_input };
);
Section Private
-
+
- basic_io_getc :CHARACTER <- SYSTEM_IO.get_char;
-
+
- basic_io_eof :CHARACTER <- SYSTEM_IO.eof;
\ No newline at end of file
diff --git a/lib/internal/portable/io/std_input_output.li b/lib/internal/portable/io/std_input_output.li
index aebb4a3..b206978 100644
--- a/lib/internal/portable/io/std_input_output.li
+++ b/lib/internal/portable/io/std_input_output.li
@@ -19,20 +19,20 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=STD_INPUT_OUTPUT;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="To have the useful `io'";
-
+
Section Inherit
-
+
- inherit_input_stream:INPUT_STREAM := INPUT_STREAM;
- inherit_output_stream:OUTPUT_STREAM := OUTPUT_STREAM;
-
+
Section Public
- is_connected:BOOLEAN := TRUE;
@@ -70,7 +70,7 @@ Section Public
(
std_input.end_of_input
);
-
+
- read_line_in buffer:STRING <-
(
std_input.read_line_in buffer;
diff --git a/lib/internal/portable/memory/memory.li b/lib/internal/portable/memory/memory.li
index e6328a6..3f5924f 100644
--- a/lib/internal/portable/memory/memory.li
+++ b/lib/internal/portable/memory/memory.li
@@ -19,104 +19,104 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Strict MEMORY;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- comment := "Memory manager 32/64 bits.";
-
+
- external :=
`
#define MINIMUM_SIZE 256
void *table_size[MINIMUM_SIZE/sizeof(void *)];
void *last_block[64];
`;
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
//
// MACRO ALLOCATOR
//
-
+
Section Mapping
-
- + previous_linear:MEMORY;
+
+ + previous_linear:MEMORY;
+ size_and_id:UINTEGER_CPU;
-
- //---------------> Limit for Busy
-
+
+ //---------------> Limit for Busy
+
+ next_free :MEMORY;
+ previous_free:MEMORY;
-
+
//---------------> Limit for Free
-
-Section Private
-
+
+Section Private
+
//
// Product by compiler.
//
-
+
// For GC only.
/*
- get_object_size t:INTEGER :INTEGER <- `get_object_size(@t)`:INTEGER;
-
- - mark_static_object <- `mark_static_object()`;
-
+
+ - mark_static_object <- `mark_static_object()`;
+
- demark_static_object <- `demark_static_object()`;
-
+
- mark_object ptr:POINTER type t:INTEGER <- `mark_object(@ptr, at t)`;
-
+
- demark_object ptr:POINTER type t:INTEGER <- `demark_object(@ptr, at t)`;
- */
-
+ */
+
Section Public
-
- - object_size:INTEGER <- POINTER.object_size + UINTEGER_CPU.object_size;
-
-Section MEMORY
-
+
+ - object_size:INTEGER <- POINTER.object_size + UINTEGER_CPU.object_size;
+
+Section MEMORY
+
- is_debug_memory:BOOLEAN := FALSE;
-
+
- this:POINTER <- CONVERT(MEMORY,POINTER).on Self;
-
+
- begin:POINTER <- this + object_size;
-
+
- size:UINTEGER_CPU <- size_and_id & ~ 3.to_uinteger_cpu;
-
+
- next_linear:MEMORY <- CONVERT(POINTER,MEMORY).on (begin + size);
-
+
- id:UINTEGER_CPU <- size_and_id & 01b;
-
+
- id_end:UINTEGER_CPU <- 10b;
-
+
- is_end:BOOLEAN <- (size_and_id & id_end).to_boolean;
-
+
- set_previous_linear p:MEMORY <- ( previous_linear := p; );
-
+
- set_size_and_id s:UINTEGER_CPU <- ( size_and_id := s; );
-
+
- get_index p:POINTER :UINTEGER_CPU <- (p - begin_memory).to_uinteger_cpu >> 26;
-
+
- nb_page:UINTEGER_CPU;
-
- - put_last m:MEMORY to idx:UINTEGER_CPU <-
+
+ - put_last m:MEMORY to idx:UINTEGER_CPU <-
(
? {idx < nb_page};
`last_block[@idx] = @m`;
);
-
+
- get_last idx:UINTEGER_CPU :MEMORY <-
- (
+ (
? {idx < nb_page};
`last_block[@idx]`:MEMORY
);
-
+
- search_capacity <-
- (
+ (
capacity_max := SYSTEM.get_memory_capacity;
begin_memory := SYSTEM.get_begin_memory;
/*
@@ -130,7 +130,7 @@ Section MEMORY
- new_page:MEMORY <-
( + old_size,new_size:UINTEGER_CPU;
+ block:MEMORY;
-
+
(capacity_max = 0).if {
search_capacity;
};
@@ -142,32 +142,32 @@ Section MEMORY
die_with_code exit_failure_code;
};
/*
- "Begin_memory + old_size : ".print;
+ "Begin_memory + old_size : ".print;
(begin_memory + old_size).print_hex; '\n'.print;
"object_size ".print; object_size.print; '\n'.print;
*/
- block := CONVERT(POINTER,MEMORY).on (begin_memory + old_size);
- block.set_previous_linear NULL;
+ block := CONVERT(POINTER,MEMORY).on (begin_memory + old_size);
+ block.set_previous_linear NULL;
block.set_size_and_id (id_free | id_end | (64.mb - object_size));
- block.add_link_free;
+ block.add_link_free;
put_last block to (nb_page - 1);
block
);
-
+
//
// Busy / Free Block.
//
-
+
- id_free:UINTEGER_CPU <- 00b;
- id_busy:UINTEGER_CPU <- 01b;
-
+
- set_next_free n:MEMORY <- ( next_free := n; );
- set_previous_free p:MEMORY <- ( previous_free := p; );
-
+
- delete_link_free <-
( + prev,next:MEMORY;
-
+
prev := previous_free;
next := next_free;
(prev = NULL).if {
@@ -179,72 +179,72 @@ Section MEMORY
next.set_previous_free prev;
};
);
-
+
- add_link_free <-
- (
+ (
next_free := first_free;
previous_free := NULL;
- (first_free != NULL).if {
+ (first_free != NULL).if {
first_free.set_previous_free Self;
- };
- first_free := Self;
+ };
+ first_free := Self;
);
-
+
Section MEMORY
-
+
- first_free:MEMORY;
-
+
//
// Management.
//
-
+
- to_free idx:UINTEGER_CPU <-
( + new_free,next:MEMORY;
+ new_size:UINTEGER_CPU;
{id = id_busy} ? "Memory: Macro block not busy.";
- {idx.in_range 0 to 63} ? "Memory: Bound index.";
-
+ {idx.in_range 0 to 63} ? "Memory: Bound index.";
+
next := next_linear;
new_free := previous_linear;
new_size := size_and_id & ~ 1.to_uinteger_cpu;
((new_free = NULL) || {new_free.id != id_free}).if {
// `Self' => Free
- new_free := Self;
- add_link_free;
+ new_free := Self;
+ add_link_free;
} else {
// `previous_linear' => Free
- new_size := new_size + new_free.size_and_id + object_size;
+ new_size := new_size + new_free.size_and_id + object_size;
};
-
+
((! is_end) && {next.id = id_free}).if {
// Delete and concat `next_linear'
new_size := new_size + next.size_and_id + object_size;
- next.delete_link_free;
- };
+ next.delete_link_free;
+ };
new_free.set_size_and_id new_size;
-
+
(new_free.is_end).if {
- put_last new_free to idx;
+ put_last new_free to idx;
} else {
next := new_free.next_linear;
next.set_previous_linear new_free;
- };
+ };
);
-
+
- to_busy sz:POINTER index idx:UINTEGER_CPU <-
- ( + siz,new_size:UINTEGER_CPU;
+ ( + siz,new_size:UINTEGER_CPU;
+ new,next:MEMORY;
- {id = id_free} ? "Memory: Macro block not free.";
+ {id = id_free} ? "Memory: Macro block not free.";
{(sz & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
-
+
delete_link_free;
- //
+ //
siz := size_and_id;
- new_size := siz - sz;
+ new_size := siz - sz;
(new_size > (minimum_size+object_size+object_size)).if {
siz := sz;
new := CONVERT(POINTER,MEMORY).on (begin+sz);
- new.set_previous_linear Self;
+ new.set_previous_linear Self;
new.set_size_and_id (new_size - object_size);
new.add_link_free;
(new.is_end).if {
@@ -253,21 +253,21 @@ Section MEMORY
next := new.next_linear;
next.set_previous_linear new;
};
- };
+ };
size_and_id := siz | id_busy;
{id = id_busy} ? "Memory: Macro Block not busy.";
);
-
+
- resize new_size:UINTEGER_CPU index idx:UINTEGER_CPU :MEMORY <-
( + nxt,result:MEMORY;
- + old_size,sz:UINTEGER_CPU;
-
+ + old_size,sz:UINTEGER_CPU;
+
{(new_size & (POINTER.object_size -1)) = 0} ? "Memory: Alignment.";
{idx.in_range 0 to 63} ? "Memory: Bound index.";
-
+
old_size := size;
- (new_size > old_size).if {
- (! is_end).if {
+ (new_size > old_size).if {
+ (! is_end).if {
nxt := next_linear;
sz := new_size - old_size - object_size;
((nxt.id = id_free) && {nxt.size >= sz}).if {
@@ -280,33 +280,33 @@ Section MEMORY
nxt.set_previous_linear Self;
};
result := Self;
- };
+ };
};
- (result = NULL).if {
- // new allocation.
- result := search new_size;
- copy begin to (result.begin) size old_size;
- to_free idx;
+ (result = NULL).if {
+ // new allocation.
+ result := search new_size;
+ copy begin to (result.begin) size old_size;
+ to_free idx;
};
} else {
result := Self;
- };
+ };
result
);
-
+
//
// Searching.
//
-
+
- search new_size:UINTEGER_CPU :MEMORY <-
( + result:MEMORY;
+ idx:UINTEGER_CPU;
-
-
+
+
{new_size > minimum_size-POINTER.object_size} ? "Memory: Big block.";
{(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
-
- result := first_free;
+
+ result := first_free;
{(result != NULL) && {result.size < new_size}}.while_do {
result := result.next_free;
};
@@ -316,17 +316,17 @@ Section MEMORY
idx := get_index (result.this);
{idx.in_range 0 to 63} ? "Memory: Bound index.";
result.to_busy new_size index idx;
-
+
result
);
-
+
- new_lab t:UINTEGER_32 :POINTER <-
( + idx:UINTEGER_CPU;
+ blc,prev:MEMORY;
+ result:POINTER;
-
+
{
- (idx < nb_page) &&
+ (idx < nb_page) &&
{
blc := get_last idx;
(blc.size < 4096) || {blc.id = id_busy}
@@ -334,80 +334,80 @@ Section MEMORY
}.while_do {
idx := idx + 1;
};
-
- (idx >= nb_page).if {
+
+ (idx >= nb_page).if {
blc := new_page;
- };
+ };
blc.set_size_and_id (blc.size_and_id - 4096);
- result := blc.next_linear.this;
-
+ result := blc.next_linear.this;
+
(blc.size < minimum_size).if {
blc.delete_link_free;
prev := blc.previous_linear;
- (prev != NULL).if {
+ (prev != NULL).if {
prev.set_size_and_id (prev.size_and_id + blc.size_and_id + object_size);
put_last prev to idx;
};
};
- put_32 t to result;
-
+ put_32 t to result;
+
{((result - begin_memory) & 0FFFh) = 0} ? "Memory: Alignment LAB.";
result + UINTEGER_32.object_size
- );
-
+ );
+
Section Private
-
+
- minimum_size:UINTEGER_CPU <- `MINIMUM_SIZE`:UINTEGER_CPU;
-
- - table_type idx:UINTEGER_32 :POINTER <-
+
+ - table_type idx:UINTEGER_32 :POINTER <-
(
//{idx.in_range 0 to 17} ? "Memory: Bound table_type.";
`&(table_type[@idx])`:POINTER
);
-
- - table_size idx:UINTEGER_CPU :POINTER <-
+
+ - table_size idx:UINTEGER_CPU :POINTER <-
(
- {idx.in_range 1 to (minimum_size/POINTER.object_size)} ?
+ {idx.in_range 1 to (minimum_size/POINTER.object_size)} ?
"Memory: Bound table_size.";
`&(table_size[@idx-1])`:POINTER
);
-
+
- begin_memory:POINTER;
-
+
- capacity_max:UINTEGER_CPU;
-
+
- read_ptr p:POINTER :POINTER <-
( + mem:NATIVE_ARRAY(POINTER);
mem := CONVERT(POINTER, NATIVE_ARRAY(POINTER)).on p;
mem.item 0
);
-
+
- put_ptr v:POINTER to p:POINTER <-
( + mem:NATIVE_ARRAY(POINTER);
mem := CONVERT(POINTER, NATIVE_ARRAY(POINTER)).on p;
mem.put v to 0;
);
-
+
- put_32 v:UINTEGER_32 to p:POINTER <-
( + mem:NATIVE_ARRAY(UINTEGER_32);
mem := CONVERT(POINTER, NATIVE_ARRAY(UINTEGER_32)).on p;
mem.put v to 0;
);
-
+
- micro_alloc new_size:UINTEGER_CPU table ptr_table:POINTER lab lab_type:UINTEGER_32 :POINTER <-
( + result,next,next2:POINTER;
+ page:POINTER;
{(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
{new_size >= POINTER.object_size} ? "Memory: Size = 0.";
- result := read_ptr ptr_table;
- (result = NULL).if {
- // Allocation new LAB.
- result := new_lab lab_type;
- next := result + new_size;
+ result := read_ptr ptr_table;
+ (result = NULL).if {
+ // Allocation new LAB.
+ result := new_lab lab_type;
+ next := result + new_size;
put_ptr NULL to next;
- put_ptr next to ptr_table;
- } else {
+ put_ptr next to ptr_table;
+ } else {
// Next Linked list.
next := read_ptr result;
(next = NULL).if {
@@ -416,72 +416,72 @@ Section Private
((page + (new_size << 1)) <= 4096).if {
next := result + new_size;
} else {
- next := new_lab lab_type;
+ next := new_lab lab_type;
};
put_ptr NULL to next;
put_ptr next to ptr_table;
- } else {
- // Linked list allocation.
+ } else {
+ // Linked list allocation.
next2 := read_ptr next & ~ 11b.to_uinteger_cpu;
- put_ptr next2 to result;
- result := next;
- };
- };
+ put_ptr next2 to result;
+ result := next;
+ };
+ };
result
);
-
+
- micro_free p:POINTER table ptr_table:POINTER <-
( + next,last:POINTER;
{p != NULL} ? "Memory: Pointer NULL.";
-
+
last := read_ptr ptr_table;
{last != NULL} ? "Memory: Table NULL.";
next := read_ptr last;
put_ptr (next | 11b) to p;
put_ptr p to last;
);
-
+
Section Private
- copy src:POINTER to dst:POINTER size sz:UINTEGER_CPU <-
( + na_src,na_dst:NATIVE_ARRAY(POINTER);
+ siz:INTEGER;
-
+
siz := sz.to_integer;
{(siz & (POINTER.object_size -1)) = 0} ? "Memory: Copy alignment.";
siz := siz / POINTER.object_size;
na_src := CONVERT(POINTER, NATIVE_ARRAY(POINTER)).on src;
na_dst := CONVERT(POINTER, NATIVE_ARRAY(POINTER)).on dst;
- //
- (siz - 1).downto 0 do { j:INTEGER;
+ //
+ (siz - 1).downto 0 do { j:INTEGER;
na_dst.put (na_src.item j) to j;
- };
+ };
);
-
+
- fill_memory src:POINTER size sz:UINTEGER_CPU <-
// Just for debug.
( + na_src:NATIVE_ARRAY(POINTER);
+ siz:UINTEGER_CPU;
-
+
{(sz & (POINTER.object_size -1)) = 0} ? "Memory: Copy alignment.";
-
- siz := sz.align_power (POINTER.object_size) / POINTER.object_size;
- na_src := CONVERT(POINTER,NATIVE_ARRAY(POINTER)).on src;
+
+ siz := sz.align_power (POINTER.object_size) / POINTER.object_size;
+ na_src := CONVERT(POINTER,NATIVE_ARRAY(POINTER)).on src;
((siz-1).to_integer).downto 0 do { j:INTEGER;
na_src.put NULL to j;
- };
- );
+ };
+ );
/*
Section External
-
+
- calloc (nb,sz:UINTEGER) :POINTER <-
( + result:POINTER;
+ size:UINTEGER_32;
+ tab:NATIVE_ARRAY(UINTEGER_8);
-
+
size := nb*sz;
"calloc = ".print;
- size.print; '\n'.print;
+ size.print; '\n'.print;
result := malloc (size.to_uinteger);
tab := CONVERT(POINTER,NATIVE_ARRAY(UINTEGER_8)).on result;
0.to (size-1) do { i:INTEGER;
@@ -489,11 +489,11 @@ Section External
};
result
);
-
+
- malloc sz:UINTEGER :POINTER <-
( + result:POINTER;
"malloc = ".print;
- sz.print; '\n'.print;
+ sz.print; '\n'.print;
result := MEMORY.alloc_dynamic (sz.to_pointer);
(result = NULL).if {
"MEMORY : MERDE\n".print;
@@ -501,10 +501,10 @@ Section External
"MEMORY :sortie\n".print;
result
);
-
+
- free ptr:POINTER <-
( + mem:MEMORY;
-
+
"FREE\n".print;
(ptr != NULL).if {
mem := CONVERT(POINTER, MEMORY).on (ptr - object_size);
@@ -518,127 +518,127 @@ Section Public
//
// MICRO ALLOCATOR
//
-
+
- alloc_type t:UINTEGER_32 size sz:UINTEGER_CPU :POINTER <-
// Allocation for object without type. (LAB_TYPE)
- ( + ptr_table,result:POINTER;
+ ( + ptr_table,result:POINTER;
+ new_size:UINTEGER_CPU;
-
+
verify_memory "Begin alloc_type size";
-
+
{sz <= minimum_size} ? "Memory: Size bound.";
- new_size := sz.align_power (POINTER.object_size);
- {(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
+ new_size := sz.align_power (POINTER.object_size);
+ {(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
ptr_table := table_type t;
- result := micro_alloc new_size table ptr_table lab (t | 1b);
-
+ result := micro_alloc new_size table ptr_table lab (t | 1b);
+
verify_memory "End alloc_type size";
-
+
result
);
-
+
- free p:POINTER type t:UINTEGER_32 <-
( + ptr_table:POINTER;
{p != NULL} ? "Memory: Pointer NULL.";
-
+
verify_memory "Begin free type";
-
+
ptr_table := table_type t;
micro_free p table ptr_table;
-
+
verify_memory "End free type";
);
-
+
- alloc_size sz:UINTEGER_CPU :POINTER <-
// Allocation for object with type. (LAB_SIZE)
( + ptr_table,result:POINTER;
+ new_size:UINTEGER_CPU;
-
+
verify_memory "Begin alloc_size";
-
+
{sz <= minimum_size} ? "Memory: Size bound.";
-
- new_size := sz.align_power (POINTER.object_size);
-
+
+ new_size := sz.align_power (POINTER.object_size);
+
{(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
-
- ptr_table := table_size (new_size / POINTER.object_size);
+
+ ptr_table := table_size (new_size / POINTER.object_size);
result := micro_alloc new_size table ptr_table lab (new_size.to_uinteger_32);
-
+
verify_memory "End alloc_size";
result
);
-
+
- free p:POINTER size sz:UINTEGER_CPU <-
( + ptr_table:POINTER;
+ new_size:UINTEGER_CPU;
{p != NULL} ? "Memory: Pointer NULL.";
-
+
verify_memory "Begin free size";
-
- new_size := sz.align_power (POINTER.object_size);
-
+
+ new_size := sz.align_power (POINTER.object_size);
+
{(new_size & (POINTER.object_size - 1)) = 0} ? "Memory: Alignment.";
-
+
ptr_table := table_size (new_size / POINTER.object_size);
micro_free p table ptr_table;
-
+
verify_memory "End free size";
);
-
+
- alloc_dynamic sz:UINTEGER_CPU :POINTER <-
// Allocation NATIVE_ARRAY[E]. (LAB_SIZE or malloc)
( + new_size,new_size2:UINTEGER_CPU;
+ result:POINTER;
{sz != 0} ? "Memory: Size = 0";
-
+
verify_memory "Begin alloc_dynamic";
-
- new_size := sz.align_power (POINTER.object_size);
+
+ new_size := sz.align_power (POINTER.object_size);
new_size2 := new_size; // + UINTEGER_CPU.object_size;
(new_size2 <= minimum_size).if {
- result := alloc_size new_size2;
+ result := alloc_size new_size2;
//put_32 3 to result; // 3 : 2=NATIVE_ARRAY
result := result; // + UINTEGER_CPU.object_size;
- } else {
- result := search new_size .begin;
+ } else {
+ result := search new_size .begin;
};
-
+
verify_memory "End alloc_dynamic";
-
- result
+
+ result
);
-
+
- realloc_dynamic p:POINTER old_size old_sz:UINTEGER_CPU new_size new_sz:UINTEGER_CPU :POINTER <-
( + old_size,old_size2,new_size:UINTEGER_CPU;
+ mem:MEMORY;
- + result:POINTER;
+ + result:POINTER;
{old_size < new_sz} ? "Memory: New size < Old size.";
-
+
verify_memory "Begin realloc_dynamic";
-
- old_size := old_sz.align_power (POINTER.object_size);
- old_size2 := old_size; // + UINTEGER_CPU.object_size;
- new_size := new_sz.align_power (POINTER.object_size);
- (old_size2 <= minimum_size).if {
- result := alloc_dynamic new_size;
+
+ old_size := old_sz.align_power (POINTER.object_size);
+ old_size2 := old_size; // + UINTEGER_CPU.object_size;
+ new_size := new_sz.align_power (POINTER.object_size);
+ (old_size2 <= minimum_size).if {
+ result := alloc_dynamic new_size;
copy p to result size old_size;
- free (p /*- UINTEGER_CPU.object_size*/) size old_size2;
- } else {
+ free (p /*- UINTEGER_CPU.object_size*/) size old_size2;
+ } else {
mem := CONVERT(POINTER, MEMORY).on (p - object_size);
- result := mem.resize new_size index (get_index p).begin;
+ result := mem.resize new_size index (get_index p).begin;
};
-
+
verify_memory "End realloc_dynamic";
-
+
result
);
-
+
- free_dynamic p:POINTER size sz:UINTEGER_CPU <-
( + new_size,new_size2:UINTEGER_CPU;
+ mem:MEMORY;
-
+
new_size := sz.align_power (POINTER.object_size); // BSBS: Optim, alignment by compilo.
new_size2 := new_size; // + UINTEGER_CPU.object_size;
(new_size2 <= minimum_size).if {
@@ -648,19 +648,19 @@ Section Public
mem.to_free (get_index p);
};
);
-
+
//
// GARBAGE COLLECTOR
//
/*
- garbage_collector_pass <-
(
- mark;
+ mark;
sweep;
);
-
-Section Private
-
+
+Section Private
+
- mark <-
( + stack,lab:NATIVE_ARRAY(POINTER);
+ ptr,beg_mem,end_mem,ptr_lab,ptr_table,lim_lab:POINTER;
@@ -669,10 +669,10 @@ Section Private
+ mem:MEMORY;
+ type:UINTEGER_32;
+ type_object, size_object,step:UINTEGER_32;
-
+
// Mark Global + BSS.
- mark_static_object;
-
+ mark_static_object;
+
// Mark Stack object.
stack := `top_stack()`:NATIVE_ARRAY(POINTER);
size_stack := (`@stack - begin_stack`:UINTEGER_32) / POINTER.object_size.to_uinteger_32;
@@ -687,7 +687,7 @@ Section Private
mem := get_last (ptr_mem >> 26);
(ptr > mem.next_linear.this).if {
// `ptr' is in LAB.
- ptr_lab := begin_memory + (ptr_mem & 0FFFFF000h);
+ ptr_lab := begin_memory + (ptr_mem & 0FFFFF000h);
type := read ptr_lab .to_uinteger_32;
(type & 01b != 0).if {
// LAB Type.
@@ -713,15 +713,15 @@ Section Private
};
};
);
-
+
- sweep <-
( + last:MEMORY;
+ ptr_lab,ptr_end,ptr,ptr_table,end_lab,ptr_max:POINTER;
+ type,type_object,size_object:UINTEGER_32;
-
+
// Demark a Global + BSS.
demark_static_object;
-
+
// Demark a Store.
ptr_end := begin_memory + 64.mb;
(nb_page-1).downto 0 do { i:UINTEGER_32;
@@ -747,7 +747,7 @@ Section Private
ptr := ptr + size_object;
};
} else {
- // LAB Size.
+ // LAB Size.
size_object := type;
ptr_table := table_size (size_object / POINTER.object_size.to_uinteger_32);
end_lab := read ptr_table;
@@ -761,19 +761,19 @@ Section Private
demark_object ptr type type_object;
ptr := ptr + size_object;
};
- };
+ };
};
ptr_end := ptr_end + 64.mb;
};
);
*/
-
+
Section Private
-
+
- verify_memory msg:STRING_CONSTANT<-
( + m,next,prev:MEMORY;
+ msg_intern:STRING_CONSTANT;
-
+
(is_debug_memory).if {
(begin_memory != NULL).if {
next := CONVERT(POINTER, MEMORY).on begin_memory;
@@ -781,16 +781,16 @@ Section Private
m := next;
next := m.next_linear;
prev := m.previous_linear;
-
+
(prev = NULL).if {
(m != begin_memory).if {
msg_intern := "Begin list fail!\n";
};
- } else {
+ } else {
(prev.next_linear != m).if {
msg_intern := "Previous fail!\n";
};
- };
+ };
(m.id = id_busy).if {
// Busy
} else {
@@ -800,12 +800,12 @@ Section Private
};
};
(m.is_end).if {
-
+
} else {
(next.previous_linear != m).if {
msg_intern := "Next fail!\n";
};
- };
+ };
}.do_until {(m.is_end) || {msg_intern != NULL}};
(msg_intern != NULL).if {
"************* Crash memory *************\n".print;
@@ -817,28 +817,28 @@ Section Private
};
};
);
-
+
- print_memory <-
( + m,next:MEMORY;
-
+
"------------------------------------\n".print;
"first free : ".print;
- first_free.this.print_hex;
+ first_free.this.print_hex;
'\n'.print;
-
+
next := CONVERT(POINTER, MEMORY).on begin_memory;
{
m := next;
next := m.next_linear;
-
+
'['.print;
(m.previous_linear = NULL).if {
"NULL".print;
} else {
- (m.previous_linear.this).print_hex;
+ (m.previous_linear.this).print_hex;
};
"<-".print;
- m.this.print_hex;
+ m.this.print_hex;
(m.id = id_busy).if {
"(B)".print;
} else {
diff --git a/lib/internal/portable/number/fixed_real.li b/lib/internal/portable/number/fixed_real.li
index 9dba77c..e9152b3 100644
--- a/lib/internal/portable/number/fixed_real.li
+++ b/lib/internal/portable/number/fixed_real.li
@@ -19,55 +19,55 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FIXED_REAL;
-
+
- comment := "Real number of fixed decimal part.";
-
+
Section Insert
-
+
- parent_real:REAL := REAL;
-
+
Section SELF
- - shift_bits:INTEGER <-
+ - shift_bits:INTEGER <-
(
deferred;
0
);
-
+
Section Public
-
+
- floor:INTEGER <-
(
deferred;
);
-
- //
+
+ //
// Conversions with tests
//
-
+
//
// - To unsigned integers
//
- - to_uinteger_8:UINTEGER_8 <-
- (
+ - to_uinteger_8:UINTEGER_8 <-
+ (
floor.to_raw_uinteger_8
);
- - to_uinteger_16:UINTEGER_16 <-
- (
+ - to_uinteger_16:UINTEGER_16 <-
+ (
floor.to_raw_uinteger_16
);
- to_uinteger_32:UINTEGER_32 <-
- (
+ (
floor.to_raw_uinteger_32
);
- - to_uinteger_64:UINTEGER_64 <-
- (
+ - to_uinteger_64:UINTEGER_64 <-
+ (
floor.to_raw_uinteger_64
);
@@ -76,30 +76,30 @@ Section Public
//
- to_integer_8:INTEGER_8 <-
- (
+ (
floor.to_raw_integer_8
);
- to_integer_16:INTEGER_16 <-
- (
+ (
floor.to_raw_integer_16
);
- to_integer_32:INTEGER_32 <-
- (
+ (
floor.to_raw_integer_32
);
- to_integer_64:INTEGER_64 <-
- (
+ (
floor.to_raw_integer_64
);
-
+
- to_integer:INTEGER <-
(
floor
);
-
+
//
// - To unsigned fixed reals
//
@@ -131,13 +131,13 @@ Section Public
} else {
result := to_raw_uinteger_32 >> (shift_bits - 6);
};
- result.to_raw_ureal_26_6
+ result.to_raw_ureal_26_6
);
-
+
//
// - To signed fixed reals
//
-
+
- to_real_16_16:REAL_16_16 <-
( + result:UINTEGER_32;
(shift_bits < 16).if {
@@ -165,36 +165,36 @@ Section Public
} else {
result := to_raw_integer_32 >> (shift_bits - 6);
};
- result.to_raw_ureal_26_6
+ result.to_raw_ureal_26_6
);
-
+
//
// - To float reals
//
-
+
- to_real_32:REAL_32 <-
- (
+ (
to_raw_real_32 / (1 << shift_bits)
);
- to_real_64:REAL_64 <-
- (
+ (
to_raw_real_64 / (1 << shift_bits)
);
- to_real_80:REAL_80 <-
- (
+ (
to_raw_real_80 / (1 << shift_bits)
);
- atan:SELF <- not_yet_implemented;
- - sqrt:SELF <-
+ - sqrt:SELF <-
// The Heron approximation Algorithm.
[ -? {Self > 0}; ]
( + result:SELF;
result := Self;
- 0.to 7 do { j:INTEGER;
+ 0.to 7 do { j:INTEGER;
result := (result + Self / result) /# 2;
};
result
@@ -211,27 +211,27 @@ Section Public
//
// Comparaison.
//
-
+
- Self:SELF '~=' other:SELF :BOOLEAN <-
(
Self = other
);
-
+
- is_not_a_number:BOOLEAN <- FALSE;
-
+
- is_infinity:BOOLEAN <- FALSE;
-
+
//
// Print.
//
-
+
- append_in buffer:STRING decimal n:INTEGER <-
- (
+ (
not_yet_implemented;
);
-
- - scientific_append_in buffer:STRING <-
- (
+
+ - scientific_append_in buffer:STRING <-
+ (
not_yet_implemented;
);
-
+
diff --git a/lib/internal/portable/number/float_map.li b/lib/internal/portable/number/float_map.li
index c9b7b0b..bdc8d10 100644
--- a/lib/internal/portable/number/float_map.li
+++ b/lib/internal/portable/number/float_map.li
@@ -19,46 +19,46 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_MAP;
-
+
- comment := "Mapping for REAL_xx.";
-
+
Section Private
-
+
- deferred <- crash_with_message "Slot deferred.";
-
+
Section REAL, REAL_32, REAL_64, REAL_80
-
+
- get_map f:SELF <-
(
deferred;
);
-
+
- sign:BOOLEAN <- deferred; // TRUE if positif, FALSE else.
-
+
- exponent:UINTEGER_32 <- deferred;
-
- - mantissa:UINTEGER_64 <- deferred;
-
+
+ - mantissa:UINTEGER_64 <- deferred;
+
//
// Consultation.
//
-
- - is_infinite:BOOLEAN <-
+
+ - is_infinite:BOOLEAN <-
(exponent = ((1 << exponent_bits) - 1)) && {(mantissa >> (mantissa_bits-1)) = 0};
-
+
- is_nan:BOOLEAN <-
(exponent = ((1 << exponent_bits) - 1)) && {(mantissa >> (mantissa_bits-1)) != 0};
-
+
- is_zero:BOOLEAN <- (exponent = 0) && {mantissa = 0};
-
+
Section Public
//
// Format.
//
-
+
- mantissa_bits:INTEGER_8 <- deferred;
- exponent_bits:INTEGER_8 <- deferred;
diff --git a/lib/internal/portable/number/float_map32.li b/lib/internal/portable/number/float_map32.li
index b657219..0cd0a51 100644
--- a/lib/internal/portable/number/float_map32.li
+++ b/lib/internal/portable/number/float_map32.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_MAP32;
-
+
- comment := "Mapping for REAL_32.";
-
+
Section Inherit
-
+
- parent_float_map:FLOAT_MAP := FLOAT_MAP;
-
+
Section Mapping
-
+
+ map_32:UINTEGER_32;
Section REAL, REAL_32, REAL_64, REAL_80
-
+
- get_map f:SELF <-
( + tab:NATIVE_ARRAY(SELF);
tab := CONVERT(FLOAT_MAP32,NATIVE_ARRAY(SELF)).on FLOAT_MAP32;
tab.put f to 0;
);
-
+
- sign:BOOLEAN <- (map_32 >> 31) = 0; // TRUE if positif, FALSE else.
-
+
- exponent:UINTEGER_32 <- (map_32 >> mantissa_bits) & 0FFh;
-
+
- mantissa:UINTEGER_64 <- (map_32 & 7F_FFFFh);
-
+
Section Public
//
// Format.
//
-
+
- mantissa_bits:INTEGER_8 := 23;
- exponent_bits:INTEGER_8 := 8;
-
+
diff --git a/lib/internal/portable/number/float_map64.li b/lib/internal/portable/number/float_map64.li
index efe6575..e35b866 100644
--- a/lib/internal/portable/number/float_map64.li
+++ b/lib/internal/portable/number/float_map64.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_MAP64;
-
+
- comment := "Mapping for REAL_64.";
-
+
Section Inherit
-
+
- parent_float_map:FLOAT_MAP := FLOAT_MAP;
-
+
Section Mapping
-
+
+ map_64:UINTEGER_64;
-
+
Section REAL, REAL_32, REAL_64, REAL_80
-
+
- get_map f:SELF <-
( + tab:NATIVE_ARRAY(SELF);
tab := CONVERT(FLOAT_MAP64,NATIVE_ARRAY(SELF)).on FLOAT_MAP64;
- tab.put f to 0;
+ tab.put f to 0;
);
-
+
- sign:BOOLEAN <- (map_64 >> 63) = 0; // TRUE if positif, FALSE else.
-
+
- exponent:UINTEGER_32 <- ((map_64 >> mantissa_bits) & 07_FFh).to_uinteger_32;
-
+
- mantissa:UINTEGER_64 <- map_64 & ((1 << mantissa_bits)-1);
-
+
Section Public
//
// Format.
//
-
+
- mantissa_bits:INTEGER_8 := 52;
- exponent_bits:INTEGER_8 := 11;
-
+
diff --git a/lib/internal/portable/number/float_map80.li b/lib/internal/portable/number/float_map80.li
index 94cbfd9..3b8ceec 100644
--- a/lib/internal/portable/number/float_map80.li
+++ b/lib/internal/portable/number/float_map80.li
@@ -19,41 +19,41 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_MAP80;
-
+
- comment := "Mapping for REAL_80.";
-
+
Section Inherit
-
+
- parent_float_map:FLOAT_MAP := FLOAT_MAP;
-
+
Section Mapping
-
+
+ exp_16:UINTEGER_16;
+ man_64:UINTEGER_64;
-
+
Section REAL, REAL_32, REAL_64, REAL_80
-
+
- get_map f:SELF <-
( + tab:NATIVE_ARRAY(SELF);
tab := CONVERT(FLOAT_MAP80,NATIVE_ARRAY(SELF)).on FLOAT_MAP80;
- tab.put f to 0;
+ tab.put f to 0;
);
-
+
- sign:BOOLEAN <- (exp_16 >> 15) = 0; // TRUE if positif, FALSE else.
-
+
- exponent:UINTEGER_32 <- exp_16 & 07F_FFh;
-
+
- mantissa:UINTEGER_64 <- man_64;
-
+
Section Public
//
// Format.
//
-
+
- mantissa_bits:INTEGER_8 := 64;
- exponent_bits:INTEGER_8 := 15;
-
+
diff --git a/lib/internal/portable/number/float_real.li b/lib/internal/portable/number/float_real.li
index 0476467..8aac6aa 100644
--- a/lib/internal/portable/number/float_real.li
+++ b/lib/internal/portable/number/float_real.li
@@ -19,15 +19,15 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FLOAT_REAL;
-
+
- comment := "Real number of variable decimal part.";
-
- - external := `#include <math.h>`;
-
+
+ - external := `#include <math.h>`;
+
Section Insert
-
+
- parent_float_map:FLOAT_MAP := FLOAT_MAP;
-
+
- parent_real:REAL := REAL;
diff --git a/lib/internal/portable/number/signed_fixed_real.li b/lib/internal/portable/number/signed_fixed_real.li
index bcd7238..6f22146 100644
--- a/lib/internal/portable/number/signed_fixed_real.li
+++ b/lib/internal/portable/number/signed_fixed_real.li
@@ -19,123 +19,123 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SIGNED_FIXED_REAL;
-
+
- comment := "Signed real number of fixed decimal part.";
-
+
Section Insert
-
+
- parent_fixed_real:FIXED_REAL := FIXED_REAL;
-
+
Section Public
-
+
//
// Bound test
//
-
+
- bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
(low < to_raw_integer_64) && {up > to_raw_uinteger_64}
);
-
+
//
// Around
//
-
+
- object_size:INTEGER := 4;
- floor:INTEGER <-
// Greatest integral value no greater than Current.
- (
- to_raw_integer_32 >> shift_bits
+ (
+ to_raw_integer_32 >> shift_bits
)
[
+? {Self >= Result};
+? {(Self - Result) < 1};
];
-
+
- ceiling:INTEGER <-
// Smallest integral value no smaller than Current.
- (
- (to_raw_integer_32 + ((1 << shift_bits) - 1)) >> shift_bits
+ (
+ (to_raw_integer_32 + ((1 << shift_bits) - 1)) >> shift_bits
)
[
+? {Self <= Result};
+? {(Self - Result) < 1};
];
-
+
- rounded:INTEGER <-
// Rounded integral value.
(
(to_raw_integer_32 + ((1 << shift_bits) / 2)) >> shift_bits
);
-
+
- truncated_to_integer:INTEGER <- floor;
// Integer part (largest absolute value no greater than Current).
-
+
//
// binary operator :
//
-
- - Self:SELF '-' Left 80 other:SELF :SELF <-
+
+ - Self:SELF '-' Left 80 other:SELF :SELF <-
(
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 - other.to_raw_integer_32)
);
- - Self:SELF '*#' Left 100 other:INTEGER :SELF <-
- (
+ - Self:SELF '*#' Left 100 other:INTEGER :SELF <-
+ (
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 * other)
);
-
- - Self:SELF '*' Left 100 other:SELF :SELF <-
+
+ - Self:SELF '*' Left 100 other:SELF :SELF <-
(
CONVERT(INTEGER_64,SELF).on ((to_raw_integer_64 * other.to_raw_integer_64) >> shift_bits)
);
-
- - Self:SELF '/#' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '/#' Left 100 other:INTEGER :SELF <-
(
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 / other)
);
-
- - Self:SELF '/' Left 100 other:SELF :SELF <-
+
+ - Self:SELF '/' Left 100 other:SELF :SELF <-
(
CONVERT(INTEGER_64,SELF).on ((to_raw_integer_64 << shift_bits) / other.to_raw_integer_64)
);
-
+
- Self:SELF '&' Left 100 other:SELF :SELF <-
(
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 & other.to_raw_integer_32)
);
-
- - Self:SELF '>>' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '>>' Left 100 other:INTEGER :SELF <-
(
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 >> other)
);
-
- - Self:SELF '<<' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '<<' Left 100 other:INTEGER :SELF <-
(
CONVERT(INTEGER_32,SELF).on (to_raw_integer_32 << other)
);
-
+
//
// Test binary operator :
//
-
- - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
+
+ - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
(
to_raw_integer_32 > other.to_raw_integer_32
);
-
+
//
// prefix : Unary operator
//
-
- - '~' Self:SELF :SELF <-
+
+ - '~' Self:SELF :SELF <-
(
CONVERT(INTEGER_32,SELF).on (~ to_raw_integer_32)
);
-
+
diff --git a/lib/internal/portable/number/signed_integer.li b/lib/internal/portable/number/signed_integer.li
index 4965740..fb33543 100644
--- a/lib/internal/portable/number/signed_integer.li
+++ b/lib/internal/portable/number/signed_integer.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SIGNED_INTEGER;
-
+
- comment := "Generic Signed Integer.";
-
+
Section Insert
-
+
- parent_integer:INTEGER := INTEGER;
-
+
Section Public
-
+
- append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
[ -? {buffer!=NULL}; ]
( + val:SELF;
+ i,j:INTEGER;
-
+
(Self = 0).if {
buffer.extend '0';
} else {
@@ -46,27 +46,27 @@ Section Public
val := - Self;
buffer.extend '-';
};
-
+
i := buffer.upper+1;
-
- {val = 0}.until_do {
+
+ {val = 0}.until_do {
buffer.extend ((val % 10).digit);
val := val / 10;
};
-
+
j := buffer.upper;
{i >= j}.until_do {
buffer.swap i with j;
j := j - 1;
i := i + 1;
- };
+ };
};
);
-
+
- to_octal:SELF <-
// Gives coresponding octal value.
( + result, unit, current:SELF;
-
+
(Self < 0).if {
result := -((-Self).to_octal);
} else {
@@ -80,33 +80,32 @@ Section Public
};
result
);
-
+
//
// Hashing:
//
-
+
- hash_code:INTEGER <-
( + result:INTEGER;
-
+
(Self < 0).if {
result := ~ Self;
} else {
result := Self;
};
-
+
result
)
[
+? {Result>=0};
];
-
+
//
// Bound test
//
-
+
- bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
(low < to_raw_integer_64) && {up > to_raw_uinteger_64}
);
-
\ No newline at end of file
diff --git a/lib/internal/portable/number/unsigned_fixed_real.li b/lib/internal/portable/number/unsigned_fixed_real.li
index df3dea7..264d78a 100644
--- a/lib/internal/portable/number/unsigned_fixed_real.li
+++ b/lib/internal/portable/number/unsigned_fixed_real.li
@@ -19,125 +19,125 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := UNSIGNED_FIXED_REAL;
-
+
- comment := "Unsigned real number of fixed decimal part.";
-
+
Section Inherit
-
+
- parent_fixed_real:FIXED_REAL := FIXED_REAL;
-
+
Section Public
-
+
//
// Bound test
//
-
+
- bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
(up > to_raw_uinteger_64)
);
-
+
//
// Around
//
-
+
- object_size:INTEGER := 4;
-
- - minimum:INTEGER_64 <- 0;
+
+ - minimum:INTEGER_64 <- 0;
- floor:INTEGER <-
// Greatest integral value no greater than Current.
- (
- to_raw_uinteger_32 >> shift_bits
+ (
+ to_raw_uinteger_32 >> shift_bits
)
[
+? {Self <= Result};
+? {(Self - Result) < 1};
];
-
+
- ceiling:INTEGER <-
// Smallest integral value no smaller than Current.
- (
- (to_raw_uinteger_32 + ((1 << shift_bits) - 1)) >> shift_bits
+ (
+ (to_raw_uinteger_32 + ((1 << shift_bits) - 1)) >> shift_bits
)
[
+? {Self >= Result};
+? {(Self - Result) < 1};
];
-
+
- rounded:INTEGER <-
// Rounded integral value.
(
(to_raw_uinteger_32 + ((1 << shift_bits) / 2)) >> shift_bits
);
-
+
- truncated_to_integer:INTEGER <- floor;
// Integer part (largest absolute value no greater than Current).
-
+
//
// binary operator :
//
-
- - Self:SELF '-' Left 80 other:SELF :SELF <-
+
+ - Self:SELF '-' Left 80 other:SELF :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 - other.to_raw_uinteger_32)
);
- - Self:SELF '*#' Left 100 other:INTEGER :SELF <-
- (
+ - Self:SELF '*#' Left 100 other:INTEGER :SELF <-
+ (
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 * other)
);
-
- - Self:SELF '*' Left 100 other:SELF :SELF <-
+
+ - Self:SELF '*' Left 100 other:SELF :SELF <-
(
CONVERT(UINTEGER_64,SELF).on ((to_raw_uinteger_64 * other.to_raw_uinteger_64) >> shift_bits)
);
-
- - Self:SELF '/#' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '/#' Left 100 other:INTEGER :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 / other)
);
-
- - Self:SELF '/' Left 100 other:SELF :SELF <-
+
+ - Self:SELF '/' Left 100 other:SELF :SELF <-
(
CONVERT(UINTEGER_64,SELF).on ((to_raw_uinteger_64 << shift_bits) / other.to_raw_uinteger_64)
);
-
+
- Self:SELF '&' Left 100 other:SELF :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 & other.to_raw_uinteger_32)
);
-
- - Self:SELF '>>' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '>>' Left 100 other:INTEGER :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 >> other)
);
-
- - Self:SELF '<<' Left 100 other:INTEGER :SELF <-
+
+ - Self:SELF '<<' Left 100 other:INTEGER :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (to_raw_uinteger_32 << other)
);
-
+
//
// Test binary operator :
//
-
- - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
+
+ - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
(
to_raw_uinteger_32 > other.to_raw_uinteger_32
);
-
+
//
// prefix : Unary operator
//
-
- - '~' Self:SELF :SELF <-
+
+ - '~' Self:SELF :SELF <-
(
CONVERT(UINTEGER_32,SELF).on (~ to_raw_uinteger_32)
);
-
+
diff --git a/lib/internal/portable/number/unsigned_integer.li b/lib/internal/portable/number/unsigned_integer.li
index 63fdc08..23836cf 100644
--- a/lib/internal/portable/number/unsigned_integer.li
+++ b/lib/internal/portable/number/unsigned_integer.li
@@ -19,59 +19,59 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := UNSIGNED_INTEGER;
-
+
- comment := "Generic Unsigned Integer.";
-
+
Section Insert
-
+
- parent_integer:INTEGER := INTEGER;
-
+
Section Public
-
+
//
// Range
//
-
+
- minimum:INTEGER_64 := 0.to_raw_integer_64;
-
+
//
// Function :
//
-
+
- sign:INTEGER <-
// Sign of Current (0 -1 or 1).
- (
- (Self != 0).to_integer;
+ (
+ (Self != 0).to_integer;
);
-
+
- abs:SELF <- Self; // Absolute value of `self'.
-
+
//
// Convertion
//
-
+
- append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:SELF;
+ i,j:INTEGER;
? {buffer!=NULL};
-
+
(Self = 0).if {
buffer.extend '0';
} else {
-
+
i := buffer.upper+1;
-
+
val := Self;
{val = 0}.until_do {
buffer.extend ((val % 10).digit);
val := val / 10;
};
j := buffer.upper;
-
+
{i >= j}.until_do {
buffer.swap i with j;
j := j - 1;
@@ -80,16 +80,16 @@ Section Public
};
);
-
+
- print <-
- (
+ (
print_positif;
);
-
+
- to_octal:SELF <-
// Gives coresponding octal value.
( + result, unit, current:SELF;
-
+
current := Self;
unit := 1;
{current!=0}.while_do {
@@ -99,31 +99,31 @@ Section Public
};
result
);
-
+
//
// Hashing:
//
-
+
- hash_code:INTEGER <- to_integer;
-
+
//
// Looping
//
-
+
- downto limit_down:SELF do blc:{SELF; } <-
(
- (Self+1).downto_unsigned limit_down do blc;
+ (Self+1).downto_unsigned limit_down do blc;
);
-
+
//
// Bound test
//
-
+
- bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
(up > to_raw_uinteger_64)
);
-
+
Section Private
- downto_unsigned limit_down:SELF do blc:{SELF; } <-
@@ -134,4 +134,3 @@ Section Private
};
);
-
\ No newline at end of file
diff --git a/lib/internal/portable/string/character_ref.li b/lib/internal/portable/string/character_ref.li
index b973d00..1c93cec 100644
--- a/lib/internal/portable/string/character_ref.li
+++ b/lib/internal/portable/string/character_ref.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CHARACTER_REF;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :=" .";
-
+
Section Inherit
-
+
- parent_hashable:HASHABLE <- HASHABLE;
-
+
- parent_comparable:COMPARABLE <- COMPARABLE;
-
+
Section Public
-
+
- item:CHARACTER;
-
+
- set_item value:CHARACTER <-
(
item := value;
@@ -46,7 +46,7 @@ Section Public
(
item < other.item
);
-
+
- code:INTEGER_8 <-
// ASCII code of Current
(
@@ -67,14 +67,14 @@ Section Public
// Object Printing:
- out_in_tagged_out_memory <- fill_tagged_out_memory;
-
+
- fill_tagged_out_memory <-
(
item.fill_tagged_out_memory;
);
-
+
// Hashing:
-
+
- hash_code:INTEGER <-
(
item.hash_code
diff --git a/lib/internal/portable/string/string_buffer.li b/lib/internal/portable/string/string_buffer.li
index 6008935..fac1a0b 100644
--- a/lib/internal/portable/string/string_buffer.li
+++ b/lib/internal/portable/string/string_buffer.li
@@ -56,7 +56,7 @@ Section Public
- from_string s:STRING :SELF <- create_from s;
- to_string :STRING <- parent_string;
-
+
- to_abstract_string:ABSTRACT_STRING <- parent_string;
- Self:SELF '+' other:ABSTRACT_STRING :STRING_BUFFER <-
diff --git a/lib/internal/portable/system/system_detect.li b/lib/internal/portable/system/system_detect.li
index 02759ef..00bb24f 100644
--- a/lib/internal/portable/system/system_detect.li
+++ b/lib/internal/portable/system/system_detect.li
@@ -26,7 +26,7 @@ Section Header
- copyright := "2008 Mildred Ki'Lya";
- bibliography := "";
- comment := "Detect charecteristics of the system/C compiler";
-
+
// Don't hesitate to add others slots to detect your platform.
Section Inherit
diff --git a/lib/standard/boolean/boolean.li b/lib/standard/boolean/boolean.li
index 44b65bd..cafdb4d 100644
--- a/lib/standard/boolean/boolean.li
+++ b/lib/standard/boolean/boolean.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded BOOLEAN;
@@ -29,80 +29,80 @@ Section Header
- type := `char`;
- default := FALSE;
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
-Section Private
-
+
+Section Private
+
- deferred_boolean:BOOLEAN <-
( + result:BOOLEAN;
-
+
deferred;
result
);
-
+
Section Public
//
// Conditional :
//
-
+
- if_true block:{} <- deferred;
-
+
- if_false block:{} <- deferred;
-
+
- if true_block:{} else false_block:{} <- `ERROR`; //deferred;
-
+
- if_true true_block:{} else false_block:{} <- deferred;
-
+
- if_false true_block:{} else false_block:{} <- deferred;
-
+
- if true_block:{} :BOOLEAN <- deferred_boolean;
-
+
- elseif cond:{BOOLEAN} then block:{} :BOOLEAN <- deferred_boolean;
-
+
- elseif cond:{BOOLEAN} then block:{} else block_else:{} <- deferred;
-
- - else_if cond:{BOOLEAN} then block:{} :BOOLEAN <-
+
+ - else_if cond:{BOOLEAN} then block:{} :BOOLEAN <-
// Alias.
elseif cond then block;
-
- - else_if cond:{BOOLEAN} then block:{} else block_else:{} <-
+
+ - else_if cond:{BOOLEAN} then block:{} else block_else:{} <-
// Alias.
elseif cond then block else block_else;
-
+
//
// Binary operator :
//
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <- Self = other;
-
+
- Self:SELF '!==' Right 60 other:SELF :BOOLEAN <- Self != other;
-
+
- Self:SELF '||' Left 10 other:{BOOLEAN} :BOOLEAN <- deferred_boolean;
-
- - Self:SELF '&&' Left 20 other:{BOOLEAN} :BOOLEAN <- deferred_boolean;
-
+
+ - Self:SELF '&&' Left 20 other:{BOOLEAN} :BOOLEAN <- deferred_boolean;
+
- Self:SELF '|' Left 10 other:BOOLEAN :BOOLEAN <- deferred_boolean;
-
+
- Self:SELF '&' Left 20 other:BOOLEAN :BOOLEAN <- deferred_boolean;
-
+
- Self:SELF '^' Left 10 other:BOOLEAN :BOOLEAN <- deferred_boolean;
-
+
- Self:SELF '->' Right 25 other:BOOLEAN :BOOLEAN <- deferred_boolean;
- Self:SELF '->>' Right 25 other:{BOOLEAN} :BOOLEAN <- deferred_boolean;
-
+
- Self:SELF '=>' s:ABSTRACT_STRING <- deferred;
-
+
//
// Prefix operator
//
-
+
- '!' Self:SELF :BOOLEAN <- deferred;
-
+
//
// Convertion
//
@@ -115,19 +115,19 @@ Section Public
);
- to_abstract_string:ABSTRACT_STRING <- "BOOLEAN";
-
- - to_integer:INTEGER <-
+
+ - to_integer:INTEGER <-
( + result:INTEGER;
-
+
deferred;
result
);
-
- - to_character:CHARACTER <-
+
+ - to_character:CHARACTER <-
( + result:CHARACTER;
-
+
deferred;
result
);
-
+
- append_in str:STRING <- str.append to_abstract_string;
diff --git a/lib/standard/boolean/false.li b/lib/standard/boolean/false.li
index 6228273..2692a34 100644
--- a/lib/standard/boolean/false.li
+++ b/lib/standard/boolean/false.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded FALSE;
@@ -29,24 +29,24 @@ Section Header
- type := `char`;
- default := FALSE;
-
+
Section Inherit
-
+
- inherit_boolean:BOOLEAN := BOOLEAN;
-
+
Section Public
-
+
//
// Conditional :
//
-
+
- if_true block:{};
-
+
- if_false block:{} <-
( //? {block!=NULL};
block.value;
);
-
+
- if true_block:{} else false_block:{} <-
(
false_block.value;
@@ -56,24 +56,24 @@ Section Public
(
false_block.value;
);
-
- - if_false true_block:{} else false_block:{} <-
+
+ - if_false true_block:{} else false_block:{} <-
(
true_block.value;
);
-
+
- if true_block:{} :BOOLEAN <- FALSE;
-
+
- elseif cond:{BOOLEAN} then block:{} :BOOLEAN <-
( + result:BOOLEAN;
-
+
result := cond.value;
result.if {
block.value;
};
result
);
-
+
- elseif cond:{BOOLEAN} then block:{} else block_else:{} <-
(
(cond.value).if {
@@ -82,44 +82,44 @@ Section Public
block_else.value;
};
);
-
+
//
// Binary operator :
//
-
+
- Self:SELF '||' Left 10 other:{BOOLEAN} :BOOLEAN <- other.value;
-
+
- Self:SELF '&&' Left 20 other:{BOOLEAN} :BOOLEAN <- FALSE;
-
+
- Self:SELF '|' Left 10 other:BOOLEAN :BOOLEAN <- other;
-
+
- Self:SELF '&' Left 20 other:BOOLEAN :BOOLEAN <- FALSE;
-
+
- Self:SELF '^' Left 10 other:BOOLEAN :BOOLEAN <- other;
-
+
- Self:SELF '->' Right 25 other:BOOLEAN :BOOLEAN <- TRUE;
-
+
- Self:SELF '->>' Right 25 other:{BOOLEAN} :BOOLEAN <- TRUE;
-
+
- Self:SELF '=>' s:ABSTRACT_STRING <-
(
);
-
+
//
// Prefix operator
//
-
+
- '!' Self:SELF :BOOLEAN <- TRUE;
-
+
//
// Convertion
//
-
+
- to_string:STRING <- "0".to_string;
- to_abstract_string:ABSTRACT_STRING <- "FALSE";
-
+
- to_integer:INTEGER <- 0;
-
+
- to_character:CHARACTER <- '0';
diff --git a/lib/standard/boolean/true.li b/lib/standard/boolean/true.li
index 08cd6e5..f6aaa3e 100644
--- a/lib/standard/boolean/true.li
+++ b/lib/standard/boolean/true.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded TRUE;
@@ -29,88 +29,88 @@ Section Header
- type := `char`;
- default := TRUE;
-
+
Section Inherit
-
+
- inherit_boolean:BOOLEAN := BOOLEAN;
-
+
Section Public
-
+
//
// Conditional :
//
-
+
- if_true block:{} <-
(
block.value;
);
-
+
- if_false block:{};
-
+
- if true_block:{} else false_block:{} <-
(
true_block.value;
);
-
+
- if_true true_block:{} else false_block:{} <-
(
true_block.value;
);
-
- - if_false true_block:{} else false_block:{} <-
+
+ - if_false true_block:{} else false_block:{} <-
(
false_block.value;
);
-
+
- if true_block:{} :BOOLEAN <-
(
true_block.value;
TRUE
);
-
+
- elseif cond:{BOOLEAN} then block:{} :BOOLEAN <- TRUE;
-
+
- elseif cond:{BOOLEAN} then block:{} else block_else:{};
-
+
//
// Binary operator :
//
-
+
- Self:SELF '||' Left 10 other:{BOOLEAN} :BOOLEAN <- TRUE; // or else
-
+
- Self:SELF '&&' Left 20 other:{BOOLEAN} :BOOLEAN <- other.value; // and then
-
+
- Self:SELF '|' Left 10 other:BOOLEAN :BOOLEAN <- TRUE; // or
-
+
- Self:SELF '&' Left 20 other:BOOLEAN :BOOLEAN <- other; // and
-
+
- Self:SELF '^' Left 10 other:BOOLEAN :BOOLEAN <- ! other;
-
+
- Self:SELF '->' Right 25 other:BOOLEAN :BOOLEAN <- other;
- Self:SELF '->>' Right 25 other:{BOOLEAN} :BOOLEAN <- other.value;
-
+
- Self:SELF '=>' s:ABSTRACT_STRING <-
(
s.print;
`while (1)`;
);
-
+
//
// Prefix operator
//
-
+
- '!' Self:SELF :BOOLEAN <- FALSE;
-
+
//
// Conversion
//
-
+
- to_string:STRING <- "1".to_string; // BSBS: A revoir ...
- to_abstract_string:ABSTRACT_STRING <- "TRUE";
-
+
- to_integer:INTEGER <- 1;
-
+
- to_character:CHARACTER <- '1';
diff --git a/lib/standard/collection/array.li b/lib/standard/collection/array.li
index eaa5955..f68abd6 100644
--- a/lib/standard/collection/array.li
+++ b/lib/standard/collection/array.li
@@ -19,48 +19,48 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ARRAY(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment :=" General purpose resizable ARRAYs .";
-
+
// General purpose resizable ARRAYs as they are define in the Eiffel language definition.
// The `lower' bound can be any arbitrary value, even a negative one.<br/> <br/>
//
- // This implementation uses only one chunk of memory, the `storage' area which is a
- // NATIVE_ARRAY. One must keep in mind that this internal `storage' area is always kept
+ // This implementation uses only one chunk of memory, the `storage' area which is a
+ // NATIVE_ARRAY. One must keep in mind that this internal `storage' area is always kept
// left align. Thus, you can expect good performances while using an ARRAY to modelize a
// stack behavior with `add_last' / `last' / `remove_last'.<br/>
- // Conversely `add_first' and `remove_first' are likely to slow down your program if
- // they are too often used. If the fact that `lower' is always stuck to 0 is not a
+ // Conversely `add_first' and `remove_first' are likely to slow down your program if
+ // they are too often used. If the fact that `lower' is always stuck to 0 is not a
// problem for you, also consider FAST_ARRAY to get better performances.<br/>
-
+
Section Inherit
-
+
+ parent_arrayed_collection:Expanded ARRAYED_COLLECTION(V);
-
+
Section Public
-
+
+ lower:INTEGER; // Lower index bound.
-
+
//
// Creation and Modification:
//
-
+
- create min_index:INTEGER to max_index:INTEGER :SELF <-
// Prepare the array to hold values for indexes in range
// [`min_index' .. `max_index']. Set all values to default.
// When `max_index' = `min_index' - 1, the array `is_empty'.
( + result:SELF;
-
+
result := SELF.clone;
result.make min_index to max_index;
result
);
-
+
- make min_index:INTEGER to max_index:INTEGER <-
// Prepare the array to hold values for indexes in range
// [`min_index' .. `max_index']. Set all values to default.
@@ -72,25 +72,25 @@ Section Public
[ ...
{min_index <= max_index + 1} -? "Valid bounds.";
]
- (
+ (
ensure_capacity (max_index - min_index + 1) and_bounds min_index to max_index;
)
[ ...
"Lower set." +? { lower = min_index };
"Upper set." +? { upper = max_index };
- "Items set." +? { all_default };
+ "Items set." +? { all_default };
];
-
+
- create_with_capacity needed_capacity:INTEGER lower low:INTEGER :SELF <-
// Create an empty array with `capacity' initialized
// at least to `needed_capacity' and `lower' set to `low'.
( + result:SELF;
-
+
result := clone;
result.with_capacity needed_capacity lower low;
result
);
-
+
- with_capacity needed_capacity:INTEGER lower low:INTEGER <-
// Create an empty array with `capacity' initialized
// at least to `needed_capacity' and `lower' set to `low'.
@@ -105,9 +105,9 @@ Section Public
+? { needed_capacity <= capacity };
+? { lower = low };
];
-
+
Section Public
-
+
- ensure_capacity needed_capacity:INTEGER and_bounds low:INTEGER to up:INTEGER <-
// Extend needed capacity and bouds if necessary
// * Require: `up' superior or equal to `low' - 1
@@ -129,11 +129,11 @@ Section Public
+? { upper = up };
+? {all_default};
];
-
+
//
// Modification:
//
-
+
- resize min_index:INTEGER to max_index:INTEGER <-
// Resize to bounds `min_index' and `max_index'. Do not lose any
// item whose index is in both [`lower' .. `upper'] and
@@ -146,7 +146,7 @@ Section Public
-? { min_index <= max_index + 1 };
]
( + needed, offset, intersize:INTEGER;
-
+
needed := max_index - min_index + 1;
( needed > 0 ).if {
( needed > capacity ).if {
@@ -188,15 +188,15 @@ Section Public
+? { lower = min_index };
+? { upper = max_index };
];
-
-
+
+
- reindex new_lower:INTEGER <-
// Change indexing to take in account the expected `new_lower'
// index. The `upper' index is translated accordingly.
// * Ensure: `lower' is equal to `new_lower'
// * Ensure: `count' is equal to `count' before
( + i:INTEGER;
-
+
i := new_lower - lower;
lower := lower + i;
upper := upper + i;
@@ -205,15 +205,15 @@ Section Public
+? { lower = new_lower };
+? { count = Old count };
];
-
+
//
// Implementation of deferred:
//
-
+
- subarray min:INTEGER to max:INTEGER :SELF <-
// Return the subarray between `min' to `max'
// * Ensure: `Result.lower' is equal to `min' before
- ( + result:SELF;
+ ( + result:SELF;
result := slice min to max;
result.reindex min;
@@ -222,34 +222,34 @@ Section Public
[ ...
+? { Result.lower = min };
];
-
+
- is_empty:BOOLEAN <-
// Is Self empty ?
( upper < lower );
-
- - count:INTEGER <-
- //Size of current
+
+ - count:INTEGER <-
+ //Size of current
( upper - lower + 1 );
-
+
- item i:INTEGER :V <-
// Item at the corresponding index `i'.
// * Description en Francais : Item à l'index `i'
// * See: `lower', `upper', `valid_index', `put', `swap'
- (
+ (
storage.item (i - lower)
);
-
+
- put element:V to i:INTEGER <-
// Make `element' the item at index `i'.
// * See: `lower', `upper', `valid_index', `item', `swap', `force'.
- (
- storage.put element to (i - lower);
+ (
+ storage.put element to (i - lower);
);
-
+
- force element:V to index:INTEGER <-
// Make `element' the item at index `i', reindexing array if necessary.
// * See: `lower', `upper', `valid_index', `item', `swap', `force'.
- (
+ (
(upper < index).if {
(index = upper + 1).if {
add_last element;
@@ -265,13 +265,13 @@ Section Public
};
)
[ ...
- +? { lower = index.min (Old lower) };
+ +? { lower = index.min (Old lower) };
];
-
+
- copy other:SELF <-
// Copy `other' into Self
( + needed_capacity:INTEGER;
-
+
lower := other.lower;
upper := other.upper;
needed_capacity := upper - lower + 1;
@@ -283,24 +283,24 @@ Section Public
storage.copy_from (other.storage) until (needed_capacity - 1);
};
);
-
+
- set_all_with v:V <-
- // Set all element with `v'
- (
- storage.set_all_with v until (upper - lower);
+ // Set all element with `v'
+ (
+ storage.set_all_with v until (upper - lower);
);
-
+
- remove_first <-
// Remove the first `element'
// * Ensure: `upper' has same value before and after
- (
+ (
storage.remove_first (upper - lower);
lower := lower + 1;
)
[ ...
+? {upper = Old upper};
];
-
+
- remove_head n:INTEGER <-
// Remove the n firsts `element'
// * Ensure: `upper' has same value before and after
@@ -311,31 +311,31 @@ Section Public
[ ...
+? {upper = Old upper};
];
-
+
- remove index:INTEGER <-
// Remove the nth `element'
- (
+ (
storage.remove (index - lower) until (upper - lower);
- upper := upper - 1;
+ upper := upper - 1;
);
-
+
- clear <-
// Clear the array
// * Ensure: `capacity' has same value before and after
(
- upper := lower - 1;
+ upper := lower - 1;
)
[ ...
- +? {capacity = Old capacity};
+ +? {capacity = Old capacity};
];
-
+
- add_first element:V <-
// Add a new item in first position : `count' is increased by
// one and all other items are shifted right.
//
// * See: `add_last', `first', `last', `add'.
- (
+ (
(upper < lower).if {
add_last element;
} else {
@@ -344,13 +344,13 @@ Section Public
put (element,lower);
};
);
-
+
- add_last element:V <-
// Add a new item at the end : `count' is increased by one.
//
// * See: `add_first', `last', `first', `add'.
( + new_capacity:INTEGER;
-
+
( capacity < count + 1 ).if {
( capacity = 0 ).if {
new_capacity := 16;
@@ -363,14 +363,14 @@ Section Public
};
};
upper := upper + 1;
- put element to upper;
+ put element to upper;
);
-
+
- from_collection model:COLLECTION(V) <-
// Initialize the current object with the contents of `model'
(
- with_capacity ((model.count),(model.lower));
- upper := modele.upper;
+ with_capacity ((model.count),(model.lower));
+ upper := modele.upper;
(model.lower).to (model.upper) do { i:INTEGER;
put ((model.item i),i);
};
@@ -379,56 +379,56 @@ Section Public
+? { lower = model.lower };
+? { upper = model.upper };
];
-
+
- all_default:BOOLEAN <-
(
storage.all_default (upper - lower)
);
-
+
- occurrences element:V :INTEGER <-
- (
+ (
storage.occurrences element until (upper - lower)
);
-
+
- fast_occurrences element:V :INTEGER <-
- (
+ (
storage.fast_occurrences element until (upper - lower)
);
-
+
- first_index_of element:V :INTEGER <-
( + result:INTEGER;
-
+
(upper >= lower).if {
result := lower + storage.first_index_of element until (upper - lower);
} else {
result := lower;
};
);
-
+
- index_of element:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
-
+
(upper >= lower).if {
result := lower + storage.index_of (element,start_index - lower) until (upper - lower);
} else {
result := lower;
};
- result
+ result
);
-
+
- reverse_index_of element:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
-
+
(upper >= lower).if {
result := lower + storage.reverse_index_of element from (start_index - lower);
} else {
result := lower;
};
);
-
+
- fast_index_of element:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
-
+
(upper >= lower).if {
result := lower + storage.fast_index_of (element,start_index - lower) until (upper - lower);
} else {
@@ -436,10 +436,10 @@ Section Public
};
result
);
-
+
- fast_reverse_index_of element:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
-
+
(upper >= lower).if {
result := lower + storage.fast_reverse_index_of element from (start_index - lower);
} else {
@@ -447,36 +447,36 @@ Section Public
};
result
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
- ( + result:BOOLEAN;
-
+ ( + result:BOOLEAN;
+
(Self = other).if {
result := true;
}.elseif {(lower = other.lower) && {upper = other.upper}} then {
result := storage.fast_memcmp (other.storage) until count;
- };
+ };
result
);
-
+
- is_equal_map other:SELF :BOOLEAN <-
( + result:BOOLEAN;
-
+
( Self = other ).if {
result := true;
}.elseif {(lower = other.lower) && {upper = other.upper}} then {
result := storage.memcmp (other.storage) until count;
- };
+ };
result
);
-
+
- slice min:INTEGER to max:INTEGER :SELF <-
( + result:SELF;
-
+
result := SELF.create lower to (lower + max - min);
(max >= min).if {
// Slice not empty
result.storage.slice_copy storage to 0 from (min - lower) to (max - lower);
- };
+ };
);
-
+
diff --git a/lib/standard/collection/array2.li b/lib/standard/collection/array2.li
index ed833d9..fb5cf90 100644
--- a/lib/standard/collection/array2.li
+++ b/lib/standard/collection/array2.li
@@ -19,46 +19,46 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ARRAY2(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :=" General prurpose, resizable, two dimensional array.";
-
+
Section Inherit
+ parent_collection2:Expanded COLLECTION2(V);
-
+
Section Public
-
+
+ lower1:INTEGER;
+ lower2:INTEGER;
-
+
+ upper1:INTEGER;
+ upper2:INTEGER;
-
+
Section ARRAY2
-
+
+ storage:NATIVE_ARRAY(V);
// To store elements line by line.
+ capacity:INTEGER;
// Number of elements in `storage'.
-
+
Section Public
-
+
//
// Creation / modification:
//
-
+
- create (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) :SELF <-
// Reset all bounds `line_minimum' / `line_maximum' / `column_minimum' and
// `column_maximum' using arguments as new values.
// All elements are set to the default value of type E.
( + result:SELF;
-
+
result:= clone;
result.make (line_min, column_min) to (line_max, column_max);
result
@@ -83,7 +83,7 @@ Section Public
} else {
capacity := count;
storage := NATIVE_ARRAY(V).create count;
- };
+ };
)
[ ...
+? {line_minimum = line_min};
@@ -94,13 +94,13 @@ Section Public
- from_collection2 model:COLLECTION2(V) <-
(
- make (model.line_minimum,model.column_minimum)
+ make (model.line_minimum,model.column_minimum)
to (model.line_maximum,model.column_maximum);
-
+
line_minimum.to line_maximum do { i:INTEGER;
column_minimum.to column_maximum do { j:INTEGER;
put (model.item (i,j)) to (i,j);
- };
+ };
};
)
[ ...
@@ -108,7 +108,7 @@ Section Public
+? { lower2 = model.lower2 };
];
- - from_collection contents:COLLECTION(V)
+ - from_collection contents:COLLECTION(V)
size (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) <-
// Reset all bounds using `line_min', `line_max', `column_min',
// and `column_max' .
@@ -118,11 +118,11 @@ Section Public
-? { column_min <= column_max };
-? { contents.count = (line_max - line_min + 1) * (column_max - column_min +1) };
]
- (
- make (line_min,column_min) to (line_max,column_max);
+ (
+ make (line_min,column_min) to (line_max,column_max);
0.to (count - 1) do { i:INTEGER;
storage.put (contents.item (contents.lower + i)) to i;
- };
+ };
)
[ ...
+? { line_minimum = line_min };
@@ -131,7 +131,7 @@ Section Public
+? { column_maximum = column_max };
+? { count = contents.count };
];
-
+
- from_model model:COLLECTION(COLLECTION(V)) <-
// The `model' is used to fill line by line the COLLECTION2.
// Assume all sub-collections of `model' have the same indexing.
@@ -141,7 +141,7 @@ Section Public
(model.lower).to (modele.upper) do { line:INTEGER;
(model.first.lower).to (model.first.upper) do { column:INTEGER;
put (model.item line.item column) to (line,column);
- };
+ };
};
)
[ ...
@@ -150,11 +150,11 @@ Section Public
-? { column_minimum = model.first.lower};
-? { column_maximum = model.first.upper};
];
-
+
//
// Resizing:
//
-
+
- resize (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) <-
// Resize bounds of the Current array
[ ...
@@ -162,17 +162,17 @@ Section Public
-? { column_max >= column_min };
]
( + tmp:SELF;
-
- tmp := SELF.create (line_min,column_min) to (line_max, column_max);
+
+ tmp := SELF.create (line_min,column_min) to (line_max, column_max);
// BSBS: It may be possible to avoid this ceation when :
// BSBS: new `capacity' <= old `capacity'
lower1.to line_maximum do { l:INTEGER;
lower2.to column_maximum do { c:INTEGER;
(tmp.valid_index (l,c)).if {
tmp.put (item (l,c)) to (l,c);
- };
- };
- };
+ };
+ };
+ };
standard_copy tmp;
)
[ ...
@@ -181,72 +181,72 @@ Section Public
+? { column_minimum = column_min };
+? { column_maximum = column_max };
];
-
+
//
// Implementation of others feature from COLLECTION2:
//
-
+
- item (line,column:INTEGER) :V <-
(
storage.item ((line - lower1) * count2 + column - lower2)
);
-
+
- put element:V to (line,column:INTEGER) <-
(
storage.put element to ((line - lower1) * count2 + column - lower2);
);
-
+
- count1:INTEGER <-
(
upper1 - lower1 + 1
);
-
+
- count2:INTEGER <-
(
upper2 - lower2 + 1
);
-
+
- count:INTEGER <-
(
count1 * count2
);
-
+
- force x:V to (line, column:INTEGER) <-
(
(! valid_index (line,column)).if {
- resize (line.min lower1,column.min lower2) to
+ resize (line.min lower1,column.min lower2) to
(line.max upper1,column.max upper2);
};
put x to (line,column);
);
-
+
- set_all_with element:V <-
(
storage.set_all_with element until (count - 1);
);
-
+
- replace_all old_value:V with new_value:V <-
(
storage.replace_all old_value with new_value until (count - 1);
);
-
+
- fast_replace_all old_value:V with new_value:V <-
(
storage.fast_replace_all old_value with new_value until (count - 1);
);
-
- - sub_collection2 (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) :SELF <-
+
+ - sub_collection2 (line_min, column_min:INTEGER) to (line_max, column_max:INTEGER) :SELF <-
( + k:INTEGER;
+ result:SELF;
-
- result := SELF.create (line_min,column_min) to (line_max,column_max);
+
+ result := SELF.create (line_min,column_min) to (line_max,column_max);
k := 0;
- line_min.to line_max do { i:INTEGER;
+ line_min.to line_max do { i:INTEGER;
column_min.to column_max do { j:INTEGER;
result.storage.put (item (i,j)) to k;
k := k + 1;
- };
- };
+ };
+ };
result
)
[ ...
@@ -255,51 +255,51 @@ Section Public
+? { result.upper1 = line_max };
+? { result.upper2 = column_max };
];
-
+
//
// Looking and comparison:
//
-
+
- occurrences elt:V :INTEGER <-
(
- storage.occurrences elt until (count - 1)
+ storage.occurrences elt until (count - 1)
);
-
+
- fast_occurrences elt:V :INTEGER <-
(
- storage.fast_occurrences elt until (count - 1)
+ storage.fast_occurrences elt until (count - 1)
);
-
+
- has x:V :BOOLEAN <-
// Search if a element x is in the array using `equal'.
// See also `fast_has' to chose the apropriate one.
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.first_index_of x until (count - 1) <= count - 1;
};
result
);
-
+
- fast_has x:V :BOOLEAN <-
// Search if a element x is in the array using `='.
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.fast_first_index_of x until (count - 1) <= count - 1;
};
result
);
-
+
- all_default:BOOLEAN <-
(
storage.all_default (count - 1)
);
-
+
- swap (line1, column1:INTEGER) with (line2, column2:INTEGER) <-
( + tmp:V;
- + c2, index1, index2:INTEGER;
-
+ + c2, index1, index2:INTEGER;
+
c2 := count2;
index1 := (line1 - lower1) * c2 + column1 - lower2;
index2 := (line2 - lower1) * c2 + column2 - lower2;
@@ -307,7 +307,7 @@ Section Public
storage.put (storage.item index2) to index1;
storage.put tmp to index2;
);
-
+
- copy other:SELF <-
(
lower1 := other.lower1;
@@ -320,7 +320,7 @@ Section Public
};
storage.copy_from (other.storage) until (count - 1);
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
(
+ result:BOOLEAN;
@@ -334,32 +334,32 @@ Section Public
} else {
result := storage.memcmp (other.storage) until count;
};
-
+
result
);
-
+
//
// Other features:
//
-
+
- transpose <-
// Transpose the Current array
( + oldu1,oldu2 :INTEGER;
+ oldl1,oldl2 :INTEGER;
+ tmp1,tmp2:INTEGER;
-
+
oldu1 := line_maximum;
oldu2 := column_maximum;
oldl1 := lower1;
oldl2 := lower2;
tmp1 := lower1.min lower2;
tmp2 := line_maximum.max column_maximum;
- resize (tmp1,tmp1) to (tmp2,tmp2);
- lower1.to line_maximum do { i:INTEGER;
+ resize (tmp1,tmp1) to (tmp2,tmp2);
+ lower1.to line_maximum do { i:INTEGER;
(i + 1).to column_maximum do { j:INTEGER;
swap (i,j) with (j,i);
};
- };
+ };
resize (oldl2,oldl1) to (oldu2,oldu1);
)
[ ...
@@ -369,19 +369,19 @@ Section Public
+? { column_maximum = Old line_maximum };
+? { count = Old count };
];
-
+
- to_external:POINTER <-
// Gives C access to the internal `storage' (may be dangerous).
(
storage.to_external
);
-
+
//
// Invariant.
//
-
+
// [ ...
// -? { count2 = upper2 - lower2 + 1 };
// -? { capacity >= count }
-// ];
-
+// ];
+
diff --git a/lib/standard/collection/array3.li b/lib/standard/collection/array3.li
index 362c849..273d681 100644
--- a/lib/standard/collection/array3.li
+++ b/lib/standard/collection/array3.li
@@ -19,60 +19,60 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ARRAY3(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
- comment :=" General prurpose, resizable, three dimensional array..";
-
+
Section Inherit
-
+
+ parent_collection3:Expanded COLLECTION3(V);
-
+
Section Public
-
+
+ lower1:INTEGER;
+ lower2:INTEGER;
+ lower3:INTEGER;
-
+
+ upper1:INTEGER;
+ upper2:INTEGER;
+ upper3:INTEGER;
-
+
+ count1:INTEGER;
+ count2:INTEGER;
+ count3:INTEGER;
-
+
+ count:INTEGER;
-
+
Section ARRAY3
-
+
+ storage:NATIVE_ARRAY(V);
// To store elements line by line.
-
+
+ capacity:INTEGER;
// Number of elements in `storage'.
-
+
Section Public
-
+
//
// Creation / modification:
- //
-
- - create (line_min, column_min, depth_min:INTEGER)
+ //
+
+ - create (line_min, column_min, depth_min:INTEGER)
to (line_max, column_max, depth_max:INTEGER) :SELF <-
// Reset all bounds `line_minimum' / `line_maximum' / `column_minimum'
// `column_maximum' / `depth_min' and `depth_max' using arguments as
// new values. All elements are set to the default value of type E.
( + result:SELF;
-
+
result := clone;
result.make (line_min, column_min, depth_min) to (line_max, column_max, depth_max);
result
- );
-
+ );
+
- make (line_min, column_min, depth_min:INTEGER) to (line_max, column_max, depth_max:INTEGER) <-
// Reset all bounds `line_minimum' / `line_maximum' / `column_minimum'
// `column_maximum' / `depth_min' and `depth_max' using arguments as
@@ -82,7 +82,7 @@ Section Public
-? { column_min <= column_max };
-? { depth_min <= depth_max };
]
- (
+ (
lower1 := line_min;
upper1 := line_max;
lower2 := column_min;
@@ -108,28 +108,28 @@ Section Public
+? { depth_minimum = depth_min };
+? { depth_maximum = depth_max };
];
-
+
- from_collection3 model:COLLECTION3(V) <-
(
- make (model.line_minimum, model.column_minimum, model.depth_minimum)
+ make (model.line_minimum, model.column_minimum, model.depth_minimum)
to (model.line_maximum, model.column_maximum, model.depth_maximum);
-
- line_minimum.to line_maximum do { i:INTEGER;
- column_minimum.to column_maximum do { j:INTEGER;
+
+ line_minimum.to line_maximum do { i:INTEGER;
+ column_minimum.to column_maximum do { j:INTEGER;
depth_minimum.to depth_maximum do { k:INTEGER;
put (model.item (i,j,k)) to (i,j,k);
- };
- };
- };
+ };
+ };
+ };
)
[ ...
+? { lower1 = model.lower1 };
+? { lower2 = model.lower2 };
+? { lower3 = model.lower3 };
];
-
- - from_collection contents:COLLECTION(V)
- size (line_min,column_min,depth_min:INTEGER)
+
+ - from_collection contents:COLLECTION(V)
+ size (line_min,column_min,depth_min:INTEGER)
to (line_max,column_max,depth_max:INTEGER) <-
// Reset all bounds using `line_min', `line_max', `column_min',
// `column_max', `depth_min', and `depth_max'.
@@ -138,18 +138,18 @@ Section Public
-? { line_min <= line_max };
-? { column_min <= column_max };
-? { depth_min <= depth_max };
- -? {
- contents.count = (line_max - line_min + 1) *
- (column_max - column_min + 1) *
- (depth_max - depth_min + 1)
+ -? {
+ contents.count = (line_max - line_min + 1) *
+ (column_max - column_min + 1) *
+ (depth_max - depth_min + 1)
};
]
- (
+ (
make (line_min,column_min,depth_min) to (line_max,column_max,depth_max);
-
+
0.to (count - 1) do { i:INTEGER;
storage.put (contents.item (contents.lower + i)) to i;
- };
+ };
)
[ ...
+? { line_minimum = line_min };
@@ -160,19 +160,19 @@ Section Public
+? { depth_maximum = depth_max };
+? { count = contents.count };
];
-
+
- from_model model:COLLECTION(COLLECTION(COLLECTION(V))) <-
//The `model' is used to fill line by line the COLLECTION3.
//Assume all sub-collections of have the same indexing.
(
- make (model.lower,model.first.lower,model.first.first.lower)
+ make (model.lower,model.first.lower,model.first.first.lower)
to (model.upper,model.first.upper,model.first.first.upper);
-
+
(model.lower).to (model.upper) do { line:INTEGER;
(model.first.lower).to (model.first.upper) do { column:INTEGER;
(model.first.first.lower).to (model.first.first.upper) do { depth:INTEGER;
put (model.item line.item column.item depth) to (line,column,depth);
- };
+ };
};
};
)
@@ -184,11 +184,11 @@ Section Public
-? { depth_minimum = model.first.first.lower };
-? { depth_maximum = model.first.first.upper };
];
-
+
//
// Resizing:
//
-
+
- resize (line_min, column_min, depth_min:INTEGER) to (line_max, column_max, depth_max:INTEGER) <-
// Resize bounds of the Current array
[ ...
@@ -197,22 +197,22 @@ Section Public
-? { depth_max >= depth_min };
]
( + tmp:SELF;
-
+
tmp := SELF.clone;
tmp.make (line_min, column_min, depth_min) to (line_max, column_max, depth_max);
//BSBS: It may be possible to avoid this creation when :
//BSBS: new `capacity' <= old `capacity'
-
+
lower1.to line_maximum do { l:INTEGER;
lower2.to column_maximum do { c:INTEGER;
lower3.to depth_maximum do { d:INTEGER;
(tmp.valid_index (l,c,d)).if {
tmp.put (item (l,c,d)) to (l,c,d);
- };
- };
- };
- };
-
+ };
+ };
+ };
+ };
+
standard_copy tmp;
)
[ ...
@@ -223,128 +223,128 @@ Section Public
+? { depth_minimum = depth_min };
+? { depth_maximum = depth_max };
];
-
+
//
// Implementation of others feature from COLLECTION3:
//
-
+
- item (line, column, depth:INTEGER) :V <-
(
storage.item (
- (line - lower1) * count2 * count3 +
+ (line - lower1) * count2 * count3 +
(column - lower2) * count3 + depth - lower3
)
);
-
+
- put element:V to (line, column, depth:INTEGER) <-
(
storage.put element to (
- (line - lower1) * count2 * count3 +
+ (line - lower1) * count2 * count3 +
(column - lower2) * count3 + depth - lower3
);
);
-
+
- force x:V to (line, column, depth:INTEGER) <-
(
(! valid_index (line,column,depth)).if {
- resize (line.min lower1,column.min lower2,depth.min lower3)
+ resize (line.min lower1,column.min lower2,depth.min lower3)
to (line.max upper1,column.max upper2,depth.max upper3);
};
put x to (line,column,depth);
);
-
+
- set_all_with element:V <-
(
storage.set_all_with element with (count - 1);
);
-
+
- replace_all old_value:V with new_value:V <-
(
storage.replace_all old_value with new_value until (count - 1);
);
-
+
- fast_replace_all old_value:V with new_value:V <-
(
storage.fast_replace_all old_value with new_value until (count - 1);
);
-
- - sub_collection3 (line_min, column_min, depth_min:INTEGER)
+
+ - sub_collection3 (line_min, column_min, depth_min:INTEGER)
to (line_max, column_max, depth_max:INTEGER) :SELF <-
( + n:INTEGER;
+ result:SELF;
-
+
result := create (line_min,column_min,depth_min) to (line_max,column_max,depth_max);
-
+
line_min.to line_max do { i:INTEGER;
column_min.to column_max do { j:INTEGER;
depth_min.to depth_max do { k:INTEGER;
result.storage.put (item (i,j,k)) to n;
n := n + 1;
- };
+ };
};
};
result
)
- [ ...
+ [ ...
+? { result.lower1 = line_min };
+? { result.lower2 = column_min };
+? { result.lower3 = depth_min };
+? { result.upper1 = line_max };
+? { result.upper2 = column_max };
- +? { result.upper3 = depth_max };
+ +? { result.upper3 = depth_max };
];
-
+
//
// Looking and comparison:
//
-
+
- occurrences elt:V :INTEGER <-
(
storage.occurrences elt until (count - 1)
);
-
+
- fast_occurrences elt:V :INTEGER <-
(
storage.fast_occurrences elt until (count - 1)
);
-
+
- has x:V :BOOLEAN <-
//Search if a element x is in the array using `equal'.
//See also `fast_has' to choose the apropriate one.
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.index_of x until (count - 1) <= count - 1;
};
result
);
-
+
- fast_has x:V :BOOLEAN <-
// Search if a element x is in the array using `='.
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.fast_index_of x until (count - 1) <= count -1;
};
result
);
-
+
- all_default:BOOLEAN <-
(
storage.all_default (count - 1)
);
-
+
- swap (line1, column1, depth1:INTEGER) with (line2, column2, depth2:INTEGER) <-
( + tmp:V;
+ index1, index2:INTEGER;
-
+
index1 := (line1 - lower1) * count2 * count3 + (column1 - lower2) * count3 + depth1 - lower3;
index2 := (line2 - lower1) * count2 * count3 + (column2 - lower2) * count3 + depth2 - lower3;
tmp := storage.item index1;
storage.put(storage.item index2) to index1;
storage.put tmp to index2;
);
-
+
- copy other:SELF <-
(
lower1 := other.lower1;
@@ -363,25 +363,25 @@ Section Public
};
storage.copy_from (other.storage) until (count - 1);
);
-
+
//
// Invariant.
//
-
+
// [ ...
// -? { count1 = upper1 - lower1 + 1 };
// -? { count2 = upper2 - lower2 + 1 };
// -? { count3 = upper3 - lower3 + 1 };
// -? { capacity >= count };
// ];
-
-
-/*
+
+
+/*
- '==' Right 60 other:SELF :BOOLEAN <-
(
+ result:BOOLEAN;
result := FALSE;
-
+
( other = Self ).if {
result := true;
}.elseif { lower1 != other.lower1 } then {
@@ -393,7 +393,7 @@ Section Public
} else {
result := storage.memcmp (other.storage) until count;
};
-
+
result
);
*/
\ No newline at end of file
diff --git a/lib/standard/collection/avl_dictionary.li b/lib/standard/collection/avl_dictionary.li
index 94a7ede..a69fcf1 100644
--- a/lib/standard/collection/avl_dictionary.li
+++ b/lib/standard/collection/avl_dictionary.li
@@ -19,42 +19,42 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := AVL_DICTIONARY(V, K);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Associative memory. Values of type `V' are stored using Keys of type `K'.";
-
- // Efficient implementation of DICTIONARY using an AVL balanced tree.
- // AVL stands for the names of G. M. Adel'son-Velskii and E. M. Landis,
- // two Russian mathematicians who first came up with this method of keeping
+
+ // Efficient implementation of DICTIONARY using an AVL balanced tree.
+ // AVL stands for the names of G. M. Adel'son-Velskii and E. M. Landis,
+ // two Russian mathematicians who first came up with this method of keeping
// the tree balanced.
Section Insert
-
+
+ parent_avl_tree:Expanded AVL_TREE(K);
Section Inherit
-
+
+ parent_simple_dictionary:Expanded SIMPLE_DICTIONARY(V, K);
-
+
Section Private
-
+
- key_memory:K <- item_memory;
-
+
Section Public
-
+
- capacity:INTEGER <- count;
- - at k:K :V <-
+ - at k:K :V <-
( + dic:AVL_DICTIONARY_NODE(V,K);
dic ?= root.at k;
dic.value
);
- - fast_at k:K :V <-
+ - fast_at k:K :V <-
( + dic:AVL_DICTIONARY_NODE(V,K);
dic ?= root.fast_at k;
dic.value
@@ -63,7 +63,7 @@ Section Public
- reference_at k:K :V <-
( + result:V;
+ n:AVL_DICTIONARY_NODE(V, K);
-
+
(root != NULL).if {
n := root.at k;
(n != NULL).if {
@@ -76,7 +76,7 @@ Section Public
- fast_reference_at k:K :V <-
( + result:V;
+ n:AVL_DICTIONARY_NODE(V, K);
-
+
(root != NULL).if {
n := root.fast_at k;
(n != NULL).if {
@@ -85,9 +85,9 @@ Section Public
};
result
);
-
+
- put v:V to k:K <- add v to k;
-
+
- add v:V to k:K <-
(
value_memory := v;
@@ -104,7 +104,7 @@ Section Public
- occurrences v:V :INTEGER <-
( + result:INTEGER;
-
+
(root != NULL).if {
result := root.occurrences v;
};
@@ -113,7 +113,7 @@ Section Public
- fast_occurrences v:V :INTEGER <-
( + result:INTEGER;
-
+
(root != NULL).if {
result := root.fast_occurrences v;
};
@@ -121,7 +121,7 @@ Section Public
);
- key_at v:V :K <- root.key_at v;
-
+
- fast_key_at v:V :K <- root.fast_key_at v;
- clear_count <- clear_count_and_capacity;
@@ -154,7 +154,7 @@ Section Public
);
- internal_key k:K :K <- root.at(k).key;
-
+
- make <-
(
map := FAST_ARRAY(AVL_TREE_NODE(K)).create 0;
@@ -166,19 +166,19 @@ Section Public
);
Section Private
-
+
+ value_memory:V;
- set_value_and_key n:AVL_TREE_NODE(K) <-
( + dic:AVL_DICTIONARY_NODE(V,K);
-
+
dic ?= n;
dic.make (value_memory, key_memory);
);
- set_value n:AVL_TREE_NODE(K) <-
( + dic:AVL_DICTIONARY_NODE(V,K);
-
+
dic ?= n;
dic.set_value value_memory;
);
@@ -195,7 +195,7 @@ Section Private
- discard_node n:AVL_DICTIONARY_NODE(V, K) <-
( + v:V;
+ k:K;
-
+
n.make (v, k);
);
@@ -203,12 +203,12 @@ Section Private
(
AVL_DICTIONARY_NODE(V, K).clone
);
-
-
- //
+
+
+ //
//invariant
//
-
+
//[ ...
// -? {lost_nodes != NULL};
// -? {lost_nodes = common_lost_nodes.at generating_type};
diff --git a/lib/standard/collection/avl_set.li b/lib/standard/collection/avl_set.li
index 873aab8..be21856 100644
--- a/lib/standard/collection/avl_set.li
+++ b/lib/standard/collection/avl_set.li
@@ -19,20 +19,20 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := AVL_SET(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
Section Inherit
-
+
+ parent_set:Expanded SET(V);
-
+
+ parent_avl_tree:Expanded AVL_TREE(V);
-
-Section Public
-
+
+Section Public
+
- add e:V <-
(
item_memory := e;
@@ -58,7 +58,7 @@ Section Public
- reference_at e:V :V <-
( + n:AVL_SET_NODE(V);
+ result:V;
-
+
(root != NULL).if {
n := root.at e;
(n != NULL).if {
@@ -70,18 +70,18 @@ Section Public
- item index:INTEGER :V <-
( + result:V;
-
+
(map_dirty).if {
build_map;
};
map.item (index - 1).item
);
-
+
Section Private
-
+
- set_item n:AVL_SET_NODE(V) <-
(
- n.make item_memory;
+ n.make item_memory;
);
- set_value n:AVL_SET_NODE(V);
@@ -97,7 +97,7 @@ Section Private
- discard_node n:AVL_SET_NODE(V) <-
( //+ i:V;
-
+
//n.make i;
//n.set_left (lost_nodes.item);
//lost_nodes.set_item n;
@@ -108,16 +108,16 @@ Section Private
AVL_SET_NODE(V).create
);
-Section Public
-
+Section Public
+
- create:SELF <-
( + result:SELF;
-
+
result := clone;
result.make;
result
);
-
+
- make <-
(
//(lost_nodes != NULL).if {
@@ -131,11 +131,11 @@ Section Public
// };
// };
);
-
+
//
// Invariant.
//
-
+
// [
// -? {lost_nodes != NULL};
// -? {lost_nodes = common_lost_nodes.at generating_type};
diff --git a/lib/standard/collection/fast_array.li b/lib/standard/collection/fast_array.li
index 9b4b575..66b7b5b 100644
--- a/lib/standard/collection/fast_array.li
+++ b/lib/standard/collection/fast_array.li
@@ -31,7 +31,7 @@ Section Header
\Unlike ARRAY, the `lower' bound of a FAST_ARRAY is frozen \
\to 0. Thus, some memory is saved and looping toward `lower' \
\bound (which is 0) run a little bit faster.";
-
+
// General purpose resizable FAST_ARRAYs. The only difference with ARRAY is the
// fact that the `lower' bound is actually frozen to 0. The `item' access is likely
// to be more efficient as well as loop going from `upper' to `lower' just because
@@ -46,7 +46,7 @@ Section Header
// `add_last' / `last' / `remove_last'. Conversely `add_first' and `remove_first' are
// likely to slow down your program if they are too often used. If the fact that
// `lower' is stuck to 0 do matter, also consider ARRAY.
-
+
Section Inherit
+ parent_arrayed_collection:Expanded ARRAYED_COLLECTION(V);
@@ -188,9 +188,9 @@ Section Public
(capacity = 0).if {
storage := NATIVE_ARRAY(V).create new_capacity;
} else {
- storage := storage.realloc capacity with new_capacity;
+ storage := storage.realloc capacity with new_capacity;
};
- capacity := new_capacity;
+ capacity := new_capacity;
};
)
[
@@ -224,7 +224,7 @@ Section Public
new_capacity := new_capacity * 2;
};
storage := storage.realloc capacity with new_capacity;
- capacity := new_capacity;
+ capacity := new_capacity;
};
}.elseif { new_count != count } then {
storage.clear new_count to (count - 1);
@@ -360,17 +360,17 @@ Section Public
up := max;
{
sw:=FALSE;
- low.to up do { i:INTEGER;
+ low.to up do { i:INTEGER;
(cmp.value (item i,item (i+1))).if {
swap i with (i+1);
sw := TRUE;
};
-
+
idx := max - i;
(cmp.value (item idx,item (idx+1))).if {
swap idx with (idx+1);
sw := TRUE;
- };
+ };
};
up := up - 1;
low := low + 1;
@@ -512,7 +512,7 @@ Section Public
(
storage.fast_reverse_index_of (element, start_index)
);
-
+
- subarray min:INTEGER to max:INTEGER :SELF <- // slice
( + result:SELF;
diff --git a/lib/standard/collection/fast_array2.li b/lib/standard/collection/fast_array2.li
index 9744008..b4274ad 100644
--- a/lib/standard/collection/fast_array2.li
+++ b/lib/standard/collection/fast_array2.li
@@ -129,7 +129,7 @@ Section Public
// The `model' is used to fill line by line the COLLECTION2.
// Assume all sub-collections of `model' have the number of items.
( + l,c:INTEGER;
-
+
make(model.count, model.first.count);
l := model.lower;
lower1.to upper1 do { line:INTEGER;
@@ -145,13 +145,13 @@ Section Public
- sub_collection2 (line_min,column_min:INTEGER) to (line_max,column_max:INTEGER) :SELF <-
( + l,c:INTEGER;
+ result:SELF;
-
+
result := create (line_max - line_min + 1, column_max - column_min + 1);
l := line_min;
(result.lower1).to (result.upper1) do { line:INTEGER;
c := column_min;
(result.lower2).to (result.upper2) do { column:INTEGER;
- result.put (item (l, c)) to (line, column);
+ result.put (item (l, c)) to (line, column);
c := c + 1;
};
l := l + 1;
diff --git a/lib/standard/collection/fast_array3.li b/lib/standard/collection/fast_array3.li
index 632d337..d2760df 100644
--- a/lib/standard/collection/fast_array3.li
+++ b/lib/standard/collection/fast_array3.li
@@ -19,63 +19,63 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FAST_ARRAY3(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Resizable three dimensional array.\
\Unlike ARRAY3, the `lower1', `lower2' and `lower3' bounds \
\are frozen to 0. Thus, one can expect better performances. .";
-
+
Section Inherit
-
+
+ parent_collection3:Expanded COLLECTION3(V);
-
+
Section Public
-
+
+ upper1:INTEGER;
+ count1:INTEGER;
-
+
+ upper2:INTEGER;
+ count2:INTEGER;
-
+
+ upper3:INTEGER;
+ count3:INTEGER;
-
+
+ count:INTEGER;
-
+
Section Private
-
+
+ count2x3:INTEGER;
// To speed up access, this value is always equal to
// `count2' * `count3'
-
+
Section FAST_ARRAY3
-
+
+ storage:NATIVE_ARRAY(V);
-
+
+ capacity:INTEGER; // of `storage'.
-
+
Section Public
-
+
- lower1:INTEGER := 0;
-
+
- lower2:INTEGER := 0;
-
+
- lower3:INTEGER := 0;
-
+
- create (new_count1, new_count2, new_count3:INTEGER) :SELF<-
// Create or reset `Current' with new dimensions.
// All elements are set to the default value of type E.
( + result:SELF;
-
+
result := clone;
result.make (new_count1, new_count2, new_count3);
result
);
-
+
- make (new_count1, new_count2, new_count3 :INTEGER) <-
// Create or reset `self' with new dimensions.
// All elements are set to the default value of type E.
@@ -84,7 +84,7 @@ Section Public
-? { new_count2 > 0 };
-? { new_count3 > 0 };
]
- (
+ (
count1 := new_count1;
upper1 := new_count1 - 1;
count2 := new_count2;
@@ -106,7 +106,7 @@ Section Public
+? { count3 = new_count3 };
+? { all_default };
];
-
+
- from_collection3 model:COLLECTION3(V) <-
// Uses the `model' to update self.
(
@@ -119,7 +119,7 @@ Section Public
};
};
);
-
+
- from_collection contents:COLLECTION(V) size (new_count1, new_count2, new_count3:INTEGER) <-
// Reset all bounds using `new_count#i'.
// Copy all elements of `contents', line by line into self.
@@ -129,7 +129,7 @@ Section Public
-? { new_count3 >= 0 };
-? { contents.count = new_count1 * new_count2 * new_count3 };
]
- (
+ (
make (new_count1, new_count2, new_count3);
lower1.to (count - 1) do { i:INTEGER;
storage.put (contents.item (contents.lower + i)) to i;
@@ -141,19 +141,19 @@ Section Public
+? { depth_maximum = new_count3 - 1 };
+? { count = contents.count };
];
-
-
+
+
- from_model model:COLLECTION(COLLECTION(COLLECTION(V))) <-
// The `model' is used to fill line by line the COLLECTION3.
// Assume all sub-collections of have the same indexing.
( + n:INTEGER;
-
+
make (
- model.upper - model.lower + 1,
- model.first.upper - model.first.lower + 1,
+ model.upper - model.lower + 1,
+ model.first.upper - model.first.lower + 1,
model.first.first.upper - model.first.first.lower + 1
);
-
+
(model.lower).to (model.upper) do { line:INTEGER;
(model.first.lower).to (model.first.upper) do { column:INTEGER;
(model.first.first.lower).to (model.first.first.upper) do { depth:INTEGER;
@@ -168,22 +168,22 @@ Section Public
+? { column_maximum = model.first.upper - model.first.lower };
+? { depth_maximum = model.first.first.upper - model.first.first.lower };
];
-
+
//
// Implementation of others feature from COLLECTION3:
//
-
+
- item (line, column, depth:INTEGER) :V <-
(
storage.item (line * count2x3 + column * count3 + depth)
);
-
+
- put element:V to (line, column, depth:INTEGER) <-
(
storage.put element to (line * count2x3 + column * count3 + depth);
);
-
-
+
+
- force element:V to (line, column, depth :INTEGER) <-
(
(! valid_index (line, column, depth)).if {
@@ -191,8 +191,8 @@ Section Public
};
put element to (line,column,depth);
);
-
-
+
+
- copy other:SELF <-
(
count1 := other.count1;
@@ -209,18 +209,18 @@ Section Public
};
storage.copy_from (other.storage) until (count - 1);
);
-
- - sub_collection3 (line_min,column_min,depth_min:INTEGER)
+
+ - sub_collection3 (line_min,column_min,depth_min:INTEGER)
to (line_max,column_max,depth_max:INTEGER) :SELF <-
( + n:INTEGER;
+ result:SELF;
-
+
result := SELF.create (
- line_max - line_min + 1,
- column_max - column_min + 1,
+ line_max - line_min + 1,
+ column_max - column_min + 1,
depth_max - depth_min + 1
);
-
+
line_min.to line_max do { i:INTEGER;
column_min.to column_max do { j:INTEGER;
depth_min.to depth_max do { k:INTEGER;
@@ -234,30 +234,30 @@ Section Public
[ ...
+? { result.upper1 = line_max - line_min };
+? { result.upper2 = column_max - column_min };
- +? { result.upper3 = depth_max - depth_min };
+ +? { result.upper3 = depth_max - depth_min };
];
-
+
//
// Writing:
//
-
+
- set_all_with x:V <-
// All element are set with the value x.
(
storage.set_all_with x until (count - 1);
);
-
+
- all_default:BOOLEAN <-
(
storage.all_default (count - 1)
);
-
+
- slice (l1,up1:INTEGER) to (l2,up2:INTEGER) to (l3,up3:INTEGER) :SELF <-
// Create a new collection initialized with elements of
// range `low'..`up'. result has the same dynamic type
// as self collection.
( + result:SELF;
-
+
result := SELF.create (up1 - l1 + 1, up2 - l2 + 1, up3 - l3 + 1);
l1.to up1 do { line:INTEGER;
l2.to up2 do { column:INTEGER;
@@ -266,8 +266,8 @@ Section Public
};
};
};
- );
-
+ );
+
- set_slice (l1,up1:INTEGER) to (l2,up2:INTEGER) to (l3,up3:INTEGER) with element:V <-
// Set all the elements in the
// range [(l1,up1),(l2,up2),(l3,up3)] of
@@ -280,8 +280,8 @@ Section Public
};
};
};
- );
-
+ );
+
- swap (line1, column1, depth1:INTEGER) with (line2, column2, depth2:INTEGER) <-
( + tmp:V;
+ c3, c2x3, index1, index2:INTEGER;
@@ -293,25 +293,25 @@ Section Public
storage.put (storage.item index2) to index1;
storage.put tmp to index2;
);
-
+
//
// Looking and comparison:
//
-
+
- occurrences elt:V :INTEGER <-
(
storage.occurrences elt until (count - 1)
);
-
+
- fast_occurrences elt:V :INTEGER <-
(
storage.fast_occurrences elt until (count - 1)
);
-
+
//
// Resizing:
//
-
+
- resize (new_count1,new_count2,new_count3:INTEGER) <-
[ ...
-? { new_count1 > 0};
@@ -319,11 +319,11 @@ Section Public
-? { new_count3 > 0};
]
( + tmp:SELF;
-
+
tmp := SELF.create (new_count1, new_count2, new_count3);
// BSBS: It may be possible to avoid this creation when :
// BSBS: new `capacity' <= old `capacity'
-
+
line_maximum.downto 0 do { l:INTEGER;
column_maximum.downto 0 do { c:INTEGER;
depth_maximum.downto 0 do { d:INTEGER;
@@ -344,65 +344,65 @@ Section Public
+? { count3 = new_count3 };
+? { count = new_count1 * new_count2 * new_count3 };
];
-
+
//
// Looking and Searching:
//
-
+
- has x:V :BOOLEAN <-
// Look for `x' using `equal' for comparison.
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.index_of x until (count-1) <= (count-1);
};
result
- );
-
+ );
+
- fast_has x:V :BOOLEAN <-
// Same as `has' but use `=' for comparison
( + result:BOOLEAN;
-
+
(count > 0).if {
result := storage.fast_index_of x until (count - 1) <= (count - 1);
};
result
- );
-
+ );
+
//
// Other features:
//
-
+
- replace_all old_value:V with new_value:V <-
(
storage.replace_all old_value with new_value until (count - 1);
);
-
-
+
+
- fast_replace_all old_value:V with new_value:V <-
(
storage.fast_replace_all old_value with new_value until (count - 1);
);
-
+
//
// Invariant.
//
-
+
// [ ...
// -? {count1 = upper1 + 1};
-// -? {count2 = upper2 + 1};
+// -? {count2 = upper2 + 1};
// -? {count3 = upper3 + 1};
// -? {count = count1 * count2 * count3};
// -? {count2x3 = count2 * count3};
// -? {capacity >= count};
// ];
-
+
/*
- '==' Right 60 other:SELF :BOOLEAN <-
(
+ result:BOOLEAN;
result := FALSE;
-
+
(other = Self).if {
result := TRUE;
}.elseif { upper1 != other.upper1} then {
@@ -411,7 +411,7 @@ Section Public
} else {
result := storage.memcmp (other.storage) until count;
};
-
+
result
);
*/
\ No newline at end of file
diff --git a/lib/standard/collection/hashed_dictionary.li b/lib/standard/collection/hashed_dictionary.li
index a20916d..c7a0ee9 100644
--- a/lib/standard/collection/hashed_dictionary.li
+++ b/lib/standard/collection/hashed_dictionary.li
@@ -29,7 +29,7 @@ Section Header
\Values of type `V' are stored using Keys of type `K'.";
// Efficient implementation of DICTIONARY using `hash_code' on keys.
-
+
Section Inherit
- parent_simple_dictionary:Expanded SIMPLE_DICTIONARY(V,K);
@@ -310,7 +310,7 @@ Section Public
- fast_remove k:K <-
( + h, idx:INTEGER;
+ node, previous_node:HASHED_DICTIONARY_NODE(V,K);
-
+
cache_user := -1;
h := k.hash_code;
idx := h % capacity;
@@ -320,10 +320,10 @@ Section Public
count := count - 1;
node := dispose_node node;
buckets.put node to idx;
- } else {
+ } else {
previous_node := node;
- node := node.next;
- {(node = NULL) || {node.key = k}}.until_do {
+ node := node.next;
+ {(node = NULL) || {node.key = k}}.until_do {
previous_node := node;
node := node.next;
};
@@ -369,7 +369,7 @@ Section Public
+ idx:INTEGER;
node := buckets.item idx;
- count.downto 1 do { i:INTEGER;
+ count.downto 1 do { i:INTEGER;
{node != NULL}.until_do {
idx := idx + 1;
? {idx < capacity};
@@ -582,7 +582,7 @@ Section Public
+? { is_empty };
+? { capacity >= medium_size };
];
-
+
//
// Invariant
//
diff --git a/lib/standard/collection/hashed_set.li b/lib/standard/collection/hashed_set.li
index a22c98e..58b7fdf 100644
--- a/lib/standard/collection/hashed_set.li
+++ b/lib/standard/collection/hashed_set.li
@@ -178,7 +178,7 @@ Section Public
count := count + 1;
};
);
-
+
- remove e:V <-
// Remove item `e' from the set:the mathematical definition of
// removing from a set is followed.
@@ -284,7 +284,7 @@ Section Public
( + idx:INTEGER;
+ node:HASHED_SET_NODE(V);
+ result:V;
-
+
idx := e.hash_code % capacity;
node := buckets.item idx;
{(node = NULL) || {node.item == e}}.until_do {
@@ -300,7 +300,7 @@ Section Public
( + idx:INTEGER;
+ node:HASHED_SET_NODE(V);
+ result:V;
-
+
idx := e.hash_code % capacity;
node := buckets.item idx;
{(node = NULL) || {cmp.value (node.item,e)}}.until_do {
@@ -352,7 +352,7 @@ Section Public
count := count - 1;
} else {
node1 := node2;
- };
+ };
node2 := node2.next;
c := c - 1;
};
@@ -379,7 +379,7 @@ Section Public
- from_collection model:COLLECTION(V) <-
( + i, up:INTEGER;
-
+
with_capacity (model.count.max 1);
up := model.upper;
i := model.lower;
diff --git a/lib/standard/collection/iterator.li b/lib/standard/collection/iterator.li
index f85c5cf..9bbd279 100644
--- a/lib/standard/collection/iterator.li
+++ b/lib/standard/collection/iterator.li
@@ -81,8 +81,8 @@ Section Public
- make t:TRAVERSABLE(V) increment inc:INTEGER :SELF <-
make t index (t.lower) increment inc;
- - make t:TRAVERSABLE(V) index i:INTEGER increment inc:INTEGER :SELF <-
- [
+ - make t:TRAVERSABLE(V) index i:INTEGER increment inc:INTEGER :SELF <-
+ [
-? {inc != 0};
-? {t != NULL};
-? {t.valid_index i};
@@ -91,7 +91,7 @@ Section Public
increment := inc;
traversable := t;
index := i;
- Self
+ Self
);
- make t:TRAVERSABLE(V) index i:INTEGER :SELF <-
diff --git a/lib/standard/collection/linked2_list.li b/lib/standard/collection/linked2_list.li
index 9307f4c..0e99725 100644
--- a/lib/standard/collection/linked2_list.li
+++ b/lib/standard/collection/linked2_list.li
@@ -19,48 +19,48 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED2_LIST(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Two way linked list with internal automatic memorization \
\of the last access .";
-
+
Section Inherit
-
+
+ parent_linked_collection:Expanded LINKED_COLLECTION(V);
-
+
Section LINKED2_LIST
-
+
+ first_link:LINK2(V);
// NULL when empty or gives access to the first element.
-
+
+ last_link:LINK2(V);
// NULL when empty or gives access to the last element.
-
- + mem_idx:INTEGER;
-
+
+ + mem_idx:INTEGER;
+
+ mem_lnk:LINK2(V);
// To speed up accessing, `mem_idx' and `mem_lnk' is the
// memory of the last access done. For example, after
// item(1), `mem_idx' is 1 and `mem_lnk' is `first_link'.
// When list is empty, `first_link' is NULL as well as
// `mem_lnk' and `mem_idx' is 0;
-
+
Section Public
-
+
- create:SELF <-
// Make an empty list;
- (
+ (
SELF.clone
);
-
+
- is_empty:BOOLEAN <- first_link = NULL;
-
+
- add_first element:V <-
- (
+ (
(first_link = NULL).if {
first_link := LINK2(V).create element previous NULL next NULL;
last_link := first_link;
@@ -77,9 +77,9 @@ Section Public
[ ...
+? { upper = 1 + Old upper };
];
-
+
- add_last element:V <-
- (
+ (
(first_link = NULL).if {
first_link := LINK2(V).create element previous NULL next NULL;
last_link := first_link;
@@ -92,10 +92,10 @@ Section Public
upper := upper + 1;
};
);
-
+
- add element:V to index:INTEGER <-
( + link:LINK2(V);
-
+
(index = 1).if {
add_first element;
}.elseif {index = upper + 1} then {
@@ -108,18 +108,18 @@ Section Public
link.next.set_previous link;
mem_lnk.set_next link;
upper := upper + 1;
- };
+ };
);
-
+
- remove_first <-
- (
+ (
(upper = 1).if {
- first_link := NULL;
+ first_link := NULL;
last_link := NULL;
mem_lnk := NULL;
mem_idx := 0;
upper := 0;
- } else {
+ } else {
first_link := first_link.next;
first_link.set_previous NULL;
upper := upper - 1;
@@ -128,13 +128,13 @@ Section Public
} else {
mem_lnk := first_link;
mem_idx := 1;
- };
+ };
};
);
-
+
- remove index:INTEGER <-
( + link:LINK2(V);
-
+
(index = 1).if {
remove_first;
}.elseif { index = upper} then {
@@ -149,11 +149,11 @@ Section Public
upper := upper - 1;
};
);
-
+
- first:V <- first_link.item;
-
+
- last:V <- last_link.item;
-
+
- item index:INTEGER :V <-
(
(index != mem_idx).if {
@@ -161,33 +161,33 @@ Section Public
};
mem_lnk.item
);
-
+
- put element:V to index:INTEGER <-
- (
+ (
(index != mem_idx).if {
go_item index;
};
- mem_lnk.set_item element;
+ mem_lnk.set_item element;
);
-
+
- count:INTEGER <- upper;
-
+
- set_all_with v:V <-
- (
+ (
(first_link != NULL).if {
first_link.set_all_with v;
- };
+ };
);
-
+
- copy other:SELF <-
(
from_collection other;
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
( + result:BOOLEAN;
+ lnk1, lnk2:LINK2(V);
-
+
(Self = other).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -199,15 +199,15 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- is_equal_map other:SELF :BOOLEAN <-
( + result:BOOLEAN;
+ lnk1, lnk2:LINK2(V);
+ safe_equal:SAFE_EQUAL(V);
-
+
( Self = other ).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -219,27 +219,27 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- index_of x:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
+ safe_equal:SAFE_EQUAL(V);
-
+
result := start_index;
{(result > upper) || {safe_equal.test x with (item result)}}.until_do {
result := result + 1;
- };
+ };
result
);
-
+
- reverse_index_of element:V start start_index:INTEGER :INTEGER <-
- ( + safe_equal:SAFE_EQUAL(V);
+ ( + safe_equal:SAFE_EQUAL(V);
+ temporary_idx:INTEGER;
+ temporary_lnk:LINK2(V);
+ result:INTEGER;
-
+
(start_index != mem_idx).if {
go_item start_index;
};
@@ -260,25 +260,25 @@ Section Public
- fast_index_of x:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
+ u:INTEGER;
-
+
result := lower;
u := upper;
{(result > u) || {x = item result}}.until_do {
result := result + 1;
};
result
- );
+ );
- fast_reverse_index_of element:V start start_index:INTEGER :INTEGER <-
( + temporary_idx:INTEGER;
+ temporary_lnk:LINK2(V);
+ result:INTEGER;
-
+
(start_index != mem_idx).if {
go_item start_index;
};
temporary_idx := mem_idx;
- temporary_lnk := mem_lnk;
+ temporary_lnk := mem_lnk;
{(temporary_idx < lower) || {element = temporary_lnk.item}}.until_do {
temporary_idx := temporary_idx - 1;
temporary_lnk := temporary_lnk.previous;
@@ -289,7 +289,7 @@ Section Public
mem_lnk := temporary_lnk;
};
);
-
+
- clear <-
(
(first_link != NULL).if {
@@ -303,10 +303,10 @@ Section Public
[ ...
+? {upper = 0};
];
-
+
- from_collection model:COLLECTION(V) <-
( + lnk:LINK2(V);
-
+
(first_link = NULL).if {
(model.lower).to (model.upper) do { i:INTEGER;
add_last (model.item i);
@@ -335,14 +335,14 @@ Section Public
upper := i;
last_link := mem_lnk;
};
- };
+ };
);
-
+
- slice low:INTEGER to up:INTEGER :SELF <-
( + lnk:LINK2(V);
+ result:SELF;
- result := SELF.create;
+ result := SELF.create;
(mem_idx != low).if {
go_item low;
};
@@ -353,26 +353,26 @@ Section Public
};
result
);
-
+
- occurrences element:V :INTEGER <-
( + lnk:LINK2(V);
+ safe_equal:SAFE_EQUAL(V);
+ result:INTEGER;
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(safe_equal.test element with (lnk.item)).if {
result := result + 1;
};
lnk := lnk.next;
- };
+ };
result
);
-
+
- fast_occurrences element:V :INTEGER <-
( + lnk:LINK2(V);
+ result:INTEGER;
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(element = lnk.item).if {
@@ -382,21 +382,21 @@ Section Public
};
result
);
-
+
- force element:V to index:INTEGER <-
( + v:V;
-
+
{index <= upper}.until_do {
add_last v;
};
put element to index;
);
-
+
- all_default:BOOLEAN <-
( + l:LINK2(V);
+ d:V;
+ result:BOOLEAN;
-
+
result := TRUE;
l := first_link;
{(! result) || {l = NULL}}.until_do {
@@ -405,12 +405,12 @@ Section Public
result := d.is_default;
};
l := l.next;
- };
+ };
result
);
-
+
- remove_last <-
- (
+ (
(upper = 1).if {
first_link := NULL;
last_link := NULL;
@@ -426,37 +426,37 @@ Section Public
mem_lnk := first_link;
};
upper := upper - 1;
- };
+ };
);
-
+
- replace_all old_value:V with new_value:V <-
( + safe_equal:SAFE_EQUAL(V);
-
+
lower.to upper do { i:INTEGER;
(safe_equal.test (item i) with old_value).if {
put new_value to i;
};
- };
+ };
);
-
+
- fast_replace_all old_value:V with new_value:V <-
- (
+ (
lower.to upper do { i:INTEGER;
(item i = old_value).if {
put new_value to i;
};
- };
+ };
);
-
+
- reverse <-
- ( + temp:V;
- + low:LINK2(V);
+ ( + temp:V;
+ + low:LINK2(V);
+ high:LINK2(V);
+ i:INTEGER;
-
+
low := first_link;
high := last_link;
-
+
i := count / 2;
? {(i > 0) -> ((low != NULL) & (high != NULL))};
? {(i > 0) -> ((low != high) & (low.previous != high))};
@@ -467,11 +467,11 @@ Section Public
low := low.next;
high := high.previous;
i := i - 1;
- };
+ };
);
-
+
Section Private
-
+
- go_item index:INTEGER <-
[ ...
-? { valid_index index };
@@ -512,15 +512,15 @@ Section Private
+? { mem_idx = index };
+? { mem_lnk != NULL };
];
-
+
//
// Invariant.
//
-
+
// [ ...
// "Empty status." -? {(first_link = NULL) ->
// ((last_link = NULL) & (upper = 0) & (mem_idx = 0) & (mem_lnk = NULL))};
-
+
// "Not empty status." -? {(first_link != NULL) ->
// ((last_link != NULL) & (upper > 0) & (mem_idx > 0) & (mem_lnk != NULL))};
// ];
diff --git a/lib/standard/collection/linked_list.li b/lib/standard/collection/linked_list.li
index be74681..677fd77 100644
--- a/lib/standard/collection/linked_list.li
+++ b/lib/standard/collection/linked_list.li
@@ -19,59 +19,59 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED_LIST(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="One way linked list with internal automatic memorization of the last access.";
-
- // One way linked list implementation with internal automatic cached memorization
- // of the last access. Because of the last access memory cache, the traversal of a
- // LINKED_LIST from the `lower' index to the `upper' index using `item' is quite
+
+ // One way linked list implementation with internal automatic cached memorization
+ // of the last access. Because of the last access memory cache, the traversal of a
+ // LINKED_LIST from the `lower' index to the `upper' index using `item' is quite
// efficient. As one can expect, adding element using `add_first' or
- // `add_last' is really efficient too, actually, the total number of elements
- // (i.e. `count') as well as a reference to the last cell is also cached automatically.
- // Keep in mind that LINKED_LIST uses a one way linked storage from `lower' to `upper',
- // so traversing a LINKED_LIST from `upper' to `lower' will be extremely time consumming
+ // `add_last' is really efficient too, actually, the total number of elements
+ // (i.e. `count') as well as a reference to the last cell is also cached automatically.
+ // Keep in mind that LINKED_LIST uses a one way linked storage from `lower' to `upper',
+ // so traversing a LINKED_LIST from `upper' to `lower' will be extremely time consumming
// (also consider LINKED2_LIST).
-
+
Section Inherit
-
+
+ parent_linked_collection:Expanded LINKED_COLLECTION(V);
-
+
Section LINKED_LIST
-
+
+ first_link:LINKED_LIST_NODE(V);
// NULL when empty or gives access to the first element.
-
+
+ last_link:LINKED_LIST_NODE(V);
// NULL when empty or gives access to the last element.
-
- + mem_idx:INTEGER;
+
+ + mem_idx:INTEGER;
+ mem_lnk:LINKED_LIST_NODE(V);
// To speed up accessing, `mem_idx' and `mem_lnk' is the
// memory of the last access done. For example, after
// item(1), `mem_idx' is 1 and `mem_lnk' is `first_link'.
// When list is empty, `first_link' is NULL as well as
// `mem_lnk' and `mem_idx' is 0;
-
+
Section Public
-
+
- create:SELF <-
// Make an empty list;
- (
- SELF.clone
+ (
+ SELF.clone
)
[ ...
+? {count = 0};
];
-
+
- is_empty:BOOLEAN <- first_link = NULL;
-
+
- add_first element:V <-
- (
+ (
(first_link = NULL).if {
first_link := LINKED_LIST_NODE(V).create element next NULL;
upper := 1;
@@ -82,12 +82,12 @@ Section Public
first_link := LINKED_LIST_NODE(V).create element next first_link;
upper := upper + 1;
mem_idx := mem_idx + 1;
- };
+ };
);
-
+
- add_last element:V <-
( + lnk:LINKED_LIST_NODE(V);
-
+
(first_link = NULL).if {
first_link := LINKED_LIST_NODE(V).create element next NULL;
upper := 1;
@@ -101,7 +101,7 @@ Section Public
last_link := lnk;
};
);
-
+
- add element:V to index:INTEGER <-
( + link:LINKED_LIST_NODE(V);
@@ -118,11 +118,11 @@ Section Public
upper := upper + 1;
};
);
-
+
- remove_first <-
- (
+ (
(upper = 1).if {
- first_link := NULL;
+ first_link := NULL;
last_link := NULL;
mem_lnk := NULL;
mem_idx := 0;
@@ -135,12 +135,12 @@ Section Public
mem_idx := mem_idx - 1;
};
upper := upper - 1;
- };
+ };
);
-
+
- remove index:INTEGER <-
- ( + link:LINKED_LIST_NODE(V);
-
+ ( + link:LINKED_LIST_NODE(V);
+
(index = 1).if {
remove_first;
}.elseif {index = upper} then {
@@ -152,13 +152,13 @@ Section Public
link := mem_lnk.next;
mem_lnk.set_next (link.next);
upper := upper - 1;
- };
+ };
);
-
+
- first:V <- first_link.item;
-
+
- last:V <- last_link.item;
-
+
- item i:INTEGER :V <-
(
(i != mem_idx).if {
@@ -166,33 +166,33 @@ Section Public
};
mem_lnk.item
);
-
+
- put element:V to i:INTEGER <-
- (
+ (
(i != mem_idx).if {
go_item i;
};
mem_lnk.set_item element;
);
-
+
- count:INTEGER <- upper;
-
+
- set_all_with v:V <-
- (
+ (
(first_link != NULL).if {
first_link.set_all_with v;
- };
+ };
);
-
+
- copy other:SELF <-
(
from_collection other;
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
( + result:BOOLEAN;
+ lnk1, lnk2:LINKED_LIST_NODE(V);
-
+
(Self = other).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -204,15 +204,15 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- is_equal_map other:SELF :BOOLEAN <-
( + result:BOOLEAN;
- + lnk1, lnk2:LINKED_LIST_NODE(V);
+ + lnk1, lnk2:LINKED_LIST_NODE(V);
+ safe_equal:SAFE_EQUAL(V);
-
+
( Self = other).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -224,24 +224,24 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- index_of element:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
//+ safe_equal:SAFE_EQUAL(V);
-
+
result := start_index;
//{(result > upper) || {safe_equal.test x with (item result)}}.until_do {
{(result > upper) || {element == item result}}.until_do {
result := result + 1;
- };
+ };
result
);
- reverse_index_of element:V start start_index:INTEGER :INTEGER <-
- ( + safe_equal: SAFE_EQUAL(V);
+ ( + safe_equal: SAFE_EQUAL(V);
+ temporary_idx, new_mem_idx:INTEGER;
+ temporary_lnk, new_mem_lnk:LINKED_LIST_NODE(V);
+ result:INTEGER;
@@ -265,11 +265,11 @@ Section Public
};
result
);
-
+
- fast_index_of element:V start start_index:INTEGER :INTEGER <-
( + u:INTEGER;
+ result:INTEGER;
-
+
result := start_index;
u := upper;
{(result > u) || {element = item result}}.until_do {
@@ -277,9 +277,9 @@ Section Public
};
result
);
-
+
- fast_reverse_index_of element:V start start_index:INTEGER :INTEGER <-
- ( + safe_equal: SAFE_EQUAL(V);
+ ( + safe_equal: SAFE_EQUAL(V);
+ temporary_idx, new_mem_idx:INTEGER;
+ temporary_lnk, new_mem_lnk:LINKED_LIST_NODE(V);
+ result:INTEGER;
@@ -303,7 +303,7 @@ Section Public
};
result
);
-
+
- clear <-
(
(first_link != NULL).if {
@@ -315,12 +315,12 @@ Section Public
};
)
[ ...
- +? {upper = 0};
+ +? {upper = 0};
];
-
+
- from_collection model:COLLECTION(V) <-
( + lnk:LINKED_LIST_NODE(V);
-
+
(first_link = NULL).if {
(model.lower).to (model.upper) do { i:INTEGER;
add_last (model.item i);
@@ -336,7 +336,7 @@ Section Public
};
};
(lnk = first_link).if {
- ? { model.count = 0 };
+ ? { model.count = 0 };
clear;
}.elseif { lnk != NULL } then {
+ i:INTEGER;
@@ -344,19 +344,19 @@ Section Public
(mem_idx != i).if {
go_item i;
};
- ? { lnk = mem_lnk.next };
+ ? { lnk = mem_lnk.next };
mem_lnk.set_next NULL;
upper := i;
last_link := mem_lnk;
};
- };
+ };
);
-
+
- slice low:INTEGER to up:INTEGER :SELF <-
( + result:SELF;
+ lnk:LINKED_LIST_NODE(V);
-
- result := SELF.create;
+
+ result := SELF.create;
(mem_idx != low).if {
go_item low;
};
@@ -365,29 +365,29 @@ Section Public
result.add_last (lnk.item);
lnk := lnk.next;
};
-
+
result
);
-
+
- occurrences element:V :INTEGER <-
( + lnk:LINKED_LIST_NODE(V);
+ result:INTEGER;
+ safe_equal:SAFE_EQUAL(V);
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(safe_equal.test element with (lnk.item)).if {
result := result + 1;
};
lnk := lnk.next;
- };
+ };
result
);
-
+
- fast_occurrences element:V :INTEGER <-
( + lnk:LINKED_LIST_NODE(V);
+ result:INTEGER;
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(element = lnk.item).if {
@@ -397,21 +397,21 @@ Section Public
};
result
);
-
+
- force element:V to index:INTEGER <-
( + v:V;
-
+
{index <= upper}.until_do {
add_last v;
};
put element to index;
);
-
+
- all_default:BOOLEAN <-
( + result:BOOLEAN;
+ l:LINKED_LIST_NODE(V);
+ d:V;
-
+
result := TRUE;
l := first_link;
{(! result) || {l = NULL}}.until_do {
@@ -421,12 +421,12 @@ Section Public
};
l := l.next;
};
-
+
result
);
-
+
- remove_last <-
- (
+ (
(upper = 1).if {
first_link := NULL;
last_link := NULL;
@@ -440,21 +440,21 @@ Section Public
upper := upper - 1;
last_link := mem_lnk;
last_link.set_next NULL;
- };
+ };
);
-
+
- replace_all old_value:V with new_value:V <-
( + safe_equal:SAFE_EQUAL(V);
-
+
lower.to upper do { i:INTEGER;
(safe_equal.test (item i) with old_value).if {
put new_value to i;
};
- };
+ };
);
-
+
- fast_replace_all old_value:V with new_value:V <-
- (
+ (
lower.to upper do { i:INTEGER;
(item i = old_value).if {
put new_value to i;
@@ -464,8 +464,8 @@ Section Public
- reverse <-
( + prev, lnk, next:LINKED_LIST_NODE(V);
-
- lnk := first_link;
+
+ lnk := first_link;
{lnk = NULL}.until_do {
next := lnk.next;
lnk.set_next prev;
@@ -478,17 +478,17 @@ Section Public
mem_idx := count - mem_idx + 1;
};
);
-
+
Section Private
-
+
- go_item i:INTEGER <-
- [
+ [
-? { valid_index i};
-? { mem_idx != i};
-? { mem_idx > 0};
-? { mem_lnk != NULL};
- ]
- (
+ ]
+ (
(mem_idx > i).if {
mem_idx := 1;
mem_lnk := first_link;
@@ -502,15 +502,15 @@ Section Private
+? {mem_idx = i};
+? {mem_lnk != NULL};
];
-
+
//
// Invariant
//
-
+
// [ ...
-// "Empty status." -? {(first_link = NULL) ->>
+// "Empty status." -? {(first_link = NULL) ->>
// {(last_link = NULL) & (upper = 0) & (mem_idx = 0) & (mem_lnk = NULL)}};
-// "Not empty status." -? {(first_link != NULL) ->>
-// {(last_link != NULL) & (upper > 0) & (mem_idx > 0) & (mem_lnk != NULL)}};
+// "Not empty status." -? {(first_link != NULL) ->>
+// {(last_link != NULL) & (upper > 0) & (mem_idx > 0) & (mem_lnk != NULL)}};
// ];
diff --git a/lib/standard/collection/linked_xor_list.li b/lib/standard/collection/linked_xor_list.li
index 6651a5c..204151c 100644
--- a/lib/standard/collection/linked_xor_list.li
+++ b/lib/standard/collection/linked_xor_list.li
@@ -19,55 +19,55 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LINKED_XOR_LIST(V);
- copyright := "2003-2007 Benoit Sonntag";
-
+
- comment := "One Xor way linked list with internal automatic memorization \
\of the last access .";
-
+
Section Inherit
-
+
+ parent_linked_collection:Expanded LINKED_COLLECTION(V);
-
+
Section LINKED2_LIST
-
+
+ first_link:LINKED_XOR_NODE(V);
// NULL when empty or gives access to the first element.
-
+
+ last_link:LINKED_XOR_NODE(V);
// NULL when empty or gives access to the last element.
-
- + mem_idx:INTEGER;
-
+
+ + mem_idx:INTEGER;
+
+ mem_lnk:LINKED_XOR_NODE(V);
+ mem_lnk_prev:LINKED_XOR_NODE(V);
- + mem_lnk_next:LINKED_XOR_NODE(V);
+ + mem_lnk_next:LINKED_XOR_NODE(V);
// To speed up accessing, `mem_idx' and `mem_lnk' is the
// memory of the last access done. For example, after
// item(1), `mem_idx' is 1 and `mem_lnk' is `first_link'.
// When list is empty, `first_link' is NULL as well as
// `mem_lnk' and `mem_idx' is 0;
-
+
Section Public
-
+
- create:SELF <-
// Make an empty list;
- (
+ (
SELF.clone
);
-
+
- is_empty:BOOLEAN <- first_link = NULL;
-
+
- add_first element:V <-
( + new:LINKED_XOR_NODE(V);
(first_link = NULL).if {
first_link := LINKED_XOR_NODE(V).create element previous NULL next NULL;
last_link := first_link;
upper := mem_idx := 1;
- mem_lnk := first_link;
+ mem_lnk := first_link;
} else {
new := LINKED_XOR_NODE(V).create element previous NULL next first_link;
first_link.set_link new and (first_link.next NULL);
@@ -82,7 +82,7 @@ Section Public
[ ...
+? { upper = 1 + Old upper };
];
-
+
- add_last element:V <-
( + new:LINKED_XOR_NODE(V);
(first_link = NULL).if {
@@ -101,10 +101,10 @@ Section Public
upper := upper + 1;
};
);
-
+
- add element:V to index:INTEGER <-
( + link:LINKED_XOR_NODE(V);
-
+
(index = 1).if {
add_first element;
}.elseif {index = upper + 1} then {
@@ -118,18 +118,18 @@ Section Public
mem_lnk.set_link mem_lnk_prev and link;
mem_lnk_next := link;
upper := upper + 1;
- };
+ };
);
-
+
- remove_first <-
( + next,next_next:LINKED_XOR_NODE;
(upper = 1).if {
- first_link := NULL;
+ first_link := NULL;
last_link := NULL;
mem_lnk := mem_lnk_prev := mem_lnk_next := NULL;
mem_idx := 0;
upper := 0;
- } else {
+ } else {
next := first_link.next NULL;
next_next := next.next first_link;
next.set_link NULL and next_next;
@@ -144,13 +144,13 @@ Section Public
mem_lnk := first_link;
mem_lnk_next := next_next;
mem_idx := 1;
- };
+ };
};
);
-
+
- remove index:INTEGER <-
( + next_next:LINKED_XOR_NODE(V);
-
+
(index = 1).if {
remove_first;
}.elseif { index = upper} then {
@@ -167,11 +167,11 @@ Section Public
upper := upper - 1;
};
);
-
+
- first:V <- first_link.item;
-
+
- last:V <- last_link.item;
-
+
- item index:INTEGER :V <-
(
(index != mem_idx).if {
@@ -179,39 +179,39 @@ Section Public
};
mem_lnk.item
);
-
+
- put element:V to index:INTEGER <-
- (
+ (
(index != mem_idx).if {
go_item index;
};
- mem_lnk.set_item element;
+ mem_lnk.set_item element;
);
-
+
- count:INTEGER <- upper;
-
+
- set_all_with v:V <-
- (
+ (
not_yet_implemented;
-
+
(first_link != NULL).if {
first_link.set_all_with v;
- };
+ };
);
-
+
- copy other:SELF <-
(
not_yet_implemented;
-
+
from_collection other;
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
( + result:BOOLEAN;
+ lnk1, lnk2:LINKED_XOR_NODE(V);
-
+
not_yet_implemented;
-
+
(Self = other).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -223,17 +223,17 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- is_equal_map other:SELF :BOOLEAN <-
( + result:BOOLEAN;
+ lnk1, lnk2:LINKED_XOR_NODE(V);
+ safe_equal:SAFE_EQUAL(V);
-
+
not_yet_implemented;
-
+
( Self = other ).if {
result := TRUE;
}.elseif {upper = other.upper} then {
@@ -245,31 +245,31 @@ Section Public
lnk1 := lnk1.next;
lnk2 := lnk2.next;
};
- };
+ };
result
);
-
+
- index_of x:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
+ safe_equal:SAFE_EQUAL(V);
-
+
not_yet_implemented;
-
+
result := start_index;
{(result > upper) || {safe_equal.test x with (item result)}}.until_do {
result := result + 1;
- };
+ };
result
);
-
+
- reverse_index_of element:V start start_index:INTEGER :INTEGER <-
- ( + safe_equal:SAFE_EQUAL(V);
+ ( + safe_equal:SAFE_EQUAL(V);
+ temporary_idx:INTEGER;
+ temporary_lnk:LINKED_XOR_NODE(V);
+ result:INTEGER;
-
+
not_yet_implemented;
-
+
(start_index != mem_idx).if {
go_item start_index;
};
@@ -290,29 +290,29 @@ Section Public
- fast_index_of x:V start start_index:INTEGER :INTEGER <-
( + result:INTEGER;
+ u:INTEGER;
-
+
not_yet_implemented;
-
+
result := lower;
u := upper;
{(result > u) || {x = item result}}.until_do {
result := result + 1;
};
result
- );
+ );
- fast_reverse_index_of element:V start start_index:INTEGER :INTEGER <-
( + temporary_idx:INTEGER;
+ temporary_lnk:LINKED_XOR_NODE(V);
+ result:INTEGER;
-
+
not_yet_implemented;
-
+
(start_index != mem_idx).if {
go_item start_index;
};
temporary_idx := mem_idx;
- temporary_lnk := mem_lnk;
+ temporary_lnk := mem_lnk;
{(temporary_idx < lower) || {element = temporary_lnk.item}}.until_do {
temporary_idx := temporary_idx - 1;
temporary_lnk := temporary_lnk.previous;
@@ -323,12 +323,12 @@ Section Public
mem_lnk := temporary_lnk;
};
);
-
+
- clear <-
(
-
+
not_yet_implemented;
-
+
(first_link != NULL).if {
first_link := NULL;
mem_idx := 0;
@@ -340,12 +340,12 @@ Section Public
[ ...
+? {upper = 0};
];
-
+
- from_collection model:COLLECTION(V) <-
( + lnk:LINKED_XOR_NODE(V);
-
+
not_yet_implemented;
-
+
(first_link = NULL).if {
(model.lower).to (model.upper) do { i:INTEGER;
add_last (model.item i);
@@ -374,16 +374,16 @@ Section Public
upper := i;
last_link := mem_lnk;
};
- };
+ };
);
-
+
- slice low:INTEGER to up:INTEGER :SELF <-
( + lnk:LINKED_XOR_NODE(V);
+ result:SELF;
-
+
not_yet_implemented;
-
- result := SELF.create;
+
+ result := SELF.create;
(mem_idx != low).if {
go_item low;
};
@@ -394,30 +394,30 @@ Section Public
};
result
);
-
+
- occurrences element:V :INTEGER <-
( + lnk:LINKED_XOR_NODE(V);
+ safe_equal:SAFE_EQUAL(V);
+ result:INTEGER;
-
+
not_yet_implemented;
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(safe_equal.test element with (lnk.item)).if {
result := result + 1;
};
lnk := lnk.next;
- };
+ };
result
);
-
+
- fast_occurrences element:V :INTEGER <-
( + lnk:LINKED_XOR_NODE(V);
+ result:INTEGER;
-
+
not_yet_implemented;
-
+
lnk := first_link;
{lnk = NULL}.until_do {
(element = lnk.item).if {
@@ -427,25 +427,25 @@ Section Public
};
result
);
-
+
- force element:V to index:INTEGER <-
( + v:V;
-
+
not_yet_implemented;
-
+
{index <= upper}.until_do {
add_last v;
};
put element to index;
);
-
+
- all_default:BOOLEAN <-
( + l:LINKED_XOR_NODE(V);
+ d:V;
+ result:BOOLEAN;
-
+
not_yet_implemented;
-
+
result := TRUE;
l := first_link;
{(! result) || {l = NULL}}.until_do {
@@ -454,12 +454,12 @@ Section Public
result := d.is_default;
};
l := l.next;
- };
+ };
result
);
-
+
- remove_last <-
- (
+ (
(upper = 1).if {
first_link := NULL;
last_link := NULL;
@@ -469,7 +469,7 @@ Section Public
} else {
link := last_link.previous NULL;
link.set_link (link.previous last_link) and NULL;
- last_link := link;
+ last_link := link;
(mem_idx = upper).if {
mem_idx := 1;
mem_lnk := first_link;
@@ -477,44 +477,44 @@ Section Public
mem_lnk_next := mem_lnk.next NULL;
};
upper := upper - 1;
- };
+ };
);
-
+
- replace_all old_value:V with new_value:V <-
( + safe_equal:SAFE_EQUAL(V);
-
+
not_yet_implemented;
-
+
lower.to upper do { i:INTEGER;
(safe_equal.test (item i) with old_value).if {
put new_value to i;
};
- };
+ };
);
-
+
- fast_replace_all old_value:V with new_value:V <-
- (
-
+ (
+
not_yet_implemented;
-
+
lower.to upper do { i:INTEGER;
(item i = old_value).if {
put new_value to i;
};
- };
+ };
);
-
+
- reverse <-
- ( + temp:V;
- + low:LINKED_XOR_NODE(V);
+ ( + temp:V;
+ + low:LINKED_XOR_NODE(V);
+ high:LINKED_XOR_NODE(V);
+ i:INTEGER;
-
+
not_yet_implemented;
-
+
low := first_link;
high := last_link;
-
+
i := count / 2;
? {(i > 0) -> ((low != NULL) & (high != NULL))};
? {(i > 0) -> ((low != high) & (low.previous != high))};
@@ -525,11 +525,11 @@ Section Public
low := low.next;
high := high.previous;
i := i - 1;
- };
+ };
);
-
+
Section Private
-
+
- go_item index:INTEGER <-
[ ...
-? { valid_index index };
@@ -562,7 +562,7 @@ Section Private
{index = mem_idx}.until_do {
mem_lnk_next := mem_lnk;
mem_lnk := mem_lnk_prev;
- mem_lnk_prev := mem_lnk.previous mem_lnk_next;
+ mem_lnk_prev := mem_lnk.previous mem_lnk_next;
mem_idx := mem_idx - 1;
};
} else {
@@ -573,7 +573,7 @@ Section Private
{index = mem_idx}.until_do {
mem_lnk_prev := mem_lnk;
mem_lnk := mem_lnk_next;
- mem_lnk_next := mem_lnk.next mem_lnk_prev;
+ mem_lnk_next := mem_lnk.next mem_lnk_prev;
mem_idx := mem_idx + 1;
};
};
@@ -582,15 +582,15 @@ Section Private
+? { mem_idx = index };
+? { mem_lnk != NULL };
];
-
+
//
// Invariant.
//
-
+
// [ ...
// "Empty status." -? {(first_link = NULL) ->
// ((last_link = NULL) & (upper = 0) & (mem_idx = 0) & (mem_lnk = NULL))};
-
+
// "Not empty status." -? {(first_link != NULL) ->
// ((last_link != NULL) & (upper > 0) & (mem_idx > 0) & (mem_lnk != NULL))};
// ];
diff --git a/lib/standard/file_system/directory.li b/lib/standard/file_system/directory.li
index e715a6b..fbf80fa 100644
--- a/lib/standard/file_system/directory.li
+++ b/lib/standard/file_system/directory.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := DIRECTORY;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Basic Directory management";
-
+
Section Inherit
-
+
- parent_entry:ENTRY := ENTRY;
-
+
Section DIRECTORY
-
+
+ list:LINKED_LIST(ENTRY);
- - alias:HASHED_DICTIONARY(ENTRY,ABSTRACT_STRING) :=
+ - alias:HASHED_DICTIONARY(ENTRY,ABSTRACT_STRING) :=
HASHED_DICTIONARY(ENTRY,ABSTRACT_STRING).create;
-
+
Section Public
-
+
//
// Manager.
//
-
+
- remove_me <- remove_path ".";
-
+
- remove p:ABSTRACT_STRING :BOOLEAN <-
// Remove file or directory (WARNING: delete recursive)
( + dir:DIRECTORY;
+ i:INTEGER;
+ result:BOOLEAN;
+ e:ENTRY;
-
+
e := get_entry p;
(e != NULL).if {
(e.is_directory).if {
dir ?= e;
result := dir.open;
(result).if {
- i := dir.lower;
+ i := dir.lower;
{(i > dir.upper) || {! result}}.until_do {
result := remove (dir.item i.path);
i := i + 1;
- };
+ };
result.if {
result := physical_remove (e.path);
};
@@ -73,25 +73,25 @@ Section Public
};
(result).if {
// Remove Alias.
- alias.remove (e.path);
+ alias.remove (e.path);
};
};
result
);
-
+
- move old_path:ABSTRACT_STRING to new_path:ABSTRACT_STRING :BOOLEAN <-
( + result:BOOLEAN;
+ e:ENTRY;
-
+
"WARNING : Et les alias des sous répertoires, fichiers, ...\n".print;
-
+
string_tmp.copy path;
string_tmp.add_last '/';
- string_tmp.append old_path;
+ string_tmp.append old_path;
reduce_path string_tmp;
string_tmp2.copy path;
string_tmp2.add_last '/';
- string_tmp2.append new_path;
+ string_tmp2.append new_path;
reduce_path string_tmp2;
e := alias.reference_at string_tmp;
((result := physical_move string_tmp to string_tmp2) && {e != NULL}).if {
@@ -101,41 +101,41 @@ Section Public
};
result
);
-
- - get_entry p:ABSTRACT_STRING :ENTRY <-
+
+ - get_entry p:ABSTRACT_STRING :ENTRY <-
( + result:ENTRY;
+ idx:INTEGER;
string_tmp2.copy path;
string_tmp2.add_last '/';
string_tmp2.append p;
reduce_path string_tmp2;
- string_tmp3.copy string_tmp2;
+ string_tmp3.copy string_tmp2;
{
result := alias.reference_at string_tmp2; // with { (e1,e2:ABSTRACT_STRING); e1 ~= e2 };
(result = NULL).if {
- idx := string_tmp2.fast_last_index_of '/';
+ idx := string_tmp2.fast_last_index_of '/';
(idx > 0).if {
string_tmp2.keep_head (idx-1);
} else {
string_tmp2.clear;
};
};
- }.do_while {(result = NULL) && {! string_tmp2.is_empty}};
+ }.do_while {(result = NULL) && {! string_tmp2.is_empty}};
(result = NULL).if {
result := FILE_SYSTEM.physical_get_entry string_tmp3;
}.elseif {string_tmp3.count != string_tmp2.count} then {
+ dir:DIRECTORY;
- dir ?= result;
- result := dir.physical_get_entry string_tmp3;
+ dir ?= result;
+ result := dir.physical_get_entry string_tmp3;
};
result
- );
-
+ );
+
//
// Indexing.
//
-
+
- open:BOOLEAN <-
(
deferred;
@@ -143,105 +143,105 @@ Section Public
[
+? {list != NULL};
];
-
+
- is_open:BOOLEAN <- list != NULL;
-
+
- lower:INTEGER := 1;
// Minimum index.
-
- - upper:INTEGER <-
+
+ - upper:INTEGER <-
[
{is_open} -? "Directory not open.";
]
(
list.upper
- );
-
+ );
+
// Maximum index.
-
- - valid_index index:INTEGER :BOOLEAN <-
+
+ - valid_index index:INTEGER :BOOLEAN <-
// True when `index' is valid (ie. inside actual
// bounds of the collection).
[
{is_open} -? "Directory not open.";
]
- (
- index.in_range lower to upper
+ (
+ index.in_range lower to upper
)
[
+? {Result = index.in_range lower to upper};
+? {list.count = Old list.count};
];
-
+
//
// Counting.
//
-
+
- count:INTEGER <- (upper - lower + 1);
// Number of available indices.
-
+
- is_empty:BOOLEAN <- count = 0;
// Is collection empty ?
-
+
//
// Accessing.
//
-
+
- item i:INTEGER :ENTRY <-
- // Item at the corresponding index `i'.
+ // Item at the corresponding index `i'.
[
-? {valid_index i};
{is_open} -? "Directory not open.";
]
- (
+ (
list.item i
- );
-
- - first:ENTRY <-
- // The very `first' item.
+ );
+
+ - first:ENTRY <-
+ // The very `first' item.
[
{is_open} -? "Directory not open.";
-? {! is_empty};
]
- (
+ (
item lower
);
-
-
+
+
- last:ENTRY <-
// The `last' item.
[
{is_open} -? "Directory not open.";
-? {! is_empty};
]
- (
+ (
item upper
);
-
+
- parent:ENTRY <-
(
get_entry ".."
);
-
+
//
// Writing:
//
-
+
- make_directory p:ABSTRACT_STRING :DIRECTORY <-
- ( + result:DIRECTORY;
+ ( + result:DIRECTORY;
string_tmp.copy path;
string_tmp.add_last '/';
- string_tmp.append p;
- reduce_path string_tmp;
+ string_tmp.append p;
+ reduce_path string_tmp;
(physical_make_directory string_tmp).if {
- result ?= get_entry string_tmp;
+ result ?= get_entry string_tmp;
? {result != NULL};
};
result
);
-
+
- make_file p:ABSTRACT_STRING :FILE <-
- ( + result:FILE;
+ ( + result:FILE;
string_tmp.copy path;
string_tmp.add_last '/';
string_tmp.append p;
@@ -252,20 +252,20 @@ Section Public
};
result
);
-
+
- create_file p:ABSTRACT_STRING :FILE <-
(
make_file p
);
-
+
//
// Display.
//
-
+
- print <-
- (
- lower.to upper do { j:INTEGER;
- string_tmp.copy (item j.path);
+ (
+ lower.to upper do { j:INTEGER;
+ string_tmp.copy (item j.path);
(item j.is_directory).if {
string_tmp.append " D ";
} else {
@@ -275,49 +275,49 @@ Section Public
string_tmp.add_last ' ';
};
string_tmp.print;
- };
+ };
'\n'.print;
);
-
+
Section DIRECTORY
-
+
//
// Physical implementation.
//
- physical_get_entry new_path:ABSTRACT_STRING :ENTRY <-
( + result:ENTRY;
-
- ((! is_open) && {open}).if {
+
+ ((! is_open) && {open}).if {
result := get_entry new_path;
};
result
);
-
+
- physical_make_directory new_path:ABSTRACT_STRING :BOOLEAN <-
- (
+ (
deferred;
FALSE
);
- physical_make_file new_path:ABSTRACT_STRING :BOOLEAN <-
- (
+ (
deferred;
FALSE
);
- physical_remove p:ABSTRACT_STRING :BOOLEAN <-
- (
+ (
deferred;
FALSE
);
-
+
- physical_move old_path:ABSTRACT_STRING to new_path:ABSTRACT_STRING :BOOLEAN <-
- (
+ (
deferred;
FALSE
);
-
+
Section Private
-
+
- string_tmp3:STRING := STRING.create 255;
diff --git a/lib/standard/file_system/entry.li b/lib/standard/file_system/entry.li
index 51020f3..e1049f4 100644
--- a/lib/standard/file_system/entry.li
+++ b/lib/standard/file_system/entry.li
@@ -19,102 +19,102 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ENTRY;
- copyright := "2003-2007 Benoit Sonntag, Jerome Hilbert";
-
+
- comment := "Abstract Entry.";
-
-Section Inherit
-
+
+Section Inherit
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
//
// Path.
//
-
+
+ path:STRING_CONSTANT;
-
- + name:STRING_CONSTANT;
-
+
+ + name:STRING_CONSTANT;
+
- dirname:STRING <-
( + result:STRING;
-
+
result := STRING.create (path.count);
get_parent_path path in result;
result
);
-
+
//
// Date / Time.
//
-
+
- access:UINTEGER_16 <- ( deferred; 0);
-
+
- access_time:TIME <- ( deferred; TIME);
- access_date:DATE <- ( deferred; DATE);
-
+
- update_time:TIME <- ( deferred; TIME);
- update_date:DATE <- ( deferred; DATE);
-
+
- create_time:TIME <- ( deferred; TIME);
- create_date:DATE <- ( deferred; DATE);
-
+
//
// type.
//
-
+
- is_directory:BOOLEAN <-
( + dir:DIRECTORY;
+ e:ENTRY;
-
+
e := Self; // Bug Compilo
dir ?= e;
dir != NULL
);
-
+
- is_file:BOOLEAN <- ! is_directory;
-
+
//
// Open / Close
//
-
+
- open:BOOLEAN <-
// Return FILE or DIRECTORY, NULL:error.
- (
+ (
deferred;
- );
-
- - is_open:BOOLEAN <-
+ );
+
+ - is_open:BOOLEAN <-
(
deferred;
FALSE
);
-
+
Section ENTRY
-
+
- string_tmp:STRING := STRING.create 255;
-
+
- string_tmp2:STRING := STRING.create 255;
-
+
- set_path n:ABSTRACT_STRING <-
( + idx:INTEGER;
path := STRING_CONSTANT.create_copy n;
- idx := path.last_index_of '/';
+ idx := path.last_index_of '/';
(name = NULL).if {
name := STRING_CONSTANT.clone;
};
- name.set_storage (path.storage + idx) count (path.count - idx);
+ name.set_storage (path.storage + idx) count (path.count - idx);
);
-
+
- reduce_path st:STRING <-
( + i:INTEGER;
+ stat:INTEGER;
+ car:CHARACTER;
-
+
st.replace_all '\\' with '/';
i := st.lower;
@@ -138,7 +138,7 @@ Section ENTRY
i := i - 2;
stat := 1;
}.when 3 then {
- // toto/foo/../bar => toto/bar
+ // toto/foo/../bar => toto/bar
// ^ ^
+ idx:INTEGER;
idx := st.last_index_of '/' since (i-4);
@@ -167,18 +167,18 @@ Section ENTRY
// foo/...bar => foo/...bar
stat := 0;
};
- }.elseif {(car = ':') && {i > 2} &&
+ }.elseif {(car = ':') && {i > 2} &&
{st.item (i-1).is_letter} && {st.item (i-2) = '/'}
} then {
st.remove_first (i-2);
- i := st.lower;
+ i := st.lower;
} else {
// Other character.
stat := 0;
};
i := i + 1;
};
-
+
stat.when 0 then {
// foo/bar => foo/bar
// ^ ^
@@ -189,9 +189,9 @@ Section ENTRY
}.when 2 then {
// foo/. => foo
// ^ ^
- st.remove_last 2;
+ st.remove_last 2;
}.when 3 then {
- // toto/foo/.. => toto
+ // toto/foo/.. => toto
// ^ ^
+ idx:INTEGER;
idx := st.last_index_of '/' since (i-4);
@@ -201,7 +201,7 @@ Section ENTRY
st.remove_between idx to (i-1);
};
};
-
+
(st.is_empty).if {
st.add_last '/';
};
@@ -210,13 +210,13 @@ Section ENTRY
//
// Alias Entry.
//
-
+
- get_parent_path p:ABSTRACT_STRING in tmp:STRING <-
- [
+ [
-? {p.last != '/'};
]
( + i:INTEGER;
-
+
(tmp != p).if {
tmp.copy p;
};
@@ -225,7 +225,7 @@ Section ENTRY
tmp.copy "../";
} else {
tmp.keep_head (i-1);
- (tmp.is_empty).if {
+ (tmp.is_empty).if {
tmp.add_last '/';
};
};
diff --git a/lib/standard/file_system/file.li b/lib/standard/file_system/file.li
index 62d2e04..356ccf4 100644
--- a/lib/standard/file_system/file.li
+++ b/lib/standard/file_system/file.li
@@ -19,55 +19,55 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FILE;
- copyright := "2003-2007 Benoit Sonntag, Jerome Hilbert";
-
+
- comment := "Abstract File Management";
-
+
Section Inherit
-
- - parent_entry:ENTRY := ENTRY;
-
+
+ - parent_entry:ENTRY := ENTRY;
+
Section Public
-
+
- cursor:UINTEGER_32 <-
[
-? {is_open};
]
- (
+ (
deferred;
0
);
-
+
- size:UINTEGER_32 <-
- (
+ (
deferred;
0
);
-
+
- set_cursor n:UINTEGER_32 <-
[
-? {is_open};
-? {n <= size};
]
(
- deferred;
+ deferred;
);
-
+
//
// Update.
//
-
+
- is_empty:BOOLEAN <- size = 0;
// Is collection empty ?
-
+
//
// Read.
//
-
- - read dest:OBJECT :INTEGER <-
+
+ - read dest:OBJECT :INTEGER <-
// WARNING: It's good for Mapping objects, else serializable is necessary.
[
-? {is_open};
@@ -75,8 +75,8 @@ Section Public
( + buf:NATIVE_ARRAY(UINTEGER_8);
buf := CONVERT(OBJECT,NATIVE_ARRAY(UINTEGER_8)).on dest;
physical_read buf size (dest.object_size)
- );
-
+ );
+
- read dest:ARRAYED size nb_elt:INTEGER :INTEGER <-
[
-? {is_open};
@@ -85,22 +85,22 @@ Section Public
+ index,s:INTEGER;
+ result:INTEGER;
+ new_count:INTEGER;
-
+
new_count := dest.count + nb_elt;
dest.set_capacity new_count;
buf := dest.to_native_array_uinteger_8;
index := dest.count * dest.element_sizeof;
- s := nb_elt * dest.element_sizeof;
+ s := nb_elt * dest.element_sizeof;
result := physical_read (buf+index) size s;
dest.set_count new_count;
? {result % dest.element_sizeof = 0};
result / dest.element_sizeof
);
-
+
//
// Write.
//
-
+
- write src:ARRAYED from start:INTEGER size nb_elt:INTEGER :INTEGER <-
[
-? {is_open};
@@ -108,7 +108,7 @@ Section Public
( + buf:NATIVE_ARRAY(UINTEGER_8);
+ index,s:INTEGER;
+ result:INTEGER;
-
+
buf := src.to_native_array_uinteger_8;
index := (start-src.lower) * src.element_sizeof;
s := nb_elt * src.element_sizeof;
@@ -116,36 +116,36 @@ Section Public
? {result % src.element_sizeof = 0};
result / src.element_sizeof
);
-
+
- write src:ARRAYED size nb_elt:INTEGER :INTEGER <-
(
write src from (src.lower) size nb_elt
);
-
+
- write src:ARRAYED :INTEGER <-
(
write src size (src.count)
);
-
+
//
// Close.
//
-
+
- close <-
- (
+ (
deferred;
)
[
+? {! is_open};
];
-
+
- open_read_only:BOOLEAN <-
(
deferred;
);
-
+
Section FILE
-
+
- physical_read buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
[
-? {is_open};
@@ -157,19 +157,19 @@ Section FILE
[
+? { (cursor = Old cursor + s ) || {cursor = size} };
];
-
+
- physical_write buf:NATIVE_ARRAY(UINTEGER_8) size s:INTEGER :INTEGER <-
[
-? {is_open};
]
- (
+ (
deferred;
0
)
[
+? {cursor = Old cursor + s};
];
-
-
-
-
+
+
+
+
diff --git a/lib/standard/io/io.li b/lib/standard/io/io.li
index 181235d..431658a 100644
--- a/lib/standard/io/io.li
+++ b/lib/standard/io/io.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := IO;
@@ -28,7 +28,7 @@ Section Header
- comment := "Standard Input Output.";
Section Inherit
-
+
- inherit_std_input:STD_INPUT := STD_INPUT;
-
+
- inherit_std_output:STD_OUTPUT := STD_OUTPUT;
diff --git a/lib/standard/io/std_error.li b/lib/standard/io/std_error.li
index 3fde7a2..dfacdda 100644
--- a/lib/standard/io/std_error.li
+++ b/lib/standard/io/std_error.li
@@ -19,25 +19,25 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := STD_ERROR;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
- - comment := " To write on the standard error output. As for UNIX, the default\
+
+ - comment := " To write on the standard error output. As for UNIX, the default\
\ standard error file is the screen. \
\Note: only one instance of this class should be necessary (have a look\
\in the root classes to search for the good name to use).";
-
+
Section Inherit
-
+
- inherit_output_stream:OUTPUT_STREAM := OUTPUT_STREAM;
-
+
Section Public
- is_connected:BOOLEAN := TRUE;
-
+
- make <-
(
);
diff --git a/lib/standard/io/std_input.li b/lib/standard/io/std_input.li
index ef7aa54..408fb2b 100644
--- a/lib/standard/io/std_input.li
+++ b/lib/standard/io/std_input.li
@@ -19,27 +19,27 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := STD_INPUT;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :=" To use the standard input file. As for UNIX, the default standard input is the keyboard.";
-
+
Section Inherit
-
+
- inherit_input_stream:INPUT_STREAM := INPUT_STREAM;
-
+
Section Private
- memory:CHARACTER;
// Memory of the last available user's value.
Section Public
-
+
- is_connected:BOOLEAN := TRUE;
-
+
- read_character :CHARACTER <-
// Read character from stdin
(
@@ -50,21 +50,21 @@ Section Public
};
last_character
);
-
-
+
+
- unread_character <-
(
push_back_flag := TRUE;
);
-
-
+
+
- last_character:CHARACTER <-
// Return last character from stdin
(
memory
);
-
-
+
+
- end_of_input:BOOLEAN <-
// Return TRUE if end of input
(
@@ -74,7 +74,7 @@ Section Public
};
result
);
-
+
- read_line_in buffer:STRING <-
// Real all character until \n (so read a line)
(
@@ -83,7 +83,7 @@ Section Public
( (last_character != '\n') && { memory != basic_io_eof } ).if {
buffer.extend memory;
mem := basic_io_getc;
-
+
{ (mem = basic_io_eof) || {mem = '\n'} }.until_do {
buffer.extend mem;
mem := basic_io_getc;
@@ -91,6 +91,6 @@ Section Public
memory := mem;
};
);
-
+
diff --git a/lib/standard/io/std_output.li b/lib/standard/io/std_output.li
index fa0c5b5..85af284 100644
--- a/lib/standard/io/std_output.li
+++ b/lib/standard/io/std_output.li
@@ -19,27 +19,27 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=STD_OUTPUT;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="Standard Output (UNIX Operating System).";
-
+
Section Inherit
-
+
- inherit_output_stream:OUTPUT_STREAM := OUTPUT_STREAM;
-
+
Section Public
-
+
- is_connected:BOOLEAN := TRUE;
-
+
- put_character c:CHARACTER <- basic_io_putc c;
// Put `c' on stdout
-
+
diff --git a/lib/standard/kernel/convert.li b/lib/standard/kernel/convert.li
index 4bf64f1..deb361b 100644
--- a/lib/standard/kernel/convert.li
+++ b/lib/standard/kernel/convert.li
@@ -19,16 +19,15 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CONVERT(S,D);
- copyright := "2003-2007 Benoit Sonntag";
-
+
- comment := "Don't use this prototype !";
Section Public
-
+
- on src:S :D <- `13`;
-
-
\ No newline at end of file
+
diff --git a/lib/standard/kernel/i_dont_know_prototyping.li b/lib/standard/kernel/i_dont_know_prototyping.li
index d95a0f6..350d1d5 100644
--- a/lib/standard/kernel/i_dont_know_prototyping.li
+++ b/lib/standard/kernel/i_dont_know_prototyping.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := I_DONT_KNOW_PROTOTYPING;
@@ -28,11 +28,11 @@ Section Header
- comment := "Facility, but it's not in prototype spirit.";
Section Public
-
+
//
// Conditional.
//
-
+
- if cond:BOOLEAN then true_block:{} :BOOLEAN <-
(
cond.if true_block
@@ -42,32 +42,32 @@ Section Public
(
cond.if true_block else false_block;
);
-
+
//
// Loop.
//
-
+
- while cond:{} do body:{} <-
(
cond.while_do body;
);
-
+
- do body:{} while cond:{} <-
(
body.do_while cond;
);
-
+
- repeat body:{} until cond:{} <-
(
body.do_until cond;
);
-
+
//
// Print.
//
-
+
- printf str:ABSTRACT_STRING <-
(
str.print;
);
-
+
diff --git a/lib/standard/kernel/object.li b/lib/standard/kernel/object.li
index 9a560f9..78193d3 100644
--- a/lib/standard/kernel/object.li
+++ b/lib/standard/kernel/object.li
@@ -177,7 +177,7 @@ Section Public
- print <- to_abstract_string.print;
- println <- to_abstract_string.println;
-
+
- dynamic_type:SELF <- SELF;
- same_dynamic_type other:OBJECT :BOOLEAN <-
diff --git a/lib/standard/kernel/pointer.li b/lib/standard/kernel/pointer.li
index 3522db2..1bbe25a 100644
--- a/lib/standard/kernel/pointer.li
+++ b/lib/standard/kernel/pointer.li
@@ -19,59 +19,59 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded POINTER;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "References to objects (POINTER is mapped as C type 'void *')";
-
+
- export := UINTEGER_CPU;
-
+
- type := `void *`;
-
+
- default := `NULL`:POINTER;
-
+
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
-
+
- in_range low:SELF to up:SELF :BOOLEAN <- TRUE; // BSBS: A revoir.
-
+
- object_size:INTEGER <- `sizeof(void *)`:INTEGER;
-
+
- is_null:BOOLEAN <- (Self = NULL);
// Is the external POINTER a NULL pointer ?
-
+
- is_not_null:BOOLEAN <- ! is_null;
// Is the external POINTER a non-NULL pointer ?
-
+
- to_native_array:NATIVE_ARRAY(UINTEGER_8) <- NATIVE_ARRAY(UINTEGER_8).force_conversion Self;
// Convert `pointer' into 'native_array' type.
-
+
// - to_uinteger_32:UINTEGER_32 <- `(unsigned int)@Self`:UINTEGER_32;
// convert `pointer' into uinteger type (adress of the pointer)
-
+
// - from_uinteger p:UINTEGER_32 :POINTER <- CONVERT(UINTEGER_32,POINTER).on p;
// create POINTER from an adress
-
+
// - to_integer:INTEGER <- to_raw_integer;
- to_string :STRING <- to_uinteger_cpu.to_hexadecimal;
-
+
//
// Convertion format without test.
//
-
+
- to_raw_uinteger_cpu:UINTEGER_CPU <- CONVERT(SELF,UINTEGER_CPU).on Self;
-
+
- to_raw_integer:INTEGER <- CONVERT(UINTEGER_CPU,INTEGER).on to_raw_uinteger_cpu;
-
+
- to_raw_uinteger:UINTEGER <- CONVERT(UINTEGER_CPU,UINTEGER).on to_raw_uinteger_cpu;
-
+
- to_raw_uinteger_8:UINTEGER_8 <- CONVERT(UINTEGER_CPU,UINTEGER_8 ).on to_raw_uinteger_cpu;
- to_raw_uinteger_16:UINTEGER_16 <- CONVERT(UINTEGER_CPU,UINTEGER_16).on to_raw_uinteger_cpu;
@@ -79,7 +79,7 @@ Section Public
- to_raw_uinteger_32:UINTEGER_32 <- CONVERT(UINTEGER_CPU,UINTEGER_32).on to_raw_uinteger_cpu;
- to_raw_uinteger_64:UINTEGER_64 <- CONVERT(UINTEGER_CPU,UINTEGER_64).on to_raw_uinteger_cpu;
-
+
- to_raw_integer_8:INTEGER_8 <- CONVERT(UINTEGER_CPU,INTEGER_8 ).on to_raw_uinteger_cpu;
- to_raw_integer_16:INTEGER_16 <- CONVERT(UINTEGER_CPU,INTEGER_16).on to_raw_uinteger_cpu;
@@ -87,4 +87,3 @@ Section Public
- to_raw_integer_32:INTEGER_32 <- CONVERT(UINTEGER_CPU,INTEGER_32).on to_raw_uinteger_cpu;
- to_raw_integer_64:INTEGER_64 <- CONVERT(UINTEGER_CPU,INTEGER_64).on to_raw_uinteger_cpu;
-
\ No newline at end of file
diff --git a/lib/standard/kernel/reference.li b/lib/standard/kernel/reference.li
index 869182a..ac1ca52 100644
--- a/lib/standard/kernel/reference.li
+++ b/lib/standard/kernel/reference.li
@@ -19,12 +19,12 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := REFERENCE(E);
-
+
- import := E;
- export := E,POINTER;
-
+
- copyright := "2003-2008 Sonntag Benoit";
- author := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
@@ -35,9 +35,9 @@ Section Inherit
- parent_object:OBJECT := OBJECT;
Section Public
-
+
+ value:E;
-
+
//
// Creation.
//
@@ -50,14 +50,14 @@ Section Public
);
- make v:E <-
- (
+ (
value := v;
);
-
+
//
// Cast.
//
-
+
- to_e:E <- value;
-
+
- from_e v:E :SELF <- create v;
diff --git a/lib/standard/number/fixed_real/real_16_16.li b/lib/standard/number/fixed_real/real_16_16.li
index c06ed41..1c132ea 100644
--- a/lib/standard/number/fixed_real/real_16_16.li
+++ b/lib/standard/number/fixed_real/real_16_16.li
@@ -19,55 +19,55 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_16_16;
- export := REAL_32, REAL_64;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "signed 16.16 fixed float.";
-
+
- type := `signed long`;
- default := (0.to_raw_real_16_16);
-
+
Section Insert
-
+
- parent_signed_fixed_real:SIGNED_FIXED_REAL := SIGNED_FIXED_REAL;
-
+
Section SELF
- shift_bits:INTEGER <- 16;
Section Public
-
+
//
// Range.
//
-
- - minimum:INTEGER_64 <- INTEGER_16.minimum;
- - maximum:UINTEGER_64 <- INTEGER_16.maximum;
-
+ - minimum:INTEGER_64 <- INTEGER_16.minimum;
+
+ - maximum:UINTEGER_64 <- INTEGER_16.maximum;
+
//
// Convertion format with test.
//
-
+
- to_real_16_16:REAL_16_16 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:INTEGER;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_integer;
-
+
(val < 0).if {
val := - val;
buffer.extend '-';
@@ -83,12 +83,12 @@ Section Public
buffer.insert '0' to old_count;
};
);
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/fixed_real/real_24_8.li b/lib/standard/number/fixed_real/real_24_8.li
index a804856..79ef0f7 100644
--- a/lib/standard/number/fixed_real/real_24_8.li
+++ b/lib/standard/number/fixed_real/real_24_8.li
@@ -19,53 +19,53 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_24_8;
- export := REAL_32, REAL_64;
-
+
- comment := "signed 24.8 fixed float.";
-
+
- type := `signed long`;
- default := (0.to_raw_real_24_8);
-
+
Section Insert
-
+
- parent_signed_fixed_real:SIGNED_FIXED_REAL := SIGNED_FIXED_REAL;
-
+
Section SELF
- shift_bits:INTEGER <- 8;
Section Public
-
+
//
// Range.
//
-
- - minimum:INTEGER_64 <- - 7F_FFFFh.to_raw_integer_64;
- - maximum:UINTEGER_64 <- 7F_FFFFh.to_raw_uinteger_64;
-
+ - minimum:INTEGER_64 <- - 7F_FFFFh.to_raw_integer_64;
+
+ - maximum:UINTEGER_64 <- 7F_FFFFh.to_raw_uinteger_64;
+
//
// Convertion format with test.
//
-
+
- to_real_24_8:REAL_24_8 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:INTEGER;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_integer;
-
+
(val < 0).if {
val := - val;
buffer.extend '-';
@@ -82,13 +82,13 @@ Section Public
};
);
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/fixed_real/real_26_6.li b/lib/standard/number/fixed_real/real_26_6.li
index b7ea699..174bbcd 100644
--- a/lib/standard/number/fixed_real/real_26_6.li
+++ b/lib/standard/number/fixed_real/real_26_6.li
@@ -19,62 +19,62 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_26_6;
- export := REAL_32, REAL_64;
-
+
- comment := "signed 26.6 fixed float.";
- type := `unsigned long`;
- default := (0.to_raw_real_26_6);
-
+
Section Insert
-
+
- parent_signed_fixed_real:SIGNED_FIXED_REAL := SIGNED_FIXED_REAL;
Section SELF
- shift_bits:INTEGER <- 6;
-
+
Section Public
-
+
//
// Range.
//
-
+
- minimum:INTEGER_64 <- - 1FF_FFFFh.to_raw_integer_64;
-
+
- maximum:UINTEGER_64 <- 1FF_FFFFh.to_raw_uinteger_64;
-
+
//
// Convertion format with test.
//
-
+
- to_real_26_6:REAL_26_6 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:INTEGER_32;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_integer;
-
+
(val < 0).if {
val := - val;
buffer.extend '-';
};
(val >> 6).append_in buffer;
buffer.extend '.';
-
+
old_count:=buffer.count;
- // 1/64 = 0.015625 => 6 digit.
+ // 1/64 = 0.015625 => 6 digit.
(((val & 63) * 1000000)>>6).append_in buffer;
new_count:=old_count+6;
{buffer.count!=new_count}.while_do {
@@ -82,13 +82,13 @@ Section Public
};
);
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/fixed_real/ureal_16_16.li b/lib/standard/number/fixed_real/ureal_16_16.li
index 49e1b06..263e403 100644
--- a/lib/standard/number/fixed_real/ureal_16_16.li
+++ b/lib/standard/number/fixed_real/ureal_16_16.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UREAL_16_16;
- export := REAL_32, REAL_64;
-
+
- comment := "unsigned 16.16 fixed float.";
-
+
- type := `signed long`;
- default := (0.to_raw_ureal_16_16);
-
+
Section Insert
-
+
- parent_unsigned_fixed_real:UNSIGNED_FIXED_REAL := UNSIGNED_FIXED_REAL;
Section SELF
- shift_bits:INTEGER <- 16;
-
+
Section Public
-
+
//
// Range.
//
-
- - maximum:UINTEGER_64 <- UINTEGER_16.maximum;
-
+
+ - maximum:UINTEGER_64 <- UINTEGER_16.maximum;
+
//
// Convertion format with test.
//
-
+
- to_real_16_16:REAL_16_16 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:INTEGER;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_integer;
-
+
(val < 0).if {
val := - val;
buffer.extend '-';
@@ -79,12 +79,12 @@ Section Public
buffer.insert '0' to old_count;
};
);
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/fixed_real/ureal_24_8.li b/lib/standard/number/fixed_real/ureal_24_8.li
index eb5322d..4b53639 100644
--- a/lib/standard/number/fixed_real/ureal_24_8.li
+++ b/lib/standard/number/fixed_real/ureal_24_8.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UREAL_24_8;
- export := REAL_32, REAL_64;
-
+
- comment := "signed 24.8 fixed float.";
-
+
- type := `signed long`;
- default := (0.to_raw_ureal_24_8);
-
+
Section Insert
-
+
- parent_unsigned_fixed_real:UNSIGNED_FIXED_REAL := UNSIGNED_FIXED_REAL;
-
+
Section SELF
- - shift_bits:INTEGER <- 8;
-
+ - shift_bits:INTEGER <- 8;
+
Section Public
-
+
//
// Range.
//
-
- - maximum:UINTEGER_64 <- 0FF_FFFFh.to_raw_uinteger_64;
-
+
+ - maximum:UINTEGER_64 <- 0FF_FFFFh.to_raw_uinteger_64;
+
//
// Convertion format with test.
//
-
+
- to_real_24_8:REAL_24_8 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:INTEGER;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_integer;
-
+
(val < 0).if {
val := - val;
buffer.extend '-';
@@ -80,13 +80,13 @@ Section Public
};
);
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/fixed_real/ureal_26_6.li b/lib/standard/number/fixed_real/ureal_26_6.li
index 2a34844..2757838 100644
--- a/lib/standard/number/fixed_real/ureal_26_6.li
+++ b/lib/standard/number/fixed_real/ureal_26_6.li
@@ -19,56 +19,56 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UREAL_26_6;
- export := REAL_32, REAL_64;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "unsigned 26.6 fixed float.";
-
+
- type := `unsigned long`;
- default := (0.to_raw_ureal_26_6);
-
+
Section Insert
-
+
- parent_unsigned_fixed_real:UNSIGNED_FIXED_REAL := UNSIGNED_FIXED_REAL;
Section SELF
- shift_bits:INTEGER <- 6;
-
+
Section Public
-
+
//
// Range.
//
-
+
- maximum:UINTEGER_64 <- 3FF_FFFFh.to_raw_uinteger_64;
-
+
//
// Convertion format with test.
//
-
+
- to_ureal_26_6:UREAL_26_6 <- Self;
-
+
//
// Convertion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
( + val:UINTEGER_32;
+ old_count,new_count:INTEGER;
? {buffer!=NULL};
-
+
val := to_raw_uinteger_32;
(val >> 6).append_in buffer;
buffer.extend '.';
old_count:=buffer.count;
- // 1/64 = 0.015625 => 6 digit.
+ // 1/64 = 0.015625 => 6 digit.
(((val & 63) * 1000000)>>6).append_in buffer;
new_count:=old_count+6;
{buffer.count!=new_count}.while_do {
@@ -76,13 +76,13 @@ Section Public
};
);
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/standard/number/integer/integer.li b/lib/standard/number/integer/integer.li
index d194157..567e168 100644
--- a/lib/standard/number/integer/integer.li
+++ b/lib/standard/number/integer/integer.li
@@ -51,7 +51,7 @@ Section Public
//
- maximum:UINTEGER_64 <-
- // Maximum of integer
+ // Maximum of integer
07FFFFFFFh.to_raw_uinteger_64;
- minimum:INTEGER_64 <-
diff --git a/lib/standard/number/integer/integer_16.li b/lib/standard/number/integer/integer_16.li
index 7f46d8a..6775db9 100644
--- a/lib/standard/number/integer/integer_16.li
+++ b/lib/standard/number/integer/integer_16.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded INTEGER_16;
- export := INTEGER, INTEGER_64, INTEGER_32;
-
+
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag, 2007 Xavier Oswald";
-
+
- comment := "Signed 16 bits integer.";
- type := `signed short`;
- default := (0.to_raw_integer_16);
-
+
Section Insert
-
+
- parent_signed_integer:SIGNED_INTEGER := SIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER := 2;
//
// Range
//
-
+
- maximum:UINTEGER_64 <- 32767.to_raw_uinteger_64;
-
+
- minimum:INTEGER_64 <- - 32767.to_raw_integer_64;
-
+
//
// Conversion with test.
//
diff --git a/lib/standard/number/integer/integer_32.li b/lib/standard/number/integer/integer_32.li
index 056c2e4..52b5f8c 100644
--- a/lib/standard/number/integer/integer_32.li
+++ b/lib/standard/number/integer/integer_32.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded INTEGER_32;
-
+
- export := INTEGER, INTEGER_64, POINTER;
-
+
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag, 2007 Xavier Oswald";
- comment :="Signed 32 bits integer.";
- type := `signed int`;
- default := (0.to_raw_integer_32);
-
+
Section Insert
-
+
- parent_signed_integer:SIGNED_INTEGER := SIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER := 4;
//
// Range
//
-
- - maximum:UINTEGER_64 <- 07FFF_FFFFh.to_raw_uinteger_64;
-
+
+ - maximum:UINTEGER_64 <- 07FFF_FFFFh.to_raw_uinteger_64;
+
- minimum:INTEGER_64 <- - 07FFF_FFFFh.to_raw_integer_64;
-
+
//
// Conversion with test.
//
-
- - to_integer_32:INTEGER_32 <- Self;
+
+ - to_integer_32:INTEGER_32 <- Self;
diff --git a/lib/standard/number/integer/integer_64.li b/lib/standard/number/integer/integer_64.li
index 26fe87f..6d8d0ef 100644
--- a/lib/standard/number/integer/integer_64.li
+++ b/lib/standard/number/integer/integer_64.li
@@ -19,41 +19,41 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded INTEGER_64;
- export := INTEGER;
-
+
- comment := "Signed 64 bits integer.";
- type := `signed long long `;
- default := (0.to_raw_integer_64);
-
+
Section Insert
-
+
- parent_signed_integer:SIGNED_INTEGER := SIGNED_INTEGER;
-
+
Section Public
- object_size:INTEGER := 8;
-
-
+
+
- '-' Self:SELF :SELF <- zero - Self;
-
+
//
// Range
//
-
+
- maximum:UINTEGER_64 <- `0x7FFFFFFFFFFFFFFFLLU`:UINTEGER_64;
-
+
- minimum:INTEGER_64 <- `-0x8000000000000000LL`:INTEGER_64;
-
+
//
// Conversion with test.
//
-
+
- to_integer_64:INTEGER_64 <- Self;
-
+
diff --git a/lib/standard/number/integer/integer_8.li b/lib/standard/number/integer/integer_8.li
index fafaa16..45fe223 100644
--- a/lib/standard/number/integer/integer_8.li
+++ b/lib/standard/number/integer/integer_8.li
@@ -19,40 +19,40 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name :=Expanded INTEGER_8;
- export := INTEGER, INTEGER_64, INTEGER_32, INTEGER_16;
- - copyright :=
+ - copyright :=
"2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag, 2007 Xavier Oswald";
- comment :="Signed 8 bits integer.";
- type := `signed char`;
- default := (`(0)`:INTEGER_8); //CONVERT[INTEGER,INTEGER_8].on 0); //0.to_raw_integer_8);
-
+
Section Insert
-
+
- parent_signed_integer:SIGNED_INTEGER := SIGNED_INTEGER;
-
+
Section Public
- object_size:INTEGER := 1;
-
+
//
// Range
//
-
+
- maximum:UINTEGER_64 <- 127.to_raw_uinteger_64;
-
+
- minimum:INTEGER_64 <- - 127.to_raw_integer_64;
-
+
//
// Conversion.
//
-
- - to_integer_8:INTEGER_8 <-
+
+ - to_integer_8:INTEGER_8 <-
[ ]
(
Self
@@ -60,11 +60,11 @@ Section Public
[ ];
- to_character:CHARACTER <- `@Self`:CHARACTER; // `13`;
-
-
+
+
diff --git a/lib/standard/number/integer/uinteger.li b/lib/standard/number/integer/uinteger.li
index 7607a83..116653d 100644
--- a/lib/standard/number/integer/uinteger.li
+++ b/lib/standard/number/integer/uinteger.li
@@ -19,56 +19,56 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
//
// BSBS : Tout a REVOIR !!!!!!!!!!!
//
-
+
+ name := Expanded UINTEGER;
-
+
- export := // BSBS : A revoir!
- // Integer:
+ // Integer:
UINTEGER_8, UINTEGER_16, UINTEGER_32, UINTEGER_64,
INTEGER_8 , INTEGER_16 , INTEGER_32 , INTEGER_64 ,
UINTEGER_BIG,//INTEGER_BIG,
// Fixed real:
- UREAL_16_16, UREAL_24_8 , UREAL_26_6 ,
- REAL_16_16 , REAL_24_8 , REAL_26_6 ,
+ UREAL_16_16, UREAL_24_8 , UREAL_26_6 ,
+ REAL_16_16 , REAL_24_8 , REAL_26_6 ,
// Float Real:
REAL, REAL_32, REAL_64, REAL_80,
// Other:
POINTER;
-
+
- comment := "Generic Integer.";
-
+
- type := `unsigned int`;
- default := 0;
Section Insert
-
+
- parent_numeric:NUMERIC := NUMERIC;
-
+
Section Public
-
+
//
// Range.
//
-
- - maximum:UINTEGER_64 <- 07FFFFFFFh.to_raw_uinteger_64;
-
- - minimum:INTEGER_64 <- (0).to_raw_integer_64;
-
+
+ - maximum:UINTEGER_64 <- 07FFFFFFFh.to_raw_uinteger_64;
+
+ - minimum:INTEGER_64 <- (0).to_raw_integer_64;
+
//
// Binary Operator.
//
-
+
- Self:SELF '%' Left 100 other:SELF :SELF <- Self - ((Self / other) * other);
-
+
- Self:SELF '%#' Left 100 other:INTEGER :SELF <- Self % other;
-
+
- Self:SELF '**' Right 120 exp:SELF :SELF <-
( + result:SELF;
-
+
(exp = 0).if {
result := 1;
} else {
@@ -89,28 +89,28 @@ Section Public
//
// Conversion format with test.
//
-
+
- bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
TRUE
);
-
+
// - to_integer:INTEGER <- Self;
-
+
- to_pointer:POINTER <-
(
to_raw_pointer
);
-
+
//
- // BCD Format.
+ // BCD Format.
//
-
+
- to_binary:SELF <-
// Self is BCD formatted, convert to binary value
( + result:SELF;
+ val,mul:SELF;
-
+
val := Self;
mul := 1;
{val!=0}.while_do {
@@ -118,29 +118,29 @@ Section Public
mul := mul * 10;
val := val >> 4;
};
-
+
result
);
-
+
- to_bcd:SELF <-
// Self is binary formatted, convert to bcd value
( + result:SELF;
+ val,mul:SELF;
-
+
val := Self;
{val != 0}.while_do {
result := result | ((val % 10) << mul);
mul := mul + 4;
val := val / 10;
};
-
- result
+
+ result
);
-
+
//
// Facility typing.
//
-
+
- kb:SELF <- Self << 10;
// Self in Kilobyte (ie. 1kb = 1024 bytes)
@@ -156,7 +156,7 @@ Section Public
//
// Logic Operator
//
-
+
- Self:SELF '&' Left 100 other:SELF :SELF <- `6`;
// AND operator
@@ -175,46 +175,46 @@ Section Public
//
// Unary operator
//
-
+
- '~' Self:SELF :SELF <- -Self - SELF.one; //(-SELF.one) - Self;
-
+
//
- // Test.
+ // Test.
//
-
+
- align_power step:SELF :SELF <-
- [
+ [
-? {step.is_power_2};
]
( + a:SELF;
-
+
a := step - 1;
(Self + a) & (~ a)
);
-
+
- 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
);
-
+
//
// Function :
//
-
+
- sqrt:SELF <-
// Square root
( + r,x:SELF;
-
+
x:=(Self + 1) >> 1;
{x > r}.while_do {
x:=x-r;
@@ -222,18 +222,18 @@ Section Public
};
r
);
-
+
- Self:SELF '!' :SELF <- factorial;
// Factorial. Use it like "45!;" or "bar!.print;"
-
+
- factorial:SELF <-
- // Factorial.
+ // Factorial.
// * Require: Self >= 0
[
-? {Self >= 0};
]
( + result,value:SELF;
-
+
result := 1;
value := Self;
{value <= 1}.until_do {
@@ -242,7 +242,7 @@ Section Public
};
result
);
-
+
- fibonacci:SELF <-
// Fibonacci
// * Require: Self >= 0
@@ -250,7 +250,7 @@ Section Public
-? {Self >= 0};
]
( + result:SELF;
-
+
(Self <= 1).if {
result := 1;
} else {
@@ -258,11 +258,11 @@ Section Public
};
result
);
-
+
- is_odd:BOOLEAN <- (Self & 1) = 1; // Is odd ?
-
+
- is_even:BOOLEAN <- ! is_odd; // Is even ?
-
+
- gcd other:SELF :SELF <-
// Great Common Divisor of `self' and `other'.
[
@@ -270,19 +270,19 @@ Section Public
-? {other >= 0};
]
( + result:SELF;
-
+
(other = 0).if {
result := Self;
} else {
result := other.gcd (Self % other);
};
-
+
result
)
[
+? {result == other.gcd self};
];
-
+
//
// Random
//
@@ -299,8 +299,8 @@ Section Public
- random_upper upper:SELF :SELF <-
// Random number between 0 to `upper'.
- [
- -? {upper > 0};
+ [
+ -? {upper > 0};
]
(
random % (upper+1)
@@ -314,28 +314,28 @@ Section Public
[
-? {lower < upper};
]
- (
+ (
lower + random_upper (upper-lower)
)
[
+? {Result.in_range lower to upper};
];
-
+
//
// Looping.
//
-
+
- times action:BLOCK <-
(
1.to Self do { i:INTEGER;
action.value;
};
);
-
+
//
// Convertion
//
-
+
// *French, Slot, Description : Renvoi une chaîne représentant le nombre en base 10
// *English, Slot, Description : String of the number in base 10
@@ -349,88 +349,88 @@ Section Public
- append_in buffer:STRING <- to_integer_32.append_in buffer;
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
-
+
- decimal_digit:CHARACTER <-
// Gives the corresponding CHARACTER for range 0..9.
[
-? {in_range 0 to 9};
]
- (
+ (
(Self.to_integer_8 + '0'.code).to_character
)
[
+? {"0123456789".has Result};
+? {Result.decimal_value = Self};
];
-
+
- digit:CHARACTER <- decimal_digit;
-
+
- hexadecimal_digit:CHARACTER <-
// Gives the corresponding CHARACTER for range 0..15.
[
-? {in_range 0 to 15};
]
( + result:CHARACTER;
-
+
(Self <= 9).if {
result := digit;
} else {
result := ('A'.code + (Self - 10).to_integer_8).to_character;
- };
+ };
result
)
[
+? {"0123456789ABCDEF".has Result};
];
-
+
- to_character:CHARACTER <- to_integer_8.to_character;
// Return the coresponding ASCII character.
-
+
- to_octal:SELF <-
// Gives coresponding octal value.
( + result:SELF;
-
+
deferred;
result
);
-
+
- to_hexadecimal:STRING <-
// 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.
// * See: `to_hexadecimal_in' to save memory.
( + result:STRING;
-
+
result := STRING.create 8;
to_hexadecimal_in result;
result
);
-
+
- to_hexadecimal_format s:INTEGER :STRING <-
// 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.
// * See: `to_hexadecimal_in' to save memory.
( + result:STRING;
-
+
result := STRING.create 8;
to_hexadecimal_in result format s;
result
- );
-
+ );
+
- to_hexadecimal_in buffer:STRING <-
// Append in `buffer' the equivalent of `to_hexadecimal'. No new STRING
// creation during the process.
[ -? {buffer!=NULL}; ]
( + val:SELF;
+ i,old_count:INTEGER;
-
+
(Self = 0).if {
buffer.extend '0';
} else {
i := buffer.count + 1;
val := Self;
- {val != 0}.while_do { //JBJB
+ {val != 0}.while_do { //JBJB
buffer.extend ((val & 15).hexadecimal_digit);
val := val >> 4;
};
@@ -442,20 +442,20 @@ Section Public
};
};
);
-
+
- to_hexadecimal_in buffer:STRING format s:INTEGER <-
// Append in `buffer' the equivalent of `to_hexadecimal'. No new STRING
// creation during the process.
[ -? {buffer!=NULL}; ]
( + val:SELF;
+ i,old_count:INTEGER;
-
+
(Self = 0).if {
buffer.extend '0';
} else {
i := buffer.count + 1;
val := Self;
- {val != 0}.while_do { //JBJB
+ {val != 0}.while_do { //JBJB
buffer.extend ((val & 15).hexadecimal_digit);
val := val >> 4;
};
@@ -467,7 +467,7 @@ Section Public
};
};
buffer.precede_multiple '0' by (s.to_integer - buffer.count);
- );
+ );
- to_binary_in buffer:STRING format s:INTEGER <-
// Append in `buffer' the equivalent of `to_binary_string'. No new STRING
@@ -475,13 +475,13 @@ Section Public
[ -? {buffer!=NULL}; ]
( + val:SELF;
+ i,old_count:INTEGER;
-
+
(Self = 0).if {
buffer.extend '0';
} else {
i := buffer.count + 1;
val := Self;
- {val != 0}.while_do {
+ {val != 0}.while_do {
buffer.extend ('0' +# (val & 1));
val := val >> 1;
};
@@ -493,18 +493,18 @@ Section Public
};
};
buffer.precede_multiple '0' by ((s.to_integer) - buffer.count);
- );
-
+ );
+
//
// Hashing:
//
-
+
- hash_code:INTEGER <- to_integer_32.hash_code; // BSBS: Il faut revoir => Depending processor
-
+
//
// Print
//
-
+
- print <-
(
(Self = 0).if {
@@ -516,13 +516,13 @@ Section Public
print_positif;
};
);
-
+
- print_positif <-
// Display this number without memory.
[ -? {Self >=# 0}; ]
( + char:CHARACTER;
- + val:SELF;
-
+ + val:SELF;
+
char := (Self % 10).decimal_digit;
val := Self / 10;
(val != 0).if {
@@ -535,23 +535,23 @@ Section Public
// Display this number without memory.
( + char:CHARACTER;
+ val:SELF;
-
- char := (Self & 0Fh).hexadecimal_digit;
- val := Self / 16;
+
+ char := (Self & 0Fh).hexadecimal_digit;
+ val := Self / 16;
(val != 0).if {
val.print_hex;
};
char.print;
);
-
+
//
// Debug manager facility.
//
-
+
- Self:SELF '?' blc:BLOCK <- blc ?# Self;
-
-Section INTEGER
-
+
+Section INTEGER
+
- to_raw_pointer:POINTER <- CONVERT(SELF,POINTER).on Self;
diff --git a/lib/standard/number/integer/uinteger_16.li b/lib/standard/number/integer/uinteger_16.li
index 8acee90..a65d23b 100644
--- a/lib/standard/number/integer/uinteger_16.li
+++ b/lib/standard/number/integer/uinteger_16.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UINTEGER_16;
- export :=
- UINTEGER_64, UINTEGER_32,
+ UINTEGER_64, UINTEGER_32,
INTEGER_64 , INTEGER_32 ,
INTEGER;
-
+
- comment :="Unsigned 16 bits integer.";
- type := `unsigned short`;
- default := (0.to_raw_uinteger_16);
-
+
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
- - object_size:INTEGER := 2;
+ - object_size:INTEGER := 2;
//
// Range.
//
-
- - maximum:UINTEGER_64 := 65535.to_raw_uinteger_64;
-
+
+ - maximum:UINTEGER_64 := 65535.to_raw_uinteger_64;
+
//
// Conversion with test.
//
-
+
- to_uinteger_16:UINTEGER_16 <- Self;
-
+
//- to_char_unicode:CHAR_UNICODE <- CHAR_UNICODE.force_conversion Self;
diff --git a/lib/standard/number/integer/uinteger_32.li b/lib/standard/number/integer/uinteger_32.li
index 8d60296..28de9bb 100644
--- a/lib/standard/number/integer/uinteger_32.li
+++ b/lib/standard/number/integer/uinteger_32.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UINTEGER_32;
- export := INTEGER, UINTEGER_64, INTEGER_64;
-
+
- comment := "Unsigned 32 bits integer.";
-
+
- type := `unsigned int`;
- default := (0.to_raw_uinteger_32);
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER := 4;
//
// Range.
//
-
+
- maximum:UINTEGER_64 := ~ 0.to_raw_uinteger_32;
-
+
//
// Conversion with test.
//
-
+
- to_uinteger_32:UINTEGER_32 <- Self;
- to_uinteger_64:UINTEGER_64 <- to_raw_uinteger_64;
diff --git a/lib/standard/number/integer/uinteger_64.li b/lib/standard/number/integer/uinteger_64.li
index 769be07..4584258 100644
--- a/lib/standard/number/integer/uinteger_64.li
+++ b/lib/standard/number/integer/uinteger_64.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UINTEGER_64;
- export := INTEGER;
@@ -28,24 +28,23 @@ Section Header
- type := `unsigned long long`;
- default := (0.to_raw_uinteger_64);
-
+
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER := 8;
//
// Range.
//
-
- - maximum:UINTEGER_64 := `0xFFFFFFFFFFFFFFFFLLU`:UINTEGER_64; //BSBS pb C 0FFFFFFFFFFFFFFFFh;
-
+
+ - maximum:UINTEGER_64 := `0xFFFFFFFFFFFFFFFFLLU`:UINTEGER_64; //BSBS pb C 0FFFFFFFFFFFFFFFFh;
+
//
// Conversion with test.
//
-
+
- to_uinteger_64:UINTEGER_64 <- Self;
-
\ No newline at end of file
diff --git a/lib/standard/number/integer/uinteger_8.li b/lib/standard/number/integer/uinteger_8.li
index 18dfcc9..d8b9274 100644
--- a/lib/standard/number/integer/uinteger_8.li
+++ b/lib/standard/number/integer/uinteger_8.li
@@ -19,11 +19,11 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UINTEGER_8;
-
- - export :=
- UINTEGER_64, UINTEGER_32, UINTEGER_16,
+
+ - export :=
+ UINTEGER_64, UINTEGER_32, UINTEGER_16,
INTEGER_64 , INTEGER_32 , INTEGER_16 ,
INTEGER;
@@ -31,30 +31,30 @@ Section Header
- type := `unsigned char`;
- default := (0.to_raw_uinteger_8);
-
+
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER := 1;
//
// Range.
//
-
+
- maximum:UINTEGER_64 := 255.to_raw_uinteger_64;
-
+
//
// Conversion with test.
//
-
+
- to_uinteger_8:UINTEGER_8 <- Self;
-
- - to_character:CHARACTER <-
+
+ - to_character:CHARACTER <-
[ -? {in_range (CHARACTER.minimum) to (CHARACTER.maximum)}; ]
- (
+ (
CONVERT(UINTEGER_8, CHARACTER).on Self
);
diff --git a/lib/standard/number/integer/uinteger_big.li b/lib/standard/number/integer/uinteger_big.li
index eefe675..d69b3ae 100644
--- a/lib/standard/number/integer/uinteger_big.li
+++ b/lib/standard/number/integer/uinteger_big.li
@@ -22,7 +22,7 @@ Section Header
+ name := UINTEGER_BIG; // Aucun Auto-Cast pour l'instant...(peut etre
// INTEGER_BIG ...)
-
+
- comment := "Integer without bits limit! (Just for fun!)";
Section Inherit
@@ -30,11 +30,11 @@ Section Inherit
- parent_object:OBJECT := OBJECT;
Section UINTEGER_BIG
-
+
+ storage:FAST_ARRAY(UINTEGER_32);
-
+
- last_modulo:UINTEGER_32;
-
+
- count:INTEGER <- storage.count;
- lower:INTEGER <- storage.lower;
@@ -46,40 +46,40 @@ Section UINTEGER_BIG
- copy other:UINTEGER_BIG <- storage.copy (other.storage);
- force elt:UINTEGER_32 to idx:INTEGER <- storage.force elt to idx;
-
+
- put elt:UINTEGER_32 to idx:INTEGER <- storage.put elt to idx;
-
+
- add_last elt:UINTEGER_32 <- storage.add_last elt;
-
+
- resize new_size:INTEGER <-
(
- ? { new_size > 0};
+ ? { new_size > 0};
storage.resize new_size;
);
-
+
- last:UINTEGER_32 <- storage.last;
-
+
- normalize <-
(
{(storage.count != 1) && {storage.last == 0}}.while_do {
storage.remove_last;
- };
+ };
);
-Section Public
+Section Public
- - create init:UINTEGER_32 :UINTEGER_BIG <-
+ - create init:UINTEGER_32 :UINTEGER_BIG <-
( + result:SELF;
-
+
result := clone;
result.make init;
result
);
-
+
- make init:UINTEGER_32 :SELF <-
- (
+ (
(storage = NULL).if {
- storage := FAST_ARRAY(UINTEGER_32).create_with_capacity 4;
+ storage := FAST_ARRAY(UINTEGER_32).create_with_capacity 4;
} else {
storage.clear;
};
@@ -89,72 +89,72 @@ Section Public
//
// Conversion format with test.
//
-
- - to_uinteger_64:UINTEGER_64 <-
+
+ - to_uinteger_64:UINTEGER_64 <-
[ -? {count <= 2}; ] // Bound limit control.
( + result:UINTEGER_64;
-
+
result := storage.first;
(count > 1).if {
result := result | (storage.item 1.to_uinteger_64 << 32);
};
result
);
-
- - to_uinteger_32:UINTEGER_32 <-
+
+ - to_uinteger_32:UINTEGER_32 <-
[ -? {count = 1}; ]
- (
+ (
storage.first
);
-
- - to_uinteger_16:UINTEGER_16 <-
+
+ - to_uinteger_16:UINTEGER_16 <-
[ -? {count = 1}; ]
- (
+ (
storage.first.to_uinteger_16
);
-
- - to_uinteger_8:UINTEGER_8 <-
+
+ - to_uinteger_8:UINTEGER_8 <-
[ -? {count = 1}; ]
- (
+ (
storage.first.to_uinteger_8
);
-
- - to_integer_64:INTEGER_64 <-
+
+ - to_integer_64:INTEGER_64 <-
[ -? {(to_uinteger_64 >> 63) = 0}; ]
- (
+ (
to_uinteger_64.to_integer_64
);
-
- - to_integer:INTEGER <-
+
+ - to_integer:INTEGER <-
[ -? {(to_uinteger_64 >> 31) = 0}; ]
- (
+ (
storage.first.to_integer
);
-
- - to_integer_16:INTEGER_16 <-
+
+ - to_integer_16:INTEGER_16 <-
[ -? {(to_uinteger_16 >> 15) = 0}; ]
- (
+ (
storage.first.to_uinteger_16
);
-
- - to_integer_8:INTEGER_8 <-
+
+ - to_integer_8:INTEGER_8 <-
[ -? {(to_uinteger_8 >> 7) = 0}; ]
- (
+ (
storage.first.to_integer_8
);
-
+
//
// binary operator :
//
-
- - substract other:SELF :SELF <-
+
+ - substract other:SELF :SELF <-
[ ? {Self >= other}; ]
( + over,substr,part1,part2:UINTEGER_64;
+ idx:INTEGER;
(Self == other).if {
set_with_zero;
- } else {
+ } else {
idx := lower;
{idx > other.upper}.until_do {
part1 := item idx;
@@ -170,11 +170,11 @@ Section Public
over := substr >> 32;
put ((substr & 0FFFF_FFFFh).to_uinteger_32) to idx;
idx := idx + 1;
- };
+ };
normalize;
- };
+ };
);
-
+
- substract_integer other:INTEGER :SELF <-
[ ? {Self >=# other}; ]
( + part1,over,substr:UINTEGER_64;
@@ -182,7 +182,7 @@ Section Public
(Self ==# other).if {
set_with_zero;
- } else {
+ } else {
part1 := item 0;
substr := part1 - other;
over := substr >> 32;
@@ -194,16 +194,16 @@ Section Public
over := substr >> 32;
put ((substr & 0FFFF_FFFFh).to_uinteger_32) to idx;
idx := idx + 1;
- };
+ };
normalize;
- };
+ };
);
-
- - addition other:SELF :SELF <-
+
+ - addition other:SELF :SELF <-
[ -? {Self >= other}; ]
( + part1,part2,sum,over:UINTEGER_64;
+ idx:INTEGER;
-
+
idx := lower;
{idx > other.upper}.until_do {
part1 := item idx;
@@ -221,13 +221,13 @@ Section Public
};
(over != 0).if {
add_last (over.to_uinteger_32);
- };
- );
-
+ };
+ );
+
- addition_integer other:INTEGER :SELF <-
( + part1,sum,over:UINTEGER_64;
+ idx:INTEGER;
-
+
part1 := item 0;
sum := part1 + other;
put ((sum & 0FFFF_FFFFh).to_uinteger_32) to 0;
@@ -237,28 +237,28 @@ Section Public
part1 := item idx;
sum := part1 + over;
put ((sum & 0FFFF_FFFFh).to_uinteger_32) to idx;
- idx := idx + 1;
+ idx := idx + 1;
over := sum >> 32;
- };
+ };
(over != 0).if {
add_last (over.to_uinteger_32);
- };
+ };
);
-
- - multiply other:SELF :SELF <-
+
+ - multiply other:SELF :SELF <-
( + part1,part2,product:UINTEGER_64;
+ index_result:INTEGER;
-
+
lower.to upper do { idx:INTEGER;
+ result_current:UINTEGER_BIG;
-
+
result_current := 0;
result_current.resize count;
part1 := item idx;
index_result := idx;
(other.lower).to (other.upper) do { idx_other:INTEGER;
part2 := other.item idx_other;
- product := part1 * part2;
+ product := part1 * part2;
(product < (UINTEGER_32.maximum.to_uinteger_64)).if {
result_current.put (product.to_uinteger_32) to index_result;
} else {
@@ -268,24 +268,24 @@ Section Public
index_result := index_result + 1;
};
};
-
+
result := result + result_current;
-
+
};
result.clean;
result
);
-
+
- Self:SELF '*#' Left 100 other:INTEGER :SELF <-
(
+ result:UINTEGER_BIG;
+ part1,product,over:UINTEGER_64;
-
+
result := 0;
result.resize count;
- lower.to upper do { idx:INTEGER;
- part1 := item idx;
- product := part1 * other + over;
+ lower.to upper do { idx:INTEGER;
+ part1 := item idx;
+ product := part1 * other + over;
(product < (UINTEGER_32.maximum.to_uinteger_64)).if {
result.put (product.to_uinteger_32) to idx;
over := 0;
@@ -294,30 +294,30 @@ Section Public
over := product >> 32;
};
};
-
+
(over!==0).if {
result.add_last (over.to_uinteger_32);
- };
-
+ };
+
result.clean;
result
);
-
- - Self:SELF '/' Left 100 other:SELF :SELF <-
+
+ - Self:SELF '/' Left 100 other:SELF :SELF <-
( + result:UINTEGER_BIG;
-
-
+
+
);
-
-
+
+
- Self:SELF '/#' Left 100 other:INTEGER :SELF <-
( + result:SELF;
+ last_mod,div:UINTEGER_64;
+ idx:INTEGER;
-
+
result.resize count;
idx := upper;
- last_mod := item idx;
+ last_mod := item idx;
{idx < lower}.until_do {
div := 0;
(last_mod < other).if {
@@ -329,8 +329,8 @@ Section Public
};
} else {
div := last_mod / (other.to_uinteger_64);
- last_mod := last_mod % (other.to_uinteger_64);
- };
+ last_mod := last_mod % (other.to_uinteger_64);
+ };
(div !== 0).if {
result.put ((div & (UINTEGER_32.maximum.to_uinteger_64)).to_uinteger_32) to idx;
};
@@ -339,9 +339,9 @@ Section Public
result.clean;
result
);
-
+
- and_binary other:SELF :SELF <-
- (
+ (
(other.upper < upper).if {
storage.remove_tail (upper - other.upper);
};
@@ -350,22 +350,22 @@ Section Public
};
normalize;
);
-
+
- or_binary other:SELF :SELF <-
- (
+ (
lower.to (upper.min (other.upper)) do { i:INTEGER;
put (item i | other.item i) to i;
};
upper.to (other.upper) do { i:INTEGER;
add_last (other.item i);
- };
+ };
);
//
// Test binary operator :
//
-
- - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
+
+ - Self:SELF '>' Right 60 other:SELF :BOOLEAN <-
(
+ result:BOOLEAN;
(count > (other.count)).if {
@@ -386,14 +386,14 @@ Section Public
find := TRUE;
};
- i := i + 1;
+ i := i + 1;
};
};
-
+
result
);
-
-
+
+
- Self:SELF '>#' Right 60 other:INTEGER :BOOLEAN <-
(
+ result:BOOLEAN;
@@ -404,7 +404,7 @@ Section Public
};
result
);
-
+
- Self:SELF '==' Right 60 other:SELF :BOOLEAN <-
(
+ result:BOOLEAN;
@@ -418,61 +418,61 @@ Section Public
result := TRUE;
};
};
-
+
result
);
-
+
//
// Function.
//
- factorial_integer n:INTEGER <-
[ -? {n >= 0}; ]
- (
+ (
(n = 0).if {
set_with_zero;
put 1 to 0;
} else {
2.to n do { i:INTEGER;
- multiply_integer i;
+ multiply_integer i;
};
};
);
-
+
//
// conversion
//
-
- - append_in buffer:STRING <-
+
+ - append_in buffer:STRING <-
// Append in the `buffer' the equivalent of `to_string'. No new STRING
// creation during the process.
- ( + value:UINTEGER_BIG;
+ ( + value:UINTEGER_BIG;
+ mod:UINTEGER_32;
+ counter:INTEGER;
+ old_upper,new_upper:INTEGER;
-
+
old_upper:=buffer.upper + 1;
-
- (upper = 0).if {
+
+ (upper = 0).if {
item 0.append_in buffer;
} else {
value:=Self;
{
value:=value /# 1000000000;
- mod:=last_modulo;
+ mod:=last_modulo;
{counter==0}.until_do {
buffer.extend '0';
counter:=counter-1;
};
counter := 9;
- {
+ {
buffer.extend ((mod % 10).digit);
mod := mod / 10;
counter := counter-1;
}.do_while {mod!==0};
}.do_while {value!==0};
-
- new_upper := buffer.upper;
+
+ new_upper := buffer.upper;
// Swap.
{old_upper >= new_upper}.until_do {
@@ -482,30 +482,30 @@ Section Public
};
};
);
-
+
- print_positif <-
(
string_tmp.clear;
append_in string_tmp;
string_tmp.print;
);
-/*
+/*
- append_in buffer:STRING <-
( + val:SELF;
- + i,j:INTEGER;
+ + i,j:INTEGER;
? {buffer!=NULL};
-
+
(self == 0).if {
buffer.extend '0';
- } else {
- i := buffer.upper + 1;
+ } else {
+ i := buffer.upper + 1;
val.copy Self;
{val == 0}.until_do {
buffer.extend ((val %# 10).digit);
val := val /# 10;
};
j := buffer.upper;
-
+
{i >= j}.until_do {
buffer.swap i with j;
j := j - 1;
@@ -515,15 +515,15 @@ Section Public
);
*/
Section Public
-
+
- set_with_zero <-
(
storage.clear;
storage.add_last 0;
);
-
+
- is_zero:BOOLEAN <- ((storage.count = 1) && {storage.first = 0});
-
+
- compare other:SELF :INTEGER <-
// -1 if Self < other
// 0 if Self = other
@@ -531,7 +531,7 @@ Section Public
( + result,up_s,up_o:INTEGER;
+ v_s,v_o:INTEGER_32;
+ i:INTEGER;
-
+
up_s := upper;
up_o := other.upper;
(up_s = up_o).if {
@@ -551,13 +551,13 @@ Section Public
} else {
(up_s < up_o).if {
result := -1;
- } else {
+ } else {
result := 1;
};
};
result
);
-
+
- divide_one_word divisor:UINTEGER_32 :UINTEGER_32 <-
// This method is used by `divide'. The one word divisor is
// specified by `divisor' is saw as unsigned.
@@ -568,7 +568,7 @@ Section Public
( + i, remainder_word1, remainder_word0:INTEGER;
+ result:UINTEGER_32;
+ x:UINTEGER_64;
-
+
(count = 1).if {
result := first;
(result < divisor).if {
@@ -584,7 +584,7 @@ Section Public
remainder_word0 := item i;
x := (remainder_word1.to_uinteger_64 << 32) | remainder_word0;
remainder_word1 := x % divisor;
- put (x / divisor) to i;
+ put (x / divisor) to i;
i := i - 1;
};
(item upper = 0).if {
@@ -592,17 +592,17 @@ Section Public
? {item upper != 0};
};
result := remainder_word1;
- };
+ };
result
);
-
+
- normalize_shift:INTEGER_8 <-
// Shift left until the most significant bit is on.
// Result give the number of left shift.
[ -? {! is_zero}; ]
( + head:UINTEGER_32;
+ result:INTEGER_8;
-
+
head := item upper;
{(head & 8000_0000h) != 0}.until_do {
head := head << 1;
@@ -614,7 +614,7 @@ Section Public
result
)
[ +? {item upper < 0}; ];
-
+
- shift_left n:INTEGER <-
// Shift bits of magnitude by `n' position left. (Note that no bit can
// be lost because the `storage' area is automatically extended when
@@ -623,11 +623,11 @@ Section Public
( + left,right: INTEGER_8;
+ word_shift:INTEGER;
+ new_value:UINTEGER_32;
-
+
(last != 0).if {
word_shift := n >> 5;
- left := (n & 1Fh).to_integer_8; // Optimistic prediction
- right := 32 - left;
+ left := (n & 1Fh).to_integer_8; // Optimistic prediction
+ right := 32 - left;
((last >> right) = 0).if {
storage.add 0 first (word_shift+1);
word_shift.to (upper-1) do { i:INTEGER;
@@ -644,20 +644,20 @@ Section Public
new_value := item word_shift << left;
storage.put new_value to word_shift;
};
- };
+ };
);
-
+
- shift_right n:INTEGER <-
- // Shift bits of magnitude by `n' position right.
+ // Shift bits of magnitude by `n' position right.
[ -? {n > 0}; ]
( + left,right: INTEGER_8;
+ word_right:INTEGER;
+ new_value:UINTEGER_32;
-
+
(last != 0).if {
word_right := n >> 5;
- right := (n & 1Fh).to_integer_8; // Optimistic prediction
- left := 32 - right;
+ right := (n & 1Fh).to_integer_8; // Optimistic prediction
+ left := 32 - right;
word_shift.to (upper-1) do { i:INTEGER;
new_value := (item (i+1) << left) | (item i >> right);
storage.put new_value to (i - word_shift);
@@ -668,28 +668,28 @@ Section Public
} else {
storage.put new_value to (upper - word_shift);
storage.remove_tail word_shift;
- };
- };
+ };
+ };
);
-
- - multiply_and_subtract (u1, qhat: INTEGER, d_storage: FAST_ARRAY(UINTEGER_32),
+
+ - multiply_and_subtract (u1, qhat: INTEGER, d_storage: FAST_ARRAY(UINTEGER_32),
d_offset:INTEGER, r_storage:FAST_ARRAY(UINTEGER_32),r_offset, length: INTEGER):BOOLEAN <-
// Only used by `divide'.
[ -? {qhat != 0}; ]
- ( + i, j, jmax, m1, m2: INTEGER;
+ ( + i, j, jmax, m1, m2: INTEGER;
+ dec,result:BOOLEAN;
-
+
(qhat = 1).if {
i := d_offset;
j := r_offset;
- jmax := r_offset + length;
+ jmax := r_offset + length;
{j = jmax}.until_do {
(dec).if {
- x_32 := r_storage.item j - d_storage.item i - 1;
+ x_32 := r_storage.item j - d_storage.item i - 1;
dec := x_32 >= r_storage.item j;
r_storage.put x_32 to j;
} else {
- x_32 := r_storage.item j - d_storage.item i;
+ x_32 := r_storage.item j - d_storage.item i;
dec := x_32 > r_storage.item j;
r_storage.put x_32 to j;
};
@@ -700,11 +700,11 @@ Section Public
(u1 = 0).if {
result := TRUE;
} else {
- x_32 := r_storage.item j - 1;
+ x_32 := r_storage.item j - 1;
result := r_storage.item j = 0;
r_storage.put x_32 to j;
- ? {! result};
- };
+ ? {! result};
+ };
};
} else {
i := d_offset;
@@ -715,11 +715,11 @@ Section Public
m2 := (x & 0FFFF_FFFFh).to_uinteger_32;
m1 := (x >> 32).to_uinteger_32;
(dec).if {
- x_32 := r_storage.item j - m2 - 1;
+ x_32 := r_storage.item j - m2 - 1;
dec := x_32 >= r_storage.item j;
r_storage.put x_32 to j;
} else {
- x_32 := r_storage.item j - m2;
+ x_32 := r_storage.item j - m2;
dec := x_32 > r_storage.item j;
r_storage.put x_32 to j;
};
@@ -730,7 +730,7 @@ Section Public
(u1 = 0).if {
result := TRUE;
} else {
- x_32 := r_storage.item j - m1 - 1;
+ x_32 := r_storage.item j - m1 - 1;
result := x_32 >= r_storage.item j;
r_storage.put x_32 to j;
};
@@ -739,7 +739,7 @@ Section Public
}.elseif {u1 = 0} then {
result := TRUE;
} else {
- x_32 := r_storage.item j - m1;
+ x_32 := r_storage.item j - m1;
result := x_32 > r_storage.item j;
r_storage.put x_32 to j;
};
@@ -751,15 +751,15 @@ Section Public
r_storage:FAST_ARRAY(UINTEGER_32),r_offset, length:INTEGER):BOOLEAN <-
// Only used by `divide'.
// `old_u1' is the value of `u1' before `multiply_and_subtract'.
- ( + i, j, jmax:INTEGER;
+ ( + i, j, jmax:INTEGER;
+ inc,result:BOOLEAN;
-
+
i := d_offset;
j := r_offset;
jmax := r_offset + length;
- {j = jmax}.until_do {
+ {j = jmax}.until_do {
(inc).if {
- x_32 := r_storage.item j + d_storage.item i + 1;
+ x_32 := r_storage.item j + d_storage.item i + 1;
inc := x_32 <= r_storage.item j;
r_storage.put x_32 to j;
} else {
@@ -786,19 +786,19 @@ Section Public
-? {other != NULL};
-? {quotient != NULL};
-? {remainder != NULL};
- ]
- ( + v:SELF;
+ ]
+ ( + v:SELF;
v := other.twin;
v.multiply quotient;
v.add remainder;
Self == v
);
-
+
- divide_to (other, quotient, remainder:SELF) <-
// Euclidian division.
// Calculates the `quotient' and `remainder' of `Current'
// divided by `other'. (The contents of `Current' and `other' are
- // not changed.)
+ // not changed.)
// Note: Uses Algorithm D in Knuth
[ -? {! other.is_zero};
-? {quotient != NULL};
@@ -809,43 +809,43 @@ Section Public
-? {remainder != Self};
]
( + cmp, shift, nlen, dlen, qlen, j, k, v1, v2, u1, u2, rem: INTEGER;
- + qhat, rhat, v2qhat_1, v2qhat_2, d_offset: INTEGER;
+ + qhat, rhat, v2qhat_1, v2qhat_2, d_offset: INTEGER;
+ q_storage, r_storage, d_storage:FAST_ARRAY(UINTEGER_32);
+ q_capacity, r_capacity:INTEGER;
+ borrow:BOOLEAN;
-
+
(is_zero).if {
// Dividend is zero:
quotient.set_with_zero;
remainder.set_with_zero;
} else {
cmp := compare other;
- (cmp < 0).if {
+ (cmp < 0).if {
// Dividend less than divisor:
quotient.set_with_zero;
- remainder.copy Self;
+ remainder.copy Self;
}.elseif {cmp = 0} then {
- // Dividend equal to divisor:
+ // Dividend equal to divisor:
quotient.from_integer 1;
remainder.set_with_zero;
}.elseif {other.count = 1} then {
// Special case one word divisor:
- quotient.copy Self;
+ quotient.copy Self;
remainder.storage.clear;
- rem := quotient.divide_one_word (other.first);
- remainder.add_last rem;
+ rem := quotient.divide_one_word (other.first);
+ remainder.add_last rem;
} else {
// Copy divisor storage to protect divisor:
register1.copy other;
remainder.copy Self;
// D1 normalize the divisor:
- shift := register1.normalize_shift;
+ shift := register1.normalize_shift;
(shift != 0).if {
remainder.shift_left shift;
};
- // D2 Initialize j:
+ // D2 Initialize j:
r_storage := remainder.storage;
- r_capacity := remainder.capacity;
+ r_capacity := remainder.capacity;
nlen := remainder.count; // To avoid invariant class violation
remainder.set_with_zero;
d_storage := register1.storage;
@@ -877,11 +877,11 @@ Section Public
};
// To avoid invariant violation on quotient
quotient.set_with_zero;
- {k < 0}.until_do {
+ {k < 0}.until_do {
j := j - 1; // D3 Calculate qhat - estimate qhat
(u1 = v1).if {
qhat := ~0;
- } else {
+ } else {
x := (u1.to_uinteger_64 << 32) | u2;
rhat := (x % v1).to_uinteger_32;
qhat := (x / v1).to_uinteger_32; // Correct qhat
@@ -928,10 +928,10 @@ Section Public
(borrow).if {
// D6 Add back
borrow := add_back(u1, d_storage, d_offset, r_storage, j - dlen + 2, dlen);
- ? {borrow};
+ ? {borrow};
q_storage.put (qhat - 1) to k;
} else {
- q_storage.put qhat to k;
+ q_storage.put qhat to k;
};
};
// D7 loop on j
@@ -946,24 +946,24 @@ Section Public
};
quotient.set_all(q_storage, q_capacity, qlen, 0, FALSE);
// Remove leading zero of remainder
- j := dlen - 1;
+ j := dlen - 1;
{(j < 0) || {r_storage.item j != 0}}.until_do {
j := j - 1;
};
j := j + 1;
? {j >= 0};
(j = 0).if {
- ? {remainder.is_zero};
+ ? {remainder.is_zero};
} else {
remainder.set_all(r_storage, r_capacity, j, 0, FALSE);
};
// D8 Unnormalize:
(shift > 0).if {
remainder.shift_right shift;
- };
+ };
};
};
)
- [
- ? {is_a_good_divide(other, quotient, remainder)};
+ [
+ ? {is_a_good_divide(other, quotient, remainder)};
];
diff --git a/lib/standard/number/integer/uinteger_cpu.li b/lib/standard/number/integer/uinteger_cpu.li
index 5382811..87d040b 100644
--- a/lib/standard/number/integer/uinteger_cpu.li
+++ b/lib/standard/number/integer/uinteger_cpu.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded UINTEGER_CPU;
- export := UINTEGER_64, POINTER;
-
+
- comment := "Unsigned integer (variable size according to CPU word).";
-
+
- type := `unsigned long`;
- default := (0.to_raw_uinteger_cpu);
Section Insert
-
+
- parent_unsigned_integer:UNSIGNED_INTEGER := UNSIGNED_INTEGER;
-
+
Section Public
-
+
- object_size:INTEGER <- `sizeof(unsigned long)`:INTEGER;
//
// Range.
//
-
+
- maximum:UINTEGER_64 := (~ 0.to_uinteger_cpu).to_raw_uinteger_64;
-
+
//
// Conversion with test.
//
-
+
- to_uinteger_64:UINTEGER_64 <- to_raw_uinteger_64;
-
+
- to_pointer:POINTER <- to_raw_pointer;
\ No newline at end of file
diff --git a/lib/standard/number/real/real.li b/lib/standard/number/real/real.li
index 54277d0..842d461 100644
--- a/lib/standard/number/real/real.li
+++ b/lib/standard/number/real/real.li
@@ -19,9 +19,9 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL;
-
+
- export :=
REAL_32, REAL_64, REAL_80,
REAL_16_16, REAL_24_8, REAL_26_6,
@@ -29,28 +29,28 @@ Section Header
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag, 2007 Xavier Oswald";
- comment := "Generic real number.";
-
+
- type := `float`;
- default := 0.0;
-
+
- lip <-
(
add_lib "-lm";
);
Section Insert
-
+
- inherit_numeric:NUMERIC := NUMERIC;
-
+
Section Public
-
+
- Self:SELF '+' Left 80 other:SELF :SELF <- `@Self + @other`:SELF;
- - bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
+ - bound_test low:INTEGER_64 to up:UINTEGER_64 :BOOLEAN <-
(
TRUE
);
-
+
- pi :SELF <- 3.14159265358979323846;
// Pi number
@@ -78,7 +78,7 @@ Section Public
Self.pow exp
);
- - Self:SELF '^' Right 120 exp:SELF :SELF <-
+ - Self:SELF '^' Right 120 exp:SELF :SELF <-
// Power
(
Self.pow exp
@@ -87,46 +87,46 @@ Section Public
//
// Convertion format with test.
//
-
+
- floor:INTEGER <-
// Greatest integral value no greater than Current.
- (
+ (
to_raw_integer
);
-
+
- ceiling:INTEGER <-
// Smallest integral value no smaller than Current.
- (
+ (
(Self + 0.9999).floor
);
-
+
- round:INTEGER <-
// Rounded integral value.
(
(Self + 0.5).floor
);
-
+
- truncated_to_integer:INTEGER <- floor;
// Integer part (largest absolute value no greater than Current).
-
+
//
// Comparaison.
//
-
+
- Self:SELF '~=' other:SELF :BOOLEAN <-
// Equal, close to 0.001
(
(Self - other).abs < 0.001
);
-
+
- is_not_a_number:BOOLEAN <- deferred;
-
+
- is_infinity:BOOLEAN <- deferred;
-
+
//
// Print.
//
-
+
- append_in buffer:STRING <-
// Append `Self' decimal representation in `buffer' with 4 decimal
(
@@ -141,31 +141,31 @@ Section Public
append_in result;
result
);
-
+
- append_in buffer:STRING format n:INTEGER decimal d:INTEGER <-
(
append_in buffer format n with ' ' decimal d;
);
-
+
- append_in buffer:STRING format n:INTEGER with c:CHARACTER decimal d:INTEGER <-
- // String of the number in base 10 with `c' replacing blanck
- [
+ // String of the number in base 10 with `c' replacing blanck
+ [
-? {n >= 3};
]
( + old_count:INTEGER;
-
+
old_count := buffer.count;
append_in buffer decimal d;
buffer.insert c to old_count on (n - (buffer.count - old_count));
);
-
+
- append_in buffer:STRING decimal n:INTEGER <-
// String of the number in base 10 with 4 decimal
( + val:SELF;
- + val_10:INTEGER;
+ + val_10:INTEGER;
+ char:CHARACTER;
+ i:INTEGER;
-
+
get_map Self;
// Sign.
(sign).if {
@@ -173,9 +173,9 @@ Section Public
} else {
buffer.add_last '-';
val := - Self;
- };
+ };
(is_zero).if {
- // Zero case.
+ // Zero case.
buffer.add_last '0';
}.elseif {is_infinite} then {
// Infinite case.
@@ -183,38 +183,38 @@ Section Public
}.elseif {is_nan} then {
// Nan case.
buffer.append "Nan";
- } else {
+ } else {
// Value case = 1.mantisse x 2^(exp-127)
(val > INTEGER.maximum.to_real_32).if {
scientific_append_in buffer;
} else {
- val_10 := val.to_integer;
- val_10.append_in buffer;
- val := val - val_10;
+ val_10 := val.to_integer;
+ val_10.append_in buffer;
+ val := val - val_10;
(n != 0).if {
buffer.add_last '.';
i := n;
- {(val != 0) && {i > 0}}.while_do {
+ {(val != 0) && {i > 0}}.while_do {
val := val * 10;
val_10 := val.to_integer;
char := val_10.decimal_digit;
buffer.add_last char;
val := val - val_10;
i := i - 1;
- };
+ };
buffer.extend_multiple '0' by i;
};
};
- };
+ };
);
-
- - scientific_append_in buffer:STRING <-
+
+ - scientific_append_in buffer:STRING <-
// Scientific number representation
( + val:SELF;
+ val_10:INTEGER;
+ exp_10:INTEGER;
+ char:CHARACTER;
-
+
get_map Self;
// Sign.
(sign).if {
@@ -222,7 +222,7 @@ Section Public
} else {
buffer.add_last '-';
val := - Self;
- };
+ };
(is_zero).if {
// Zero case.
buffer.add_last '0';
@@ -247,7 +247,7 @@ Section Public
buffer.add_last char;
buffer.add_last '.';
val := val - val_10;
- {val != 0}.while_do {
+ {val != 0}.while_do {
val := val * 10;
val_10 := val.to_integer;
char := val_10.decimal_digit;
@@ -258,19 +258,19 @@ Section Public
exp_10.append_in buffer;
};
);
-
+
- append_in buffer:STRING format_c fmt:ABSTRACT_STRING <-
- ( + nc_buf,nc_fmt:NATIVE_ARRAY(CHARACTER);
+ ( + nc_buf,nc_fmt:NATIVE_ARRAY(CHARACTER);
+ old_count,cap:INTEGER;
-
+
old_count := buffer.count;
cap := buffer.capacity - old_count;
nc_buf := buffer.to_external + old_count;
nc_fmt := fmt.to_external;
`snprintf(@nc_buf, at cap, at nc_fmt, at Self)`;
buffer.restore_after_external;
- );
-
+ );
+
- print_decimal s:INTEGER <-
// print with `s' decimal
(
@@ -278,17 +278,17 @@ Section Public
append_in string_tmp decimal s;
string_tmp.print;
);
-
+
- print_int i:INTEGER decimal d:INTEGER <-
(
print_format (i+d+1) decimal d;
);
-
+
- print_format s:INTEGER decimal d:INTEGER <-
[
-? {s > d};
]
- (
+ (
print_format s with ' ' decimal d;
);
@@ -296,16 +296,16 @@ Section Public
[
-? {s > d};
]
- (
+ (
string_tmp.clear;
append_in string_tmp format s with c decimal d;
string_tmp.print;
);
-
+
- print_format_c fmt:ABSTRACT_STRING <-
(
string_tmp.clear;
append_in string_tmp format_c fmt;
string_tmp.print;
);
-
+
diff --git a/lib/standard/number/real/real_32.li b/lib/standard/number/real/real_32.li
index 83020d4..7c2c3ce 100644
--- a/lib/standard/number/real/real_32.li
+++ b/lib/standard/number/real/real_32.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_32;
- export := REAL, REAL_64, REAL_80;
-
+
- comment := "Float (C `float' mapping).";
-
+
- type := `float`;
- default := (0.to_raw_real_32);
-
+
Section Insert
-
+
- parent_float_map32:FLOAT_MAP32 := FLOAT_MAP32;
- parent_float_real:FLOAT_REAL := FLOAT_REAL;
-
+
diff --git a/lib/standard/number/real/real_64.li b/lib/standard/number/real/real_64.li
index 44d9ec0..28eb47f 100644
--- a/lib/standard/number/real/real_64.li
+++ b/lib/standard/number/real/real_64.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_64;
- export := REAL, REAL_80;
-
+
- comment := "Float (C `double' mapping).";
-
+
- type := `double`;
- default := (0.to_raw_real_64);
-
+
Section Insert
-
+
- parent_float_map64:FLOAT_MAP64 := FLOAT_MAP64;
-
+
- parent_float_real:FLOAT_REAL := FLOAT_REAL;
-
-
-
-
+
+
+
+
diff --git a/lib/standard/number/real/real_80.li b/lib/standard/number/real/real_80.li
index 010d493..ed47fa0 100644
--- a/lib/standard/number/real/real_80.li
+++ b/lib/standard/number/real/real_80.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded REAL_80;
- export := REAL;
-
+
- comment := "Float 80 bits (C `long double' mapping).";
-
+
- type := `long double`;
- default := (0.to_raw_real_80);
-
+
Section Insert
-
+
- parent_float_map80:FLOAT_MAP80 := FLOAT_MAP80;
- parent_float_real:FLOAT_REAL := FLOAT_REAL;
-
+
diff --git a/lib/standard/property/comparable.li b/lib/standard/property/comparable.li
index d4df7bc..787a70b 100644
--- a/lib/standard/property/comparable.li
+++ b/lib/standard/property/comparable.li
@@ -19,22 +19,22 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COMPARABLE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := " All classes handling COMPARABLE objects with a total order\
\relation should inherit from this class.";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
- - Self:SELF '==' Right 60 other:E :BOOLEAN <-
+
+ - Self:SELF '==' Right 60 other:E :BOOLEAN <-
( + result:BOOLEAN;
+ same:SELF;
same ?= other;
@@ -53,11 +53,11 @@ Section Public
// Is `self' less than or equal `other'?
(
+ result:BOOLEAN;
-
+
? { other != NULL };
result := ! (other < Self);
? { result = ((Self < other) | == other)};
-
+
result
);
@@ -74,7 +74,7 @@ Section Public
?{ other != NULL };
! (Self < other)
);
-
+
- in_range lower:SELF to upper:SELF :BOOLEAN <-
// Return true if `self' is in range [`lower'..`upper']
(
@@ -94,7 +94,7 @@ Section Public
} else {
result := 0;
};
-
+
? { (result = 0) = ( == other)};
? { (result = -1) = (Self < other)};
? { (result = 1) = (Self > other)};
@@ -106,27 +106,27 @@ Section Public
// Minimum of `self' and `other'.
(
+ result:SELF;
-
+
?{ other != NULL };
( Self <= other ).if {
result := Self;
} else {
result := other;
};
-
+
? { (result <= Self) && { result <= other}};
? { (compare result = 0) || { other.compare result = 0 }};
-
+
result
);
-
-
+
+
- max other:SELF :SELF <-
// Maximum of `self' and `other'.
(
+ result:SELF;
?{ other != NULL };
-
+
( Self >= other ).if {
result := Self;
} else {
diff --git a/lib/standard/property/hashable.li b/lib/standard/property/hashable.li
index 7e136e6..7db6847 100644
--- a/lib/standard/property/hashable.li
+++ b/lib/standard/property/hashable.li
@@ -19,20 +19,20 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := HASHABLE;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :=" .";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
- hash_code:INTEGER <-
// The hash-code value of `Current'.
(
diff --git a/lib/standard/property/safe_equal.li b/lib/standard/property/safe_equal.li
index 6b851b0..d3e215d 100644
--- a/lib/standard/property/safe_equal.li
+++ b/lib/standard/property/safe_equal.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SAFE_EQUAL(E);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment :="The goal of this class is to share the definition of \
\feature `safe_equal'. Feature `safe_equal' compares \
\two arguments of type E, by calling `==' only \
\and only if both arguments have the `same_type'..";
-
+
Section Inherit
-
+
- parent:OBJECT := OBJECT;
-
+
Section Public
-
+
- safe_equal (e1, e2:E) :BOOLEAN <-
// In order to avoid run-time type errors, feature `safe_equal' call
// `==' only when `e1' and `e2' have exactly the same `generating_type'.
@@ -44,7 +44,7 @@ Section Public
// allocation of some reference type during the comparison).
( /*
+ result:BOOLEAN;
-
+
( e1.is_basic_expanded_type).if { then
result := (e1 = e2);
}.elseif {e1.is_expanded_type} then {
@@ -55,10 +55,10 @@ Section Public
}.elseif {e1.generating_type = e2.generating_type} then {
result := e1 == e2;
}; // end if
-
+
result
*/
(e1=e2) || {(e1!=NULL) && {e1==e2}}
);
-
+
diff --git a/lib/standard/property/traversable.li b/lib/standard/property/traversable.li
index c47a9cf..1aeaa68 100644
--- a/lib/standard/property/traversable.li
+++ b/lib/standard/property/traversable.li
@@ -19,18 +19,18 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TRAVERSABLE(V);
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "A `TRAVERSABLE(E_)' is a finite readable sequence of objects of type E_.";
-
+
// For instance, `COLLECTION's and `STRING's are `TRAVERSABLE'.
//
- // A good performance should always be obtained by sequentially acessing a
- // `TRAVERSABLE' with increasing indexes (from `lower' to `upper'), as
+ // A good performance should always be obtained by sequentially acessing a
+ // `TRAVERSABLE' with increasing indexes (from `lower' to `upper'), as
// demonstrated in the following code snippet :
//
// i := a_traversable.lower;
@@ -39,20 +39,20 @@ Section Header
// i := i + 1;
// };
//
- // Other accessing methods (including random access and sequential access
- // from `upper' to `lower') may or may not lead to acceptable performance,
+ // Other accessing methods (including random access and sequential access
+ // from `upper' to `lower') may or may not lead to acceptable performance,
// depending on the particular implementation of `TRAVERSABLE'.
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
//
// Indexing:
//
-
+
- lower:INTEGER <-
// Minimum index.
//
@@ -69,23 +69,23 @@ Section Public
(
deferred;
0
- );
-
+ );
+
- valid_index i:INTEGER :BOOLEAN <-
// True when `i' is valid (i.e., inside actual bounds).
//
// See also `lower', `upper', `item'.
- (
+ (
(lower <= i) && {i <= upper}
)
- [
+ [
"Definition." +? {Result = ((lower <= i) & (i <= upper))};
];
//
// Counting:
//
-
+
- count:INTEGER <-
// Number of available indices.
//
@@ -108,11 +108,11 @@ Section Public
[
"Definition." +? {Result = (count = 0)};
];
-
+
//
// Accessing:
//
-
+
- item i:INTEGER :V <-
// Item at the corresponding index `i'.
//
@@ -135,7 +135,7 @@ Section Public
(
item lower
)
- [
+ [
"Definition." +? {Result = item lower};
];
@@ -143,7 +143,7 @@ Section Public
// The `last' item.
//
// See also `first', `item'.
- [
+ [
-? {! is_empty};
]
(
@@ -152,7 +152,7 @@ Section Public
[
"Definition." +? {Result = item upper};
];
-
+
//
// Iterate:
//
diff --git a/lib/standard/string/character.li b/lib/standard/string/character.li
index 2a9d8e3..1517504 100644
--- a/lib/standard/string/character.li
+++ b/lib/standard/string/character.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded CHARACTER;
- export := INTEGER_8, CHAR_UNICODE;
@@ -30,25 +30,25 @@ Section Header
- type := `char`;
- default := '\0';
-
+
Section Insert
-
+
- parent_character_ref:CHARACTER_REF := CHARACTER_REF;
-
+
Section Public
-
+
- in_range lower:SELF to upper:SELF :BOOLEAN <- ((Self >= lower) && {Self<= upper});
-
+
//
// General :
//
-
+
- object_size:INTEGER := 1;
-
+
- maximum:INTEGER := 255;
-
+
- minimum:INTEGER := 0;
-
+
- to_integer:INTEGER <-
// Sign-extended conversion.
( + result:INTEGER;
@@ -56,7 +56,7 @@ Section Public
? {result.in_range (INTEGER_8.minimum) to (INTEGER_8.maximum)};
result
);
-
+
- code:INTEGER_8 <-
// ASCII code of Current.
// No Sign-extended conversion.
@@ -65,22 +65,22 @@ Section Public
//? {result.in_range minimum to maximum};
result
);
-
+
- to_integer_8:INTEGER_8 <- CONVERT(CHARACTER,INTEGER_8).on Self;
// Auto-cast.
-
+
- to_uinteger_8:UINTEGER_8 <- CONVERT(CHARACTER,UINTEGER_8).on Self;
-
+
//
// Print.
//
-
+
- print <- IO.put_character Self;
-
+
//
// Switch case :
//
-
+
- when value:CHARACTER then block:{} :CHARACTER <-
(
(Self=value).if block;
@@ -92,7 +92,7 @@ Section Public
((Self = value1) || {Self = value2}).if block;
Self
);
-
+
- when first_value:CHARACTER to last_value:CHARACTER then block:{} :CHARACTER <-
( ? {first_value<=last_value};
@@ -103,7 +103,7 @@ Section Public
//
// Looping.
//
-
+
- to limit_up:SELF do blc:{CHARACTER;} <-
(
(Self<=limit_up).if {
@@ -111,7 +111,7 @@ Section Public
(Self+1.to_character).to limit_up do blc;
};
);
-
+
- downto limit_down:SELF do blc:{CHARACTER;} <-
(
(Self>=limit_down).if {
@@ -119,7 +119,7 @@ Section Public
(Self-1.to_character).downto limit_down do blc;
};
);
-
+
- to limit_up:SELF by step:SELF do blc:{CHARACTER;} <-
(
(Self<=limit_up).if {
@@ -127,7 +127,7 @@ Section Public
(Self+step.to_character).to limit_up by step do blc;
};
);
-
+
- downto limit_down:SELF by step:SELF do blc:{CHARACTER;} <-
(
(Self>=limit_down).if {
@@ -135,33 +135,33 @@ Section Public
(Self-step.to_character).downto limit_down by step do blc;
};
);
-
+
//
// Binary operator :
//
-
+
- Self:SELF '+' other:CHARACTER :CHARACTER <- (code+other.code).to_character;
-
+
- Self:SELF '-' other:CHARACTER :CHARACTER <- (code-other.code).to_character;
- Self:SELF '-!' other:CHARACTER :INTEGER <- code - other.code;
-
+
- Self:SELF '+#' other:INTEGER :CHARACTER <- (code + other).to_character;
- Self:SELF '-#' other:INTEGER :CHARACTER <- (code - other).to_character;
-
+
- Self:SELF '<' other:SELF :BOOLEAN <- ( code < other.code );
// Comparison using `code'.
-
+
- Self:SELF '<=' other:SELF :BOOLEAN <- ( code <= other.code );
// Comparison using `code'.
-
+
- Self:SELF '>' other:SELF :BOOLEAN <- ( code > other.code );
// Comparison using `code'.
-
+
- Self:SELF '>=' other:SELF :BOOLEAN <- ( code >= other.code );
// Comparison using `code'.
-
+
- decimal_value:INTEGER <-
// Gives the value of a decimal digit.
( + result:INTEGER;
@@ -170,7 +170,7 @@ Section Public
? {result.in_range 0 to 9};
result
);
-
+
- binary_value:INTEGER <-
// Gives the value of a binary digit.
( + result:INTEGER;
@@ -179,7 +179,7 @@ Section Public
? {result.in_range 0 to 1};
result
);
-
+
- octal_value:INTEGER <-
// Gives the value of an octal digit.
( + result:INTEGER;
@@ -188,7 +188,7 @@ Section Public
? {result.in_range 0 to 7};
result
);
-
+
- hexadecimal_value:INTEGER <-
// Gives the value of an hexadecimal digit.
( + result:INTEGER;
@@ -203,7 +203,7 @@ Section Public
? {result.in_range 0 to 15};
result
);
-
+
- same_as other:CHARACTER :BOOLEAN <-
// Case insensitive comparison.
// No difference between upper/lower case letters.
@@ -222,7 +222,7 @@ Section Public
};
result
);
-
+
- to_upper:SELF <-
// Conversion to the corresponding upper case.
( + result:SELF;
@@ -233,7 +233,7 @@ Section Public
};
result
);
-
+
- to_lower:SELF <-
// Conversion to the corresponding lower case.
( + result:SELF;
@@ -244,7 +244,7 @@ Section Public
};
result
);
-
+
- is_letter:BOOLEAN <-
// Is it a letter ('a' .. 'z' or 'A' .. 'Z') ?
( + result:BOOLEAN;
@@ -256,7 +256,7 @@ Section Public
? {result = (in_range 'A' to 'Z' | in_range 'a' to 'z')};
result
);
-
+
- is_digit:BOOLEAN <-
// Belongs to '0'..'9'.
( + result:BOOLEAN;
@@ -266,7 +266,7 @@ Section Public
? {result = in_range '0' to '9'};
result
);
-
+
- is_binary_digit:BOOLEAN <-
// Belongs to '0'..'1'.
( + result:BOOLEAN;
@@ -274,7 +274,7 @@ Section Public
? {result = in_range '0' to '1'};
result
);
-
+
- is_octal_digit:BOOLEAN <-
// Belongs to '0'..'7'.
( + result:BOOLEAN;
@@ -284,7 +284,7 @@ Section Public
? {result = in_range '0' to '7'};
result
);
-
+
- is_hexadecimal_digit:BOOLEAN <-
// Is it one character of "0123456789abcdefABCDEF" ?
( + result:BOOLEAN;
@@ -298,7 +298,7 @@ Section Public
? {result = ("0123456789abcdefABCDEF".has Self)};
result
);
-
+
- is_lower:BOOLEAN <-
// Is it some lowercase letter ('a'..'z')?
( + result:BOOLEAN;
@@ -307,7 +307,7 @@ Section Public
};
result
);
-
+
- is_upper:BOOLEAN <-
// Is it some uppercase letter ('A'..'Z')?
( + result:BOOLEAN;
@@ -316,14 +316,14 @@ Section Public
};
result
);
-
+
- is_separator:BOOLEAN <-
// 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'}
);
-
+
- is_letter_or_digit:BOOLEAN <-
// Is it a letter (see `is_letter') or a digit (see `is_digit') ?
( + result:BOOLEAN;
@@ -331,35 +331,35 @@ Section Public
? {result = (is_letter | is_digit)};
result
);
-
+
- is_identifier:BOOLEAN <-
// Is it a letter or a digit or '_' ?
(
(is_letter_or_digit) || {Self = '_'}
);
-
+
- is_ascii:BOOLEAN := TRUE;
// Is character a 8-bit ASCII character?
-
+
- is_bit:BOOLEAN <- ((Self='0') || {Self='1'});
// True for `0' and `1'.
-
+
- next:CHARACTER <-
// Give the next character (the following `code');
( ? {code<255};
(code + 1).to_character
);
-
+
- previous:CHARACTER <-
// Give the previous character (the `code' before);
( ? {code > 0};
(code - 1).to_character
);
-
+
//
// Conversions:
//
-
+
- to_string:STRING <-
// Create a new STRING containing only this character.
(
@@ -385,13 +385,13 @@ Section Public
? {result.count = 2};
result
);
-
+
- to_hexadecimal_in str:STRING <-
// Append the equivalent of `to_hexadecimal' at the end of
// `str'. Thus you can save memory because no other
// STRING is allocate for the job.
( + c, old_count:INTEGER;
-
+
old_count:=str.count;
c := code >> 4;
(c<10).if {
@@ -407,11 +407,11 @@ Section Public
};
? {str.count = (2 + old_count)};
);
-
+
//
// Miscellaneous:
//
-
+
- is_alpha:BOOLEAN <-
// See `is_letter' (yes this is just a call to `is_letter').
// Isn't `is_letter' better English ;-)
@@ -420,12 +420,12 @@ Section Public
? {result = is_letter};
result
);
-
+
//
// Hashing :
//
-
+
- hash_code: INTEGER <- code;
-
-
+
+
diff --git a/lib/standard/string/string.li b/lib/standard/string/string.li
index f3e7187..2f76595 100644
--- a/lib/standard/string/string.li
+++ b/lib/standard/string/string.li
@@ -76,7 +76,7 @@ Section Public
// characters of storage.
( ? {needed_capacity >= 0};
(needed_capacity > 0).if {
- (capacity < needed_capacity).if {
+ (capacity < needed_capacity).if {
storage := NATIVE_ARRAY(CHARACTER).create needed_capacity;
capacity := needed_capacity;
};
diff --git a/lib/standard/time/date.li b/lib/standard/time/date.li
index 85bed69..024e0a0 100644
--- a/lib/standard/time/date.li
+++ b/lib/standard/time/date.li
@@ -45,9 +45,9 @@ Section Private
(
CONVERT(UINTEGER_32,SELF).on i
);
-
+
Section Public
-
+
- Self:SELF '>' Right 60 other:SELF :BOOLEAN <- to_raw > other.to_raw;
- Self:SELF '<' Right 60 other:SELF :BOOLEAN <- to_raw < other.to_raw;
diff --git a/lib/standard/time/time.li b/lib/standard/time/time.li
index c5a1a01..3b4f127 100644
--- a/lib/standard/time/time.li
+++ b/lib/standard/time/time.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded TIME;
- copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
+
- comment := "Time";
-
+
- type := `unsigned long`;
-
+
- default := `0`:TIME;
-
+
Section Insert
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Private
-
+
- to_raw:UINTEGER_32 <-
(
CONVERT(SELF, UINTEGER_32).on Self
@@ -47,12 +47,12 @@ Section Public
(
(to_raw >> 24).to_uinteger_8
);
-
+
- minute:UINTEGER_8 <-
(
((to_raw & 0FF0000h) >> 16).to_uinteger_8
);
-
+
- second:UINTEGER_8 <-
(
((to_raw & 0FF00h) >> 8).to_uinteger_8
@@ -62,73 +62,73 @@ Section Public
(
(to_raw & 0FFh).to_uinteger_8
);
-
+
Section Public
-
+
- Self:SELF '>' Right 60 other:SELF :BOOLEAN <- to_raw > other.to_raw;
-
+
- Self:SELF '<' Right 60 other:SELF :BOOLEAN <- to_raw < other.to_raw;
-
+
- Self:SELF '>=' Right 60 other:SELF :BOOLEAN <- to_raw >= other.to_raw;
-
+
- Self:SELF '<=' Right 60 other:SELF :BOOLEAN <- to_raw <= other.to_raw;
-
- - to_csecond:INTEGER <- hour.to_integer * (60*60*100) +
- minute.to_integer * (60*100) +
- second.to_integer * 100 +
+
+ - to_csecond:INTEGER <- hour.to_integer * (60*60*100) +
+ minute.to_integer * (60*100) +
+ second.to_integer * 100 +
csecond;
-
- - Self:SELF '-' Right 60 other:SELF :SELF <-
- (
+
+ - Self:SELF '-' Right 60 other:SELF :SELF <-
+ (
create_csecond (Self -# other)
);
-
+
// BSBS: A uniformiser -# +# ???
-
+
- Self:SELF '-#' Right 60 other:SELF :INTEGER <- to_csecond - other.to_csecond;
-
+
- Self:SELF '+#' Right 60 other:INTEGER :TIME <-
- (
+ (
create_csecond (to_csecond + other)
);
-
+
- create (h,m,s,cs:INTEGER) :TIME <-
( + t:UINTEGER_32;
? {h.in_range 0 to 23};
? {m.in_range 0 to 59};
? {s.in_range 0 to 59};
? {cs.in_range 0 to 99};
-
+
t := h.to_uinteger_32 <<24;
t := t | (m.to_uinteger_32 << 16);
t := t | (s.to_uinteger_32 << 8);
t := t | cs;
CONVERT(UINTEGER_32, SELF).on t
);
-
+
- create_csecond csec:INTEGER :SELF <-
( + h,m,s,cs,diff:INTEGER;
-
+
diff := csec;
h := diff / (60*60*100);
diff := diff % (60*60*100);
-
+
m := diff / (60*100);
diff := diff % (60*100);
-
+
s := diff / 100;
- cs := diff % 100;
-
+ cs := diff % 100;
+
create (h,m,s,cs)
);
-
+
- to_string:STRING <-
( + result:STRING;
result := STRING.create 8;
append_in result;
result
);
-
+
- append_in str:STRING <-
(
hour.append_in str format 2 with '0';
@@ -146,12 +146,12 @@ Section Public
str.add_last ':';
minute.append_in str format 2 with '0';
);
-
+
- update <-
(
- // JBJB A FAIRE !!
+ // JBJB A FAIRE !!
);
-
+
- print <-
(
to_string.print;
diff --git a/shorter/belinda.li b/shorter/belinda.li
index 052d54e..81c947d 100644
--- a/shorter/belinda.li
+++ b/shorter/belinda.li
@@ -11,100 +11,100 @@
\</head>\n\
\<body BGCOLOR=\"#FFFFFF\">\n\
\\n";
-
- - end :=
+
+ - end :=
"\n</body>\n\
\</html>\n";
-
+
//
// Syntax.
//
-
- - keyword :=
+
+ - keyword :=
"<strong><font color=\"#A020F0\">" + token + "</font></strong>";
- - keyword_section :=
+ - keyword_section :=
"<dd><strong><font color=\"#A020F0\">" + token + "</font></strong></dd>";
-
+
- operator :=
"<font color=\"#B8860B\">" + token + "</font>";
-
+
- keyprototype :=
" <font color=\"#008000\">"+token+"</font>";
- prototype :=
" <a href=\"" + token + ".html\">\
\<font color=\"#008000\">"+token+"</font></a>";
-
+
- comment_line :=
"<br><font FACE=\"Helvetica\" color=\"#000000\"><B>" + token + "</B></font>";
- comment_slot_line :=
"<dd>" + token + "</dd>";
-
+
- comment_new_line_extern := "<br>";
- comment_new_line_slot := "<br>";
-
- - slot :=
+
+ - slot :=
" <strong><font color=\"#0000FF\">" + token + "</font></strong> ";
-
+
- slot_style :=
"<dd><strong><font color=\"#FF0000\">" + token + " </font></strong>";
-
- - local := " "+token+" ";
- - block :=
- "<font color=\"#FF0000\">" + token + "</font>";
+ - local := " "+token+" ";
+
+ - block :=
+ "<font color=\"#FF0000\">" + token + "</font>";
+
+ - warning :=
+ "<font color=\"#FF0000\"><b>" + token + "</b></font><br>";
- - warning :=
- "<font color=\"#FF0000\"><b>" + token + "</b></font><br>";
-
//
// Java doc style.
- //
-
+ //
+
- title := "<td align=\"right\"><em><b>Lisaac<sup><font size=\"-2\">TM</font></sup> Platform</b></em></td><hr><h2>" + token + "</h2><hr>";
-
+
- table_begin := "<table summary=\"\" width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tbody><tr class=\"TableHeadingColor\" bgcolor=\"#ccccff\"><td colspan=\"2\"><font size=\"+2\"><b>" + token + "</b></font></td></tr>";
-
+
- table_item := "<tr class=\"TableRowColor\" bgcolor=\"white\"><td>" + token + "</td></tr>";
-
+
- table_slot_name := "<code><dt><b><a href=\"#"+token+"\">" + token + "</a></b></code>";
- table_slot_comment := "<dd>" + token;
-
+
- table_end := "</tbody></table> ";
-
- - sub_title := "</dl></p><table summary=\"\" width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tbody><tr class=\"TableHeadingColor\" bgcolor=\"#ccccff\"><td colspan=\"1\"><font size=\"+2\"><b>" + token + "</b></font></td></tr></tbody></table>";
-
+
+ - sub_title := "</dl></p><table summary=\"\" width=\"100%\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\"><tbody><tr class=\"TableHeadingColor\" bgcolor=\"#ccccff\"><td colspan=\"1\"><font size=\"+2\"><b>" + token + "</b></font></td></tr></tbody></table>";
+
- slot_title := "</dl><a name=\"" + token + "\"><!-- --></a><hr><h3>" + token + "</h3><dl>";
-
+
- subsub_title := "<dt><b><br>" + token + "</b></dt>";
-
+
- prototype_path := "<dd><code>" + token + "</code></dd>";
- identifier := "<em><b><font color=\"#000000\">" + token + "</font></em></b>";
-
+
- identifier_slot := "<code><b><a href=\"#"+token+"\">" + token + "</a></b></code>";
-
+
- parameter := "<dd>" + token + "</dd>";
- require := "<dd>" + token + "</dd>";
- ensure := "<dd>" + token + "</dd>";
- see := "<dd>" + token + "</dd>";
-
+
- description_en_francais := "<dd><em><strong><font color=\"#707070\">" + token + "</font></strong></em></dd>";
- necessite := "<dd><em><strong><font color=\"#707070\">" + token + "</font></strong></em></dd>";
- garantie := "<dd><em><strong><font color=\"#707070\">" + token + "</font></strong></em></dd>";
- - voir := "<dd><em><strong><font color=\"#707070\">" + token + "</font></strong></em></dd>";
-
+ - voir := "<dd><em><strong><font color=\"#707070\">" + token + "</font></strong></em></dd>";
+
- prototype_comment_light := "<strong>" + token + "</strong><hr>";
- prototype_comment := "<em>" + token + "</em>";
-
-
+
+
//
// Recursive Option.
//
-
+
- index :=
"<html><head><title>Lisaac Documentation</title></head>\n\
\<frameset cols=\"300,*\" border=\"3\" frameborder=\"yes\" \
@@ -121,9 +121,9 @@
\<h3>Frame Error</h3>\n\
\<p>This web site works only with frames.</p>\n\
\</noframes>\n\
- \</html>\n";
-
- - default :=
+ \</html>\n";
+
+ - default :=
"<html><head><title>Proto</title></head>\n\
\<body bgcolor=\"#FFFFFF\">\n\
\<H1>Lisaac documentation</H1>\n\
@@ -135,24 +135,24 @@
"<html><head><title>List Directories</title></head>\n\
\<body bgcolor=\"#FFFFFF\">\n\
\<a href=\"file_list.html\" target=\"file\">All</a>\n";
-
+
- directory_list_item :=
"<br><a href=\""+token+".html\" target=\"file\">"+token+"</a>\n";
-
- - directory_list_end :=
+
+ - directory_list_end :=
"</body>\n\
\</html>";
- file_list_begin :=
"<html><head><title>All Files</title></head>\n\
\<body bgcolor=\"#F0F0FF\" link=\"black\" vlink=\"black\">\n";
-
+
- file_list_item :=
"<br><a href=\""+token+".html\" target=\"content\">"+token+"</a>\n";
-
+
- file_list_end :=
"</body>\n\
\</html>";
-
+
diff --git a/shorter/html.li b/shorter/html.li
index 2d54772..c430a29 100644
--- a/shorter/html.li
+++ b/shorter/html.li
@@ -11,36 +11,36 @@
\</head>\n\
\<body BGCOLOR=\"#FFFFFF\">\n\
\\n";
-
- - end :=
+
+ - end :=
"\n</body>\n\
\</html>\n";
-
- - keyword :=
+
+ - keyword :=
"<strong><font color=\"#A020F0\">" + token + "</font></strong>";
- - keyword_section :=
+ - keyword_section :=
"<br><br><strong><font color=\"#A020F0\">" + token + "</font></strong>";
-
- - integer :=
+
+ - integer :=
"<font color=\"#A020F0\">" + token + "</font>";
-
- - character :=
+
+ - character :=
"<font color=\"#5F9EA0\">" + token + "</font>";
-
+
- string :=
"<font color=\"#BC8F8F\">" + token + "</font>";
-
+
- operator :=
"<font color=\"#B8860B\">" + token + "</font>";
-
+
- keyprototype :=
"<font color=\"#008000\">"+token+"</font>";
- prototype :=
"<a href=\"" + token + ".html\">\
\<font color=\"#008000\">"+token+"</font></a>";
-
+
- comment_header_line := " ";
- comment_line :=
@@ -48,29 +48,29 @@
- comment_slot_line :=
"<br><em><strong><font color=\"#707070\">        " + token + "</font></strong></em>";
-
- - comment :=
+
+ - comment :=
" ";
-
- - slot :=
+
+ - slot :=
"<strong><font color=\"#0000FF\">" + token + "</font></strong>";
- - slot_call :=
+ - slot_call :=
"<font color=\"#0000FF\">" + token + "</font>";
-
+
- slot_style :=
"<br><br><strong><font color=\"#FF0000\">    " + token + "</font></strong>";
-
- - block :=
- "<font color=\"#FF0000\">" + token + "</font>";
-
- - external :=
+
+ - block :=
+ "<font color=\"#FF0000\">" + token + "</font>";
+
+ - external :=
"<em><strong><font color=\"#A4DEA4\">" + token + "</font></strong></em>";
-
+
//
// Recursive Option.
//
-
+
- index :=
"<html><head><title>Lisaac Documentation</title></head>\n\
\<frameset cols=\"260,*\" border=\"3\" frameborder=\"yes\" \
@@ -87,9 +87,9 @@
\<h3>Frame Error</h3>\n\
\<p>This web site works only with frames.</p>\n\
\</noframes>\n\
- \</html>\n";
-
- - default :=
+ \</html>\n";
+
+ - default :=
"<html><head><title>Proto</title></head>\n\
\<body bgcolor=\"#FFFFFF\">\n\
\<H1>Lisaac documentation</H1>\n\
@@ -101,24 +101,24 @@
"<html><head><title>List Directories</title></head>\n\
\<body bgcolor=\"#FFFFFF\">\n\
\<a href=\"file_list.html\" target=\"file\">All</a>\n";
-
+
- directory_list_item :=
"<br><a href=\""+token+".html\" target=\"file\">"+token+"</a>\n";
-
- - directory_list_end :=
+
+ - directory_list_end :=
"</body>\n\
\</html>";
- file_list_begin :=
"<html><head><title>All Files</title></head>\n\
\<body bgcolor=\"#F0F0FF\" link=\"black\" vlink=\"black\">\n";
-
+
- file_list_item :=
"<br><a href=\""+token+".html\" target=\"content\">"+token+"</a>\n";
-
+
- file_list_end :=
"</body>\n\
\</html>";
-
+
diff --git a/shorter/html_raw.li b/shorter/html_raw.li
index bbeb4f5..ccc212d 100644
--- a/shorter/html_raw.li
+++ b/shorter/html_raw.li
@@ -11,36 +11,36 @@
\</head>\n\
\<body BGCOLOR=\"#FFFFFF\">\n\
\<pre>\n";
-
- - end :=
+
+ - end :=
"\n</body>\n\
\</html>\n";
-
- - keyword :=
+
+ - keyword :=
"<strong><font color=\"#A020F0\">" + token + "</font></strong>";
- - keyword_section :=
+ - keyword_section :=
"<strong><font color=\"#A020F0\">" + token + "</font></strong>";
-
- - integer :=
+
+ - integer :=
"<font color=\"#A020F0\">" + token + "</font>";
-
- - character :=
+
+ - character :=
"<font color=\"#5F9EA0\">" + token + "</font>";
-
+
- string :=
"<font color=\"#BC8F8F\">" + token + "</font>";
-
+
- operator :=
"<font color=\"#B8860B\">" + token + "</font>";
-
+
- keyprototype :=
"<font color=\"#008000\">"+token+"</font>";
- prototype :=
"<a href=\"" + token + ".html\">\
\<font color=\"#008000\">"+token+"</font></a>";
-
+
- comment_header_line :=
"<em><font color=\"#FF0000\">//" + token + "</font></em>";
@@ -49,38 +49,38 @@
- comment_slot_line :=
"<em><font color=\"#FF0000\">//" + token + "</font></em>";
-
- - french :=
+
+ - french :=
"<em><font color=\"#FF0FF0\">//" + token + "</font></em>";
- - english :=
+ - english :=
"<em><font color=\"#8080FF\">//" + token + "</font></em>";
-
- - greek :=
+
+ - greek :=
"<em><font color=\"#808000\">//" + token + "</font></em>";
- - comment :=
+ - comment :=
"<em><font color=\"#5F9EA0\">" + token + "</font></em>";
-
- - slot :=
+
+ - slot :=
"<strong><font color=\"#0000FF\">" + token + "</font></strong>";
- - slot_call :=
+ - slot_call :=
"<font color=\"#0000FF\">" + token + "</font>";
-
+
- slot_style :=
"<strong><font color=\"#FF0000\">" + token + "</font></strong>";
-
- - block :=
- "<font color=\"#FF0000\">" + token + "</font>";
-
- - external :=
+
+ - block :=
+ "<font color=\"#FF0000\">" + token + "</font>";
+
+ - external :=
"<em><strong><font color=\"#A4DEA4\">" + token + "</font></strong></em>";
-
+
//
// Recursive Option.
//
-
+
- index :=
"<html><head><title>Lisaac Documentation</title></head>\n\
\<frameset cols=\"260,*\" border=\"3\" frameborder=\"yes\" \
@@ -97,9 +97,9 @@
\<h3>Frame Error</h3>\n\
\<p>This web site works only with frames.</p>\n\
\</noframes>\n\
- \</html>\n";
-
- - default :=
+ \</html>\n";
+
+ - default :=
"<html><head><title>Proto</title></head>\n\
\<body bgcolor=\"red\">\n\
\Content proto documentation.\n\
@@ -110,24 +110,24 @@
"<html><head><title>List Directories</title></head>\n\
\<body bgcolor=\"#FFFFFF\">\n\
\<a href=\"file_list.html\" target=\"file\">All</a>\n";
-
+
- directory_list_item :=
"<br><a href=\""+token+".html\" target=\"file\">"+token+"</a>\n";
-
- - directory_list_end :=
+
+ - directory_list_end :=
"</body>\n\
\</html>";
- file_list_begin :=
"<html><head><title>All Files</title></head>\n\
\<body bgcolor=\"#F0F0FF\" link=\"black\" vlink=\"black\">\n";
-
+
- file_list_item :=
"<br><a href=\""+token+".html\" target=\"content\">"+token+"</a>\n";
-
+
- file_list_end :=
"</body>\n\
\</html>";
-
+
diff --git a/shorter/latex.li b/shorter/latex.li
index 77f2dd4..b0c0291 100644
--- a/shorter/latex.li
+++ b/shorter/latex.li
@@ -1,34 +1,34 @@
- begin :=
"\\begin{verbatim}\n";
-
- - end :=
+
+ - end :=
"\\end{verbatim}\n";
-
- - keyword :=
+
+ - keyword :=
"{\\bf{}" + last_string + "}";
-
+
- integer := last_string;
-
- - character :=
+
+ - character :=
"{\\it{}" + last_string + "}";
-
+
- string :=
"{\\it{}" + last_string + "}";
-
+
- operator := last_string;
-
+
- prototype :=
"<a href=\""+last_string+".html\">\
\<font color=\"#008000\">"+last_string+"</font></a>";
-
+
- comment_line :=
"{\\it{}" + last_string + "}";
-
+
- comment := "";
-
- - slot :=
+
+ - slot :=
"{\\bf{}" + last_string + "}";
-
+
- slot_style := last_string;
-
+
- block := "\\" + last_string;
\ No newline at end of file
diff --git a/src/aliaser_local.li b/src/aliaser_local.li
index 182c7ae..ab86f40 100644
--- a/src/aliaser_local.li
+++ b/src/aliaser_local.li
@@ -30,9 +30,9 @@ Section Header
Section Inherit
- parent_any:ANY := ANY;
-
-Section ALIASER_LOCAL,LIST
-
+
+Section ALIASER_LOCAL,LIST
+
- free_context:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 64;
- top_context:INTEGER;
@@ -67,7 +67,7 @@ Section Public
loc := wr.local;
((is_on) && {loc.style = '+'}).if {
- loc2 := loc.my_alias;
+ loc2 := loc.my_alias;
(loc2 = NULL).if {
loc2 := search_alias loc;
(loc2 = loc).if {
@@ -165,7 +165,7 @@ Section ALIASER_LOCAL, READ_LOCAL
j := j + 1;
};
((j > tab.upper) || {tab.item j != v}).if {
- tab.add v to j;
+ tab.add v to j;
};
};
);
diff --git a/src/any.li b/src/any.li
index 19be30c..edd19a3 100644
--- a/src/any.li
+++ b/src/any.li
@@ -87,7 +87,7 @@ Section Public
- loop_invariant:LOOP;
//
-
+
- late_binding_counter:INTEGER;
- null_counter:INTEGER;
diff --git a/src/code_life/call_slot.li b/src/code_life/call_slot.li
index 4ba9d3d..e5e6dfb 100644
--- a/src/code_life/call_slot.li
+++ b/src/code_life/call_slot.li
@@ -197,26 +197,26 @@ Section Private
(profil.link_count = 1).if {
//
// Inlining simple.
- //
+ //
(list_current.old_seq_or_and = seq_or_and).if {
- argument_to_assignment source index 0 alias FALSE style '+';
+ argument_to_assignment source index 0 alias FALSE style '+';
(result_list.lower).to (result_list.upper) do { j:INTEGER;
source.add_last (result_list.item j.write);
};
result := source.execute;
- profil.remove_inline;
+ profil.remove_inline;
new_execute_pass;
is_good := TRUE;
};
} else {
//
- // Inline by copy:
+ // Inline by copy:
//
- (list_current.old_seq_or_and = seq_or_and).if {
- profil.unlink Self;
-
+ (list_current.old_seq_or_and = seq_or_and).if {
+ profil.unlink Self;
+
prof_block ?= profil;
- ((prof_block != NULL) && {prof_block.is_context_sensitive}).if {
+ ((prof_block != NULL) && {prof_block.is_context_sensitive}).if {
(profil.argument_list.lower).to (profil.argument_list.upper) do { j:INTEGER;
loc := profil.argument_list.item j;
(loc != NULL).if {
@@ -226,19 +226,19 @@ Section Private
} else {
LOCAL.alias_on;
};
-
+
//LOCAL.alias_on;
- new_src := source.my_copy;
+ new_src := source.my_copy;
argument_to_assignment new_src index 0 alias TRUE style '+';
(result_list.lower).to (result_list.upper) do { j:INTEGER;
wrt := result_list.item j.write;
old_val := wrt.value;
- wrt.set_value (old_val.my_copy);
+ wrt.set_value (old_val.my_copy);
old_val.remove;
new_src.add_last wrt;
- };
-
+ };
+
((prof_block != NULL) && {prof_block.is_context_sensitive}).if {
(profil.argument_list.lower).to (profil.argument_list.upper) do { j:INTEGER;
loc := profil.argument_list.item j;
@@ -248,13 +248,13 @@ Section Private
};
} else {
LOCAL.alias_off;
- };
-
+ };
+
//LOCAL.alias_off;
result := new_src.execute;
is_good := TRUE;
- new_execute_pass;
+ new_execute_pass;
};
};
};
@@ -271,8 +271,8 @@ Section Private
//profil := profil.update self link FALSE;
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
- wrt ?= argument_list.item j;
- (wrt != NULL).if {
+ wrt ?= argument_list.item j;
+ (wrt != NULL).if {
(wrt.execute_argument).if {
new_execute_pass;
argument_list.put NULL to j;
@@ -281,7 +281,7 @@ Section Private
};
};
};
- };
+ };
/* BSBS: A revoir avec pb `list' l.352 et `profil' pour result
(result_list.lower).to (result_list.upper) do { j:INTEGER;
result_list.item j.execute;
@@ -328,8 +328,8 @@ Section Public
(! is_good).if {
execute_normal;
(source.is_empty).if {
- // Suppression.
- profil.unlink Self;
+ // Suppression.
+ profil.unlink Self;
new_execute_pass;
} else {
result := Self;
@@ -371,7 +371,7 @@ Section Public
argument_list.is_empty.if {
buffer.append "()";
} else {
- buffer.append "(";
+ buffer.append "(";
argument_list.lower.to (argument_list.upper) do { j:INTEGER;
arg := argument_list.item j;
(arg = NULL).if {
@@ -380,8 +380,8 @@ Section Public
arg.value.display buffer;
};
buffer.add_last ',';
- };
- buffer.put ')' to (buffer.upper);
+ };
+ buffer.put ')' to (buffer.upper);
};
);
@@ -428,13 +428,13 @@ Section Public
buffer.append "->thread.mutex));\n";
(low).to (argument_list.upper) do { j:INTEGER;
val := argument_list.item j;
- (val != NULL).if {
+ (val != NULL).if {
buffer.append indent;
cop_argument.genere buffer;
buffer.append "->param_";
np.append_in buffer;
buffer.append "=(int)";
- val.genere_value buffer;
+ val.genere_value buffer;
buffer.append ";\n";
np := np + 1;
} else {
@@ -483,15 +483,15 @@ Section Public
};
};
(! is_interrupt).if {
- buffer.add_last '(';
+ buffer.add_last '(';
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
val := argument_list.item j;
arg := profil.argument_list.item j;
- (val != NULL).if {
+ (val != NULL).if {
(buffer.last != '(').if {
buffer.add_last ',';
};
- val.genere_value buffer;
+ val.genere_value buffer;
};
};
(result_list.count > 1).if {
@@ -500,7 +500,7 @@ Section Public
buffer.add_last ',';
};
wrt ?= result_list.item j.write;
- wrt.genere_argument_result buffer;
+ wrt.genere_argument_result buffer;
};
};
buffer.add_last ')';
@@ -533,24 +533,24 @@ Section PROFIL
// Argument -> Affectation.
wrt := argument_list.first;
(wrt != NULL).if {
- argument_list.put NULL to 0;
- (! wrt.value.static_type.is_expanded).if {
+ argument_list.put NULL to 0;
+ (! wrt.value.static_type.is_expanded).if {
new_val := CAST.create (wrt.static_type) value (wrt.value);
wrt.set_value new_val;
};
wrt.variable.set_style '+';
new_wrt := wrt.execute;
- (new_wrt != NULL).if {
- list_current.insert new_wrt to (list_current.index);
+ (new_wrt != NULL).if {
+ list_current.insert new_wrt to (list_current.index);
};
};
(argument_list.lower + 1).to (argument_list.upper) do { k:INTEGER;
wrt := argument_list.item k;
- (wrt != NULL).if {
- argument_list.put NULL to k;
+ (wrt != NULL).if {
+ argument_list.put NULL to k;
wrt.variable.set_style '+';
new_wrt := wrt.execute;
- (new_wrt != NULL).if {
+ (new_wrt != NULL).if {
list_current.insert new_wrt to (list_current.index);
};
};
@@ -566,9 +566,9 @@ Section PROFIL
switch ?= source.last;
(switch.list.lower).to (switch.list.upper) do { k:INTEGER;
body := switch.list.item k.code;
- (body.is_empty).if_false {
+ (body.is_empty).if_false {
msg_slot ?= body.last;
- ((msg_slot != NULL) && {msg_slot.profil = profil}).if {
+ ((msg_slot != NULL) && {msg_slot.profil = profil}).if {
// DEBUG
(msg_slot = Self).if {
semantic_error (position,"CALL_SLOT : BUG!!!!");
@@ -576,7 +576,7 @@ Section PROFIL
// FIN DEBUG
msg_slot.argument_to_assignment body index (body.upper) alias FALSE;
body.put (LOOP_END.create (msg_slot.position) loop result) to (body.upper);
- };
+ };
};
};
result
@@ -592,14 +592,14 @@ Section PROFIL
// Argument -> Affectation.
(argument_list.upper).downto (argument_list.lower) do { k:INTEGER;
val := argument_list.item k;
- (val != NULL).if {
+ (val != NULL).if {
argument_list.put NULL to k;
(is_alias).if {
- loc ?= val.variable;
- new_wrt := loc.write (val.position) value (val.value);
- loc.unwrite val;
+ loc ?= val.variable;
+ new_wrt := loc.write (val.position) value (val.value);
+ loc.unwrite val;
} else {
- new_wrt := val;
+ new_wrt := val;
};
lst.insert new_wrt to idx;
new_wrt.variable.set_style styl;
diff --git a/src/code_life/cast.li b/src/code_life/cast.li
index 989ffaa..d167f23 100644
--- a/src/code_life/cast.li
+++ b/src/code_life/cast.li
@@ -19,80 +19,80 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CAST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Cast type.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
+
Section Public
-
+
- is_invariant:BOOLEAN <- value.is_invariant;
-
+
+ static_type:TYPE_FULL;
-
+
+ value:EXPR;
-
+
//
// Creation.
//
-
+
- create t:TYPE_FULL value v:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make t value v;
- result
+ result
);
-
+
- make t:TYPE_FULL value v:EXPR <-
(
position := v.position;
static_type := t;
value := v;
);
-
+
- my_copy:SELF <-
(
create static_type value (value.my_copy)
);
-
+
//
// Searching.
//
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add (static_type.raw);
);
-
+
//
// Executing pass.
//
-
+
- remove <-
- (
+ (
value.remove;
);
-
- - execute_unlink:INSTR <-
+
+ - execute_unlink:INSTR <-
(
value.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ int:INTEGER_CST;
+ lst_typ:TYPES_TMP;
+ other:CAST;
-
+
value := value.execute_link;
result := Self;
//
@@ -100,12 +100,12 @@ Section Public
result := value;
new_execute_pass;
}.elseif {
- (ALIAS_STR.is_integer (static_type.raw.name)) &&
+ (ALIAS_STR.is_integer (static_type.raw.name)) &&
{value.is_constant} &&
{ int ?= value; // BSBS: Merde avc les prototype_cst de type type_id : INTEGER
int != NULL
}
- } then {
+ } then {
int.cast_type static_type;
result := value;
new_execute_pass;
@@ -124,27 +124,27 @@ Section Public
new_execute_pass;
};
lst_typ.free;
- };
+ };
//
result
);
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
- (
+ (
buffer.add_last '(';
buffer.add_last '(';
- static_type.genere_declaration buffer;
+ static_type.genere_declaration buffer;
buffer.add_last ' ';
- static_type.genere_star_declaration buffer;
+ static_type.genere_star_declaration buffer;
buffer.add_last ')';
value.genere buffer;
buffer.add_last ')';
);
-
+
//
// Display.
//
diff --git a/src/code_life/cop_lock.li b/src/code_life/cop_lock.li
index 7d3a921..f2edac3 100644
--- a/src/code_life/cop_lock.li
+++ b/src/code_life/cop_lock.li
@@ -19,63 +19,63 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COP_LOCK;
- copyright := "2003-2007 Benoit Sonntag";
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "COP in for data or function.";
-
+
Section Inherit
-
+
+ parent_instr:Expanded INSTR;
-
+
Section Public
-
+
+ data:EXPR;
-
+
//
// Creation.
//
-
+
- create p:POSITION with dta:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with dta;
result
);
-
+
- make p:POSITION with dta:EXPR <-
(
position := p;
data := dta;
);
-
- - my_copy:SELF <-
- (
+
+ - my_copy:SELF <-
+ (
create position with (data.my_copy)
);
-
+
- remove <-
(
data.remove;
);
-
+
//
// Execute.
//
-
+
- execute:INSTR <-
(
Self
);
-
+
//
// Generation.
//
-
+
- genere buffer:STRING <-
(
buffer.append "// Pre thread.\n";
@@ -83,21 +83,21 @@ Section Public
// buffer.append "print_char('\\n');\n";
buffer.append indent;
buffer.append "{ lith_node node,*n;\n";
- indent.append " ";
+ indent.append " ";
buffer.append indent;
buffer.append "lith_object *obj;\n";
buffer.append indent;
- buffer.append "void *thread_save;\n";
+ buffer.append "void *thread_save;\n";
buffer.append indent;
buffer.append "obj = &((";
data.genere buffer;
- buffer.append ")->thread);\n";
+ buffer.append ")->thread);\n";
buffer.append indent;
buffer.append "node.next = NULL;\n";
buffer.append indent;
buffer.append "pthread_mutex_init(&node.mutex,NULL);\n";
buffer.append indent;
- buffer.append "pthread_mutex_lock(&obj->mutex);\n";
+ buffer.append "pthread_mutex_lock(&obj->mutex);\n";
buffer.append indent;
buffer.append "n = obj->last;\n";
buffer.append indent;
@@ -113,28 +113,28 @@ Section Public
buffer.append indent;
buffer.append "};\n";
buffer.append indent;
- buffer.append "obj->last = &node;\n";
+ buffer.append "obj->last = &node;\n";
buffer.append indent;
buffer.append "pthread_mutex_unlock(&obj->mutex);\n";
//
- buffer.append indent;
+ buffer.append indent;
buffer.append "pthread_mutex_lock (&node.mutex);\n";
- buffer.append indent;
+ buffer.append indent;
buffer.append "thread_save=pthread_getspecific(current_thread);\n";
buffer.append indent;
buffer.append "pthread_setspecific(current_thread,";
data.genere buffer;
- buffer.add_last ')';
+ buffer.add_last ')';
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "COP_LOCK(";
data.display buffer;
buffer.add_last ')';
);
-
+
diff --git a/src/code_life/cop_unlock.li b/src/code_life/cop_unlock.li
index ff69c56..84119f9 100644
--- a/src/code_life/cop_unlock.li
+++ b/src/code_life/cop_unlock.li
@@ -19,63 +19,63 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COP_UNLOCK;
- copyright := "2003-2007 Benoit Sonntag";
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "COP in for data or function.";
-
+
Section Inherit
-
+
+ parent_instr:Expanded INSTR;
-
+
Section Public
-
+
//
// Creation.
//
-
+
- create p:POSITION :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p;
result
);
-
+
- make p:POSITION <-
(
- position := p;
+ position := p;
);
-
- - my_copy:SELF <-
- (
+
+ - my_copy:SELF <-
+ (
create position
);
-
+
- remove <-
(
// Nothing.
);
-
+
//
// Execute.
//
-
+
- execute:INSTR <-
(
Self
);
-
+
//
// Generation.
//
-
+
- genere buffer:STRING <-
(
- buffer.append "pthread_mutex_lock(&(obj->mutex));\n";
+ buffer.append "pthread_mutex_lock(&(obj->mutex));\n";
buffer.append indent;
buffer.append "n = obj->first->next;\n";
buffer.append indent;
@@ -91,20 +91,20 @@ Section Public
buffer.append indent;
buffer.append "obj->first = n;\n";
buffer.append indent;
- buffer.append "pthread_mutex_unlock(&obj->mutex);\n";
+ buffer.append "pthread_mutex_unlock(&obj->mutex);\n";
buffer.append indent;
- buffer.append "pthread_setspecific(current_thread,thread_save);\n";
+ buffer.append "pthread_setspecific(current_thread,thread_save);\n";
indent.remove_last 2;
buffer.append indent;
buffer.add_last '}';
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "COP_UNLOCK()";
);
-
+
diff --git a/src/code_life/expr.li b/src/code_life/expr.li
index 4c149c9..bc4ff56 100644
--- a/src/code_life/expr.li
+++ b/src/code_life/expr.li
@@ -84,15 +84,15 @@ Section Public
result := Self;
} else {
? {list_current != NULL};
- (static_type.is_export_to t).if {
- // Auto-export.
+ (static_type.is_export_to t).if {
+ // Auto-export.
local := static_type.get_temporary position;
- instr := local.write position value Self;
+ instr := local.write position value Self;
list_current.add_last instr;
//
- slot_name := ALIAS_STR.get (TYPE.last_cast_name);
+ slot_name := ALIAS_STR.get (TYPE.last_cast_name);
slot_msg := static_type.get_slot slot_name;
- (slot_msg = NULL).if {
+ (slot_msg = NULL).if {
string_tmp.clear;
static_type.append_name_in string_tmp;
string_tmp.append " -> ";
@@ -107,14 +107,14 @@ Section Public
static_type.prototype.position.put_position;
POSITION.send_error;
//semantic_error p,string_tmp;
- };
- (slot_msg.argument_count != 1).if {
+ };
+ (slot_msg.argument_count != 1).if {
semantic_error (slot_msg.position,"No argument for this slot.");
};
ts ?= slot_msg.result_type;
- ((ts = NULL) || {ts.to_run_for (t.raw) != t}).if {
+ ((ts = NULL) || {ts.to_run_for (t.raw) != t}).if {
string_tmp.copy "Type result `";
- slot_msg.result_type.append_in string_tmp;
+ slot_msg.result_type.append_in string_tmp;
string_tmp.append "' is incorrect (Used for auto-conversion to `";
t.append_name_in string_tmp;
string_tmp.append "').";
@@ -123,22 +123,22 @@ Section Public
position.put_position;
POSITION.send_error;
};
- //
+ //
rec := local.read position;
node := NODE.new_read position slot slot_msg
receiver rec self rec intern FALSE;
list_current.add_last node;
- //
+ //
result := node.result_expr;
}.elseif {t.is_import_to static_type} then {
// Auto-import.
local := static_type.get_temporary position;
- instr := local.write position value Self;
+ instr := local.write position value Self;
list_current.add_last instr;
- //
+ //
slot_name := ALIAS_STR.get (TYPE.last_cast_name);
slot_msg := t.get_slot slot_name;
- (slot_msg = NULL).if {
+ (slot_msg = NULL).if {
string_tmp.clear;
t.append_name_in string_tmp;
string_tmp.append " <- ";
@@ -153,13 +153,13 @@ Section Public
t.prototype.position.put_position;
POSITION.send_error;
//semantic_error p,string_tmp;
- };
+ };
(slot_msg.argument_count != 2).if {
semantic_error (slot_msg.position,"Incorrect argument for this slot.");
};
ts ?= slot_msg.result_type;
- ((ts = NULL) || {ts != ITM_TYPE_PARAMETER.type_self}).if {
- string_tmp.copy "Type result `";
+ ((ts = NULL) || {ts != ITM_TYPE_PARAMETER.type_self}).if {
+ string_tmp.copy "Type result `";
slot_msg.result_type.append_in string_tmp;
string_tmp.append "' is incorrect (Used for auto-conversion to `";
t.append_name_in string_tmp;
@@ -169,19 +169,19 @@ Section Public
position.put_position;
POSITION.send_error;
};
- //
+ //
args := FAST_ARRAY(EXPR).create_with_capacity 2;
args.add_last (PROTOTYPE_CST.create position type t);
args.add_last (local.read position);
node := NODE.new_read position slot slot_msg
receiver (args.first.my_copy) with args intern FALSE;
list_current.add_last node;
- //
- result := node.result_expr;
+ //
+ result := node.result_expr;
} else {
- // Type Error
+ // Type Error
string_tmp.copy "Type `";
- t.append_name_in string_tmp;
+ t.append_name_in string_tmp;
string_tmp.append "' is invalid with `";
static_type.append_name_in string_tmp;
string_tmp.append "'.";
diff --git a/src/code_life/expr_multiple.li b/src/code_life/expr_multiple.li
index 46a556a..dda8d7d 100644
--- a/src/code_life/expr_multiple.li
+++ b/src/code_life/expr_multiple.li
@@ -19,41 +19,41 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_MULTIPLE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Multiple expression manager";
-
- // BSBS: Utiliser ca une seule fois ! cela doit etre possible!
-
+
+ // BSBS: Utiliser ca une seule fois ! cela doit etre possible!
+
Section Inherit
-
+
- parent_expr:EXPR := EXPR;
-
+
Section Public
-
+
+ expr_list:FAST_ARRAY(EXPR);
-
+
- cardinality:INTEGER <- expr_list.count;
-
+
- static_type:TYPE_FULL <-
(
expr_list.first.static_type
);
-
+
- get_type t:TYPES_TMP <-
(
crash_with_message "EXPR_MULTIPLE.get_type";
);
-
+
//
// Creation
//
-
+
// BSBS: Optim : Il faut que ce soit alouer et free après !!!
- create l:FAST_ARRAY(EXPR) :SELF <-
( + result:SELF;
@@ -61,70 +61,70 @@ Section Public
result.make l;
result
);
-
+
- make l:FAST_ARRAY(EXPR) <-
(
expr_list := l;
position := l.last.position;
);
-
+
- my_copy:SELF <-
( + new_lst:FAST_ARRAY(EXPR);
-
+
new_lst := FAST_ARRAY(EXPR).create_with_capacity (expr_list.count);
(expr_list.lower).to (expr_list.upper) do { j:INTEGER;
new_lst.add_last (expr_list.item j.my_copy);
};
SELF.create new_lst
);
-
+
//
// Remove.
//
-
+
- remove <-
(
(expr_list.lower).to (expr_list.upper) do { j:INTEGER;
expr_list.item j.remove;
};
);
-
+
//
// Execute.
//
-
- - execute_unlink:INSTR <-
+
+ - execute_unlink:INSTR <-
(
(expr_list.lower).to (expr_list.upper) do { j:INTEGER;
expr_list.item j.remove;
};
NULL
);
-
+
- execute_link:EXPR <-
(
list_current.debug_display;
crash_with_message "EXPR_MULTIPLE.execute_link";
NULL
);
-
+
//
// Access facility.
//
-
+
- lower:INTEGER <- expr_list.lower;
- upper:INTEGER <- expr_list.upper;
-
+
- item i:INTEGER :EXPR <- expr_list.item i;
- last:EXPR <- expr_list.last;
- first:EXPR <- expr_list.first;
-
- - count:INTEGER <- expr_list.count;
-
+
+ - count:INTEGER <- expr_list.count;
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.add_last '(';
@@ -135,4 +135,3 @@ Section Public
expr_list.last.display buffer;
buffer.add_last ')';
);
-
\ No newline at end of file
diff --git a/src/code_life/instr.li b/src/code_life/instr.li
index 5ba2cd8..9b58bdc 100644
--- a/src/code_life/instr.li
+++ b/src/code_life/instr.li
@@ -19,58 +19,58 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := INSTR;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all Instruction.";
-
+
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
-
+
Section Public
-
+
- is_invariant:BOOLEAN <- FALSE;
-
+
//
//
//
-
+
- hash_code:INTEGER <- INTEGER.force_conversion position;
- - my_copy:SELF <-
- (
+ - my_copy:SELF <-
+ (
debug_display;
- deferred;
- NULL
- );
-
+ deferred;
+ NULL
+ );
+
//
// Executing pass.
//
- cmp other:INSTR :BOOLEAN := FALSE;
-
+
- i_am_the_last i:INSTR :BOOLEAN <- (i = Self);
-
- - execute:INSTR <-
- (
+
+ - execute:INSTR <-
+ (
debug_display;
- deferred;
+ deferred;
NULL
);
-
- - remove <-
+
+ - remove <-
(
- debug_display;
+ debug_display;
deferred;
);
- - genere buffer:STRING <-
+ - genere buffer:STRING <-
(
// BUG.
display buffer;
@@ -92,34 +92,34 @@ Section Public
};
);
- - display buffer:STRING <-
+ - display buffer:STRING <-
(
"INSTR.display\n".print;
- deferred;
+ deferred;
);
- debug_display <-
( + voir:STRING;
-
+
voir := STRING.create 250;
display voir;
voir.print;
'\n'.print;
);
-
+
- simplify_type v:VARIABLE <-
( + tmp_type:TYPES_TMP;
-
+
((! v.is_static) && {! v.type.is_strict}).if {
tmp_type := TYPES_TMP.new;
v.get_type tmp_type;
(tmp_type.count != 0).if {
(tmp_type.first = TYPE_NULL).if {
tmp_type.remove_first;
- (tmp_type.count = 1).if {
- v.set_type (tmp_type.first.default.to_strict);
+ (tmp_type.count = 1).if {
+ v.set_type (tmp_type.first.default.to_strict);
};
- };
+ };
};
tmp_type.free;
};
diff --git a/src/code_life/list.li b/src/code_life/list.li
index 41d0664..b264f6e 100644
--- a/src/code_life/list.li
+++ b/src/code_life/list.li
@@ -289,7 +289,7 @@ Section Public
old_index := index;
new_expr := item index.execute;
- (new_expr != NULL).if {
+ (new_expr != NULL).if {
put new_expr to index;
index := index + 1;
(new_expr = CALL_NULL).if {
@@ -417,7 +417,7 @@ Section Private
(! tab.is_empty).if {
(tab.lower).to (tab.upper) do { j:INTEGER;
- loc := tab.item j;
+ loc := tab.item j;
loc.is_result.if_false {
/*
(loc.type.is_expanded).if {
diff --git a/src/code_life/loop.li b/src/code_life/loop.li
index 2540f37..5cc23d9 100644
--- a/src/code_life/loop.li
+++ b/src/code_life/loop.li
@@ -84,7 +84,7 @@ Section Public
case := switch.list.item k.code;
(! case.is_empty).if {
loop_end ?= case.last;
- (loop_end != NULL).if {
+ (loop_end != NULL).if {
? {loop_end.loop = Self};
(loop_end.loop != Self).if {
semantic_error (position,"LOOP.my_copy BUG!!!");
@@ -221,9 +221,9 @@ Section Public
//
result := TRUE;
inverse.if {
- buffer.append "while (!";
+ buffer.append "while (!";
} else {
- buffer.append "while (";
+ buffer.append "while (";
};
switch.expr.genere buffer;
//
@@ -239,14 +239,14 @@ Section Public
body.remove_last;
body.genere buffer;
inverse.if {
- buffer.append " while (!";
+ buffer.append " while (!";
} else {
- buffer.append " while (";
- };
+ buffer.append " while (";
+ };
//
switch.expr.genere buffer;
buffer.add_last ')';
- };
+ };
current_list_level := current_list_level - 1;
diff --git a/src/code_life/push.li b/src/code_life/push.li
index 08503e5..5dd2d34 100644
--- a/src/code_life/push.li
+++ b/src/code_life/push.li
@@ -19,73 +19,73 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PUSH;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Push context for debug mode";
-
+
Section Inherit
-
+
+ parent_instr:Expanded INSTR;
-
+
Section PUSH,LISAAC
-
- - source_line:HASHED_DICTIONARY(STRING,UINTEGER_32) :=
+
+ - source_line:HASHED_DICTIONARY(STRING,UINTEGER_32) :=
HASHED_DICTIONARY(STRING,UINTEGER_32).create;
-
+
Section Public
-
+
+ context:LOCAL;
-
+
+ is_first:BOOLEAN;
-
+
- set_first f:BOOLEAN <-
(
is_first := f;
);
-
+
//
// Creation.
//
-
+
- create pos:POSITION context v:LOCAL first f:BOOLEAN :SELF <-
( + result:SELF;
? {v != NULL};
-
+
result := clone;
result.make pos context v first f;
result
);
-
+
- make pos:POSITION context v:LOCAL first f:BOOLEAN <-
- ( ? {pos.code != 0};
+ ( ? {pos.code != 0};
? {v != NULL};
(v = NULL).if {
crash_with_message "PUSH";
- };
+ };
position := pos;
context := v;
- is_first := f;
+ is_first := f;
);
-
- - my_copy:SELF <-
+
+ - my_copy:SELF <-
( + result:SELF;
+ new_context:LOCAL;
-
+
(LOCAL.is_alias).if {
new_context := context.get_alias;
new_context.set_ensure_count 1;
result := create position context new_context first is_first;
- } else {
+ } else {
result := create position context context first is_first;
};
- result
+ result
);
-
+
//
// Execute.
//
@@ -94,11 +94,11 @@ Section Public
(
// Nothing.
);
-
- - execute:INSTR <-
+
+ - execute:INSTR <-
( + result:INSTR;
+ other:SELF;
-
+
result := Self;
(list_current.index < list_current.upper).if {
other ?= list_current.item (list_current.index + 1);
@@ -111,7 +111,7 @@ Section Public
}.elseif {(is_first) && {! other.is_first}} then {
result := NULL;
};
- };
+ };
};
result
);
@@ -119,13 +119,13 @@ Section Public
//
// Genere
//
-
+
- genere buffer:STRING <-
( + id:UINTEGER_32;
+ idf:STRING_CONSTANT;
-
- idf := ALIASER_LOCAL.push Self;
- (is_first).if {
+
+ idf := ALIASER_LOCAL.push Self;
+ (is_first).if {
buffer.append "lisaac_push_first(&";
} else {
buffer.append "lisaac_push(&";
@@ -140,12 +140,12 @@ Section Public
buffer.add_last 'L';
};
id.append_in buffer;
- buffer.add_last ')';
-
+ buffer.add_last ')';
+
buffer.append "; /* L";
position.line.append_in buffer;
buffer.add_last ' ';
- buffer.append (position.prototype.name);
+ buffer.append (position.prototype.name);
buffer.append "*/";
);
diff --git a/src/code_life/read.li b/src/code_life/read.li
index bf7816d..6104877 100644
--- a/src/code_life/read.li
+++ b/src/code_life/read.li
@@ -162,9 +162,9 @@ Section Public
} then {
//
// VALUE_EXPR propagation, step by step.
- //
+ //
result := val;
- variable.unread Self;
+ variable.unread Self;
new_execute_pass;
};
};
@@ -173,14 +173,14 @@ Section Public
//
// Normal.
//
- ((is_slot) && {loop_invariant != NULL} && {is_invariant}).if {
+ ((is_slot) && {loop_invariant != NULL} && {is_invariant}).if {
//old_loop_invariant := loop_invariant;
//loop_invariant := NULL;
//
l := static_type.get_temporary position;
wrt := l.write position value Self;
loop_list.insert_before wrt;
- result := l.read position;
+ result := l.read position;
//
//wrt.execute;
//result := result.execute_link;
diff --git a/src/code_life/read_global.li b/src/code_life/read_global.li
index 0c35093..7ce7d39 100644
--- a/src/code_life/read_global.li
+++ b/src/code_life/read_global.li
@@ -19,80 +19,80 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := READ_GLOBAL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Read for global";
-
+
Section Inherit
-
+
+ parent_read:Expanded READ;
-
+
Section Public
-
- - is_invariant:BOOLEAN <- global.is_invariant NULL;
-
+
+ - is_invariant:BOOLEAN <- global.is_invariant NULL;
+
+ global:SLOT_DATA;
-
+
- variable:VARIABLE <- global;
-
+
//
// Comparison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + rd:READ_GLOBAL;
-
+
rd ?= other;
- ((rd != NULL) && {global = rd.global})
+ ((rd != NULL) && {global = rd.global})
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with g:SLOT_DATA :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with g;
- result
+ result
);
-
+
- make p:POSITION with g:SLOT_DATA <-
(
position := p;
global := g;
);
-
+
//
// Execute
//
-
- - execute_access_unlink:INSTR <-
+
+ - execute_access_unlink:INSTR <-
(
global.execute;
NULL
);
- - execute_access_link <-
+ - execute_access_link <-
(
global.execute;
);
-
+
//
// Genere
//
-
+
- genere buffer:STRING <-
- (
+ (
buffer.append (variable.intern_name);
);
-
+
diff --git a/src/code_life/read_local.li b/src/code_life/read_local.li
index 6459713..9859ecb 100644
--- a/src/code_life/read_local.li
+++ b/src/code_life/read_local.li
@@ -19,90 +19,90 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := READ_LOCAL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Read for local.";
-
+
Section Inherit
-
+
+ parent_read:Expanded READ;
-
+
Section Public
-
- - is_invariant:BOOLEAN <- local.is_invariant;
-
+
+ - is_invariant:BOOLEAN <- local.is_invariant;
+
+ local:LOCAL;
-
+
- variable:VARIABLE <- local;
-
+
//
// Comparison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + rd:READ_LOCAL;
-
+
rd ?= other;
- ((rd != NULL) && {local = rd.local})
+ ((rd != NULL) && {local = rd.local})
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with l:LOCAL :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with l;
- result
+ result
);
-
+
- make p:POSITION with l:LOCAL <-
(
position := p;
- local := l;
+ local := l;
);
-
+
//
// Execute
//
-
+
- execute_access_unlink:INSTR <- NULL;
-
+
- execute_access_link;
-
+
//
// Genere
//
-
+
- genere buffer:STRING <-
( + tb:PROFIL_BLOCK;
+ idf:STRING_CONSTANT;
-
+
idf := ALIASER_LOCAL.read Self;
(local.is_result /*ensure_count = -100*/).if {
buffer.add_last '*';
};
buffer.append idf;
//
-
- tb ?= local.type.raw;
+
+ tb ?= local.type.raw;
(tb != NULL).if {
ALIASER_LOCAL.add_var_size local;
};
-
+
((variable.type_set.count = 1) && {variable.type_set.first = TYPE_NULL}).if {
buffer.append " /* Always NULL */ ";
};
-
+
);
-
+
diff --git a/src/code_life/read_slot.li b/src/code_life/read_slot.li
index 575dcfd..bfc5a97 100644
--- a/src/code_life/read_slot.li
+++ b/src/code_life/read_slot.li
@@ -19,58 +19,58 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := READ_SLOT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Read for slot";
-
+
Section Inherit
-
+
+ parent_read:Expanded READ;
-
+
Section Public
-
+
- is_slot:BOOLEAN <- TRUE;
-
- - is_invariant:BOOLEAN <- slot.is_invariant receiver;
-
+
+ - is_invariant:BOOLEAN <- slot.is_invariant receiver;
+
+ slot:SLOT_DATA;
-
+
+ receiver:EXPR;
-
+
- variable:VARIABLE <- slot;
-
- - get_last_value:EXPR <- variable.get_last_value receiver;
-
+
+ - get_last_value:EXPR <- variable.get_last_value receiver;
+
//
// Comparison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + rd:READ_SLOT;
-
+
rd ?= other;
- ((rd != NULL) && {slot = rd.slot} && {receiver ~= rd.receiver})
+ ((rd != NULL) && {slot = rd.slot} && {receiver ~= rd.receiver})
);
Section SLOT
-
+
//
// Creation.
//
-
+
- create p:POSITION with (r:EXPR,s:SLOT_DATA) :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with (r,s);
- result
+ result
);
-
+
- make p:POSITION with (r:EXPR,s:SLOT_DATA) <-
(
position := p;
@@ -79,63 +79,63 @@ Section SLOT
);
Section Public
-
+
- my_copy:SELF <-
( + result:SELF;
-
+
result ?= slot.read position with (receiver.my_copy);
result
);
-
+
//
// Executing pass.
//
-
+
- remove <-
(
receiver.remove;
parent_read.remove;
);
-
- - execute_access_unlink:INSTR <-
+
+ - execute_access_unlink:INSTR <-
(
slot.execute;
receiver.execute_unlink
);
-
- - execute_access_link <-
- (
+
+ - execute_access_link <-
+ (
slot.execute;
- receiver := receiver.execute_link;
+ receiver := receiver.execute_link;
);
//
// Genere
//
-
+
- genere buffer:STRING <-
( + tf,tf2:TYPE_FULL;
+ t:TYPE;
+ add_end:BOOLEAN;
+ ptr,ptr2:BOOLEAN;
-
+
(is_java).if {
receiver.genere buffer;
//not_yet_implemented;
buffer.add_last '.';
buffer.append (variable.intern_name);
- } else {
+ } else {
(slot.intern_name = ALIAS_STR.slot_self).if {
buffer.append "((";
tf := slot.type;
- tf.genere_declaration buffer;
+ tf.genere_declaration buffer;
buffer.add_last ' ';
- tf.genere_star_declaration buffer;
+ tf.genere_star_declaration buffer;
buffer.add_last ')';
receiver.genere buffer;
buffer.append ".self)";
} else {
- tf := receiver.static_type;
+ tf := receiver.static_type;
t := slot.receiver_type;
(t.alias_slot != NULL).if {
tf2 := slot.type;
@@ -154,38 +154,38 @@ Section Public
(tf.is_strict) || {tf.is_expanded_ref} || {tf.is_expanded}
).if {
receiver.genere buffer;
- } else {
- buffer.append "((";
- t.put_reference_declaration buffer;
+ } else {
+ buffer.append "((";
+ t.put_reference_declaration buffer;
buffer.add_last ' ';
- t.put_reference_star_declaration buffer;
+ t.put_reference_star_declaration buffer;
buffer.add_last ')';
receiver.genere buffer;
- buffer.add_last ')';
+ buffer.add_last ')';
};
(t.alias_slot = NULL).if {
((tf.is_expanded) && {! tf.is_expanded_ref} && {! tf.is_strict}).if {
buffer.add_last '.';
} else {
buffer.append "->";
- };
- buffer.append (variable.intern_name);
+ };
+ buffer.append (variable.intern_name);
}.elseif {add_end} then {
buffer.append "))";
};
- };
+ };
};
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
receiver.display buffer;
buffer.append "->";
- parent_read.display buffer;
+ parent_read.display buffer;
);
diff --git a/src/code_life/result.li b/src/code_life/result.li
index f3a4ad9..1247250 100644
--- a/src/code_life/result.li
+++ b/src/code_life/result.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := RESULT;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,16 +32,16 @@ Section Inherit
- parent_expr:EXPR := EXPR;
Section Public
-
+
- position:POSITION <- value.position;
-
- + write:WRITE;
-
+
+ + write:WRITE;
+
- set_write v:WRITE <-
(
write := v;
);
-
+
//
// Creation.
//
@@ -54,48 +54,47 @@ Section Public
);
- make v:WRITE <-
- (
+ (
write := v;
);
-
+
- my_copy:SELF <-
( + wrt:WRITE;
+ rd:READ;
rd ?= write.value;
(rd = NULL).if {
- wrt := write.variable.write (write.position) with NULL value (write.value.my_copy);
+ wrt := write.variable.write (write.position) with NULL value (write.value.my_copy);
} else {
- rd := rd.variable.read_direct (rd.position) with NULL;
- wrt := write.variable.write (write.position) with NULL value rd;
+ rd := rd.variable.read_direct (rd.position) with NULL;
+ wrt := write.variable.write (write.position) with NULL value rd;
};
create wrt
);
-
+
- execute:INSTR <-
(
write ?= write.execute;
Self
);
-
+
//
// Remove
//
-
+
- remove <-
(
write.remove;
);
-
+
//
// Expr definition.
- //
-
+ //
+
- static_type:TYPE_FULL <- write.value.static_type;
-
+
- get_type t:TYPES_TMP <- write.value.get_type t;
-
+
- execute_link:EXPR <- write.execute_link;
-
+
- execute_unlink:INSTR <- write.execute_unlink;
-
-
\ No newline at end of file
+
diff --git a/src/code_life/switch.li b/src/code_life/switch.li
index 0ee5152..a57f932 100644
--- a/src/code_life/switch.li
+++ b/src/code_life/switch.li
@@ -209,7 +209,7 @@ Section Public
//
// BSBS: Ajoute un pattern pour les elseif ...
//
- (lst_typ.lower).to (lst_typ.upper) do { j:INTEGER;
+ (lst_typ.lower).to (lst_typ.upper) do { j:INTEGER;
typ := lst_typ.item j;
{typ = list.item j.id}.until_do {
list.item j.remove;
@@ -276,19 +276,19 @@ Section Public
expr := expr.execute_link;
CALL_SLOT.reset_count_no_recursive;
- ((list.first.id = TYPE_NULL) && {list.count = 2}).if {
+ ((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 {
+ } else {
(list.lower).to (list.upper) do { j:INTEGER;
- list.item j.execute;
+ list.item j.execute;
};
};
result := detect_logic_expr;
- (result = NULL).if {
+ (result = NULL).if {
result := Self;
};
};
@@ -339,7 +339,7 @@ Section Public
is_genered := TRUE;
(expr.static_type.raw != type_boolean).if {
buffer.append "==";
- typ_first.put_id buffer;
+ typ_first.put_id buffer;
} else {
? {typ_first.name = ALIAS_STR.prototype_true};
};
@@ -418,7 +418,7 @@ Section Public
buffer.remove_last 1;
buffer.append " break;\n";
};
- };
+ };
// Debug...
(debug_level_option != 0).if {
buffer.append indent;
@@ -519,14 +519,14 @@ Section Private
{wr_true.variable = wr_false.variable}
).if {
val_true := wr_true .value;
- val_false := wr_false.value;
+ val_false := wr_false.value;
// BSBS: val_true.static_type = type_true ???
(
(a := val_true.is_constant) &&
{b := (val_true.static_type.raw = type_true)}
).if {
// | or ||
- rd ?= val_false;
+ rd ?= val_false;
(rd != NULL).if {
// |
wr_true.remove;
@@ -541,35 +541,35 @@ Section Private
wr_false.set_value val_false;
result := wr_false;
switch_new_pass := TRUE;
- };
+ };
}.elseif {
(c := val_false.is_constant) &&
{d := (val_false.static_type.raw = type_false)}
} then {
- // & or &&
- rd ?= val_true;
+ // & or &&
+ rd ?= val_true;
(rd != NULL).if {
// &
- wr_false.remove;
+ wr_false.remove;
val_true := EXPR_AND_LOGIC.create position with expr and val_true;
wr_true.set_value val_true;
- result := wr_true;
+ result := wr_true;
new_execute_pass;
}.elseif {(CALL_SLOT.count_no_recursive = 0) || {modify_count = 0}} then {
- // &&
+ // &&
wr_false.remove;
val_true := EXPR_AND_AND_LOGIC.create position with expr and val_true;
wr_true.set_value val_true;
result := wr_true;
switch_new_pass := TRUE;
- };
+ };
}.elseif {
(a) && {!b} && {c} && {!d}
} then {
// !
wr_false.remove;
wr_true.set_value (EXPR_NOT_LOGIC.create position with expr);
- result := wr_true;
+ result := wr_true;
new_execute_pass;
};
};
@@ -598,7 +598,7 @@ Section Private
wrt ?= list_current.item index;
rd ?= expr;
((wrt != NULL) && {rd != NULL} && {wrt.variable != rd.variable}).if {
- rd2 ?= wrt.value;
+ rd2 ?= wrt.value;
other ?= list_current.item (index + 1);
((rd2 != NULL) && {other != NULL} &&
{other.expr ~= expr} && {other.list.count = list.count}).if {
@@ -609,7 +609,7 @@ Section Private
list.last.code.add_last wrt;
list_current.put NOP to index;
concat_switch other;
- list_current.put NOP to (index + 1);
+ list_current.put NOP to (index + 1);
};
};
};
diff --git a/src/code_life/write.li b/src/code_life/write.li
index 1890be0..e1074dd 100644
--- a/src/code_life/write.li
+++ b/src/code_life/write.li
@@ -154,7 +154,7 @@ Section Public
/*( // BSBS: Bug, mais de toute facon le gain n'est pas la... (entre +5 a +20)
(loop_invariant != NULL) && {list_current = loop_invariant.body} &&
{is_invariant} && {variable.get_last_index != -1}
- ).if {
+ ).if {
//old_loop_invariant := loop_invariant;
//loop_invariant := NULL;
//
@@ -179,13 +179,13 @@ Section Public
};
result
);
-
+
- remove <-
( + l:LOCAL;
l ?= variable;
((l != NULL) && {l.my_alias != NULL}).if {
// It's for generation code, with ALIAS_LOCAL and SWITCH fusion case.
- l.my_alias.unwrite Self;
+ l.my_alias.unwrite Self;
} else {
variable.unwrite Self;
};
diff --git a/src/code_life/write_global.li b/src/code_life/write_global.li
index da4f6ed..3b0aa58 100644
--- a/src/code_life/write_global.li
+++ b/src/code_life/write_global.li
@@ -19,29 +19,29 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := WRITE_GLOBAL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Write global";
-
+
Section Inherit
+ parent_write:Expanded WRITE;
-
+
Section Public
-
+
+ global:SLOT_DATA;
-
+
- variable:VARIABLE <- global;
-
+
//
// Creation.
//
-
+
- create p:POSITION with val:EXPR in g:SLOT_DATA :SELF <-
( + result:SELF;
? {p.code != 0};
@@ -49,35 +49,35 @@ Section Public
result.make p with val in g;
result
);
-
+
- make p:POSITION with val:EXPR in g:SLOT_DATA <-
- (
+ (
position := p;
value := val;
global := g;
);
-
+
//
// Execute.
//
- - execute_access_unlink:INSTR <-
+ - execute_access_unlink:INSTR <-
(
global.execute;
NULL
);
- - execute_access_link <-
- (
+ - execute_access_link <-
+ (
global.execute;
);
//
// Genere
//
-
+
- genere buffer:STRING <-
- (
+ (
TYPE.add_genere_global global;
(quiet_generation).if_false {
buffer.append (global.intern_name);
@@ -85,12 +85,12 @@ Section Public
((value.static_type.raw = TYPE_NULL) && {variable.type.raw.is_block}).if {
buffer.append ".__id=0";
} else {
- buffer.add_last '=';
+ buffer.add_last '=';
genere_value buffer;
};
};
);
-
+
diff --git a/src/code_life/write_local.li b/src/code_life/write_local.li
index f09b765..45a1a26 100644
--- a/src/code_life/write_local.li
+++ b/src/code_life/write_local.li
@@ -101,12 +101,12 @@ Section Public
//
// Genere
//
-
+
- genere buffer:STRING <-
( + idf:STRING_CONSTANT;
-
+
idf := ALIASER_LOCAL.write Self;
-
+
(quiet_generation).if_false {
(local.is_result).if {
buffer.add_last '*';
diff --git a/src/code_life/write_slot.li b/src/code_life/write_slot.li
index 3d26de0..9535ab1 100644
--- a/src/code_life/write_slot.li
+++ b/src/code_life/write_slot.li
@@ -19,33 +19,33 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := WRITE_SLOT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Write slot";
-
+
Section Inherit
+ parent_write:Expanded WRITE;
-
+
Section Public
-
+
- is_invariant:BOOLEAN <- receiver.is_invariant && {value.is_invariant};
-
+
+ slot:SLOT_DATA;
-
+
- variable:VARIABLE <- slot;
-
+
+ receiver:EXPR;
-
+
//
// Creation.
//
-
+
- create p:POSITION with val:EXPR in (r:EXPR,s:SLOT_DATA) :SELF <-
( + result:SELF;
? {p.code != 0};
@@ -53,19 +53,19 @@ Section Public
result.make p with val in (r,s);
result
);
-
+
- make p:POSITION with val:EXPR in (r:EXPR,s:SLOT_DATA) <-
- (
- position := p;
+ (
+ position := p;
value := val;
receiver := r;
slot := s;
);
-
+
- my_copy:SELF <-
- ( + new_val:EXPR;
+ ( + new_val:EXPR;
+ result:SELF;
-
+
new_val := value.my_copy;
result ?= variable.write position with (receiver.my_copy) value new_val;
(quiet_generation).if {
@@ -73,80 +73,80 @@ Section Public
};
result
);
-
+
//
// Execute.
//
- - execute_access_unlink:INSTR <-
- (
+ - execute_access_unlink:INSTR <-
+ (
slot.execute;
receiver.execute_unlink
);
-
- - execute_access_link <-
- (
+
+ - execute_access_link <-
+ (
slot.execute;
- receiver := receiver.execute_link;
+ receiver := receiver.execute_link;
);
-
+
- remove <-
(
receiver.remove;
parent_write.remove;
);
-
+
//
// Genere
//
-
+
- genere buffer:STRING <-
( + tf:TYPE_FULL;
+ t:TYPE;
-
+
t := slot.receiver_type;
- t.add_genere_list;
+ t.add_genere_list;
(! quiet_generation).if {
(t.alias_slot = variable).if {
- tf := receiver.static_type;
+ tf := receiver.static_type;
((tf.is_strict) || {tf.is_expanded_ref}).if {
buffer.append "(*";
- receiver.genere buffer;
+ receiver.genere buffer;
buffer.add_last ')';
- }.elseif {tf.is_expanded} then {
- receiver.genere buffer;
+ }.elseif {tf.is_expanded} then {
+ receiver.genere buffer;
} else {
buffer.append "*((";
t := slot.receiver_type;
- t.put_reference_declaration buffer;
+ t.put_reference_declaration buffer;
buffer.add_last ' ';
- t.put_reference_star_declaration buffer;
+ t.put_reference_star_declaration buffer;
buffer.add_last ')';
receiver.genere buffer;
- buffer.add_last ')';
- };
+ buffer.add_last ')';
+ };
} else {
- // Receiver.
+ // Receiver.
(is_java).if {
receiver.genere buffer;
- buffer.add_last '.';
- } else {
- tf := receiver.static_type;
+ buffer.add_last '.';
+ } else {
+ tf := receiver.static_type;
((tf.is_strict) || {tf.is_expanded_ref}).if {
receiver.genere buffer;
buffer.append "->";
- }.elseif {tf.is_expanded} then {
+ }.elseif {tf.is_expanded} then {
receiver.genere buffer;
- buffer.add_last '.';
+ buffer.add_last '.';
} else {
buffer.append "((";
t := slot.receiver_type;
- t.put_reference_declaration buffer;
+ t.put_reference_declaration buffer;
buffer.add_last ' ';
- t.put_reference_star_declaration buffer;
+ t.put_reference_star_declaration buffer;
buffer.add_last ')';
receiver.genere buffer;
- buffer.append ")->";
+ buffer.append ")->";
};
};
//
@@ -156,12 +156,12 @@ Section Public
((value.static_type.raw = TYPE_NULL) && {variable.type.raw.is_block}).if {
buffer.append ".__id=0";
} else {
- buffer.add_last '=';
- genere_value buffer;
+ buffer.add_last '=';
+ genere_value buffer;
};
};
);
-
+
//
// Display.
//
@@ -170,11 +170,11 @@ Section Public
(
receiver.display buffer;
buffer.append "->";
- parent_write.display buffer;
+ parent_write.display buffer;
);
-
-
+
+
diff --git a/src/compiler_any/any_option.li b/src/compiler_any/any_option.li
index 9e48f18..48b256e 100644
--- a/src/compiler_any/any_option.li
+++ b/src/compiler_any/any_option.li
@@ -19,29 +19,29 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ANY_OPTION;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Option for compiler (see shorter)";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
- is_shorter :BOOLEAN := FALSE;
-
+
- is_shorter2:BOOLEAN := FALSE;
-
+
//
// Option du Shorter.
- //
-
+ //
+
- is_short_private:BOOLEAN;
- is_short_code:BOOLEAN;
-
+
diff --git a/src/constant/character_cst.li b/src/constant/character_cst.li
index 27feeb9..63f0f3a 100644
--- a/src/constant/character_cst.li
+++ b/src/constant/character_cst.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CHARACTER_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Character constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
//
@@ -50,7 +50,7 @@ Section Public
result.make p char car;
result
);
-
+
- make p:POSITION char car:STRING_CONSTANT <-
(
position := p;
@@ -63,8 +63,8 @@ Section Public
//
// Comparaison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + s:SELF;
s ?= other;
(s != NULL) && {text = s.text}
@@ -88,7 +88,7 @@ Section Public
- display buffer:STRING <-
(
buffer.add_last '\'';
- buffer.append text;
+ buffer.append text;
buffer.add_last '\'';
display_ref buffer;
);
diff --git a/src/constant/constant.li b/src/constant/constant.li
index 77da3dd..264c420 100644
--- a/src/constant/constant.li
+++ b/src/constant/constant.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CONSTANT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all constants";
-
+
Section Inherit
-
- + parent_expr:Expanded EXPR;
-
+
+ + parent_expr:Expanded EXPR;
+
Section Public
//
// Comparison.
//
-
+
- is_constant:BOOLEAN <- TRUE;
-
+
- is_invariant:BOOLEAN <- TRUE;
-
+
//
// Typing.
//
-
+
+ static_type:TYPE_FULL;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add (static_type.raw);
);
@@ -59,17 +59,17 @@ Section Public
- remove <-
(
- // Nothing.
+ // Nothing.
);
-
+
- execute_unlink:INSTR <-
(
new_execute_pass;
NULL
);
-
+
- execute_link:EXPR <- Self;
-
+
diff --git a/src/constant/integer_cst.li b/src/constant/integer_cst.li
index d782b6e..1d30c60 100644
--- a/src/constant/integer_cst.li
+++ b/src/constant/integer_cst.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := INTEGER_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Integer constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
//
@@ -39,22 +39,22 @@ Section Public
//
+ value:INTEGER_64;
-
+
- set_value new_value:INTEGER_64 <-
(
value := new_value;
check_type;
);
-
+
- to_power:INTEGER_64 <-
// 2^Result = self or else -1
( + result,val:INTEGER_64;
-
+
val := value;
(val = 0).if {
result := -1;
- } else {
- {(val & 1) = 0}.while_do {
+ } else {
+ {(val & 1) = 0}.while_do {
val := val >> 1;
result := result + 1;
};
@@ -64,17 +64,17 @@ Section Public
};
result
);
-
+
- is_signed:BOOLEAN <-
( + typ:STRING_CONSTANT;
-
- typ := static_type.raw.name;
+
+ typ := static_type.raw.name;
(typ = ALIAS_STR.prototype_integer_64) ||
{typ = ALIAS_STR.prototype_integer_32} ||
{typ = ALIAS_STR.prototype_integer_16} ||
{typ = ALIAS_STR.prototype_integer_8 }
);
-
+
- is_saturated:BOOLEAN <-
( + result:BOOLEAN;
@@ -95,9 +95,9 @@ Section Public
result := value = 0FFh;
};
};
- result
+ result
);
-
+
//
// Creation.
//
@@ -108,12 +108,12 @@ Section Public
result.make p value v type t;
result
);
-
+
- make p:POSITION value v:INTEGER_64 type t:TYPE_FULL <-
(
position := p;
value := v;
- static_type := t;
+ static_type := t;
check_type;
);
@@ -122,7 +122,7 @@ Section Public
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + p:INTEGER_CST;
p ?= other;
@@ -145,14 +145,14 @@ Section Public
//
- genere buffer:STRING <-
- (
- buffer.add_last ' ';
- value.append_in buffer;
+ (
+ buffer.add_last ' ';
+ value.append_in buffer;
(value > UINTEGER_32.maximum.to_integer_64).if {
buffer.append "LLU";
}.elseif {value > INTEGER.maximum.to_integer_64} then {
buffer.append "LU";
- };
+ };
);
//
@@ -167,13 +167,13 @@ Section Public
value.append_in buffer;
display_ref buffer;
);
-
+
Section Private
-
+
- check_type <-
( + error:BOOLEAN;
+ min,max:INTEGER_64;
-
+
// Check Range.
(static_type.raw.name)
.when (ALIAS_STR.prototype_uinteger_64) then {
@@ -204,7 +204,7 @@ Section Private
// Nothing. (Pb: BSBS : Can't range test.)
}
.when (ALIAS_STR.prototype_integer_32) then {
- ((value < INTEGER.minimum) || {value > INTEGER.maximum.to_integer_64}).if {
+ ((value < INTEGER.minimum) || {value > INTEGER.maximum.to_integer_64}).if {
error := TRUE;
min := INTEGER.minimum;
max := INTEGER.maximum.to_integer_64;
@@ -224,12 +224,12 @@ Section Private
max := INTEGER_8.maximum.to_integer_64;
};
};
-
+
(error).if {
string_tmp.copy "Invalid constant integer (";
value.append_in string_tmp;
string_tmp.append ") cast into ";
- static_type.append_name_in string_tmp;
+ static_type.append_name_in string_tmp;
string_tmp.append " [";
min.append_in string_tmp;
string_tmp.append "..";
@@ -242,7 +242,7 @@ Section Private
value := 0;
};
);
-
+
diff --git a/src/constant/native_array_character_cst.li b/src/constant/native_array_character_cst.li
index 7a10894..9b5646c 100644
--- a/src/constant/native_array_character_cst.li
+++ b/src/constant/native_array_character_cst.li
@@ -19,21 +19,21 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := NATIVE_ARRAY_CHARACTER_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "String constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
-
+
//
// Value.
//
@@ -50,7 +50,7 @@ Section Public
result.make p text n;
result
);
-
+
- make p:POSITION text n:STRING_CONSTANT <-
(
position := p;
@@ -63,8 +63,8 @@ Section Public
//
// Comparaison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + p:NATIVE_ARRAY_CHARACTER_CST;
p ?= other;
(p != NULL) && {string = p.string}
@@ -75,12 +75,12 @@ Section Public
//
- genere buffer:STRING <-
- (
+ (
buffer.add_last '\"';
buffer.append string;
buffer.add_last '\"';
);
-
+
//
// Display.
//
@@ -92,8 +92,8 @@ Section Public
buffer.add_last '\"';
display_ref buffer;
);
-
-
+
+
diff --git a/src/constant/prototype_cst.li b/src/constant/prototype_cst.li
index 71185ff..448d536 100644
--- a/src/constant/prototype_cst.li
+++ b/src/constant/prototype_cst.li
@@ -19,43 +19,43 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PROTOTYPE_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Prototype constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
//
// Creation.
//
-
+
- create p:POSITION type t:TYPE_FULL :SELF<-
( + result:SELF;
? {p.code != 0};
? {t != NULL};
-
+
result := clone;
result.make p type t;
result
);
-
+
- make p:POSITION type t:TYPE_FULL <-
(
- position := p;
- static_type := t.to_strict;
+ position := p;
+ static_type := t.to_strict;
);
- - my_copy:SELF <-
- (
+ - my_copy:SELF <-
+ (
SELF.create position type static_type
);
@@ -63,21 +63,21 @@ Section Public
// Comparaison.
//
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + p:PROTOTYPE_CST;
p ?= other;
(p != NULL) && {static_type = p.static_type}
);
-
+
//
// Execute
//
-
+
- execute_link:EXPR <-
- (
+ (
Self
- );
-
+ );
+
//
// Generation.
//
@@ -94,7 +94,7 @@ Section Public
- display buffer:STRING <-
(
static_type.display buffer;
- display_ref buffer;
+ display_ref buffer;
);
-
+
diff --git a/src/constant/real_cst.li b/src/constant/real_cst.li
index a5fc56d..6c6c25e 100644
--- a/src/constant/real_cst.li
+++ b/src/constant/real_cst.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := REAL_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Real float constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
//
@@ -39,7 +39,7 @@ Section Public
//
+ value:STRING_CONSTANT;
-
+
//
// Creation.
//
@@ -50,12 +50,12 @@ Section Public
result.make p value v type t;
result
);
-
+
- make p:POSITION value v:STRING_CONSTANT type t:TYPE_FULL <-
(
position := p;
value := v;
- static_type := t;
+ static_type := t;
);
- my_copy:SELF <- SELF.create position value value type static_type;
@@ -63,7 +63,7 @@ Section Public
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + p:REAL_CST;
p ?= other;
@@ -77,7 +77,7 @@ Section Public
- cast_type p:TYPE_FULL <-
(
? { p != type_real };
- static_type := p;
+ static_type := p;
);
//
@@ -101,8 +101,8 @@ Section Public
buffer.append value;
display_ref buffer;
);
-
-
+
+
diff --git a/src/constant/string_cst.li b/src/constant/string_cst.li
index 4e05965..751f27e 100644
--- a/src/constant/string_cst.li
+++ b/src/constant/string_cst.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := STRING_CST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "String constant";
-
+
Section Inherit
-
+
+ parent_constant:Expanded CONSTANT;
-
+
Section Public
-
- - output:STRING :=
+
+ - output:STRING :=
( + result:STRING;
-
+
result := STRING.create 256;
title "STRING CONSTANT" in result;
result
);
-
+
- output_count:INTEGER;
-
+
//
// Value.
//
+ string:STRING_CONSTANT;
-
+
//
// Creation.
//
@@ -60,7 +60,7 @@ Section Public
result.make p text n length len;
result
);
-
+
- make p:POSITION text n:STRING_CONSTANT length len:INTEGER <-
(
position := p;
@@ -74,8 +74,8 @@ Section Public
//
// Comparaison.
//
-
- - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
+
+ - Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + p:STRING_CST;
p ?= other;
(p != NULL) && {string = p.string}
@@ -86,24 +86,24 @@ Section Public
//
- genere buffer:STRING <-
- ( + idx,count,cur:INTEGER;
+ ( + idx,count,cur:INTEGER;
- is_init:BOOLEAN;
- is_storage:BOOLEAN;
- is_count:BOOLEAN;
-
+
(is_init).if_false {
is_storage := type_string_constant.get_local_slot (ALIAS_STR.slot_storage)
.slot_data_intern.ensure_count != 0;
is_count := type_string_constant.get_local_slot (ALIAS_STR.slot_count)
- .slot_data_intern.ensure_count != 0;
+ .slot_data_intern.ensure_count != 0;
is_init := TRUE;
};
-
+
count := dico_string.fast_at string;
(count >= 0).if {
output_count := output_count + 1;
idx := output_count;
-
+
cur := output.count - 1;
(is_java).if {
output.append "private static ";
@@ -120,7 +120,7 @@ Section Public
(static_type.is_late_binding).if {
output.append "__";
output.append (static_type.raw.intern_name);
- output.append "__,";
+ output.append "__,";
};
};
(is_count).if {
@@ -133,7 +133,7 @@ Section Public
{(output.count - cur) > 78}.while_do {
output.insert_string "\\\n" to (cur+78);
cur := cur + 78;
- };
+ };
output.add_last '\"';
} else {
output.remove_last 1;
@@ -150,14 +150,14 @@ Section Public
//
(is_java).if {
buffer.append "__string_";
- idx.append_in buffer;
+ idx.append_in buffer;
} else {
buffer.append "(&__string_";
idx.append_in buffer;
buffer.add_last ')';
};
);
-
+
//
// Display.
//
@@ -169,10 +169,10 @@ Section Public
buffer.add_last '\"';
display_ref buffer;
);
-
-Section Private
-
- - dico_string:HASHED_DICTIONARY(INTEGER,STRING_CONSTANT) :=
+
+Section Private
+
+ - dico_string:HASHED_DICTIONARY(INTEGER,STRING_CONSTANT) :=
HASHED_DICTIONARY(INTEGER,STRING_CONSTANT).create;
diff --git a/src/dispatcher/dta.li b/src/dispatcher/dta.li
index f81870a..1a9792f 100644
--- a/src/dispatcher/dta.li
+++ b/src/dispatcher/dta.li
@@ -19,62 +19,62 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := DTA;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all late binding";
-
+
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
-
+
Section Public
-
+
+ result_expr:EXPR;
-
+
+ slot:SLOT;
-
+
+ self_arg:EXPR;
-
+
+ context:LOCAL;
-
+
//
// Service
//
-
+
- remove <-
(
// Nothing.
);
-
+
//
// Display.
//
-
- - display buffer:STRING <-
+
+ - display buffer:STRING <-
(
buffer.append "DTA";
deferred;
);
-
-Section NODE_TYPE, DTA
-
+
+Section NODE_TYPE, DTA
+
- product t:TYPE with e:EXPR self type_self:TYPE_FULL :LIST <-
( + result:LIST;
-
+
result := LIST.create (e.position);
- (t = TYPE_NULL).if {
- TYPE_NULL.product_error position in result with context;
+ (t = TYPE_NULL).if {
+ TYPE_NULL.product_error position in result with context;
? {result.count != 0};
} else {
lookup t with e in result;
};
- result
- );
+ result
+ );
- update_branch l:LIST self type_self:TYPE_FULL :BOOLEAN <-
[
@@ -82,12 +82,12 @@ Section NODE_TYPE, DTA
]
( + node:NODE;
+ result:BOOLEAN;
-
+
node ?= l.first;
(node = NULL).if {
result := TRUE;
} else {
-
+
/*
"DTA: ".print;
type_self.print;
@@ -101,43 +101,43 @@ Section NODE_TYPE, DTA
};
result
);
-
-Section NODE_STYLE, SELF
-
- - get_argument:FAST_ARRAY(EXPR) <-
+
+Section NODE_STYLE, SELF
+
+ - get_argument:FAST_ARRAY(EXPR) <-
( + result:FAST_ARRAY(EXPR);
-
+
result := FAST_ARRAY(EXPR).create_with_capacity 1;
result.add_last (self_arg.my_copy);
result
);
-
+
Section DTA
-
- - finalise typ:TYPE with (expr:EXPR,s:SLOT) in lst:LIST <-
+
+ - finalise typ:TYPE with (expr:EXPR,s:SLOT) in lst:LIST <-
( + node:NODE_STYLE;
-
+
node := NODE_STYLE.create (expr.my_copy,s) with Self result result_expr;
- lst.add_last node;
+ lst.add_last node;
);
-
+
Section Private
-
+
- lookup typ:TYPE with expr:EXPR in lst:LIST <-
( + s:SLOT;
+ name:STRING_CONSTANT;
+ node_style:NODE_STYLE;
+ r:EXPR;
-
+
name := slot.name;
- s := typ.get_local_slot name;
+ s := typ.get_local_slot name;
(s = NULL).if {
- // Lookup parent.
- s := typ.get_path_slot name;
+ // Lookup parent.
+ s := typ.get_path_slot name;
r := s.result_type.get_expr_for typ;
node_style := NODE_STYLE.create (expr.my_copy,s) with Self result r;
lst.add_last node_style;
- lst.add_last (NODE_TYPE.create r with Self);
+ lst.add_last (NODE_TYPE.create r with Self);
} else {
// Direct call.
s.is_equal_profil slot;
diff --git a/src/dispatcher/dta_block.li b/src/dispatcher/dta_block.li
index 18de214..85ba921 100644
--- a/src/dispatcher/dta_block.li
+++ b/src/dispatcher/dta_block.li
@@ -19,73 +19,73 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := DTA_BLOCK;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Lisaac IS A Advanced Compiler";
-
+
Section Inherit
-
+
+ parent_dta_rd_args:Expanded DTA_RD_ARGS;
-
+
Section Public
-
+
+ result_expr:EXPR;
-
+
// Add.
-
+
+ model:TYPE_BLOCK;
-
+
//
// Creation.
//
-
+
- create mod:TYPE_BLOCK with larg:FAST_ARRAY(EXPR) :SELF <-
( + result:SELF;
- result := clone;
+ result := clone;
result.make mod with larg;
- result
+ result
);
-
+
- make mod:TYPE_BLOCK with larg:FAST_ARRAY(EXPR) <-
[ -? {mod.position != 0}; ]
- (
+ (
(profil_current = NULL).if {
context := context_main;
} else {
context := profil_current.context;
- };
+ };
model := mod;
position := mod.position;
argument_list := larg;
- result_expr := mod.get_expr_for (mod.position);
+ result_expr := mod.get_expr_for (mod.position);
);
-
+
//
// Display.
//
-
- - display buffer:STRING <-
+
+ - display buffer:STRING <-
(
buffer.append "DTA_BLOCK";
);
-Section NODE_STYLE, SELF
-
- - get_argument:FAST_ARRAY(EXPR) <-
+Section NODE_STYLE, SELF
+
+ - get_argument:FAST_ARRAY(EXPR) <-
( + result:FAST_ARRAY(EXPR);
+ rd:READ_SLOT;
(copy_argument).if {
- result := FAST_ARRAY(EXPR).create_with_capacity (argument_list.count);
+ result := FAST_ARRAY(EXPR).create_with_capacity (argument_list.count);
rd ?= argument_list.first;
result.add_last (rd.receiver.my_copy);
- (argument_list.lower+1).to (argument_list.upper) do { j:INTEGER;
+ (argument_list.lower+1).to (argument_list.upper) do { j:INTEGER;
result.add_last (argument_list.item j.my_copy);
- };
+ };
} else {
result := argument_list;
copy_argument := TRUE;
@@ -93,62 +93,62 @@ Section NODE_STYLE, SELF
result
);
-Section NODE_TYPE, DTA
-
+Section NODE_TYPE, DTA
+
- product t:TYPE with e:EXPR self type_self:TYPE_FULL :LIST <-
( + result:LIST;
+ t_block:PROFIL_BLOCK;
- + wrt:WRITE;
+ + wrt:WRITE;
+ wrt_larg:FAST_ARRAY(WRITE);
+ call:CALL_SLOT;
+ em:EXPR_MULTIPLE;
+ rd:READ;
+ result_var:VARIABLE;
-
+
result := LIST.create (e.position);
- (t = TYPE_NULL).if {
+ (t = TYPE_NULL).if {
TYPE_NULL.product_error (e.position) in result with context;
- } else {
- t_block ?= t;
-
-
- (t_block = NULL).if { // BSBS: debug
+ } else {
+ t_block ?= t;
+
+
+ (t_block = NULL).if { // BSBS: debug
"<<<".print;
t.print;
">>>".print; '\n'.print;
list_current.debug_display;
- syntax_error (argument_list.first.position,"Block not found");
+ syntax_error (argument_list.first.position,"Block not found");
};
-
+
wrt_larg := t_block.write_argument get_argument;
- call := CALL_SLOT.create (e.position) profil t_block with wrt_larg cop NULL;
- (result_expr.static_type.raw != TYPE_VOID).if {
+ call := CALL_SLOT.create (e.position) profil t_block with wrt_larg cop NULL;
+ (result_expr.static_type.raw != TYPE_VOID).if {
em ?= result_expr;
(em != NULL).if {
(em.lower).to (em.upper) do { j:INTEGER;
rd ?= em.item j;
? {rd != NULL};
- result_var := rd.variable;
+ result_var := rd.variable;
rd := call.profil.result_list.item j.read (e.position);
wrt := result_var.write (e.position) value rd;
- call.result_list.add_last (RESULT.create wrt);
- };
+ call.result_list.add_last (RESULT.create wrt);
+ };
} else {
rd ?= result_expr;
- result_var := rd.variable;
+ result_var := rd.variable;
rd := call.profil.result_list.first.read (e.position);
wrt := result_var.write (e.position) value rd;
- call.result_list.add_last (RESULT.create wrt);
- };
+ call.result_list.add_last (RESULT.create wrt);
+ };
};
result.add_last call;
};
- result
- );
-
+ result
+ );
+
- update_branch l:LIST self type_self:TYPE_FULL :BOOLEAN <-
(
TRUE
);
-
+
diff --git a/src/dispatcher/dta_cast.li b/src/dispatcher/dta_cast.li
index 02aeb12..bab3a94 100644
--- a/src/dispatcher/dta_cast.li
+++ b/src/dispatcher/dta_cast.li
@@ -33,9 +33,9 @@ Section Inherit
- parent_dta:DTA := DTA;
Section Public
-
+
+ position:POSITION;
-
+
+ result_expr:EXPR;
//
@@ -91,7 +91,7 @@ Section NODE_TYPE, DTA
(cast.type.raw = t).if {
new_value := CAST.create (cast.type) value (e.my_copy);
};
- }.elseif {t.is_sub_type (cast.type.raw)} then {
+ }.elseif {t.is_sub_type (cast.type.raw)} then {
new_value := CAST.create (t.default) value (e.my_copy);
};
};
diff --git a/src/dispatcher/dta_rd_args.li b/src/dispatcher/dta_rd_args.li
index d218cdc..4357ce2 100644
--- a/src/dispatcher/dta_rd_args.li
+++ b/src/dispatcher/dta_rd_args.li
@@ -19,38 +19,38 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := DTA_RD_ARGS;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Read site with arguments";
-
+
Section Inherit
-
+
+ parent_dta_rd:Expanded DTA_RD;
-
+
Section Public
-
+
- self_arg:EXPR <- argument_list.first;
-
+
// Add.
-
+
+ argument_list:FAST_ARRAY(EXPR);
-
+
+ copy_argument:BOOLEAN;
-
+
- parameter_to_type p:ITM_TYPE_PARAMETER :TYPE_FULL <-
( + result:TYPE_FULL;
+ idx:INTEGER;
- // For Genericity.
+ // For Genericity.
result := slot.receiver_type.parameter_to_type p;
(result = NULL).if {
// For Self + type parametric.
idx := slot.get_index_argument_type p;
- (idx != - 1).if {
+ (idx != - 1).if {
result := argument_list.item idx.static_type;
};
};
@@ -60,42 +60,42 @@ Section Public
//
// Creation.
//
-
+
- create p:POSITION call sl:SLOT with args:FAST_ARRAY(EXPR) intern flag:BOOLEAN :SELF <-
[ -? {p != 0}; ]
( + result:SELF;
-
+
result := clone;
result.make p call sl with args intern flag;
result
);
-
+
- make p:POSITION call sl:SLOT with args:FAST_ARRAY(EXPR) intern flag:BOOLEAN <-
(
- position := p;
+ position := p;
slot := sl;
argument_list := args;
result_expr := get_expr_result;
- is_intern := flag;
+ is_intern := flag;
(profil_current = NULL).if {
context := context_main;
} else {
context := profil_current.context;
};
);
-
+
//
// Just for ITM_EXPRESSION
//
-
+
- create_partial p:POSITION call sl:SLOT :SELF <-
( + result:SELF;
-
+
result := clone;
result.make_partial p call sl;
result
);
-
+
- make_partial p:POSITION call sl:SLOT <-
(
position := p;
@@ -105,13 +105,13 @@ Section Public
//
// Display.
//
-
- - display buffer:STRING <-
+
+ - display buffer:STRING <-
(
buffer.append "DTA_RD_ARGS:";
buffer.append (slot.name);
);
-
+
//
// Service
//
@@ -125,21 +125,21 @@ Section Public
copy_argument := TRUE;
};
);
-
-Section NODE_STYLE, SELF
-
- - get_argument:FAST_ARRAY(EXPR) <-
+
+Section NODE_STYLE, SELF
+
+ - get_argument:FAST_ARRAY(EXPR) <-
( + result:FAST_ARRAY(EXPR);
-
+
(copy_argument).if {
- result := FAST_ARRAY(EXPR).create_with_capacity (argument_list.count);
- (argument_list.lower).to (argument_list.upper) do { j:INTEGER;
+ result := FAST_ARRAY(EXPR).create_with_capacity (argument_list.count);
+ (argument_list.lower).to (argument_list.upper) do { j:INTEGER;
result.add_last (argument_list.item j.my_copy);
- };
+ };
} else {
result := argument_list;
copy_argument := TRUE;
};
result
);
-
+
diff --git a/src/dispatcher/dta_wr_code.li b/src/dispatcher/dta_wr_code.li
index 1d638eb..00791af 100644
--- a/src/dispatcher/dta_wr_code.li
+++ b/src/dispatcher/dta_wr_code.li
@@ -19,38 +19,38 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := DTA_WR_CODE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Write site with code";
-
+
Section Inherit
-
+
+ parent_dta:Expanded DTA;
-
+
Section Public
// Add.
-
+
+ code:ITM_CODE;
-
+
//
// Creation.
//
-
+
- create p:POSITION slot sl:SLOT self arg:EXPR code v:ITM_CODE :SELF <-
[ -? {p != 0}; ]
( + result:SELF;
-
+
result := clone;
result.make p slot sl self arg code v;
result
);
-
+
- make p:POSITION slot sl:SLOT self arg:EXPR code v:ITM_CODE <-
(
position := p;
@@ -68,23 +68,23 @@ Section Public
//
// Display.
//
-
- - display buffer:STRING <-
+
+ - display buffer:STRING <-
(
buffer.append "DTA_WR_CODE:";
- buffer.append (slot.name);
+ buffer.append (slot.name);
);
-
+
//
// Service
//
-
-Section DTA
-
- - finalise typ:TYPE with (expr:EXPR,s:SLOT) in lst:LIST <-
+
+Section DTA
+
+ - finalise typ:TYPE with (expr:EXPR,s:SLOT) in lst:LIST <-
( + id:PROTOTYPE_CST;
+ pos:POSITION;
-
+
pos := expr.position;
id := PROTOTYPE_CST.create pos type (TYPE_ID.get_index (s.add_style code).default);
(s.style = '+').if {
@@ -93,4 +93,4 @@ Section DTA
lst.add_last (s.slot_id.write pos value id);
};
);
-
+
diff --git a/src/dispatcher/dta_wr_value.li b/src/dispatcher/dta_wr_value.li
index dc4fc51..85047c3 100644
--- a/src/dispatcher/dta_wr_value.li
+++ b/src/dispatcher/dta_wr_value.li
@@ -110,8 +110,8 @@ Section NODE_TYPE, DTA
result := parent_dta.update_branch l self type_self;
(l.count < 3).if {
- wrt_slot ?= l.first;
- wrt_glob ?= l.first;
+ wrt_slot ?= l.first;
+ wrt_glob ?= l.first;
(wrt_slot != NULL).if {
(wrt_slot.slot.slot_id != NULL).if {
add_write_id (wrt_slot.receiver,wrt_slot.slot) in l;
diff --git a/src/dispatcher/node.li b/src/dispatcher/node.li
index 5eeecf6..780b9b9 100644
--- a/src/dispatcher/node.li
+++ b/src/dispatcher/node.li
@@ -54,9 +54,9 @@ Section PROTOTYPE
is_ok := node_list.item j.update;
(is_ok).if {
node_list.remove j;
- } else {
+ } else {
j := j + 1;
- };
+ };
};
);
@@ -299,7 +299,7 @@ Section Public
- display buffer:STRING <-
(
(switch = NULL).if {
- (first_code = NULL).if {
+ (first_code = NULL).if {
to_pointer.append_in buffer;
buffer.append "<NODE VIDE=";
expr.display buffer;
diff --git a/src/dispatcher/node_style.li b/src/dispatcher/node_style.li
index 396b074..42ae8a6 100644
--- a/src/dispatcher/node_style.li
+++ b/src/dispatcher/node_style.li
@@ -19,61 +19,61 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := NODE_STYLE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Switch node for style";
-
+
Section Inherit
-
+
+ parent_node:Expanded NODE;
-
+
Section Public
-
+
+ result_expr:EXPR;
-
+
+ slot:SLOT;
Section NODE, DTA
-
+
//
// Creation.
//
-
+
- create (e:EXPR,sl:SLOT) with dta:DTA result r:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make (e,sl) with dta result r;
result
);
-
+
- make (e:EXPR,sl:SLOT) with dta:DTA result r:EXPR <-
- (
+ (
expr := e;
slot := sl;
data := dta;
result_expr := r;
);
-
+
Section Public
-
- - my_copy:SELF <-
- (
+
+ - my_copy:SELF <-
+ (
crash_with_message "NODE_STYLE.my_copy";
- NULL
+ NULL
);
-
-Section NODE, DTA
-
+
+Section NODE, DTA
+
//
// Update.
//
-
+
- update_link self_type:TYPE_FULL :BOOLEAN <-
[
-? {self_type != NULL};
@@ -83,15 +83,15 @@ Section NODE, DTA
+ case:CASE;
+ e:EXPR;
+ low,up,count:INTEGER;
-
+
(slot.slot_id = NULL).if {
(first_code = NULL).if {
first_type := TYPE_ID.get_index (slot.lower_style);
- first_code := call_for first_type self self_type;
+ first_code := call_for first_type self self_type;
};
- } else {
+ } else {
low := slot.lower_style;
- up := slot.upper_style;
+ up := slot.upper_style;
count := up-low + 1;
(switch = NULL).if {
(slot.style = '-').if {
@@ -104,21 +104,21 @@ Section NODE, DTA
};
list := switch.list;
(list.count != count).if {
- 0.to (count-1) do { j:INTEGER;
+ 0.to (count-1) do { j:INTEGER;
typ := TYPE_ID.get_index (j+low);
-
+
((j > list.upper) || {typ != list.item j.id}).if {
case := CASE.create typ with (call_for typ self self_type);
list.add case to j;
- };
- };
+ };
+ };
};
};
FALSE
);
-
-Section Private
-
+
+Section Private
+
- call_for t:TYPE self type_self:TYPE_FULL :LIST <-
[
-? {type_self != NULL};
@@ -128,12 +128,12 @@ Section Private
+ call:CALL_SLOT;
+ em:EXPR_MULTIPLE;
+ rd:READ;
- + wrt:WRITE;
+ + wrt:WRITE;
+ result_var:VARIABLE;
- + new_larg:FAST_ARRAY(EXPR);
+ + new_larg:FAST_ARRAY(EXPR);
+ slot_dta:SLOT_DATA;
+ slot_cod:SLOT_CODE;
- + idx:INTEGER;
+ + idx:INTEGER;
+ type:TYPE_FULL;
+ my_profil:PROFIL;
+ wrt_lst:FAST_ARRAY(WRITE);
@@ -143,23 +143,23 @@ Section Private
+ cop_arg:EXPR;
+ new_val:EXPR;
+ val:EXPR;
-
+
result := LIST.create position;
-
- data_rd ?= data;
+
+ data_rd ?= data;
((type_self.prototype.style = '-') && {data_rd != NULL} && {! data_rd.is_intern}).if {
cop_arg := data.self_arg.my_copy;
};
-
+
typ ?= t;
- idx := typ.index;
+ idx := typ.index;
(idx = 0).if {
- // Data.
+ // Data.
(cop_arg != NULL).if {
result.add_last (COP_LOCK.create position with cop_arg);
};
//
- slot_dta := slot.slot_data;
+ slot_dta := slot.slot_data;
slot_dta.init;
(slot.slot_data_list != NULL).if {
(slot.slot_data_list.lower).to (slot.slot_data_list.upper) do { j:INTEGER;
@@ -171,40 +171,40 @@ Section Private
// BSBS: Pourquoi tu produit quelque chose qui serre à rien ???
(slot_dta.style = '-').if {
result.add_last (slot_dta.read position);
- } else {
+ } else {
result.add_last (slot_dta.read position with (expr.my_copy));
- };
- } else {
+ };
+ } else {
em ?= result_expr;
(em != NULL).if {
(em.lower).to (em.upper - 1) do { j:INTEGER;
rd ?= em.item j;
? {rd != NULL};
- result_var := rd.variable;
- result.add_last (new_write result_var with (expr,slot.slot_data_list.item j));
+ result_var := rd.variable;
+ result.add_last (new_write result_var with (expr,slot.slot_data_list.item j));
};
rd ?= em.last;
} else {
rd ?= result_expr;
- };
-
+ };
+
//(slot_dta.name == "storage").if {
/*
string_tmp.clear;
string_tmp.copy (type_self.raw.name);
string_tmp.add_last ' ';
- string_tmp.append (t.name);
+ string_tmp.append (t.name);
(data.slot != NULL).if {
string_tmp.add_last ' ';
- string_tmp.append (data.slot.name);
+ string_tmp.append (data.slot.name);
};
result.add_last (
EXTERNAL_C.create position text (ALIAS_STR.get string_tmp) access NULL persistant TRUE type (TYPE_NULL.default)
);
- */
+ */
/*
- "Data : ".print; slot_dta.intern_name.print;
- " dans ".print; type_self.raw.name.print;
+ "Data : ".print; slot_dta.intern_name.print;
+ " dans ".print; type_self.raw.name.print;
(profil_current != NULL).if {
profil_current.name.print;
};
@@ -215,21 +215,21 @@ Section Private
result.add_last (new_write result_var with (expr,slot_dta));
};
(cop_arg != NULL).if {
- result.add_last (COP_UNLOCK.create position);
+ result.add_last (COP_UNLOCK.create position);
};
} else {
// Function.
- slot_cod := slot.slot_code idx;
+ slot_cod := slot.slot_code idx;
(slot_cod.id_section.is_inherit_or_insert).if {
new_larg := FAST_ARRAY(EXPR).create_with_capacity 1;
new_larg.add_last (data.self_arg.my_copy);
} else {
new_larg := data.get_argument;
};
- type := new_larg.first.static_type;
+ type := new_larg.first.static_type;
? {type != NULL};
- //
- (debug_level_option != 0).if {
+ //
+ (debug_level_option != 0).if {
// BSBS: Poser le PUSH avant le NODE
//(data.context = NULL).if {
// ctext := context_main;
@@ -237,19 +237,19 @@ Section Private
(data.context = NULL).if {
crash_with_message "NODE_STYLE : data.context = NULL!\n";
};
-
+
ctext := data.context;
//};
result.add_last (
PUSH.create position context ctext first FALSE
- );
+ );
};
//
- rd ?= new_larg.first;
+ rd ?= new_larg.first;
((rd != NULL) && {rd.variable.name = ALIAS_STR.variable_self}).if {
- // Fix Self type for resend call (else it's fixed by NODE_TYPE)
- new_type_self := type;
- } else {
+ // Fix Self type for resend call (else it's fixed by NODE_TYPE)
+ new_type_self := type;
+ } else {
new_type_self := type_self;
};
/*
@@ -258,16 +258,16 @@ Section Private
string_tmp.append " / ";
type_self.display string_tmp;
result.add_last (
- EXTERNAL_C.create (data.position)
+ EXTERNAL_C.create (data.position)
text (ALIAS_STR.get string_tmp) access NULL persistant TRUE type (TYPE_VOID.default)
);
*/
new_val := CAST.create new_type_self value (new_larg.first);
- new_larg.put new_val to 0;
-
-
+ new_larg.put new_val to 0;
+
+
/*
- (new_larg.lower+1).to (new_larg.upper) do { j:INTEGER;
+ (new_larg.lower+1).to (new_larg.upper) do { j:INTEGER;
ts ?= slot_cod.get_argument_type j;
((ts != NULL) && {ts = ITM_TYPE_SIMPLE.type_self}).if {
(new_larg.item j.static_type != new_type_self).if {
@@ -276,9 +276,9 @@ Section Private
ts.print;
string_tmp.clear;
(slot_cod.argument_list.lower).to (slot_cod.argument_list.upper) do { h:INTEGER;
- slot_cod.argument_list.item h.append_in string_tmp;
+ slot_cod.argument_list.item h.append_in string_tmp;
};
- string_tmp.print;
+ string_tmp.print;
'\n'.print;
warning_error (position,"BUG");
semantic_error (new_larg.item j.position,"Type not compatible SELF.");
@@ -287,15 +287,15 @@ Section Private
//new_larg.put new_val to j;
};
};
- */
+ */
(my_profil, wrt_lst) := slot_cod.get_profil new_larg self new_type_self;
- //
- (result_expr.static_type.raw = TYPE_VOID).if {
+ //
+ (result_expr.static_type.raw = TYPE_VOID).if {
result.add_last (
CALL_SLOT.create position profil my_profil with wrt_lst cop cop_arg
);
- } else {
- call := CALL_SLOT.create position profil my_profil with wrt_lst cop NULL;
+ } else {
+ call := CALL_SLOT.create position profil my_profil with wrt_lst cop NULL;
(cop_arg != NULL).if {
result.add_last (COP_LOCK.create position with cop_arg);
result.add_last call;
@@ -308,42 +308,41 @@ Section Private
(em.lower).to (em.upper) do { j:INTEGER;
rd ?= em.item j;
? {rd != NULL};
- result_var := rd.variable;
+ result_var := rd.variable;
rd := call.profil.result_list.item j.read position;
wrt := result_var.write position value rd;
call.result_list.add_last (RESULT.create wrt);
- };
+ };
}.elseif {
- (call.profil.result_list.count != 0) ||
+ (call.profil.result_list.count != 0) ||
{call.is_interrupt}
} then {
rd ?= result_expr;
- result_var := rd.variable;
+ result_var := rd.variable;
(call.is_interrupt).if {
//val := PROTOTYPE_CST.create position type (TYPE_NULL.default);
- val := EXTERNAL_C.create position text "/* NODE_STYLE */"
+ val := EXTERNAL_C.create position text "/* NODE_STYLE */"
access NULL persistant FALSE type (type_pointer.default);
} else {
val := call.profil.result_list.first.read position;
};
wrt := result_var.write position value val;
- call.result_list.add_last (RESULT.create wrt);
- };
- };
- };
+ call.result_list.add_last (RESULT.create wrt);
+ };
+ };
+ };
result
);
-
-Section Private
-
+
+Section Private
+
- new_write var:VARIABLE with (e:EXPR,slot:SLOT_DATA) :WRITE <-
( + rd:READ;
-
+
(slot.style = '-').if {
rd := slot.read position;
- } else {
+ } else {
rd := slot.read position with (e.my_copy);
};
var.write position value rd
);
-
\ No newline at end of file
diff --git a/src/dispatcher/node_type.li b/src/dispatcher/node_type.li
index 69597b2..8549b5f 100644
--- a/src/dispatcher/node_type.li
+++ b/src/dispatcher/node_type.li
@@ -122,7 +122,7 @@ Section Private
result := TRUE;
}.elseif {(typ_f.raw = type_boolean) && {count = 2}} then {
result := TRUE;
- } else {
+ } else {
((typ_f.raw.is_block) || {typ_f.raw.subtype_list.count != count}).if {
lst_typ := TYPES_TMP.new;
expr.get_type lst_typ;
@@ -153,8 +153,8 @@ Section Private
};
list := switch.list;
(list.count != lst_typ.count).if {
- (lst_typ.lower).to (lst_typ.upper) do { j:INTEGER;
- typ := lst_typ.item j;
+ (lst_typ.lower).to (lst_typ.upper) do { j:INTEGER;
+ typ := lst_typ.item j;
((j > list.upper) || {typ != list.item j.id}).if {
add_stack_type typ;
//
@@ -162,7 +162,7 @@ Section Private
list.add case to j;
//
stack_type.remove_last;
- };
+ };
};
};
};
@@ -183,11 +183,11 @@ Section Private
(switch = NULL).if {
(first_code != NULL).if {
- (self_type = NULL).if {
+ (self_type = NULL).if {
new_type_self := expr.static_type;
((! new_type_self.is_expanded) || {new_type_self.raw = type_boolean}).if {
new_type_self := first_type.default.to_strict;
- };
+ };
} else {
new_type_self := self_type;
};
diff --git a/src/external/arithmetic/expr_add.li b/src/external/arithmetic/expr_add.li
index 6386f7e..0883d5d 100644
--- a/src/external/arithmetic/expr_add.li
+++ b/src/external/arithmetic/expr_add.li
@@ -19,60 +19,60 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_ADD;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := "+";
-
+
//
// Execute.
//
-
+
- exec_conservator_left left_cst :INTEGER_CST :EXPR <-
//-- 0 + E -> E
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := right;
left_cst.remove;
};
result
);
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E + 0 -> E
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := left;
right_cst.remove;
};
result
);
-
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 + C2 -> C3
(
- left_cst.set_value (left_cst.value + right_cst.value);
+ left_cst.set_value (left_cst.value + right_cst.value);
right_cst.remove;
left_cst
);
-
-
-
+
+
+
diff --git a/src/external/arithmetic/expr_and.li b/src/external/arithmetic/expr_and.li
index bf36757..56c2c10 100644
--- a/src/external/arithmetic/expr_and.li
+++ b/src/external/arithmetic/expr_and.li
@@ -19,83 +19,83 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_AND;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
- symbol:STRING_CONSTANT := "&";
-
+
//
// Execute.
//
-
+
- exec_conservator_left left_cst :INTEGER_CST :EXPR <-
- //-- -1 & E -> E
+ //-- -1 & E -> E
( + result:EXPR;
-
+
(left_cst.is_saturated).if {
result := right;
left_cst.remove;
};
result
);
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E & -1 -> E
( + result:EXPR;
-
+
(right_cst.is_saturated).if {
result := left;
right_cst.remove;
};
result
);
-
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 & C2 -> C3
- (
- left_cst.set_value (left_cst.value & right_cst.value);
+ (
+ left_cst.set_value (left_cst.value & right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- E & E -> E
( + result:EXPR;
-
+
(left ~= right).if {
right.remove;
result := left;
};
- result
+ result
);
-
- - exec_left left_cst :INTEGER_CST :EXPR <-
+
+ - exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 & E -> 0
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
};
result
);
-
+
- exec_right right_cst:INTEGER_CST :EXPR <-
//-- E & 0 -> 0
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := right_cst;
left.remove;
@@ -103,7 +103,7 @@ Section Public
result
);
-
+
diff --git a/src/external/arithmetic/expr_binary.li b/src/external/arithmetic/expr_binary.li
index ba120a2..2ebf040 100644
--- a/src/external/arithmetic/expr_binary.li
+++ b/src/external/arithmetic/expr_binary.li
@@ -19,124 +19,124 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_BINARY;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- left.is_invariant && {right.is_invariant};
-
+
+ left:EXPR;
-
+
+ right:EXPR;
-
- - symbol:STRING_CONSTANT <-
+
+ - symbol:STRING_CONSTANT <-
(
deferred;
NULL
);
-
+
- static_type:TYPE_FULL <- left.static_type;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
left .get_type t;
//right.get_type t;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with l:EXPR and r:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with l and r;
result
);
-
+
- make p:POSITION with l:EXPR and r:EXPR <-
(
position := p;
left := l;
right := r;
);
-
+
- my_copy:SELF <- SELF.create position with (left.my_copy) and (right.my_copy);
-
+
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + same:SELF;
-
+
same ?= other;
(same != NULL) && {left ~= same.left} && {right ~= same.right}
);
-
+
//
// Remove
//
-
+
- remove <-
(
left .remove;
right.remove;
);
-
+
//
// Execute
//
-
+
- execute_unlink:INSTR <-
- ( + instr:INSTR;
+ ( + instr:INSTR;
instr := left.execute_unlink;
(instr != NULL).if {
list_current.insert_before instr;
};
- right.execute_unlink
+ right.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ left_cst,right_cst:INTEGER_CST;
-
- old_seq := seq_call_and_loop;
+
+ old_seq := seq_call_and_loop;
left := left.execute_link;
- right := right.execute_link;
+ right := right.execute_link;
//
left_cst ?= left;
right_cst ?= right;
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {left_cst != NULL}).if {
+ ((result = NULL) && {left_cst != NULL}).if {
result := exec_conservator_left left_cst;
};
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_conservator_right right_cst;
};
(
- (result = NULL) &&
- {right_cst != NULL} &&
+ (result = NULL) &&
+ {right_cst != NULL} &&
{left_cst != NULL}
).if {
result := exec left_cst and right_cst;
- };
- ((result = NULL) && {old_seq = seq_call_and_loop}).if {
- // No conservator transformation.
+ };
+ ((result = NULL) && {old_seq = seq_call_and_loop}).if {
+ // No conservator transformation.
result := exec;
((result = NULL) && {left_cst != NULL}).if {
result := exec_left left_cst;
@@ -151,27 +151,27 @@ Section Public
result.set_position position;
new_execute_pass;
};
-
+
result
);
-
- - exec_conservator:EXPR <- NULL;
+
+ - exec_conservator:EXPR <- NULL;
- exec_conservator_left left_cst :INTEGER_CST :EXPR <- NULL;
- exec_conservator_right right_cst:INTEGER_CST :EXPR <- NULL;
-
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <- NULL;
-
+
- exec:EXPR <- NULL;
- exec_left left_cst :INTEGER_CST :EXPR <- NULL;
- exec_right right_cst:INTEGER_CST :EXPR <- NULL;
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
- (static_type.raw = type_pointer).if {
+ (static_type.raw = type_pointer).if {
buffer.append "(void *)";
} else {
buffer.add_last '(';
@@ -188,7 +188,7 @@ Section Public
buffer.add_last ' ';
buffer.append symbol;
buffer.add_last ' ';
- (static_type.raw = type_pointer).if {
+ (static_type.raw = type_pointer).if {
buffer.append "(unsigned long)";
}.elseif {! right.static_type.is_expanded} then {
buffer.append "(void *)"; // BSBS: A virer quand tu auras optim '=='
@@ -196,11 +196,11 @@ Section Public
right.genere buffer;
buffer.add_last ')';
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.add_last '(';
diff --git a/src/external/arithmetic/expr_div.li b/src/external/arithmetic/expr_div.li
index bd518da..e988746 100644
--- a/src/external/arithmetic/expr_div.li
+++ b/src/external/arithmetic/expr_div.li
@@ -19,35 +19,35 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_DIV;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Div Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
- symbol:STRING_CONSTANT := "/";
-
+
//
// Execute.
//
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E / 0 -> Error.
//-- E / 1 -> E
//-- E / -1 -> - E
//-- E / 2^n -> E >> n
( + result:EXPR;
+ v:INTEGER_64;
-
+
(right_cst.value = 0).if {
warning_error (position,"Division by zero.");
}.elseif {right_cst.value = 1} then {
@@ -56,37 +56,37 @@ Section Public
}.elseif {right_cst.value = -1} then {
result := EXPR_NEG.create position with left;
right_cst.remove;
- }.elseif {(v := right_cst.to_power) != -1} then {
+ }.elseif {(v := right_cst.to_power) != -1} then {
right_cst.set_value v;
result := EXPR_SHIFT_R.create position with left and right_cst;
};
result
);
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 / C2 -> C3
( + result:EXPR;
-
+
(right_cst.value != 0).if {
- left_cst.set_value (left_cst.value / right_cst.value);
+ left_cst.set_value (left_cst.value / right_cst.value);
right_cst.remove;
result := left_cst;
};
result
);
-
+
- exec:EXPR <-
//-- E / E -> 1
//-- -E / E -> -1
//-- E / -E -> -1
( + result:EXPR;
+ neg:EXPR_NEG;
-
+
(right ~= left).if {
result := INTEGER_CST.create position value 1 type static_type;
right.remove;
left .remove;
- } else {
+ } else {
neg ?= left;
((neg != NULL) && {neg.right ~= right}).if {
result := INTEGER_CST.create position value (-1) type static_type;
@@ -99,15 +99,15 @@ Section Public
left.remove;
right.remove;
};
- };
+ };
};
result
);
-
+
- exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 / E -> 0
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
@@ -117,13 +117,13 @@ Section Public
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/external/arithmetic/expr_mod.li b/src/external/arithmetic/expr_mod.li
index d9a2dc8..0bb072b 100644
--- a/src/external/arithmetic/expr_mod.li
+++ b/src/external/arithmetic/expr_mod.li
@@ -19,32 +19,32 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_MOD;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := "%";
-
+
//
// Execute.
//
-
+
- exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E % 0 -> Error
//-- E % 2^n -> E & (2^n -1)
( + result:EXPR;
-
+
(right_cst.value = 0).if {
warning_error (position,"Division by zero.");
}.elseif {right_cst.to_power != -1} then {
@@ -53,31 +53,31 @@ Section Public
};
result
);
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 % C2 -> C3
(
- left_cst.set_value (left_cst.value % right_cst.value);
+ left_cst.set_value (left_cst.value % right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- E % E -> 0
( + result:EXPR;
-
+
(left ~= right).if {
result := INTEGER_CST.create position value 0 type static_type;
left.remove;
right.remove;
};
- result
+ result
);
- exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 % E -> 0
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
@@ -85,25 +85,25 @@ Section Public
result
);
- - exec_right right_cst:INTEGER_CST :EXPR <-
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- E % 1 -> 0
//-- E % -1 -> 0
( + result:EXPR;
-
+
(right_cst.value = 1).if {
right_cst.set_value 0;
left.remove;
result := right_cst;
- }.elseif {right_cst.value = -1} then {
+ }.elseif {right_cst.value = -1} then {
right_cst.set_value 0;
result := right_cst;
left.remove;
};
- result
+ result
);
-
-
-
+
+
+
diff --git a/src/external/arithmetic/expr_mul.li b/src/external/arithmetic/expr_mul.li
index ef87374..601e8c8 100644
--- a/src/external/arithmetic/expr_mul.li
+++ b/src/external/arithmetic/expr_mul.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_MUL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Mul Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := "*";
-
+
//
// Execute.
//
-
+
- exec_conservator_left left_cst :INTEGER_CST :EXPR <-
//-- 1 * E -> E
//-- -1 * E -> - E
//-- 2^n * E -> E << n
( + v:INTEGER_64;
+ result:EXPR;
-
+
(left_cst.value = 1).if {
left_cst.remove;
result := right;
@@ -57,16 +57,16 @@ Section Public
left_cst.set_value v;
result := EXPR_SHIFT_L.create position with right and left_cst;
};
- result
+ result
);
-
+
- exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E * 1 -> E
//-- E * -1 -> - E
//-- E * 2^n -> E << n
( + result:EXPR;
+ v:INTEGER_64;
-
+
(right_cst.value = 1).if {
right_cst.remove;
result := left;
@@ -79,38 +79,38 @@ Section Public
};
result
);
-
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 * C2 -> C3
(
- left_cst.set_value (left_cst.value * right_cst.value);
+ left_cst.set_value (left_cst.value * right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 * E -> 0
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
};
result
);
-
+
- exec_right right_cst:INTEGER_CST :EXPR <-
//-- E * 0 -> 0
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := right_cst;
left.remove;
- };
+ };
result
);
-
-
+
+
diff --git a/src/external/arithmetic/expr_neg.li b/src/external/arithmetic/expr_neg.li
index fb36e0f..e837692 100644
--- a/src/external/arithmetic/expr_neg.li
+++ b/src/external/arithmetic/expr_neg.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_NEG;
- copyright := "2003-2007 Benoit Sonntag";
@@ -27,41 +27,41 @@ Section Header
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Negatif unary arithmetic expression.";
-
+
Section Inherit
-
+
+ parent_expr_unary:Expanded EXPR_UNARY;
-
+
Section Public
-
+
- symbol:CHARACTER <- '-';
-
+
//
// Execute.
//
-
+
- exec_conservator:EXPR <-
- //-- - - E -> E
+ //-- - - E -> E
( + sub:EXPR_NEG;
+ result:EXPR;
-
+
sub ?= right;
(sub != NULL).if {
result := sub.right;
};
result
);
-
+
- exec_right right_cst:INTEGER_CST :EXPR <-
//-- - C1 -> C2
( + result:EXPR;
(right_cst.is_signed).if {
- right_cst.set_value (- right_cst.value);
+ right_cst.set_value (- right_cst.value);
result := right_cst;
};
result
);
-
+
diff --git a/src/external/arithmetic/expr_not.li b/src/external/arithmetic/expr_not.li
index bdc046a..e17a5ad 100644
--- a/src/external/arithmetic/expr_not.li
+++ b/src/external/arithmetic/expr_not.li
@@ -19,27 +19,27 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_NOT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Not unary arithmetic expression.";
-
+
Section Inherit
-
+
+ parent_expr_unary:Expanded EXPR_UNARY;
-
+
Section Public
-
+
- symbol:CHARACTER <- '~';
-
+
//
// Execute.
//
-
+
- exec_conservator:EXPR <-
//-- ~ (~ E1 & ~ E2) -> E1 | E2
//-- ~ (~ E1 | ~ E2) -> E1 & E2
@@ -48,7 +48,7 @@ Section Public
+ and:EXPR_AND;
+ neg1,neg2:EXPR_NOT;
+ result:EXPR;
-
+
and ?= right;
(and != NULL).if {
neg1 ?= and.left;
@@ -73,8 +73,8 @@ Section Public
};
result
);
-
- - exec_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- ~ C1 -> C2
( + result:EXPR;
(right_cst.is_signed).if {
@@ -82,9 +82,9 @@ Section Public
result := right_cst;
};
result
- );
-
-
+ );
+
+
diff --git a/src/external/arithmetic/expr_or.li b/src/external/arithmetic/expr_or.li
index edd6f86..bb07162 100644
--- a/src/external/arithmetic/expr_or.li
+++ b/src/external/arithmetic/expr_or.li
@@ -19,64 +19,64 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_OR;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Or binary arithmetic expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
- symbol:STRING_CONSTANT := "|";
-
+
//
// Execute.
//
-
+
- exec_conservator_left left_cst :INTEGER_CST :EXPR <-
//-- 0 | E -> E
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := right;
left_cst.remove;
};
result
);
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E | 0 -> E
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := left;
right_cst.remove;
};
result
);
-
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 | C2 -> C3
- (
- left_cst.set_value (left_cst.value | right_cst.value);
+ (
+ left_cst.set_value (left_cst.value | right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- (! E1 & E2) | (E1 & ! E2) -> E1 ^ E2 (A lot of possibilities, but see '^' in INTEGER)
//-- E | E -> E
( + result:EXPR;
+ and_l,and_r:EXPR_AND;
+ not_l,not_r:EXPR_NOT;
-
+
(left ~= right).if {
right.remove;
result := left;
@@ -94,24 +94,24 @@ Section Public
};
};
};
- result
+ result
);
-
- - exec_left left_cst :INTEGER_CST :EXPR <-
- //-- -1 | E -> -1
+
+ - exec_left left_cst :INTEGER_CST :EXPR <-
+ //-- -1 | E -> -1
( + result:EXPR;
-
+
(left_cst.is_saturated).if {
result := left_cst;
right.remove;
};
result
);
-
+
- exec_right right_cst:INTEGER_CST :EXPR <-
//-- E | -1 -> -1
( + result:EXPR;
-
+
(right_cst.is_saturated).if {
result := right_cst;
left.remove;
@@ -119,7 +119,7 @@ Section Public
result
);
-
+
diff --git a/src/external/arithmetic/expr_shift_l.li b/src/external/arithmetic/expr_shift_l.li
index 2be4257..924b72d 100644
--- a/src/external/arithmetic/expr_shift_l.li
+++ b/src/external/arithmetic/expr_shift_l.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_SHIFT_L;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := "<<";
-
+
//
// Execute.
//
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
- //-- E << 0 -> E
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+ //-- E << 0 -> E
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := left;
right_cst.remove;
};
result
);
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 << C2 -> C3
//-- C1 << -C2 -> Error.
(
@@ -59,27 +59,27 @@ Section Public
warning_error (position,"Left shift count is negative.");
left_cst.set_value 0;
} else {
- left_cst.set_value (left_cst.value << right_cst.value);
+ left_cst.set_value (left_cst.value << right_cst.value);
};
right_cst.remove;
left_cst
);
- - exec_left left_cst :INTEGER_CST :EXPR <-
+ - exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 << E -> 0
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
};
result
);
-
- - exec_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- E << -C2 -> Error.
( + result:EXPR;
-
+
(right_cst.value < 0).if {
warning_error (position,"Left shift count is negative.");
right_cst.set_value 0;
@@ -89,5 +89,5 @@ Section Public
};
result
);
-
-
+
+
diff --git a/src/external/arithmetic/expr_shift_r.li b/src/external/arithmetic/expr_shift_r.li
index a2c159e..c3e73e0 100644
--- a/src/external/arithmetic/expr_shift_r.li
+++ b/src/external/arithmetic/expr_shift_r.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_SHIFT_R;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := ">>";
-
+
//
// Execute.
//
-
- - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
- //-- E >> 0 -> E
+
+ - exec_conservator_right right_cst:INTEGER_CST :EXPR <-
+ //-- E >> 0 -> E
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := left;
right_cst.remove;
};
result
);
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 >> C2 -> C3
//-- C1 >> -C2 -> Error.
(
@@ -59,12 +59,12 @@ Section Public
warning_error (position,"Right shift count is negative.");
left_cst.set_value 0;
} else {
- left_cst.set_value (left_cst.value >> right_cst.value);
+ left_cst.set_value (left_cst.value >> right_cst.value);
};
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- E(unsigned) >> E(unsigned) -> 0
( + result:EXPR;
@@ -77,12 +77,12 @@ Section Public
*/
result
);
-
- - exec_left left_cst:INTEGER_CST :EXPR <-
+
+ - exec_left left_cst:INTEGER_CST :EXPR <-
//-- 0 >> E -> 0
//-- -1(signed) >> E -> -1(signed)
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := left_cst;
right.remove;
@@ -92,11 +92,11 @@ Section Public
};
result
);
-
- - exec_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- E >> -C2 -> Error.
( + result:EXPR;
-
+
(right_cst.value < 0).if {
warning_error (position,"Right shift count is negative.");
right_cst.set_value 0;
@@ -106,7 +106,7 @@ Section Public
};
result
);
-
-
-
-
+
+
+
+
diff --git a/src/external/arithmetic/expr_sub.li b/src/external/arithmetic/expr_sub.li
index decbb76..dabf611 100644
--- a/src/external/arithmetic/expr_sub.li
+++ b/src/external/arithmetic/expr_sub.li
@@ -19,44 +19,44 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_SUB;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Add Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := "-";
-
+
//
// Execute.
//
-
- - exec_conservator:EXPR <-
+
+ - exec_conservator:EXPR <-
//-- E1 - - E2 -> E1 + E2
( + neg:EXPR_NEG;
+ result:EXPR;
-
- neg ?= right;
+
+ neg ?= right;
(neg != NULL).if {
result := EXPR_ADD.create position with left and (neg.right);
};
result
);
-
- - exec_conservator_left left_cst :INTEGER_CST :EXPR <-
+
+ - exec_conservator_left left_cst :INTEGER_CST :EXPR <-
//-- 0 - E -> - E
- //-- -1 - E -> ~ E
+ //-- -1 - E -> ~ E
( + result:EXPR;
-
+
(left_cst.value = 0).if {
left_cst.remove;
result := EXPR_NEG.create position with right;
@@ -64,16 +64,16 @@ Section Public
left_cst.remove;
result := EXPR_NOT.create position with right;
};
- result
+ result
);
-
+
- exec_conservator_right right_cst:INTEGER_CST :EXPR <-
//-- E - 0 -> E
//-- -E - 1 -> ~ E
//-- E - -C -> E + C
( + result:EXPR;
+ neg:EXPR_NEG;
-
+
(right_cst.value = 0).if {
right_cst.remove;
result := left;
@@ -88,23 +88,23 @@ Section Public
result := EXPR_ADD.create position with left and right_cst;
};
result
- );
-
+ );
+
- exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 - C2 -> C3
(
- left_cst.set_value (left_cst.value - right_cst.value);
+ left_cst.set_value (left_cst.value - right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- E - E -> 0
- //-- E1 - ((E1 / E2) * E2) -> E1 % E2
+ //-- E1 - ((E1 / E2) * E2) -> E1 % E2
( + result:EXPR;
+ mul:EXPR_MUL;
+ div:EXPR_DIV;
-
+
(left ~= right).if {
left.remove;
right.remove;
@@ -124,5 +124,4 @@ Section Public
result
);
-
-
\ No newline at end of file
+
diff --git a/src/external/arithmetic/expr_unary.li b/src/external/arithmetic/expr_unary.li
index 32bf833..246d5ab 100644
--- a/src/external/arithmetic/expr_unary.li
+++ b/src/external/arithmetic/expr_unary.li
@@ -19,100 +19,100 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_UNARY;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Unary Expression.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- right.is_invariant;
-
+
+ right:EXPR;
-
- - symbol:CHARACTER <-
+
+ - symbol:CHARACTER <-
(
deferred;
' '
);
-
+
- static_type:TYPE_FULL <- right.static_type;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add (static_type.raw);
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with r:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with r;
result
);
-
+
- make p:POSITION with r:EXPR <-
(
position := p;
right := r;
);
-
+
- my_copy:SELF <- SELF.create position with (right.my_copy);
-
+
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + same:SELF;
-
+
same ?= other;
(same != NULL) && {right ~= same.right}
);
-
+
- remove <-
- (
+ (
right.remove;
);
-
+
//
// Execute.
//
-
+
- execute_unlink:INSTR <-
(
right.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ right_cst:INTEGER_CST;
-
- old_seq := seq_call_and_loop;
- right := right.execute_link;
- //
+
+ old_seq := seq_call_and_loop;
+ right := right.execute_link;
+ //
right_cst ?= right;
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_right right_cst;
};
- ((result = NULL) && {old_seq = seq_call_and_loop}).if {
- // No conservator transformation.
- result := exec;
+ ((result = NULL) && {old_seq = seq_call_and_loop}).if {
+ // No conservator transformation.
+ result := exec;
};
(result = NULL).if {
result := Self;
@@ -120,20 +120,20 @@ Section Public
result.set_position position;
new_execute_pass;
};
-
+
result
);
-
- - exec_conservator:EXPR <- NULL;
-
+
+ - exec_conservator:EXPR <- NULL;
+
- exec_right right_cst:INTEGER_CST :EXPR <- NULL;
-
+
- exec:EXPR <- NULL;
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
buffer.add_last '(';
@@ -145,12 +145,12 @@ Section Public
buffer.add_last ' ';
right.genere buffer;
buffer.add_last ')';
- );
-
+ );
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.add_last '(';
diff --git a/src/external/arithmetic/expr_xor.li b/src/external/arithmetic/expr_xor.li
index 7e40b46..3383497 100644
--- a/src/external/arithmetic/expr_xor.li
+++ b/src/external/arithmetic/expr_xor.li
@@ -19,32 +19,32 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_XOR;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Xor Binary arithmetic expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary:Expanded EXPR_BINARY;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := "^";
-
+
//
// Execute.
//
-
- - exec_conservator_left left_cst :INTEGER_CST :EXPR <-
+
+ - exec_conservator_left left_cst :INTEGER_CST :EXPR <-
//-- 0 ^ E -> E
- //-- -1 ^ E -> ~ E
+ //-- -1 ^ E -> ~ E
( + result:EXPR;
-
+
(left_cst.value = 0).if {
result := right;
left_cst.remove;
@@ -59,7 +59,7 @@ Section Public
//-- E ^ 0 -> E
//-- E ^ -1 -> ~ E
( + result:EXPR;
-
+
(right_cst.value = 0).if {
result := left;
right_cst.remove;
@@ -69,23 +69,23 @@ Section Public
};
result
);
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 ^ C2 -> C3
(
- left_cst.set_value (left_cst.value ^ right_cst.value);
+ left_cst.set_value (left_cst.value ^ right_cst.value);
right_cst.remove;
left_cst
);
-
+
- exec:EXPR <-
//-- E ^ E -> 0
( + result:EXPR;
-
+
(left ~= right).if {
result := INTEGER_CST.create position value 0 type static_type;
left .remove;
right.remove;
};
- result
+ result
);
diff --git a/src/external/call_null.li b/src/external/call_null.li
index 1bb9a12..7ec5be3 100644
--- a/src/external/call_null.li
+++ b/src/external/call_null.li
@@ -19,62 +19,62 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := CALL_NULL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Call on NULL";
-
+
Section Inherit
-
- + parent_instr:Expanded INSTR;
-
-Section Public
-
+
+ + parent_instr:Expanded INSTR;
+
+Section Public
+
- my_copy:SELF <- Self;
-
+
- is_necessary:BOOLEAN;
-
+
//
// Remove
//
-
+
- remove; // Nothing.
-
+
//
// Execute
//
-
+
- execute:INSTR <- Self;
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
( + code:STRING_CONSTANT;
(debug_level_option != 0).if {
- code :=
+ code :=
"lisaac_stack_print(top_context); \
\print_string(\"Call on NULL\\n\"); \
\die_with_code(1)";
} else {
- code :=
+ code :=
"print_string(\"Call on NULL\\n\
- \(Use `-D' option)\\n\"); \
+ \(Use `-D' option)\\n\"); \
\die_with_code(1)";
};
buffer.append code;
is_necessary := TRUE;
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "Call on NULL";
diff --git a/src/external/comparison/expr_binary_cmp.li b/src/external/comparison/expr_binary_cmp.li
index b2b00b8..6df574e 100644
--- a/src/external/comparison/expr_binary_cmp.li
+++ b/src/external/comparison/expr_binary_cmp.li
@@ -67,7 +67,7 @@ Section Public
- create p:POSITION with l:EXPR and r:EXPR :SELF <-
( + result:SELF;
-
+
((symbol == "==") || {symbol == "!="}).if {
(is_executing_pass).if_false {
count_equal_live := count_equal_live + 1;
@@ -107,7 +107,7 @@ Section Public
(
left .remove;
right.remove;
-
+
((symbol == "==") || {symbol == "!="}).if {
count_equal_remov := count_equal_remov + 1;
};
@@ -123,11 +123,11 @@ Section Public
(instr != NULL).if {
list_current.insert_before instr;
};
-
+
((symbol == "==") || {symbol == "!="}).if {
count_equal_remov := count_equal_remov + 1;
};
-
+
right.execute_unlink
);
diff --git a/src/external/comparison/expr_equal.li b/src/external/comparison/expr_equal.li
index 9f89f50..e3e1180 100644
--- a/src/external/comparison/expr_equal.li
+++ b/src/external/comparison/expr_equal.li
@@ -69,13 +69,13 @@ Section Public
result := PROTOTYPE_CST.create position type (type_true.default);
left .remove;
right.remove;
-
+
(left.static_type.raw = TYPE_NULL).if {
count_equal_null := count_equal_null + 1;
} else {
count_equal_ident := count_equal_ident + 1;
};
-
+
} else {
r ?= right;
(
diff --git a/src/external/comparison/expr_inf.li b/src/external/comparison/expr_inf.li
index bf674fc..e352d40 100644
--- a/src/external/comparison/expr_inf.li
+++ b/src/external/comparison/expr_inf.li
@@ -19,59 +19,59 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_INF;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Inferior binary comparison expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_cmp:Expanded EXPR_BINARY_CMP;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := "<";
-
+
//
// Execute.
//
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 < C2 -> TRUE/FALSE
( + result:PROTOTYPE_CST;
-
+
(left_cst.value < right_cst.value).if {
result := PROTOTYPE_CST.create position type (type_true.default);
} else {
result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ };
left_cst .remove;
right_cst.remove;
-
+
result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- E < E -> FALSE
( + result:PROTOTYPE_CST;
-
+
(left ~= right).if {
result := PROTOTYPE_CST.create position type (type_false.default);
left .remove;
right.remove;
- };
-
+ };
+
result
);
-
- - exec_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- E(unsigned) < 0 -> FALSE
( + result:EXPR;
-
+
((right_cst.value = 0) && {left.static_type.raw.name.first = 'U'}).if {
result := PROTOTYPE_CST.create position type (type_false.default);
left .remove;
diff --git a/src/external/comparison/expr_inf_eq.li b/src/external/comparison/expr_inf_eq.li
index 86c3955..f6c8aeb 100644
--- a/src/external/comparison/expr_inf_eq.li
+++ b/src/external/comparison/expr_inf_eq.li
@@ -19,52 +19,52 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_INF_EQ;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Inferior or equal binary comparison expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_cmp:Expanded EXPR_BINARY_CMP;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := "<=";
-
+
//
// Execute.
//
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 <= C2 -> TRUE/FALSE
( + result:PROTOTYPE_CST;
-
+
(left_cst.value <= right_cst.value).if {
result := PROTOTYPE_CST.create position type (type_true.default);
} else {
result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ };
left_cst .remove;
right_cst.remove;
-
+
result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- E <= E -> TRUE
( + result:PROTOTYPE_CST;
-
+
(left ~= right).if {
result := PROTOTYPE_CST.create position type (type_true.default);
left .remove;
right.remove;
- };
-
+ };
+
result
);
-
+
diff --git a/src/external/comparison/expr_not_equal.li b/src/external/comparison/expr_not_equal.li
index 8e82852..8d1f004 100644
--- a/src/external/comparison/expr_not_equal.li
+++ b/src/external/comparison/expr_not_equal.li
@@ -86,7 +86,7 @@ Section Public
).if {
left .remove;
right.remove;
- result := PROTOTYPE_CST.create position type (type_true.default);
+ result := PROTOTYPE_CST.create position type (type_true.default);
count_equal_const := count_equal_const + 1;
diff --git a/src/external/comparison/expr_sup.li b/src/external/comparison/expr_sup.li
index 65247f6..1a681f0 100644
--- a/src/external/comparison/expr_sup.li
+++ b/src/external/comparison/expr_sup.li
@@ -19,64 +19,64 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_SUP;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Superior binary comparison expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_cmp:Expanded EXPR_BINARY_CMP;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := ">";
-
+
//
// Execute.
//
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 > C2 -> TRUE/FALSE
( + result:PROTOTYPE_CST;
-
+
(left_cst.value > right_cst.value).if {
result := PROTOTYPE_CST.create position type (type_true.default);
} else {
result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ };
left_cst .remove;
right_cst.remove;
-
+
result
);
-
- - exec_left left_cst :INTEGER_CST :EXPR <-
+
+ - exec_left left_cst :INTEGER_CST :EXPR <-
//-- 0 > E (unsigned) -> FALSE
( + result:EXPR;
-
+
((left_cst.value = 0) && {right.static_type.raw.name.first = 'U'}).if {
result := PROTOTYPE_CST.create position type (type_false.default);
left .remove;
right.remove;
};
- result
+ result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- E > E -> FALSE
( + result:PROTOTYPE_CST;
-
+
(left ~= right).if {
result := PROTOTYPE_CST.create position type (type_false.default);
left .remove;
right.remove;
- };
-
+ };
+
result
);
-
+
diff --git a/src/external/comparison/expr_sup_eq.li b/src/external/comparison/expr_sup_eq.li
index ad00424..d0ba6af 100644
--- a/src/external/comparison/expr_sup_eq.li
+++ b/src/external/comparison/expr_sup_eq.li
@@ -19,59 +19,59 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_SUP_EQ;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Superior or equal binary comparison expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_cmp:Expanded EXPR_BINARY_CMP;
-
-Section Public
-
+
+Section Public
+
- symbol:STRING_CONSTANT := ">=";
-
+
//
// Execute.
//
-
- - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
+
+ - exec left_cst:INTEGER_CST and right_cst:INTEGER_CST :EXPR <-
//-- C1 >= C2 -> TRUE/FALSE
( + result:PROTOTYPE_CST;
-
+
(left_cst.value >= right_cst.value).if {
result := PROTOTYPE_CST.create position type (type_true.default);
} else {
result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ };
left_cst .remove;
right_cst.remove;
-
+
result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- E >= E -> TRUE
( + result:PROTOTYPE_CST;
-
+
(left ~= right).if {
result := PROTOTYPE_CST.create position type (type_true.default);
left .remove;
right.remove;
- };
-
+ };
+
result
);
-
- - exec_right right_cst:INTEGER_CST :EXPR <-
+
+ - exec_right right_cst:INTEGER_CST :EXPR <-
//-- E(unsigned) >= 0 -> TRUE
( + result:EXPR;
-
+
((right_cst.value = 0) && {left.static_type.raw.name.first = 'U'}).if {
result := PROTOTYPE_CST.create position type (type_true.default);
left .remove;
diff --git a/src/external/external_c.li b/src/external/external_c.li
index d068ab5..188b041 100644
--- a/src/external/external_c.li
+++ b/src/external/external_c.li
@@ -19,32 +19,32 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXTERNAL_C;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit";
- comment := "External C instruction.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
+ is_persistant:BOOLEAN;
+ static_type:TYPE_FULL;
- + living_type:TYPES;
-
+ + living_type:TYPES;
+
- set_living_type l:TYPES <-
(
living_type := l;
);
-
+
- get_type t:TYPES_TMP <-
(
(living_type = NULL).if {
@@ -57,18 +57,18 @@ Section Public
//
// External value.
//
-
+
+ code:STRING_CONSTANT;
+ access_list:FAST_ARRAY(EXPR);
//
// Creation.
//
-
- - create p:POSITION
+
+ - create p:POSITION
text c:STRING_CONSTANT
- access ac:FAST_ARRAY(EXPR)
- persistant per:BOOLEAN
+ access ac:FAST_ARRAY(EXPR)
+ persistant per:BOOLEAN
type t:TYPE_FULL :SELF <-
( + result:SELF;
result := clone;
@@ -76,10 +76,10 @@ Section Public
result
);
- - make p:POSITION
+ - make p:POSITION
text c:STRING_CONSTANT
- access ac:FAST_ARRAY(EXPR)
- persistant per:BOOLEAN
+ access ac:FAST_ARRAY(EXPR)
+ persistant per:BOOLEAN
type t:TYPE_FULL <-
(
position := p;
@@ -92,18 +92,18 @@ Section Public
- my_copy:SELF <-
( + result:SELF;
+ new_access:FAST_ARRAY(EXPR);
- + val:EXPR;
-
+ + val:EXPR;
+
(access_list != NULL).if {
new_access := FAST_ARRAY(EXPR).create_with_capacity (access_list.count);
(access_list.lower).to (access_list.upper) do { j:INTEGER;
- val := access_list.item j.my_copy;
+ val := access_list.item j.my_copy;
new_access.add_last val;
- };
+ };
};
- result := SELF.create position text code
- access new_access persistant is_persistant type static_type;
- result.set_living_type living_type;
+ result := SELF.create position text code
+ access new_access persistant is_persistant type static_type;
+ result.set_living_type living_type;
result
);
@@ -119,10 +119,10 @@ Section Public
};
};
);
-
+
- execute_unlink:INSTR <-
( + result,instr:INSTR;
-
+
(is_persistant).if {
// Normal.
static_type := TYPE_VOID.default;
@@ -130,7 +130,7 @@ Section Public
} else {
// Remove.
(access_list != NULL).if {
- (access_list.lower).to (access_list.upper) do { j:INTEGER;
+ (access_list.lower).to (access_list.upper) do { j:INTEGER;
instr := access_list.item j.execute_unlink;
(instr != NULL).if {
list_current.insert_before instr;
@@ -143,11 +143,11 @@ Section Public
- execute_link:EXPR <-
( + e:EXPR;
-
+
// Normal
- (access_list != NULL).if {
+ (access_list != NULL).if {
(access_list.lower).to (access_list.upper) do { j:INTEGER;
- e := access_list.item j.execute_link;
+ e := access_list.item j.execute_link;
access_list.put e to j;
};
};
@@ -164,18 +164,18 @@ Section Public
profil_main.set_external_present TRUE;
};
buffer.append "/* PERSISTANT */";
- };
-
+ };
+
(static_type.raw != TYPE_VOID).if {
buffer.append "((";
- static_type.genere_declaration buffer;
+ static_type.genere_declaration buffer;
buffer.add_last ' ';
- static_type.genere_star_declaration buffer;
- buffer.append ")(";
- } else {
+ static_type.genere_star_declaration buffer;
+ buffer.append ")(";
+ } else {
// buffer.append "if (";
- };
-
+ };
+
(access_list != NULL).if {
beg := code.lower;
idx := code.index_of '@' since beg;
@@ -184,7 +184,7 @@ Section Public
buffer.add_last (code.item k);
};
beg := idx + 1;
- access_list.item j.genere buffer;
+ access_list.item j.genere buffer;
idx := code.index_of '@' since beg;
};
// Copy end.
@@ -206,9 +206,9 @@ Section Public
//
- display buffer:STRING <-
- (
+ (
buffer.add_last '`';
- buffer.append code;
+ buffer.append code;
((access_list != NULL) && { ! access_list.is_empty}).if {
buffer.add_last '(';
access_list.lower.to (access_list.upper - 1) do { j:INTEGER;
@@ -217,12 +217,12 @@ Section Public
};
access_list.last.display buffer;
buffer.add_last ')';
- };
+ };
buffer.add_last '`';
static_type.append_name_in buffer;
(living_type != NULL).if {
- buffer.add_last '(';
- (living_type.lower).to (living_type.upper-1) do { j:INTEGER;
+ buffer.add_last '(';
+ (living_type.lower).to (living_type.upper-1) do { j:INTEGER;
buffer.append (living_type.item j.intern_name);
buffer.add_last ',';
};
@@ -231,7 +231,7 @@ Section Public
};
display_ref buffer;
);
-
+
diff --git a/src/external/forall_data.li b/src/external/forall_data.li
index e0ca3b8..ccbdad2 100644
--- a/src/external/forall_data.li
+++ b/src/external/forall_data.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := FORALL_DATA;
- copyright := "2003-2009 Sonntag Benoit";
@@ -30,13 +30,13 @@ Section Header
Section Inherit
+ parent_instr:Expanded INSTR;
-
+
Section Public
-
+
+ action:ITM_READ_ARG2;
-
+
+ list_data:FAST_ARRAY(COUPLE(SLOT_DATA,EXPR));
-
+
//
// Creation.
//
@@ -52,9 +52,9 @@ Section Public
( + lst:FAST_ARRAY(SLOT);
+ dta:SLOT_DATA;
+ c:COUPLE(SLOT_DATA,EXPR);
-
+
action := ITM_READ_ARG2.create (ac.position) name (ALIAS_STR.slot_value) args (,);
- list_data := FAST_ARRAY(COUPLE(SLOT_DATA,EXPR)).create;
+ list_data := FAST_ARRAY(COUPLE(SLOT_DATA,EXPR)).create;
t.add_reflexivity Self;
lst := t.slot_run;
(lst.lower).to (lst.upper) do { i:INTEGER;
@@ -65,51 +65,51 @@ Section Public
};
};
);
-
+
//
//
//
-
+
- my_copy:SELF <-
(
clone
);
-
+
//
- // Depend.
+ // Depend.
//
-
+
- add var:SLOT_DATA <-
(
-
+
);
-
+
//
// Execute.
//
-
- - execute:INSTR <-
+
+ - execute:INSTR <-
(
-
+
);
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
(list_data.lower).to (list_data.upper) do { i:INTEGER;
list_data.item i.second.genere buffer;
};
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
- (
+ (
buffer.append "Forall_data:\n";
indent.append " ";
(list_data.lower).to (list_data.upper) do { i:INTEGER;
@@ -120,6 +120,5 @@ Section Public
buffer.append indent;
list_data.item i.second.genere buffer;
};
- indent.remove_last 2;
+ indent.remove_last 2;
);
-
\ No newline at end of file
diff --git a/src/external/get_type_id.li b/src/external/get_type_id.li
index 6ce0975..efa2941 100644
--- a/src/external/get_type_id.li
+++ b/src/external/get_type_id.li
@@ -19,80 +19,80 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := GET_TYPE_ID;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Get intern ID object";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- TRUE;
-
+
+ receiver:TYPE_FULL;
-
+
- static_type:TYPE_FULL <- type_integer.default;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add type_integer;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION receiver e:TYPE_FULL :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p receiver e;
result
);
-
+
- make p:POSITION receiver e:TYPE_FULL <-
(
- position := p;
- receiver := e;
+ position := p;
+ receiver := e;
);
-
+
- my_copy:SELF <- SELF.create position receiver receiver;
// BSBS: Tu peux renvoyer Self ! Non ?
-
+
//
// Remove
//
-
+
- remove <-
(
// Nothing.
);
-
+
//
// Execute
//
-
+
- execute_unlink:INSTR <-
- (
+ (
NULL
);
-
+
- execute_link:EXPR <-
- (
+ (
Self
);
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
(receiver.is_late_binding).if {
@@ -103,11 +103,11 @@ Section Public
buffer.append (ALIAS_STR.separate); // <=> "__";
};
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "type_id(";
diff --git a/src/external/is_expanded.li b/src/external/is_expanded.li
index 3e258fb..a2e8217 100644
--- a/src/external/is_expanded.li
+++ b/src/external/is_expanded.li
@@ -19,101 +19,101 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := IS_EXPANDED;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "True, if `Self' is Expanded type.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- TRUE;
-
+
+ receiver:EXPR;
-
+
- static_type:TYPE_FULL <- type_boolean.default;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add type_true;
t.add type_false;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION receiver e:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p receiver e;
result
);
-
+
- make p:POSITION receiver e:EXPR <-
(
- position := p;
- receiver := e;
+ position := p;
+ receiver := e;
);
-
+
- my_copy:SELF <- SELF.create position receiver (receiver.my_copy);
-
+
//
// Remove
//
-
+
- remove <-
(
receiver.remove;
);
-
+
//
// Execute
//
-
+
- execute_unlink:INSTR <-
- (
+ (
receiver.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ instr:INSTR;
-
+
(receiver.static_type.is_expanded).if {
result := PROTOTYPE_CST.create position type (type_true.default);
} else {
result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ };
instr := receiver.execute_unlink;
(instr != NULL).if {
- list_current.insert_before instr;
+ list_current.insert_before instr;
};
new_execute_pass;
result
);
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
crash_with_message "IS_EXPANDED.genere !";
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "is_expanded(";
diff --git a/src/external/logic/expr_and_and_logic.li b/src/external/logic/expr_and_and_logic.li
index b9b0adb..f0044e9 100644
--- a/src/external/logic/expr_and_and_logic.li
+++ b/src/external/logic/expr_and_and_logic.li
@@ -19,49 +19,49 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_AND_AND_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "&& Binary logical expression.";
-
+
Section Inherit
-
+
+ parent_expr_and_logic:Expanded EXPR_AND_LOGIC;
-
+
Section Public
-
+
+ symbol:STRING_CONSTANT := "&&";
-
+
//
// Execute.
//
-
+
- execute_unlink:INSTR <-
- (
+ (
execute_link
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ left_cst,right_cst:PROTOTYPE_CST;
+ left_t,right_t:TYPE;
-
- old_seq := seq_call_and_loop;
- left := left.execute_link;
+
+ old_seq := seq_call_and_loop;
+ left := left.execute_link;
//
seq_or_and := seq_or_and + 1;
seq_inline := seq_inline + 1;
- //
- right := right.execute_link;
+ //
+ right := right.execute_link;
//
left_cst ?= left;
right_cst ?= right;
-
+
(left_cst != NULL).if { // BSBS : Peux faire mieux !!!
(left_cst.static_type.raw = type_true).if {
left_t := type_true;
@@ -76,24 +76,24 @@ Section Public
right_t := type_false;
};
};
-
+
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {left_cst != NULL}).if {
+ ((result = NULL) && {left_cst != NULL}).if {
result := exec_conservator_left left_t;
};
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_conservator_right right_t;
};
(
- (result = NULL) &&
- {right_cst != NULL} &&
+ (result = NULL) &&
+ {right_cst != NULL} &&
{left_cst != NULL}
).if {
result := exec left_t and right_t;
- };
- ((result = NULL) && {(old_seq + 1) = seq_call_and_loop}).if {
- // No conservator transformation.
+ };
+ ((result = NULL) && {(old_seq + 1) = seq_call_and_loop}).if {
+ // No conservator transformation.
result := exec;
((result = NULL) && {left_cst != NULL}).if {
result := exec_left left_t;
@@ -108,28 +108,28 @@ Section Public
} else {
new_execute_pass;
};
-
+
result
);
-
+
- exec_conservator:EXPR <-
//-- E && Var -> E & Var
( + rd:READ;
+ result:EXPR;
-
+
rd ?= right;
(rd != NULL).if {
result := EXPR_AND_LOGIC.create position with left and right;
};
result
);
-
+
//-- for && same &
-
+
- exec_conservator_left left_cst :TYPE :EXPR <-
//-- FALSE && E -> FALSE
( + result:EXPR;
-
+
result := parent_expr_and_logic.exec_conservator_left left_cst;
((result = NULL) && {left_cst = type_false}).if {
result := left;
@@ -137,7 +137,7 @@ Section Public
};
result
);
-
+
diff --git a/src/external/logic/expr_and_logic.li b/src/external/logic/expr_and_logic.li
index d6f1826..504c57c 100644
--- a/src/external/logic/expr_and_logic.li
+++ b/src/external/logic/expr_and_logic.li
@@ -19,53 +19,53 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_AND_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "And binary logical expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_logic:Expanded EXPR_BINARY_LOGIC;
-
-Section Public
-
+
+Section Public
+
+ symbol:STRING_CONSTANT := "&";
-
+
//
// Execute.
//
-
- - exec_conservator_left left_cst :TYPE :EXPR <-
+
+ - exec_conservator_left left_cst :TYPE :EXPR <-
//-- TRUE & E -> E
( + result:EXPR;
-
+
(left_cst = type_true).if {
result := right;
left.remove;
};
result
);
-
- - exec_conservator_right right_cst:TYPE :EXPR <-
+
+ - exec_conservator_right right_cst:TYPE :EXPR <-
//-- E & TRUE -> E
( + result:EXPR;
-
+
(right_cst = type_true).if {
result := left;
right.remove;
};
result
);
-
+
- exec left_cst:TYPE and right_cst:TYPE :EXPR <-
//-- C1 & C2 -> C3
( + result:EXPR;
-
+
(left_cst = type_true).if {
result := right;
left.remove;
@@ -75,33 +75,33 @@ Section Public
};
result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- E & E -> E
( + result:EXPR;
-
+
(left ~= right).if {
result := left;
right.remove;
};
- result
+ result
);
- - exec_left left_cst :TYPE :EXPR <-
+ - exec_left left_cst :TYPE :EXPR <-
//-- FALSE & E -> FALSE
( + result:EXPR;
-
+
(left_cst = type_false).if {
result := left;
right.remove;
};
result
);
-
- - exec_right right_cst:TYPE :EXPR <-
+
+ - exec_right right_cst:TYPE :EXPR <-
//-- E & FALSE -> FALSE
( + result:EXPR;
-
+
(right_cst = type_false).if {
result := right;
left.remove;
@@ -109,16 +109,16 @@ Section Public
result
);
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/src/external/logic/expr_binary_logic.li b/src/external/logic/expr_binary_logic.li
index 02e98d9..a366546 100644
--- a/src/external/logic/expr_binary_logic.li
+++ b/src/external/logic/expr_binary_logic.li
@@ -19,109 +19,109 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_BINARY_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Binary logical expression.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- left.is_invariant && {right.is_invariant};
-
+
+ left:EXPR;
-
+
+ right:EXPR;
-
- - symbol:STRING_CONSTANT <-
+
+ - symbol:STRING_CONSTANT <-
(
deferred;
NULL
);
-
+
- static_type:TYPE_FULL <- type_boolean.default;
-
+
- get_type t:TYPES_TMP <-
- (
- t.add type_true;
+ (
+ t.add type_true;
t.add type_false;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with l:EXPR and r:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with l and r;
result
);
-
+
- make p:POSITION with l:EXPR and r:EXPR <-
(
position := p;
left := l;
right := r;
);
-
+
- my_copy:SELF <- SELF.create position with (left.my_copy) and (right.my_copy);
-
+
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + same:SELF;
-
+
same ?= other;
(same != NULL) && {left ~= same.left} && {right ~= same.right}
- );
-
+ );
+
//
// Remove
//
-
+
- remove <-
(
left .remove;
right.remove;
);
-
+
//
// Execute
//
-
+
- execute_unlink:INSTR <-
- ( + instr:INSTR;
+ ( + instr:INSTR;
instr := left.execute_unlink;
(instr != NULL).if {
list_current.insert_before instr;
};
- right.execute_unlink
+ right.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ left_cst,right_cst:PROTOTYPE_CST;
+ left_t,right_t:TYPE;
-
- old_seq := seq_call_and_loop;
+
+ old_seq := seq_call_and_loop;
left := left .execute_link;
- right := right.execute_link;
+ right := right.execute_link;
//
left_cst ?= left;
right_cst ?= right;
-
+
(left_cst != NULL).if { // BSBS : Peux faire mieux !!!
(left_cst.static_type.raw = type_true).if {
left_t := type_true;
@@ -136,24 +136,24 @@ Section Public
right_t := type_false;
};
};
-
+
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {left_cst != NULL}).if {
+ ((result = NULL) && {left_cst != NULL}).if {
result := exec_conservator_left left_t;
};
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_conservator_right right_t;
};
(
- (result = NULL) &&
- {right_cst != NULL} &&
+ (result = NULL) &&
+ {right_cst != NULL} &&
{left_cst != NULL}
).if {
result := exec left_t and right_t;
- };
- ((result = NULL) && {old_seq = seq_call_and_loop}).if {
- // No conservator transformation.
+ };
+ ((result = NULL) && {old_seq = seq_call_and_loop}).if {
+ // No conservator transformation.
result := exec;
((result = NULL) && {left_cst != NULL}).if {
result := exec_left left_t;
@@ -169,27 +169,27 @@ Section Public
result.set_position position;
new_execute_pass;
};
-
+
result
);
-
- - exec_conservator:EXPR <- NULL;
+
+ - exec_conservator:EXPR <- NULL;
- exec_conservator_left left_cst :TYPE :EXPR <- NULL;
- exec_conservator_right right_cst:TYPE :EXPR <- NULL;
-
+
- exec left_cst:TYPE and right_cst:TYPE :EXPR <- NULL;
-
+
- exec:EXPR <- NULL;
- exec_left left_cst :TYPE :EXPR <- NULL;
- exec_right right_cst:TYPE :EXPR <- NULL;
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
- buffer.add_last '(';
+ buffer.add_last '(';
left.genere buffer;
buffer.add_last ' ';
buffer.append symbol;
@@ -197,14 +197,14 @@ Section Public
right.genere buffer;
buffer.add_last ')';
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
- buffer.add_last '(';
+ buffer.add_last '(';
left.display buffer;
buffer.append symbol;
right.display buffer;
diff --git a/src/external/logic/expr_not_logic.li b/src/external/logic/expr_not_logic.li
index e3cbf10..893eb5b 100644
--- a/src/external/logic/expr_not_logic.li
+++ b/src/external/logic/expr_not_logic.li
@@ -19,28 +19,28 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_NOT_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Unary not logical expression.";
-
+
Section Inherit
-
+
+ parent_expr_unary_logic:Expanded EXPR_UNARY_LOGIC;
-
-Section Public
-
+
+Section Public
+
- symbol:CHARACTER <- '!';
-
+
//
// Execute.
//
-
- - exec_conservator:EXPR <-
+
+ - exec_conservator:EXPR <-
//-- ! (E1 == E2) -> E1 != E2 (see INTEGER)
//-- ! (E1 >= E2) -> E1 < E2 (see INTEGER)
//-- ! (E1 > E2) -> E1 <= E2 (see INTEGER)
@@ -49,12 +49,12 @@ Section Public
+ sup_eq:EXPR_SUP_EQ;
+ sup:EXPR_SUP;
+ not:EXPR_NOT_LOGIC;
- + result:EXPR;
+ + result:EXPR;
not ?= right;
(not != NULL).if {
result := not.right;
- }.elseif {
+ }.elseif {
eq ?= right;
eq != NULL
} then {
@@ -62,7 +62,7 @@ Section Public
}.elseif {
sup_eq ?= right;
sup_eq != NULL
- } then {
+ } then {
result := EXPR_INF.create position with (sup_eq.left) and (sup_eq.right);
}.elseif {
sup ?= right;
@@ -72,21 +72,21 @@ Section Public
};
result
);
-
- - exec_right right_cst:TYPE :EXPR <-
+
+ - exec_right right_cst:TYPE :EXPR <-
// ! TRUE -> FALSE
// ! FALSE -> TRUE
( + pro:PROTOTYPE_CST;
-
+
pro ?= right;
- (right_cst = type_true).if {
+ (right_cst = type_true).if {
pro.make (pro.position) type (type_false.default);
} else {
pro.make (pro.position) type (type_true.default);
};
right
);
-
+
diff --git a/src/external/logic/expr_or_logic.li b/src/external/logic/expr_or_logic.li
index 21db1ce..554aa13 100644
--- a/src/external/logic/expr_or_logic.li
+++ b/src/external/logic/expr_or_logic.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_OR_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Or binary logical expression.";
-
+
Section Inherit
-
+
+ parent_expr_binary_logic:Expanded EXPR_BINARY_LOGIC;
-
-Section Public
-
+
+Section Public
+
+ symbol:STRING_CONSTANT := "|";
-
+
//
// Execute.
//
-
- - exec_conservator_left left_cst :TYPE :EXPR <-
+
+ - exec_conservator_left left_cst :TYPE :EXPR <-
//-- FALSE | E -> E
( + result:EXPR;
- (left_cst = type_false).if {
+ (left_cst = type_false).if {
result := right;
left.remove;
};
result
);
-
- - exec_conservator_right right_cst:TYPE :EXPR <-
+
+ - exec_conservator_right right_cst:TYPE :EXPR <-
//-- E | FALSE -> E
( + result:EXPR;
@@ -61,7 +61,7 @@ Section Public
};
result
);
-
+
- exec left_cst:TYPE and right_cst:TYPE :EXPR <-
//-- C1 | C2 -> C3
( + result:EXPR;
@@ -72,11 +72,11 @@ Section Public
} else {
result := right;
left.remove;
- };
+ };
result
);
-
- - exec:EXPR <-
+
+ - exec:EXPR <-
//-- (E1 > E2) | (E1 = E2) -> E1 >= E2 (a lot of possibilities, but see INTEGER)
//-- E | E -> E
( + result:EXPR;
@@ -96,10 +96,10 @@ Section Public
};
};
};
- result
+ result
);
- - exec_left left_cst :TYPE :EXPR <-
+ - exec_left left_cst :TYPE :EXPR <-
//-- TRUE | E -> TRUE
( + result:EXPR;
@@ -109,19 +109,19 @@ Section Public
};
result
);
-
- - exec_right right_cst:TYPE :EXPR <-
+
+ - exec_right right_cst:TYPE :EXPR <-
//-- E | TRUE -> TRUE
( + result:EXPR;
-
+
(right_cst = type_true).if {
result := right;
left.remove;
};
result
);
-
-
+
+
diff --git a/src/external/logic/expr_or_or_logic.li b/src/external/logic/expr_or_or_logic.li
index 8c4b798..8eeb3be 100644
--- a/src/external/logic/expr_or_or_logic.li
+++ b/src/external/logic/expr_or_or_logic.li
@@ -19,49 +19,49 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_OR_OR_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Or Binary Expression.";
-
+
Section Inherit
-
+
+ parent_expr_or_logic:Expanded EXPR_OR_LOGIC;
-
-Section Public
-
+
+Section Public
+
+ symbol:STRING_CONSTANT := "||";
-
+
//
// Execute.
//
-
+
- execute_unlink:INSTR <-
- (
+ (
execute_link
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ left_cst,right_cst:PROTOTYPE_CST;
+ left_t,right_t:TYPE;
-
- old_seq := seq_call_and_loop;
- left := left.execute_link;
+
+ old_seq := seq_call_and_loop;
+ left := left.execute_link;
//
seq_or_and := seq_or_and + 1;
seq_inline := seq_inline + 1;
//
- right := right.execute_link;
+ right := right.execute_link;
//
left_cst ?= left;
right_cst ?= right;
-
+
(left_cst != NULL).if { // BSBS : Peux faire mieux !!!
(left_cst.static_type.raw = type_true).if {
left_t := type_true;
@@ -79,21 +79,21 @@ Section Public
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {left_cst != NULL}).if {
+ ((result = NULL) && {left_cst != NULL}).if {
result := exec_conservator_left left_t;
};
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_conservator_right right_t;
};
(
- (result = NULL) &&
- {right_cst != NULL} &&
+ (result = NULL) &&
+ {right_cst != NULL} &&
{left_cst != NULL}
).if {
result := exec left_t and right_t;
- };
- ((result = NULL) && {(old_seq + 1) = seq_call_and_loop}).if {
- // No conservator transformation.
+ };
+ ((result = NULL) && {(old_seq + 1) = seq_call_and_loop}).if {
+ // No conservator transformation.
result := exec;
((result = NULL) && {left_cst != NULL}).if {
result := exec_left left_t;
@@ -108,24 +108,24 @@ Section Public
} else {
new_execute_pass;
};
-
+
result
);
-
+
- exec_conservator:EXPR <-
//-- E || Var -> E | Var
( + rd:READ;
+ result:EXPR;
-
+
rd ?= right;
(rd != NULL).if {
result := EXPR_OR_LOGIC.create position with left and right;
};
result
);
-
+
//-- for || same |
-
+
- exec_conservator_left left_cst :TYPE :EXPR <-
//-- TRUE || E -> TRUE
( + result:EXPR;
@@ -133,8 +133,7 @@ Section Public
((result = NULL) && {left_cst = type_true}).if {
result := left;
right.remove;
- };
+ };
result
);
-
-
\ No newline at end of file
+
diff --git a/src/external/logic/expr_unary_logic.li b/src/external/logic/expr_unary_logic.li
index 8b3e908..7684dbf 100644
--- a/src/external/logic/expr_unary_logic.li
+++ b/src/external/logic/expr_unary_logic.li
@@ -19,95 +19,95 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := EXPR_UNARY_LOGIC;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Unary logical expression.";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
+
+Section Public
+
- is_invariant:BOOLEAN <- right.is_invariant;
-
+
+ right:EXPR;
-
- - symbol:CHARACTER <-
+
+ - symbol:CHARACTER <-
(
deferred;
' '
);
-
+
- static_type:TYPE_FULL <- type_boolean.default;
-
+
- get_type t:TYPES_TMP <-
- (
- t.add type_true;
+ (
+ t.add type_true;
t.add type_false;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION with r:EXPR :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p with r;
result
);
-
+
- make p:POSITION with r:EXPR <-
(
position := p;
right := r;
);
-
+
- my_copy:SELF <- SELF.create position with (right.my_copy);
-
+
//
// Comparaison.
//
-
+
- Self:SELF '~=' Right 60 other:EXPR :BOOLEAN <-
( + same:SELF;
-
+
same ?= other;
(same != NULL) && {right ~= same.right}
- );
-
+ );
+
- remove <-
- (
+ (
right.remove;
);
-
+
//
// Execute.
//
-
+
- execute_unlink:INSTR <-
(
right.execute_unlink
);
-
+
- execute_link:EXPR <-
( + result:EXPR;
+ old_seq:UINTEGER_32;
+ right_cst:PROTOTYPE_CST;
+ right_t:TYPE;
-
- old_seq := seq_call_and_loop;
- right := right.execute_link;
- //
+
+ old_seq := seq_call_and_loop;
+ right := right.execute_link;
+ //
right_cst ?= right;
- (right_cst != NULL).if {
+ (right_cst != NULL).if {
(right_cst.static_type.raw = type_true).if {
right_t := type_true;
} else {
@@ -117,12 +117,12 @@ Section Public
// Conservator transformation.
result := exec_conservator;
- ((result = NULL) && {right_cst != NULL}).if {
+ ((result = NULL) && {right_cst != NULL}).if {
result := exec_right right_t;
};
- ((result = NULL) && {old_seq = seq_call_and_loop}).if {
- // No conservator transformation.
- result := exec;
+ ((result = NULL) && {old_seq = seq_call_and_loop}).if {
+ // No conservator transformation.
+ result := exec;
};
//
(result = NULL).if {
@@ -131,20 +131,20 @@ Section Public
result.set_position position;
new_execute_pass;
};
-
+
result
);
-
- - exec_conservator:EXPR <- NULL;
-
+
+ - exec_conservator:EXPR <- NULL;
+
- exec_right right_cst:TYPE :EXPR <- NULL;
-
+
- exec:EXPR <- NULL;
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
(
buffer.add_last '(';
@@ -152,12 +152,12 @@ Section Public
buffer.add_last ' ';
right.genere buffer;
buffer.add_last ')';
- );
-
+ );
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.add_last '(';
diff --git a/src/external/put_to.li b/src/external/put_to.li
index fa8519d..9078715 100644
--- a/src/external/put_to.li
+++ b/src/external/put_to.li
@@ -29,11 +29,11 @@ Section Header
- comment := "Put for NATIVE_ARRAY(E) (see ITEM)";
Section Inherit
-
- + parent_write:Expanded WRITE;
-
+
+ + parent_write:Expanded WRITE;
+
+ parent_expr:Expanded EXPR; // Note: C'est une INSTR, mais pb dans ITM_EXTERNAL
-
+
Section Public
- is_invariant:BOOLEAN <-
@@ -44,14 +44,14 @@ Section Public
+ index:EXPR;
- static_type:TYPE_FULL <- TYPE_VOID.default;
-
+
- variable:VARIABLE <-
( + typ_gen:TYPE_GENERIC;
typ_gen ?= receiver.static_type.raw;
- typ_gen.native_array_variable
+ typ_gen.native_array_variable
);
-
+
//
// Creation.
//
@@ -65,7 +65,7 @@ Section Public
);
- make p:POSITION base rec:EXPR index idx:EXPR value v:EXPR <-
- (
+ (
position := p;
receiver := rec;
index := idx;
@@ -82,7 +82,7 @@ Section Public
//
- remove <-
- (
+ (
variable.unwrite Self;
//
receiver.remove;
@@ -93,9 +93,9 @@ Section Public
//
// Execute
//
-
+
- execute:INSTR <- execute_unlink;
-
+
- execute_unlink:INSTR <-
(
execute_link
diff --git a/src/external/size_of.li b/src/external/size_of.li
index f875ef8..f7b77a8 100644
--- a/src/external/size_of.li
+++ b/src/external/size_of.li
@@ -19,91 +19,91 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SIZE_OF;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Size of object";
-
+
Section Inherit
-
+
+ parent_expr:Expanded EXPR;
-
-Section Public
-
- - is_invariant:BOOLEAN <- TRUE;
-
+
+Section Public
+
+ - is_invariant:BOOLEAN <- TRUE;
+
+ receiver:TYPE_FULL;
-
+
- static_type:TYPE_FULL <- type_integer.default;
-
+
- get_type t:TYPES_TMP <-
- (
+ (
t.add type_integer;
);
-
+
//
// Creation.
//
-
+
- create p:POSITION receiver e:TYPE_FULL :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p receiver e;
result
);
-
+
- make p:POSITION receiver e:TYPE_FULL <-
(
- position := p;
- receiver := e;
+ position := p;
+ receiver := e;
);
-
- - my_copy:SELF <- SELF.create position receiver receiver;
+
+ - my_copy:SELF <- SELF.create position receiver receiver;
// BSBS: Tu peux meme juste renvoyer Self! Non ?
-
+
//
// Remove
//
-
+
- remove <-
(
// Nothing.
);
-
+
//
// Execute
//
-
+
- execute_unlink:INSTR <-
- (
+ (
NULL
);
-
+
- execute_link:EXPR <-
- (
+ (
Self
);
-
+
//
// Genere.
//
-
+
- genere buffer:STRING <-
- (
- buffer.append "sizeof(";
+ (
+ buffer.append "sizeof(";
receiver.raw.put_expanded_declaration buffer;
- buffer.add_last ')';
+ buffer.add_last ')';
);
-
+
//
// Display.
//
-
+
- display buffer:STRING <-
(
buffer.append "size_of(";
diff --git a/src/item/itm_arg.li b/src/item/itm_arg.li
index fe206ac..28be22f 100644
--- a/src/item/itm_arg.li
+++ b/src/item/itm_arg.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_ARG;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "One argument";
-
+
Section Inherit
-
+
+ parent_itm_argument:Expanded ITM_ARGUMENT;
-
+
Section Public
+ name:STRING_CONSTANT;
-
+
+ type:ITM_TYPE_MONO;
-
+
- upper:INTEGER := 0;
-
+
//
// Creation.
//
-
+
- create p:POSITION name n:STRING_CONSTANT type t:ITM_TYPE_MONO :SELF <-
( + result:SELF;
-
+
result := SELF.clone;
result.make p name n type t;
result
@@ -58,27 +58,27 @@ Section Public
name := n;
type := t;
);
-
+
//
// Running.
//
-
- - item idx:INTEGER :ITM_TYPE_MONO <-
+
+ - item idx:INTEGER :ITM_TYPE_MONO <-
( ? {idx = 0};
type
- );
+ );
- to_run_in arg_lst:FAST_ARRAY(LOCAL) for p:PARAMETER_TO_TYPE <-
( + t:ITM_TYPE_MONO;
-
+
(name = ALIAS_STR.variable_self).if {
t := ITM_TYPE_SIMPLE.type_self;
} else {
t := type;
- };
+ };
arg_lst.add_last (
LOCAL.create position name name style ' ' type (t.to_run_for p)
- );
+ );
);
- get_index_type p:ITM_TYPE_PARAMETER :INTEGER <-
@@ -88,24 +88,24 @@ Section Public
};
result
);
-
+
- check larg:FAST_ARRAY(EXPR) index idx:INTEGER for p:PARAMETER_TO_TYPE :INTEGER <-
( + new_expr:EXPR;
-
+
new_expr := larg.item idx.check_type (type.to_run_for p) with position;
larg.put new_expr to idx;
idx + 1
- );
+ );
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append name;
buffer.add_last ':';
- type.append_in buffer;
+ type.append_in buffer;
);
- shorter_in buf:STRING <-
@@ -116,7 +116,7 @@ Section Public
put name to buf like (ALIAS_STR.short_local);
};
buf.add_last ':';
- type.shorter_in buf;
+ type.shorter_in buf;
);
-
-
+
+
diff --git a/src/item/itm_args.li b/src/item/itm_args.li
index ef06909..a5a1a6e 100644
--- a/src/item/itm_args.li
+++ b/src/item/itm_args.li
@@ -19,71 +19,71 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_ARGS;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "One argument vector";
-
+
Section Inherit
-
+
+ parent_itm_argument:Expanded ITM_ARGUMENT;
-
+
Section Public
+ name:FAST_ARRAY(STRING_CONSTANT);
-
+
+ type:ITM_TYPE_MULTI;
-
+
- upper:INTEGER <- name.upper;
-
+
//
// Creation.
//
-
- - create p:POSITION name n:FAST_ARRAY(STRING_CONSTANT)
+
+ - create p:POSITION name n:FAST_ARRAY(STRING_CONSTANT)
type t:ITM_TYPE_MULTI :SELF <-
( + result:SELF;
-
+
result := SELF.clone;
result.make p name n type t;
result
);
- - make p:POSITION name n:FAST_ARRAY(STRING_CONSTANT)
+ - make p:POSITION name n:FAST_ARRAY(STRING_CONSTANT)
type t:ITM_TYPE_MULTI <-
(
position := p;
name := n;
type := t;
);
-
+
//
// Running.
//
- - item idx:INTEGER :ITM_TYPE_MONO <-
+ - item idx:INTEGER :ITM_TYPE_MONO <-
( ? {idx.in_range 0 to upper};
type.item idx
);
-
+
- to_run_in arg_lst:FAST_ARRAY(LOCAL) for p:PARAMETER_TO_TYPE <-
( + t:TYPE_FULL;
-
+
(name.lower).to (name.upper) do { j:INTEGER;
- t := type.item j.to_run_for p;
+ t := type.item j.to_run_for p;
arg_lst.add_last (
LOCAL.create position name (name.item j) style ' ' type t
);
};
);
-
+
- get_index_type p:ITM_TYPE_PARAMETER :INTEGER <-
( + i:INTEGER;
-
+
i := name.lower;
{(i <= name.upper) && {type.item i != p}}.while_do {
i := i + 1;
@@ -93,22 +93,22 @@ Section Public
- check larg:FAST_ARRAY(EXPR) index idx:INTEGER for p:PARAMETER_TO_TYPE :INTEGER <-
( + new_expr:EXPR;
-
+
(type.lower).to (type.upper) do { i:INTEGER;
new_expr := larg.item (idx+i).check_type (type.item i.to_run_for p) with position;
larg.put new_expr to (idx+i);
};
idx + type.count
- );
-
+ );
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
- (
+ (
buffer.add_last '(';
- (name.lower).to (name.upper - 1) do { j:INTEGER;
+ (name.lower).to (name.upper - 1) do { j:INTEGER;
buffer.append (name.item j);
buffer.add_last ':';
type.item j.append_in buffer;
@@ -116,14 +116,14 @@ Section Public
};
buffer.append (name.last);
buffer.add_last ':';
- type.last.append_in buffer;
+ type.last.append_in buffer;
buffer.add_last ')';
);
-
+
- shorter_in buf:STRING <-
(
buf.add_last '(';
- (name.lower).to (name.upper - 1) do { j:INTEGER;
+ (name.lower).to (name.upper - 1) do { j:INTEGER;
(name.item j = ALIAS_STR.variable_self).if {
put (name.item j) to buf like (ALIAS_STR.short_keyword);
} else {
@@ -135,8 +135,8 @@ Section Public
};
put (name.last) to buf like (ALIAS_STR.short_local);
buf.add_last ':';
- type.last.shorter_in buf;
+ type.last.shorter_in buf;
buf.add_last ')';
);
-
+
diff --git a/src/item/itm_argument.li b/src/item/itm_argument.li
index f39fc13..d9be173 100644
--- a/src/item/itm_argument.li
+++ b/src/item/itm_argument.li
@@ -19,62 +19,62 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_ARGUMENT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent argument";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_OBJECT;
-
+
Section Public
-
+
- lower:INTEGER <- 0;
-
+
- upper:INTEGER <- ( deferred; 0);
-
+
- count:INTEGER <- upper + 1;
//
// Running.
//
-
- - item idx:INTEGER :ITM_TYPE_MONO <-
+
+ - item idx:INTEGER :ITM_TYPE_MONO <-
(
deferred;
NULL
);
-
+
- to_run_in arg_lst:FAST_ARRAY(LOCAL) for p:PARAMETER_TO_TYPE <-
(
deferred;
);
-
+
- get_index_type p:ITM_TYPE_PARAMETER :INTEGER <-
(
deferred;
);
-
+
- check larg:FAST_ARRAY(EXPR) index idx:INTEGER for p:PARAMETER_TO_TYPE :INTEGER <-
(
deferred;
0
);
-
+
//
// Comparaison.
//
-
- - is_equal other:ITM_ARGUMENT <-
+
+ - is_equal other:ITM_ARGUMENT <-
( + o:SELF;
+ err:STRING_CONSTANT;
? {other != Self};
-
+
o ?= other;
(o = NULL).if {
err := "Invariance number vector argument invalid.";
@@ -90,19 +90,19 @@ Section Public
POSITION.send_error;
};
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
deferred;
);
-
+
- shorter_in buf:STRING <-
(
deferred;
);
-
-
+
+
diff --git a/src/item/itm_binary.li b/src/item/itm_binary.li
index b0c485b..2dba8f5 100644
--- a/src/item/itm_binary.li
+++ b/src/item/itm_binary.li
@@ -133,7 +133,7 @@ Section Public
slo.position.put_position;
position_list.item j.put_position;
position.send_error;
- };
+ };
};
};
};
@@ -191,7 +191,7 @@ Section Public
} else {
extern := EXPR_NOT_EQUAL.create (pos_list.item max_pos) with
(val_list.item max_pos) and (val_list.item (max_pos+1));
- };
+ };
loc := type_boolean.default.get_temporary (pos_list.item max_pos);
expr := loc.write (pos_list.item max_pos) value extern;
list_current.add_last expr;
@@ -201,12 +201,12 @@ Section Public
l_arg := FAST_ARRAY(EXPR).create_with_capacity 2;
l_arg.add_last (val_list.item max_pos);
l_arg.add_last (val_list.item (max_pos + 1));
-
+
site := NODE.new_read (pos_list.item max_pos)
slot (slo_list.item max_pos)
receiver (l_arg.first.my_copy)
- with l_arg;
-
+ with l_arg;
+
list_current.add_last site;
val := site.result_expr;
};
diff --git a/src/item/itm_block.li b/src/item/itm_block.li
index fae8986..e8c9057 100644
--- a/src/item/itm_block.li
+++ b/src/item/itm_block.li
@@ -74,7 +74,7 @@ Section Public
tb := PROFIL_BLOCK.create Self;
t := tb.default;
//
- loc := t.get_temporary position;
+ loc := t.get_temporary position;
// tmp.id := id_block;
rec := loc.read position;
val := PROTOTYPE_CST.create position type t;
diff --git a/src/item/itm_character.li b/src/item/itm_character.li
index 95e98fe..9c6c314 100644
--- a/src/item/itm_character.li
+++ b/src/item/itm_character.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_CHARACTER;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Character constant";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CONSTANT;
-
+
Section Public
//
@@ -50,7 +50,7 @@ Section Public
result.make p char n;
result
);
-
+
- make p:POSITION char n:STRING_CONSTANT <-
(
position:=p;
@@ -62,14 +62,14 @@ Section Public
//
- to_run_expr:EXPR <-
- (
- CHARACTER_CST.create position char character
+ (
+ CHARACTER_CST.create position char character
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.add_last '\'';
diff --git a/src/item/itm_code.li b/src/item/itm_code.li
index 5c92dc4..579366c 100644
--- a/src/item/itm_code.li
+++ b/src/item/itm_code.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_CODE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all item code";
-
+
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
-
+
Section Public
-
- // Use by PARSER, for left expr assignment ( in EXPR1 := EXPR2, EXPR1.is_affect).
+
+ // Use by PARSER, for left expr assignment ( in EXPR1 := EXPR2, EXPR1.is_affect).
- is_affect:POSITION <- position;
-
+
//
// Flags.
//
@@ -45,32 +45,32 @@ Section Public
//
// Runnable.
- //
-
+ //
+
- to_run:INSTR <-
(
to_run_expr
);
-
+
- to_run_expr:EXPR <-
- (
+ (
warning_error (position,"Error: ITM_CODE.to_run");
deferred;
NULL
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
"ITM_CODE : Type:".print;
- type_id_intern.print;
+ type_id_intern.print;
'\n'.print;
deferred;
);
-
+
- print <-
(
string_tmp.clear;
diff --git a/src/item/itm_constant.li b/src/item/itm_constant.li
index cd48718..856123d 100644
--- a/src/item/itm_constant.li
+++ b/src/item/itm_constant.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_CONSTANT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all constant";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
+
Section Public
- is_constant:BOOLEAN := TRUE;
diff --git a/src/item/itm_expression.li b/src/item/itm_expression.li
index 8b4adb6..8bf9ad8 100644
--- a/src/item/itm_expression.li
+++ b/src/item/itm_expression.li
@@ -90,7 +90,7 @@ Section Public
{
idx := idx + 1;
itm_op ?= value_list.item idx;
- }.do_while {(itm_op != NULL) && {idx != value_list.upper}};
+ }.do_while {(itm_op != NULL) && {idx != value_list.upper}};
(itm_op != NULL).if {
semantic_error (itm_op.position,"Operator postfix not found.");
};
@@ -99,7 +99,7 @@ Section Public
(typ = TYPE_VOID).if {
semantic_error (val.position,"Expression type `Void'.");
};
- // Post-fix.
+ // Post-fix.
idx_post := idx + 1;
continue := TRUE;
{(idx_post <= value_list.upper) && {continue}}.while_do {
@@ -110,7 +110,7 @@ Section Public
((idx_post = value_list.upper) || {itm_op != NULL}).if {
itm_op ?= value_list.item idx_post;
slo := typ.get_slot (operator (ALIAS_STR.slot_postfix) name (itm_op.name));
- (slo != NULL).if {
+ (slo != NULL).if {
site := NODE.new_read (itm_op.position) slot slo receiver val self val intern FALSE;
list_current.add_last site;
val := site.result_expr;
@@ -130,12 +130,12 @@ Section Public
((idx_pre = low) || {itm_op != NULL}).if {
itm_op ?= value_list.item idx_pre;
slo := typ.get_slot (operator (ALIAS_STR.slot_prefix) name (itm_op.name));
- (slo = NULL).if {
+ (slo = NULL).if {
error_slot (itm_op.position) name "prefix" operator (itm_op.name) in typ;
};
site := NODE.new_read (itm_op.position) slot slo receiver val self val intern FALSE;
list_current.add_last site;
- val := site.result_expr;
+ val := site.result_expr;
idx_pre := idx_pre - 1;
continue := TRUE;
};
@@ -182,7 +182,7 @@ Section Public
max_pri := ALIAS_STR.keyword_right;
max_pos := j;
};
- } else {
+ } else {
// Other:
slo := site.data.slot;
(
@@ -205,8 +205,8 @@ Section Public
right ?= val_list.item (max_pos + 1);
(n_t = NULL).if {
// '=' or '!='.
- extern ?= val_list.item max_pos;
- extern.set_left left and_right right;
+ extern ?= val_list.item max_pos;
+ extern.set_left left and_right right;
loc := type_boolean.default.get_temporary (extern.position);
instr:= loc.write (extern.position) value extern;
list_current.add_last instr;
diff --git a/src/item/itm_extern.li b/src/item/itm_extern.li
index a1beeae..0558ebf 100644
--- a/src/item/itm_extern.li
+++ b/src/item/itm_extern.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_EXTERN;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for externals";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
+
Section Public
//
@@ -40,19 +40,19 @@ Section Public
+ extern:STRING_CONSTANT;
- //
+ //
// Constructor.
//
-
+
- last_code:STRING_CONSTANT;
-
+
- get_access:FAST_ARRAY(EXPR) <-
( + idx,base:INTEGER;
+ e:EXPR;
+ loc:STRING_CONSTANT;
+ var:VARIABLE;
+ access_list:FAST_ARRAY(EXPR);
-
+
string_tmp2.copy extern;
idx := string_tmp2.index_of '@' since (string_tmp2.lower);
(idx <= string_tmp2.count).if {
@@ -60,9 +60,9 @@ Section Public
{idx > string_tmp2.upper}.until_do {
base := idx;
idx := idx + 1;
- string_tmp.clear;
+ string_tmp.clear;
{
- (idx > string_tmp2.upper) ||
+ (idx > string_tmp2.upper) ||
{
(! string_tmp2.item idx.is_letter_or_digit) &&
{string_tmp2.item idx != '_'}
@@ -89,7 +89,7 @@ Section Public
};
e := var.read position;
access_list.add_last e;
-
+
string_tmp2.remove_between base to (base+loc.count);
string_tmp2.insert_string "(@)" to base;
idx := string_tmp2.index_of '@' since (base+2);
@@ -99,11 +99,11 @@ Section Public
last_code := ALIAS_STR.get string_tmp2;
access_list
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.add_last '`';
diff --git a/src/item/itm_external.li b/src/item/itm_external.li
index defcee1..6c05a59 100644
--- a/src/item/itm_external.li
+++ b/src/item/itm_external.li
@@ -73,7 +73,7 @@ Section Public
exp1 := profil_slot.argument_list.first.read position;
result := IS_EXPANDED.create position receiver exp1;
}
- .when 1 then { // type_id_intern:INTEGER
+ .when 1 then { // type_id_intern:INTEGER
result := GET_TYPE_ID.create position receiver
(profil_slot.argument_list.first.type);
}
@@ -85,32 +85,32 @@ Section Public
.when 3 then { // INTEGER - INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_SUB.create position with left and right;
+ result := EXPR_SUB.create position with left and right;
}
.when 4 then { // INTEGER * INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_MUL.create position with left and right;
+ result := EXPR_MUL.create position with left and right;
}
- .when 5 then { // INTEGER / INTEGER -> INTEGER.
+ .when 5 then { // INTEGER / INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_DIV.create position with left and right;
+ result := EXPR_DIV.create position with left and right;
}
.when 6 then { // INTEGER & INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_AND.create position with left and right;
+ result := EXPR_AND.create position with left and right;
}
.when 7 then { // INTEGER >> INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_SHIFT_R.create position with left and right;
+ result := EXPR_SHIFT_R.create position with left and right;
}
.when 8 then { // INTEGER << INTEGER -> INTEGER.
left := profil_slot.argument_list.first .read position;
right := profil_slot.argument_list.item 1.read position;
- result := EXPR_SHIFT_L.create position with left and right;
+ result := EXPR_SHIFT_L.create position with left and right;
}
.when 9 then { // put OBJECT to INTEGER.
exp1 := profil_slot.argument_list.first .read position;
@@ -126,7 +126,7 @@ Section Public
.when 11 then { // debug_level -> INTEGER.
result := INTEGER_CST.create position value debug_level_option type (type_integer.default);
}
- .when 12 then { // object_size -> INTEGER.
+ .when 12 then { // object_size -> INTEGER.
result := SIZE_OF.create position receiver
(profil_slot.argument_list.first.type);
}
@@ -146,9 +146,9 @@ Section Public
.when 15 then { // is_cop_type:BOOLEAN
type := profil_slot.argument_list.first.type;
(type.prototype.style = '-').if {
- result := PROTOTYPE_CST.create position type (type_true.default);
+ result := PROTOTYPE_CST.create position type (type_true.default);
} else {
- result := PROTOTYPE_CST.create position type (type_false.default);
+ result := PROTOTYPE_CST.create position type (type_false.default);
};
}
.when 16 then { // LIST.upper:INTEGER
@@ -162,10 +162,10 @@ Section Public
}
.when 19 then { // compiler_optimization -> BOOLEAN.
(is_optimization).if {
- result := PROTOTYPE_CST.create position type (type_true.default);
+ result := PROTOTYPE_CST.create position type (type_true.default);
} else {
- result := PROTOTYPE_CST.create position type (type_false.default);
- };
+ result := PROTOTYPE_CST.create position type (type_false.default);
+ };
}
.when 20 then { // compiler_built_on -> STRING_CONSTANT.
string_tmp.clear;
@@ -263,8 +263,8 @@ Section Private
args.add_last arg_nam;
args.add_last arg_typ;
args.add_last arg_val;
- list_current.add_last (
+ list_current.add_last (
NODE.new_block position receiver rec with args
- );
+ );
};
);
\ No newline at end of file
diff --git a/src/item/itm_external_type.li b/src/item/itm_external_type.li
index 07880a7..58c2e25 100644
--- a/src/item/itm_external_type.li
+++ b/src/item/itm_external_type.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_EXTERNAL_TYPE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "External C with type result";
-
+
Section Inherit
-
+
+ parent_itm_extern:Expanded ITM_EXTERN;
-
+
Section Public
//
@@ -47,21 +47,21 @@ Section Public
//
// Constructor
//
-
+
- create p:POSITION text n:STRING_CONSTANT persistant per:BOOLEAN :SELF <-
( + result:SELF;
result := clone;
result.make p text n persistant per;
result
);
-
+
- make p:POSITION text n:STRING_CONSTANT persistant per:BOOLEAN <-
(
position := p;
extern := n;
is_persistant := per;
);
-
+
//
// Added
//
@@ -79,23 +79,23 @@ Section Public
//
// Runnable
//
-
- - to_run_expr:EXPR <-
+
+ - to_run_expr:EXPR <-
( + e:EXTERNAL_C;
+ lt:TYPES_TMP;
+ lst_acc:FAST_ARRAY(EXPR);
+ typ:TYPE;
- + tmp:VARIABLE;
+ + tmp:VARIABLE;
lst_acc := get_access;
last_position := position;
- e := EXTERNAL_C.create position text last_code
+ e := EXTERNAL_C.create position text last_code
access lst_acc persistant is_persistant type (type.to_run_for profil_slot);
-
+
(type_list != NULL).if {
lt := TYPES_TMP.new;
(type_list.lower).to (type_list.upper) do { j:INTEGER;
- typ := type_list.item j.to_run_for profil_slot.raw;
+ typ := type_list.item j.to_run_for profil_slot.raw;
lt.add typ;
};
e.set_living_type (lt.to_types);
diff --git a/src/item/itm_ldots.li b/src/item/itm_ldots.li
index 4427dcb..2e8dad5 100644
--- a/src/item/itm_ldots.li
+++ b/src/item/itm_ldots.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_LDOTS;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "`...' for inherit contract";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CODE;
-
+
Section Public
//
// Constructor
//
-
+
- create p:POSITION :SELF <-
( + result:SELF;
result := clone;
result.make p;
result
);
-
+
- make p:POSITION <-
(
position := p;
);
-
+
//
// Runnable
//
@@ -58,7 +58,7 @@ Section Public
( + contract:ITM_LIST;
+ result:INSTR;
+ slot_code:SLOT_CODE;
-
+
slot_code ?= profil_slot.slot;
contract := slot_code.previous_contract;
(contract != NULL).if {
@@ -68,7 +68,7 @@ Section Public
};
result
);
-
+
- to_run_expr:EXPR <-
(
warning_error (position,"ITM_LDOTS.to_run_expr");
@@ -79,9 +79,8 @@ Section Public
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append "...";
);
-
\ No newline at end of file
diff --git a/src/item/itm_list.li b/src/item/itm_list.li
index f534a9d..6302b18 100644
--- a/src/item/itm_list.li
+++ b/src/item/itm_list.li
@@ -19,38 +19,38 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_LIST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Instruction list";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
+
Section Public
-
+
// BSBS: OPTIM : Dans 95% des cas, les list sont sans local (il faudrait spécialiser)
// Mais pb avec le parser...
-
+
//
// Data
//
+ local_list:FAST_ARRAY(ITM_LOCAL); // `+'
-
+
+ static_list:FAST_ARRAY(ITM_LOCAL); // `-'
+ code:FAST_ARRAY(ITM_CODE);
-
+
+ is_check_name:BOOLEAN;
-
+
- is_check_local:INTEGER;
-
+
//
// Constructor
//
@@ -61,12 +61,12 @@ Section Public
result.make p;
result
);
-
+
- make p:POSITION <-
(
- position := p;
+ position := p;
);
-
+
//
// Added
//
@@ -82,19 +82,19 @@ Section Public
? {! l.is_empty};
static_list := l;
);
-
+
- set_code c:FAST_ARRAY(ITM_CODE) <-
(
code := c;
- );
-
+ );
+
Section Public
-
+
- is_affect:POSITION <-
( + result,default:POSITION;
+ j:INTEGER;
+ itm_r:ITM_RESULT;
-
+
j := code.lower;
{(j < code.upper) && {result = default}}.while_do {
itm_r ?= code.item j;
@@ -110,49 +110,49 @@ Section Public
};
result
);
-
+
//
// Runnable.
//
-
- - to_run_expr:EXPR <-
+
+ - to_run_expr:EXPR <-
// List intern.
( + i:INSTR;
- + var:LOCAL;
+ + var:LOCAL;
+ stack_top:INTEGER;
+ result_top:INTEGER;
+ result:EXPR;
+ nb_result:INTEGER;
+ lr:FAST_ARRAY(EXPR);
-
+
stack_top := stack_local .upper + 1;
result_top := stack_result.upper + 1;
-
+
// Push Local.
- (local_list != NULL).if {
+ (local_list != NULL).if {
(local_list.lower).to (local_list.upper) do { j:INTEGER;
var := local_list.item j.to_run;
stack_local.add_last var;
- var.init;
- };
+ var.init;
+ };
};
- (static_list != NULL).if {
+ (static_list != NULL).if {
(static_list.lower).to (static_list.upper) do { j:INTEGER;
var := static_list.item j.to_run_static;
- stack_local.add_last var;
- };
- };
+ stack_local.add_last var;
+ };
+ };
// Append code.
(code.lower).to (code.upper) do { j:INTEGER;
- i := code.item j.to_run;
+ i := code.item j.to_run;
list_current.add_last i;
- };
- // Compute result expr.
- nb_result := stack_result.upper - result_top + 1;
-
- (nb_result = 0).if {
- result := PROTOTYPE_CST.create position type (TYPE_VOID.default); // BSBS: Alias.
- } else {
+ };
+ // Compute result expr.
+ nb_result := stack_result.upper - result_top + 1;
+
+ (nb_result = 0).if {
+ result := PROTOTYPE_CST.create position type (TYPE_VOID.default); // BSBS: Alias.
+ } else {
(nb_result > 1).if {
// Creation Vector.
lr := FAST_ARRAY(EXPR).create_with_capacity nb_result;
@@ -163,40 +163,40 @@ Section Public
} else {
result := stack_result.last.read position;
};
- };
+ };
// Pop local / Result.
- pop_stack_until stack_top;
+ pop_stack_until stack_top;
stack_result.remove_since result_top;
? {stack_result.upper = Old stack_result.upper};
- //
+ //
result
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
(code.count = 1).if {
buffer.add_last '(';
code.first.append_in buffer;
- buffer.add_last ')';
+ buffer.add_last ')';
} else {
- buffer.append "(\n";
+ buffer.append "(\n";
(code.lower).to (code.upper) do { i:INTEGER;
indent.append " ";
code.item i.append_in buffer;
buffer.append ";\n";
};
indent.remove_last 2;
- buffer.append ")";
- };
+ buffer.append ")";
+ };
);
-
+
Section ITM_LIST, ITM_RESULT
-
- - stack_result:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 16;
+
+ - stack_result:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 16;
diff --git a/src/item/itm_list_idf.li b/src/item/itm_list_idf.li
index 9885897..35e8c35 100644
--- a/src/item/itm_list_idf.li
+++ b/src/item/itm_list_idf.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_LIST_IDF;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "List identifier for assignment.";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
-Section Public
-
+
+Section Public
+
- is_affect:POSITION; // Nothing (it s good with 0).
// BSBS: A quoi ca sert ca ??? (Stop the Whisky)
-
+
//
// Data
//
@@ -53,7 +53,7 @@ Section Public
result.make p with lst;
result
);
-
+
- make p:POSITION with lst:FAST_ARRAY(STRING_CONSTANT) <-
(
position := p;
@@ -63,11 +63,10 @@ Section Public
//
// Runnable
//
-
+
- to_run_expr:EXPR <-
- (
+ (
semantic_error (position,"ITM_LIST_IDF.to_run_expr");
NULL
);
-
-
\ No newline at end of file
+
diff --git a/src/item/itm_local.li b/src/item/itm_local.li
index 63224e2..54cdbb3 100644
--- a/src/item/itm_local.li
+++ b/src/item/itm_local.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_LOCAL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Local declaration slot";
-
+
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
-
+
Section Public
//
@@ -60,7 +60,7 @@ Section Public
result.set_type t;
result
);
-
+
- make p:POSITION name n:STRING_CONSTANT <-
(
name := n;
@@ -80,10 +80,10 @@ Section Public
// Runnable
//
- - to_run:LOCAL <-
+ - to_run:LOCAL <-
( + pos:POSITION;
+ result:LOCAL;
-
+
last_position := position;
result := LOCAL.create position name name style '+' type (type.to_run_for profil_slot);
last_position := pos;
@@ -97,11 +97,11 @@ Section Public
+ larg:FAST_ARRAY(ITM_ARGUMENT);
+ arg:ITM_ARGUMENT;
+ proto:PROTOTYPE;
-
+
(type = ITM_TYPE_SIMPLE.type_self).if {
semantic_error (position,"Type `SELF' is not possible for `-' style local.");
};
- result := LOCAL.create position name name style '-' type (type.to_run_for profil_slot);
+ result := LOCAL.create position name name style '-' type (type.to_run_for profil_slot);
//
proto := position.prototype;
slot := proto.first_slot;
@@ -109,7 +109,7 @@ Section Public
slot := slot.next;
};
(slot = NULL).if {
- slot := ITM_SLOT.create position name (result.intern_name)
+ slot := ITM_SLOT.create position name (result.intern_name)
feature (SECTION_.get_name (ALIAS_STR.section_private));
slot.set_style '-';
slot.set_result_type type;
@@ -118,7 +118,7 @@ Section Public
type (ITM_TYPE_SIMPLE.type_self);
larg.add_last arg;
larg := ALIAS_ARRAY(ITM_ARGUMENT).copy larg;
- slot.set_argument_list larg;
+ slot.set_argument_list larg;
proto.add_slot slot;
} else {
result.set_intern_name (slot.name);
@@ -126,18 +126,18 @@ Section Public
//
result
);
-
- //
+
+ //
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append name;
buffer.add_last ':';
type.append_in buffer;
);
-
+
diff --git a/src/item/itm_number.li b/src/item/itm_number.li
index a54a89b..2cee426 100644
--- a/src/item/itm_number.li
+++ b/src/item/itm_number.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_NUMBER;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Integer constant";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CONSTANT;
-
+
Section Public
//
@@ -49,29 +49,29 @@ Section Public
result.make p value n;
result
);
-
+
- make p:POSITION value n:INTEGER_64 <-
(
position:=p;
value:=n;
);
-
+
//
// Runnable
//
- to_run_expr:EXPR <-
- (
- INTEGER_CST.create position value value type (type_integer.default)
+ (
+ INTEGER_CST.create position value value type (type_integer.default)
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
value.append_in buffer;
);
-
+
diff --git a/src/item/itm_object.li b/src/item/itm_object.li
index 6555055..837c296 100644
--- a/src/item/itm_object.li
+++ b/src/item/itm_object.li
@@ -43,7 +43,7 @@ Section Public
- push_context:(INTEGER,INTEGER,LOCAL) <-
(
bottom_index := stack_local.upper + 1;
- context_extern := NULL;
+ context_extern := NULL;
bottom_index,Old bottom_index,Old context_extern
);
@@ -62,7 +62,7 @@ Section Public
? {n = ALIAS_STR.get n};
j := stack_local.upper;
- {(j < stack_local.lower) || {stack_local.item j.name = n}}.until_do {
+ {(j < stack_local.lower) || {stack_local.item j.name = n}}.until_do {
j := j - 1;
};
(j >= stack_local.lower).if {
@@ -115,7 +115,7 @@ Section Public
stack_local.remove_last;
n := var.name;
(
- (n != ALIAS_STR.variable_self) &&
+ (n != ALIAS_STR.variable_self) &&
{n != ALIAS_STR.variable_tmp}
).if {
((var.ensure_count = 0) && {var.style != ' '}).if {
diff --git a/src/item/itm_old.li b/src/item/itm_old.li
index dc51cd3..d0d3337 100644
--- a/src/item/itm_old.li
+++ b/src/item/itm_old.li
@@ -87,7 +87,7 @@ Section Public
`/* Bug1 */`;
node ?= instr;
`/* Bug-end */`;
- (node != NULL).if {
+ (node != NULL).if {
NODE.node_list.remove (NODE.node_list.fast_first_index_of node);
NODE.node_list_base.add_last node;
};
diff --git a/src/item/itm_operator.li b/src/item/itm_operator.li
index a4ef188..6cdde1b 100644
--- a/src/item/itm_operator.li
+++ b/src/item/itm_operator.li
@@ -53,7 +53,7 @@ Section Public
- make p:POSITION name n:STRING_CONSTANT <-
(
position := p;
- name := n;
+ name := n;
);
//
diff --git a/src/item/itm_prototype.li b/src/item/itm_prototype.li
index e76d1f7..a70433d 100644
--- a/src/item/itm_prototype.li
+++ b/src/item/itm_prototype.li
@@ -19,74 +19,74 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_PROTOTYPE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Prototype constant";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CONSTANT;
-
+
Section Public
+ type:ITM_TYPE_MONO;
-
+
//
// Constructor
//
-
+
- create p:POSITION type n:ITM_TYPE_MONO :SELF <-
( + result:SELF;
result := clone;
result.make p type n;
result
);
-
+
- make p:POSITION type n:ITM_TYPE_MONO <-
- (
+ (
position := p;
- type := n;
+ type := n;
);
//
// Runnable
//
- - to_run_expr:EXPR <-
+ - to_run_expr:EXPR <-
( + t:TYPE_FULL;
+ result:EXPR;
-
- t := type.to_run_for profil_slot;
+
+ t := type.to_run_for profil_slot;
(t = NULL).if {
string_tmp.copy "Type `";
type.append_in string_tmp;
- string_tmp.append "' not found (Undefine type parameter).";
+ string_tmp.append "' not found (Undefine type parameter).";
semantic_error (position,string_tmp);
};
- // TYPE Classic.
+ // TYPE Classic.
(
- (t.is_expanded_c) &&
- {t.raw != type_boolean} &&
- {t.raw != type_true} &&
+ (t.is_expanded_c) &&
+ {t.raw != type_boolean} &&
+ {t.raw != type_true} &&
{t.raw != type_false}
).if {
result := t.default_value position;
result := result.check_type t with position;
- } else {
+ } else {
result := PROTOTYPE_CST.create position type t;
};
result
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
type.append_in buffer;
diff --git a/src/item/itm_read.li b/src/item/itm_read.li
index be614d6..e90a087 100644
--- a/src/item/itm_read.li
+++ b/src/item/itm_read.li
@@ -123,7 +123,7 @@ Section ITM_READ, SLOT_DATA
itm_list ?= first_itm;
(itm_list != NULL).if {
itm_read ?= itm_list.code.first;
- } else {
+ } else {
itm_read ?= first_itm;
};
is_resend := (
@@ -187,7 +187,7 @@ Section ITM_READ, SLOT_DATA
position.put_position;
POSITION.send_error;
};
- last_position := slot_msg.position;
+ last_position := slot_msg.position;
(
(profil_slot != NULL) &&
{! slot_msg.id_section.access rec_type with (profil_slot.type_self.raw)}
@@ -237,7 +237,7 @@ Section ITM_READ, SLOT_DATA
string_tmp.copy "Deferred in `";
profil_slot.slot.pretty_name_in string_tmp;
string_tmp.append "' for ";
- rec.static_type.append_name_in string_tmp;
+ rec.static_type.append_name_in string_tmp;
warning_error (position,string_tmp);
};
@@ -248,7 +248,7 @@ Section ITM_READ, SLOT_DATA
} else {
// Classic message with arguments.
(is_resend).if {
- args.put (lookup (ALIAS_STR.variable_self).read position) to 0;
+ args.put (lookup (ALIAS_STR.variable_self).read position) to 0;
} else {
args.put (args.first.my_copy) to 0;
};
@@ -286,7 +286,7 @@ Section Private
args.add_last e;
};
(verify).if {
- (! is_block_value).if {
+ (! is_block_value).if {
itm_arg := slot.argument_list.item idx;
(itm_arg.count != count).if {
string_tmp.copy "Incorrect vector size for #";
diff --git a/src/item/itm_read_arg1.li b/src/item/itm_read_arg1.li
index 27cb5c4..3656704 100644
--- a/src/item/itm_read_arg1.li
+++ b/src/item/itm_read_arg1.li
@@ -19,53 +19,53 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_READ_ARG1;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- - comment :=
- "For send message with one argument\
+ - comment :=
+ "For send message with one argument\
\ (receiver) or unary message";
-
+
Section Inherit
-
+
+ parent_itm_read:Expanded ITM_READ;
-
+
Section Public
-
+
//
// Data
//
-
+
+ arg:ITM_CODE;
//
// Constructor
//
-
+
- create p:POSITION name n:STRING_CONSTANT arg a:ITM_CODE :SELF <-
( + result:SELF;
result := clone;
result.make p name n arg a;
result
);
-
+
- make p:POSITION name n:STRING_CONSTANT arg a:ITM_CODE <-
(
position := p;
name := n;
arg := a;
);
-
+
//
// Runnable
//
- to_run_expr:EXPR <-
- (
+ (
to_run_with arg args NULL
);
diff --git a/src/item/itm_read_arg2.li b/src/item/itm_read_arg2.li
index 70f88e8..7b799a5 100644
--- a/src/item/itm_read_arg2.li
+++ b/src/item/itm_read_arg2.li
@@ -95,7 +95,7 @@ Section Public
t1 := v1.static_type;
t2 := v2.static_type;
(
- (! t1.is_expanded) &&
+ (! t1.is_expanded) &&
{! t2.is_expanded} &&
{! t1.is_sub_type t2} &&
{! t2.is_sub_type t1}
diff --git a/src/item/itm_read_args.li b/src/item/itm_read_args.li
index 6569559..5ea51da 100644
--- a/src/item/itm_read_args.li
+++ b/src/item/itm_read_args.li
@@ -19,29 +19,29 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_READ_ARGS;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Message with a lot of arguments";
-
+
Section Inherit
-
+
+ parent_itm_read:Expanded ITM_READ;
-
+
Section Public
-
+
- is_affect:POSITION <-
( + result,default:POSITION;
+ j:INTEGER;
-
+
(args.first != NULL).if {
result := args.first.position;
} else {
- j := args.lower + 1;
+ j := args.lower + 1;
{(j <= args.upper) && {result = default}}.while_do {
result := args.item j.is_affect;
j := j + 1;
@@ -49,7 +49,7 @@ Section Public
};
result
);
-
+
//
// Data
//
@@ -59,14 +59,14 @@ Section Public
//
// Constructor
//
-
+
- create p:POSITION name n:STRING_CONSTANT args arg:FAST_ARRAY(ITM_CODE) :SELF <-
( + result:SELF;
result := clone;
result.make p name n args arg;
result
);
-
+
- make p:POSITION name n:STRING_CONSTANT args arg:FAST_ARRAY(ITM_CODE) <-
(
position := p;
@@ -79,15 +79,15 @@ Section Public
//
- to_run_expr:EXPR <-
- ( + l_arg:FAST_ARRAY(ITM_CODE);
-
- l_arg := ALIAS_ARRAY(ITM_CODE).new;
- (args.lower+1).to (args.upper) do { j:INTEGER;
+ ( + l_arg:FAST_ARRAY(ITM_CODE);
+
+ l_arg := ALIAS_ARRAY(ITM_CODE).new;
+ (args.lower+1).to (args.upper) do { j:INTEGER;
l_arg.add_last (args.item j);
- };
+ };
to_run_with (args.first) args l_arg
);
-
+
diff --git a/src/item/itm_real.li b/src/item/itm_real.li
index 17b1015..b67b001 100644
--- a/src/item/itm_real.li
+++ b/src/item/itm_real.li
@@ -19,19 +19,19 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_REAL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Real float constant";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CONSTANT;
-
+
Section Public
//
@@ -49,26 +49,26 @@ Section Public
result.make p value n;
result
);
-
+
- make p:POSITION value n:STRING_CONSTANT <-
(
position:=p;
value:=n;
);
-
+
//
// Runnable
//
- to_run_expr:EXPR <-
- (
- REAL_CST.create position value value type (type_real.default)
+ (
+ REAL_CST.create position value value type (type_real.default)
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append value;
diff --git a/src/item/itm_result.li b/src/item/itm_result.li
index 0fd8f29..afaedfc 100644
--- a/src/item/itm_result.li
+++ b/src/item/itm_result.li
@@ -19,52 +19,52 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_RESULT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Result value";
-
+
Section Inherit
-
+
- parent_itm_code:ITM_CODE := ITM_CODE;
-
+
Section Public
-
+
- is_affect:POSITION <- value.is_affect;
-
+
- position:POSITION <- value.position;
-
+
//
// Data
//
-
+
+ value:ITM_CODE;
//
// Constructor
//
-
+
- create r:ITM_CODE :SELF <-
[
-? {r != NULL};
-? {r.position.code != 0};
]
( + result:SELF;
-
+
result := clone;
result.make r;
result
);
-
+
- make r:ITM_CODE <-
(
value := r;
);
-
+
//
// Runnable
//
@@ -73,8 +73,8 @@ Section Public
( + mul:EXPR_MULTIPLE;
+ val:EXPR;
+ result:INSTR;
-
- val := value.to_run_expr;
+
+ val := value.to_run_expr;
mul ?= val;
(mul != NULL).if {
(mul.lower).to (mul.upper-1) do { j:INTEGER;
@@ -87,17 +87,17 @@ Section Public
};
result
);
-
+
- to_run_expr:EXPR <-
(
crash;
NULL
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.append "return(";
@@ -108,10 +108,10 @@ Section Public
Section Private
- to_run_intern val:EXPR :INSTR <-
- ( + var:LOCAL;
-
+ ( + var:LOCAL;
+
var := val.static_type.get_temporary position;
- ITM_LIST.stack_result.add_last var;
- var.write position value val
+ ITM_LIST.stack_result.add_last var;
+ var.write position value val
);
-
+
diff --git a/src/item/itm_slot.li b/src/item/itm_slot.li
index 810ffaf..3349945 100644
--- a/src/item/itm_slot.li
+++ b/src/item/itm_slot.li
@@ -164,7 +164,7 @@ Section Public
(argument_list != NULL).if {
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
argument_list.item j.is_equal (other.argument_list.item j);
- };
+ };
};
};
};
diff --git a/src/item/itm_slot_operator.li b/src/item/itm_slot_operator.li
index d22ca37..68335b6 100644
--- a/src/item/itm_slot_operator.li
+++ b/src/item/itm_slot_operator.li
@@ -19,28 +19,28 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_SLOT_OPERATOR;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Slot item";
-
+
Section Inherit
-
+
+ parent_itm_slot:Expanded ITM_SLOT;
-
+
Section Public
-
+
+ pretty_name:STRING_CONSTANT;
-
+
- set_pretty_name n:STRING_CONSTANT <-
(
pretty_name := n;
);
-
+
//
// Access associativity & priority level.
//
@@ -56,7 +56,7 @@ Section Public
};
result
);
-
+
- priority:INTEGER <-
(
priority_and_level.abs
@@ -70,28 +70,28 @@ Section Public
priority_and_level := -l;
};
);
-
+
//
// Display.
//
-
+
- pretty_name_in buffer:STRING <-
- (
+ (
(name.has_prefix (ALIAS_STR.slot_postfix)).if {
buffer.append "Postfix '";
}.elseif {name.has_prefix (ALIAS_STR.slot_infix)} then {
buffer.append "Infix '";
} else {
buffer.append "Prefix '";
- };
+ };
buffer.append pretty_name;
buffer.add_last '\'';
);
-
+
Section ITM_SLOT
-
+
- shorter_profile_intern_in buf:STRING <-
- (
+ (
(name.has_prefix (ALIAS_STR.slot_postfix)).if {
argument_list.first.shorter_in buf;
buf.add_last ' ';
@@ -123,5 +123,5 @@ Section ITM_SLOT
buf.add_last ' ';
argument_list.first.shorter_in buf;
buf.add_last ' ';
- };
+ };
);
\ No newline at end of file
diff --git a/src/item/itm_string.li b/src/item/itm_string.li
index b23e374..c0a9d0b 100644
--- a/src/item/itm_string.li
+++ b/src/item/itm_string.li
@@ -19,22 +19,22 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_STRING;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "String constant";
-
+
Section Inherit
-
+
+ parent_itm_constant:Expanded ITM_CONSTANT;
-
+
Section Public
-
- + string:STRING_CONSTANT;
+
+ + string:STRING_CONSTANT;
//
// Constructor
@@ -46,23 +46,23 @@ Section Public
result.make p text n;
result
);
-
+
- make p:POSITION text n:STRING_CONSTANT <-
(
- position := p;
+ position := p;
string := n;
);
-
+
//
// Runnable
//
- to_run_expr:EXPR <-
- ( + result:EXPR;
+ ( + result:EXPR;
+ slt:SLOT_DATA;
+ wrt:WRITE;
+ len:INTEGER;
-
+
len := length;
result := STRING_CST.create position text string length len;
// count
@@ -75,37 +75,37 @@ Section Public
// storage
slt := type_string_constant.get_local_slot (ALIAS_STR.slot_storage).slot_data_intern;
wrt := slt.write position with (result.my_copy) value (
- NATIVE_ARRAY_CHARACTER_CST.create position text string
+ NATIVE_ARRAY_CHARACTER_CST.create position text string
);
wrt.set_quiet_generation;
list_current.add_last wrt;
//
result
);
-
- //
+
+ //
// Display.
//
-
+
- append_in buffer:STRING <-
(
buffer.add_last '\"';
buffer.append string;
buffer.add_last '\"';
);
-
+
Section Private
-
+
- length:INTEGER <-
( + i,result:INTEGER;
i := string.lower;
{i <= string.upper}.while_do {
- (string.item i = '\\').if {
+ (string.item i = '\\').if {
i := i + 1;
(string.item i.is_digit).if {
i := i + 1;
(string.item i.is_digit).if {
- i := i + 2;
+ i := i + 2;
};
};
};
diff --git a/src/item/itm_type.li b/src/item/itm_type.li
index ef95eae..7c94b97 100644
--- a/src/item/itm_type.li
+++ b/src/item/itm_type.li
@@ -19,37 +19,37 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all type";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Public
-
+
- print <-
(
string_tmp.clear;
append_in string_tmp;
string_tmp.print;
);
-
+
- append_in buffer:STRING <- deferred;
-
+
- shorter_in buf:STRING <- deferred;
-
+
- to_run_in lst:FAST_ARRAY(TYPE_FULL) for p:PARAMETER_TO_TYPE <-
(
deferred;
);
-
+
- get_expr_for p:PARAMETER_TO_TYPE :EXPR <-
(
deferred;
diff --git a/src/item/itm_type_generic.li b/src/item/itm_type_generic.li
index a960799..373d5a0 100644
--- a/src/item/itm_type_generic.li
+++ b/src/item/itm_type_generic.li
@@ -19,58 +19,58 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_GENERIC;
- copyright := "2003-2007 Benoit Sonntag";
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Generic style type";
-
+
Section Inherit
-
+
+ parent_itm_type_style:Expanded ITM_TYPE_STYLE;
-
+
Section Private
-
+
- dico_tg:FAST_ARRAY(ITM_TYPE_GENERIC) := FAST_ARRAY(ITM_TYPE_GENERIC).create_with_capacity 32;
- create n:STRING_CONSTANT 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:STRING_CONSTANT style s:STRING_CONSTANT with lt:FAST_ARRAY(ITM_TYPE_MONO) <-
(
name := n;
style := s;
list_type := lt;
);
-
+
Section Public
-
- - hash_code:INTEGER <- name.hash_code;
+
+ - hash_code:INTEGER <- name.hash_code;
+ list_type:FAST_ARRAY(ITM_TYPE_MONO);
-
- - get n:STRING_CONSTANT style s:STRING_CONSTANT
+
+ - get n:STRING_CONSTANT style s:STRING_CONSTANT
with lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
( + result:SELF;
+ idx:INTEGER;
-
+
idx := dico_tg.lower;
{
(idx <= dico_tg.upper) && {
- (dico_tg.item idx.name != n ) ||
- {dico_tg.item idx.style != s } ||
+ (dico_tg.item idx.name != n ) ||
+ {dico_tg.item idx.style != s } ||
{dico_tg.item idx.list_type != lt}
}
}.while_do {
idx := idx + 1;
- };
+ };
(idx <= dico_tg.upper).if {
result ?= dico_tg.item idx;
} else {
@@ -79,35 +79,35 @@ Section Public
};
result
);
-
+
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
( + lst:FAST_ARRAY(TYPE_FULL);
+ t:TYPE_FULL;
- + j:INTEGER;
+ + j:INTEGER;
+ result:TYPE_FULL;
+ path:STRING_CONSTANT;
-
+
lst := ALIAS_ARRAY(TYPE_FULL).new;
- j := list_type.lower;
+ j := list_type.lower;
{
- t := list_type.item j.to_run_for p;
+ t := list_type.item j.to_run_for p;
lst.add_last t;
j := j + 1;
}.do_while {(j <= list_type.upper) && {t != NULL}};
(t = NULL).if {
ALIAS_ARRAY(TYPE_FULL).free lst;
- } else {
- lst := ALIAS_ARRAY(TYPE_FULL).alias lst;
+ } else {
+ lst := ALIAS_ARRAY(TYPE_FULL).alias lst;
(p != NULL).if {
path := p.position.prototype.filename;
} else {
path := input_path;
- };
+ };
result := TYPE_GENERIC.get (path,Self) with lst;
};
result
);
-
+
- append_in buffer:STRING <-
(
(style != NULL).if {
@@ -123,7 +123,7 @@ Section Public
list_type.last.append_in buffer;
buffer.add_last ')';
);
-
+
- shorter_in buf:STRING <-
(
(style != NULL).if {
@@ -139,12 +139,12 @@ Section Public
list_type.last.shorter_in buf;
buf.add_last ')';
);
-
+
//
// Cast.
//
-
- - append_cast_name_in buf:STRING <-
+
+ - append_cast_name_in buf:STRING <-
(
parent_itm_type_style.append_cast_name_in buf;
buf.append "_of_";
diff --git a/src/item/itm_type_generic_elt.li b/src/item/itm_type_generic_elt.li
index eabafe4..982114a 100644
--- a/src/item/itm_type_generic_elt.li
+++ b/src/item/itm_type_generic_elt.li
@@ -19,78 +19,78 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_GENERIC_ELT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Virtual element for generic style type";
-
+
Section Inherit
-
+
+ parent_itm_type:Expanded ITM_TYPE_MONO;
-
+
Section Private
-
- - list:FAST_ARRAY(ITM_TYPE_GENERIC_ELT) :=
+
+ - list:FAST_ARRAY(ITM_TYPE_GENERIC_ELT) :=
// 'A' to 'Z'
( + result:FAST_ARRAY(ITM_TYPE_GENERIC_ELT);
-
- result := FAST_ARRAY(ITM_TYPE_GENERIC_ELT).create_with_capacity 26;
+
+ result := FAST_ARRAY(ITM_TYPE_GENERIC_ELT).create_with_capacity 26;
'A'.to 'Z' do { c:CHARACTER;
result.add_last (create c);
};
result
);
-
+
- create idf:CHARACTER :SELF <-
( + result:SELF;
-
+
result := clone;
result.make idf;
result
);
-
+
- make idf:CHARACTER <-
(
- index := idf -! 'A';
+ index := idf -! 'A';
);
Section Public
-
+
+ index:INTEGER;
-
+
- hash_code:INTEGER <- index;
-
+
- get idf:CHARACTER :ITM_TYPE_GENERIC_ELT <-
- (
+ (
list.item (idf -! 'A')
);
-
+
- display buffer:STRING <-
(
buffer.append "Generic[";
- buffer.add_last ('A' +# index);
+ buffer.add_last ('A' +# index);
buffer.add_last ']';
);
-
+
- shorter_in buf:STRING <-
(
string_tmp.clear;
- string_tmp.add_last ('A' +# index);
+ string_tmp.add_last ('A' +# index);
put string_tmp to buf like (ALIAS_STR.short_keyprototype);
- );
-
+ );
+
- string_tmp:STRING := STRING.create 100;
-
+
- to_run:TYPE_FULL <-
( + type_generic:TYPE_GENERIC;
+ result:TYPE_FULL;
+ t:CHARACTER;
-
+
t := 'A' +# index;
- type_generic ?= ITM_TYPE_SELF.self_up;
+ type_generic ?= ITM_TYPE_SELF.self_up;
(type_generic != NULL).if {
result := type_generic.generic_to_type t;
};
@@ -106,8 +106,8 @@ Section Public
//
// Cast.
//
-
- - append_cast_name_in buf:STRING <-
+
+ - append_cast_name_in buf:STRING <-
(
buf.add_last ('a' +# index);
);
\ No newline at end of file
diff --git a/src/item/itm_type_mono.li b/src/item/itm_type_mono.li
index eb426a8..4755917 100644
--- a/src/item/itm_type_mono.li
+++ b/src/item/itm_type_mono.li
@@ -19,62 +19,62 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_MONO;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Type simple";
-
+
Section Inherit
-
+
+ parent_itm_type:Expanded ITM_TYPE;
-
+
Section Public
-
- - hash_code:INTEGER <-
+
+ - hash_code:INTEGER <-
(
deferred;
0
);
-
+
//
// Runnable.
//
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
- (
+ (
deferred;
NULL
);
-
+
- to_run_in lst:FAST_ARRAY(TYPE_FULL) for p:PARAMETER_TO_TYPE <-
(
lst.add_last (to_run_for p);
);
-
+
- get_expr_for p:PARAMETER_TO_TYPE :EXPR <-
( + t:TYPE_FULL;
+ result:EXPR;
-
- t := to_run_for p;
+
+ t := to_run_for p;
result := t.get_temporary_expr (p.position);
result
- );
-
+ );
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
deferred;
);
-
+
//
// Cast.
//
-
+
- append_cast_name_in buf:STRING <- deferred;
\ No newline at end of file
diff --git a/src/item/itm_type_multi.li b/src/item/itm_type_multi.li
index 4738baa..1ca68f4 100644
--- a/src/item/itm_type_multi.li
+++ b/src/item/itm_type_multi.li
@@ -19,51 +19,51 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_MULTI;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "List of type";
-
+
Section Inherit
-
+
+ parent_itm_type:Expanded ITM_TYPE;
-
+
Section Private
-
+
- dico:FAST_ARRAY(ITM_TYPE_MULTI) := FAST_ARRAY(ITM_TYPE_MULTI).create_with_capacity 32;
- create lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
( + result:SELF;
-
+
result := clone;
result.make lt;
result
);
-
+
- make lt:FAST_ARRAY(ITM_TYPE_MONO) <-
(
list_type := lt;
);
-
+
Section Public
-
+
+ list_type:FAST_ARRAY(ITM_TYPE_MONO);
-
+
- count:INTEGER <- list_type.count;
-
+
- lower:INTEGER <- list_type.lower;
-
+
- upper:INTEGER <- list_type.upper;
-
+
- item i:INTEGER :ITM_TYPE_MONO <-
(
list_type.item i
);
-
+
- last:ITM_TYPE_MONO <-
(
list_type.last
@@ -73,15 +73,15 @@ Section Public
(
list_type.first
);
-
+
- get lt:FAST_ARRAY(ITM_TYPE_MONO) :SELF <-
( + result:SELF;
+ idx:INTEGER;
-
+
idx := dico.lower;
{(idx <= dico.upper) && {dico.item idx.list_type != lt}}.while_do {
idx := idx + 1;
- };
+ };
(idx <= dico.upper).if {
result ?= dico.item idx;
} else {
@@ -90,15 +90,15 @@ Section Public
};
result
);
-
+
//
// Runnable.
//
-
+
- get_expr_for p:PARAMETER_TO_TYPE :EXPR <-
( + lst:FAST_ARRAY(EXPR);
+ t:TYPE_FULL;
-
+
lst := FAST_ARRAY(EXPR).create_with_capacity count;
lower.to upper do { i:INTEGER;
t := item i.to_run_for p;
@@ -106,45 +106,45 @@ Section Public
};
EXPR_MULTIPLE.create lst
);
-
+
- to_run_in lst:FAST_ARRAY(TYPE_FULL) for p:PARAMETER_TO_TYPE <-
( + t:TYPE_FULL;
-
+
lower.to upper do { i:INTEGER;
t := item i.to_run_for p;
lst.add_last t;
};
);
-
+
//
// Display.
- //
-
+ //
+
- append_in buffer:STRING <-
- (
+ (
buffer.add_last '(';
display_raw buffer;
buffer.add_last ')';
);
-
+
- shorter_in buf:STRING <-
(
buf.add_last '(';
shorter_raw_in buf;
buf.add_last ')';
);
-
+
- display_raw buffer:STRING <-
- (
+ (
(list_type.lower).to (list_type.upper - 1) do { j:INTEGER;
list_type.item j.append_in buffer;
buffer.add_last ',';
};
list_type.last.append_in buffer;
);
-
+
- shorter_raw_in buf:STRING <-
- (
+ (
(list_type.lower).to (list_type.upper - 1) do { j:INTEGER;
list_type.item j.shorter_in buf;
buf.add_last ',';
diff --git a/src/item/itm_type_parameter.li b/src/item/itm_type_parameter.li
index 1f24b41..83a4f4f 100644
--- a/src/item/itm_type_parameter.li
+++ b/src/item/itm_type_parameter.li
@@ -19,24 +19,24 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_PARAMETER;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parameter type for argument define.";
-
+
Section Inherit
-
+
+ parent_itm_type_simple:Expanded ITM_TYPE_SIMPLE;
-
+
Section Public
-
+
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
( + result:TYPE_FULL;
-
- result := p.parameter_to_type Self;
+
+ result := p.parameter_to_type Self;
(result = NULL).if {
string_tmp.copy "Cannot resolve type for type parameter ";
append_in string_tmp;
@@ -44,16 +44,16 @@ Section Public
};
result
);
-
- //
+
+ //
// Display.
//
-
+
- shorter_in buf:STRING <-
(
(style != NULL).if {
put style to buf like (ALIAS_STR.short_keyword);
buf.add_last ' ';
- };
+ };
put name to buf like (ALIAS_STR.short_keyprototype);
);
diff --git a/src/item/itm_type_simple.li b/src/item/itm_type_simple.li
index 8af94b3..1b7444a 100644
--- a/src/item/itm_type_simple.li
+++ b/src/item/itm_type_simple.li
@@ -19,69 +19,69 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_SIMPLE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Simple type";
-
+
Section Inherit
-
+
+ parent_itm_type_mono:Expanded ITM_TYPE_MONO;
-
+
Section ITM_TYPE_SIMPLE, ITM_TYPE_SELF
-
- - dico:HASHED_DICTIONARY(ITM_TYPE_SIMPLE,STRING_CONSTANT) :=
+
+ - dico:HASHED_DICTIONARY(ITM_TYPE_SIMPLE,STRING_CONSTANT) :=
HASHED_DICTIONARY(ITM_TYPE_SIMPLE,STRING_CONSTANT).create;
Section ITM_TYPE_SIMPLE
-
+
- create n:STRING_CONSTANT :SELF <-
( + result:SELF;
-
+
result := clone;
result.make n;
result
);
-
+
- make n:STRING_CONSTANT <-
(
name := n;
dico.fast_put Self to n;
);
-
+
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_self:ITM_TYPE_SIMPLE := ITM_TYPE_PARAMETER.create (ALIAS_STR.prototype_self);
-
+
- hash_code:INTEGER <- name.hash_code;
-
+
+ name:STRING_CONSTANT;
-
+
- style:STRING_CONSTANT; // NULL
-
+
- get n:STRING_CONSTANT :ITM_TYPE_SIMPLE <-
[
- -? {n != NULL};
+ -? {n != NULL};
]
( + result:ITM_TYPE_SIMPLE;
-
- result := dico.fast_reference_at n;
+
+ result := dico.fast_reference_at n;
(result = NULL).if {
- result := create n;
- };
+ result := create n;
+ };
result
);
-
+
- to_run_for p:PARAMETER_TO_TYPE :TYPE_FULL <-
- ( + result:TYPE_FULL;
+ ( + result:TYPE_FULL;
+ path:STRING_CONSTANT;
-
+
(Self = type_null).if {
result := TYPE_NULL.default;
}.elseif {Self = type_void} then {
@@ -91,12 +91,12 @@ Section Public
path := p.position.prototype.filename;
} else {
path := input_path;
- };
+ };
result := TYPE.get (path,Self);
};
- result
+ result
);
-
+
- append_in buffer:STRING <-
(
(style != NULL).if {
@@ -105,7 +105,7 @@ Section Public
};
buffer.append name;
);
-
+
- shorter_in buf:STRING <-
(
(style != NULL).if {
@@ -114,16 +114,15 @@ Section Public
};
put name to buf like (ALIAS_STR.short_prototype);
);
-
+
//
// Cast.
//
-
- - append_cast_name_in buf:STRING <-
+
+ - append_cast_name_in buf:STRING <-
(
(name.lower).to (name.upper) do { j:INTEGER;
buf.add_last (name.item j.to_lower);
};
);
-
-
\ No newline at end of file
+
diff --git a/src/item/itm_type_style.li b/src/item/itm_type_style.li
index d3c52d0..510d387 100644
--- a/src/item/itm_type_style.li
+++ b/src/item/itm_type_style.li
@@ -19,49 +19,49 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_TYPE_STYLE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Type with style";
-
+
Section Inherit
-
+
+ parent_itm_type_simple:Expanded ITM_TYPE_SIMPLE;
-
-Section Private
-
+
+Section Private
+
- dico_ts:FAST_ARRAY(ITM_TYPE_STYLE) := FAST_ARRAY(ITM_TYPE_STYLE).create_with_capacity 32;
-
+
- create n:STRING_CONSTANT style s:STRING_CONSTANT :SELF <-
( + result:SELF;
-
+
result := clone;
result.make n style s;
result
);
-
+
- make n:STRING_CONSTANT style s:STRING_CONSTANT <-
(
name := n;
style := s;
);
-
-Section Public
-
+
+Section Public
+
+ style:STRING_CONSTANT;
-
+
- get n:STRING_CONSTANT style s:STRING_CONSTANT :SELF <-
- ( + result:SELF;
+ ( + result:SELF;
+ idx:INTEGER;
-
+
idx := dico_ts.lower;
{
(idx <= dico_ts.upper) && {
- (dico_ts.item idx.name != n) ||
+ (dico_ts.item idx.name != n) ||
{dico_ts.item idx.style != s}
}
}.while_do {
@@ -75,5 +75,5 @@ Section Public
};
result
);
-
+
diff --git a/src/item/itm_write.li b/src/item/itm_write.li
index 5648718..5d96aeb 100644
--- a/src/item/itm_write.li
+++ b/src/item/itm_write.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_WRITE;
- copyright := "2003-2007 Benoit Sonntag";
@@ -27,11 +27,11 @@ Section Header
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Parent for all write";
-
+
Section Inherit
-
+
+ parent_itm_code:Expanded ITM_CODE;
-
+
Section Public
//
@@ -41,17 +41,17 @@ Section Public
+ assign:ITM_CODE;
+ value:ITM_CODE;
-
+
- type:STRING_CONSTANT <-
(
deferred;
NULL
);
-
+
//
// Constructor
//
-
+
- create p:POSITION assign n:ITM_CODE with v:ITM_CODE :SELF <-
[ -? {p != 0}; ]
( + result:SELF;
@@ -59,7 +59,7 @@ Section Public
result.make p assign n with v;
result
);
-
+
- make p:POSITION assign n:ITM_CODE with v:ITM_CODE <-
(
position := p;
@@ -70,11 +70,11 @@ Section Public
//
// Access.
//
-
+
- get_simple_name:STRING_CONSTANT <-
( + result:STRING_CONSTANT;
+ without_arg:ITM_READ;
-
+
without_arg ?= assign;
(without_arg != NULL).if {
result := without_arg.name;
@@ -83,24 +83,24 @@ Section Public
};
result
);
-
+
//
// Display.
//
-
+
- append_in buffer:STRING <-
(
assign.append_in buffer;
buffer.append type;
value.append_in buffer;
);
-
+
Section Private
-
+
- affect name:STRING_CONSTANT with v:EXPR :EXPR <-
- ( + loc:LOCAL;
- + result:EXPR;
-
+ ( + loc:LOCAL;
+ + result:EXPR;
+
loc := lookup name;
(loc != NULL).if {
result := affect_local loc with v;
@@ -111,10 +111,10 @@ Section Private
);
- affect_local loc:LOCAL with v:EXPR :EXPR <-
- ( + e:INSTR;
- + result:EXPR;
+ ( + e:INSTR;
+ + result:EXPR;
+ val:EXPR;
-
+
(loc.style = '-').if {
result := affect_slot (loc.intern_name) with v;
} else {
@@ -122,11 +122,11 @@ Section Private
POSITION.put_error semantic text "Argument assignment is not possible.";
loc.position.put_position;
position.put_position;
- POSITION.send_error;
+ POSITION.send_error;
};
val := v.check_type (loc.type) with position;
- e := loc.write position value val;
- list_current.add_last e;
+ e := loc.write position value val;
+ list_current.add_last e;
result := loc.read position;
};
result
@@ -143,12 +143,12 @@ Section Private
+ em:EXPR_MULTIPLE;
+ new_val:EXPR;
+ lst:FAST_ARRAY(EXPR);
-
+
loc := lookup (ALIAS_STR.variable_self);
rec := loc.read position;
//
- type := rec.static_type.raw;
- slot := type.get_slot name;
+ type := rec.static_type.raw;
+ slot := type.get_slot name;
(slot = NULL).if {
string_tmp.copy "Slot `";
string_tmp.append name;
@@ -178,4 +178,4 @@ Section Private
result := node.result_expr;
result
);
-
+
diff --git a/src/item/itm_write_cast.li b/src/item/itm_write_cast.li
index 9784c45..5f91d5a 100644
--- a/src/item/itm_write_cast.li
+++ b/src/item/itm_write_cast.li
@@ -19,39 +19,39 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_WRITE_CAST;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Assignment slot `?=' style";
-
+
Section Inherit
-
+
+ parent_itm_write:Expanded ITM_WRITE;
-
+
Section Public
- type:STRING_CONSTANT <- "?=";
//
- // Runnable
+ // Runnable
//
- to_run_expr:EXPR <-
( + val:EXPR;
+ loc:LOCAL;
- + node:NODE;
+ + node:NODE;
+ nm:STRING_CONSTANT;
+ typ_cast:TYPE_FULL;
+ slot:SLOT;
+ ts:ITM_TYPE_SIMPLE;
-
+
// Value -> local.
val := value.to_run_expr;
- loc := val.static_type.get_temporary position;
+ loc := val.static_type.get_temporary position;
list_current.add_last (loc.write position value val);
val := loc.read position;
// Assign.
@@ -60,7 +60,7 @@ Section Public
(loc != NULL).if {
typ_cast := loc.type;
} else {
- slot := profil_slot.type_self.get_slot nm;
+ slot := profil_slot.type_self.get_slot nm;
(slot = NULL).if {
string_tmp.copy "Slot `";
string_tmp.append nm;
@@ -70,7 +70,7 @@ Section Public
semantic_error (position,string_tmp);
};
ts ?= slot.result_type;
- typ_cast := ts.to_run_for profil_slot;
+ typ_cast := ts.to_run_for profil_slot;
};
(verify).if {
((typ_cast.affect_with (val.static_type)) && {! val.static_type.is_generic}).if {
@@ -79,7 +79,7 @@ Section Public
};
// Dispatch case.
node := NODE.new_cast position type typ_cast with val;
- list_current.add_last node;
+ list_current.add_last node;
// Assignment result.
affect nm with (node.result_expr)
// Value result.
diff --git a/src/item/itm_write_code.li b/src/item/itm_write_code.li
index 908b204..28c3d52 100644
--- a/src/item/itm_write_code.li
+++ b/src/item/itm_write_code.li
@@ -19,25 +19,25 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_WRITE_CODE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Assignment slot with new code";
-
+
Section Inherit
-
+
+ parent_itm_write:Expanded ITM_WRITE;
-
+
Section Public
- type:STRING_CONSTANT <- "<-";
//
- // Runnable
+ // Runnable
//
- to_run_expr:EXPR <-
@@ -49,15 +49,15 @@ Section Public
+ type:TYPE_FULL;
+ slot:SLOT;
+ name:STRING_CONSTANT;
-
+
itm_read ?= assign;
name := itm_read.name;
- ? {itm_read != NULL};
+ ? {itm_read != NULL};
loc := lookup (ALIAS_STR.variable_self);
rec := loc.read position;
//
- type := rec.static_type;
- slot := type.get_slot name;
+ type := rec.static_type;
+ slot := type.get_slot name;
(slot = NULL).if {
string_tmp.copy "Slot `";
string_tmp.append name;
@@ -70,11 +70,11 @@ Section Public
node := NODE.new_write position slot slot receiver rec code value;
list_current.add_last node;
result := node.result_expr;
-
+
result
);
-
+
diff --git a/src/item/itm_write_value.li b/src/item/itm_write_value.li
index 19d75eb..43b8f57 100644
--- a/src/item/itm_write_value.li
+++ b/src/item/itm_write_value.li
@@ -19,25 +19,25 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ITM_WRITE_VALUE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Write with a value";
-
+
Section Inherit
-
+
+ parent_itm_write:Expanded ITM_WRITE;
-
+
Section Public
- type:STRING_CONSTANT <- ":=";
//
- // Runnable
+ // Runnable
//
- to_run_expr:EXPR <-
@@ -49,26 +49,26 @@ Section Public
+ itm_read:ITM_READ;
+ lst_exp:FAST_ARRAY(EXPR);
+ result:EXPR;
-
+
val := value.to_run_expr;
-
- val_multiple ?= val;
+
+ val_multiple ?= val;
(val_multiple != NULL).if {
//
- // Assignment Vector.
+ // Assignment Vector.
//
lst_exp := FAST_ARRAY(EXPR).create_with_capacity (val_multiple.count);
ass_multiple ?= assign;
- (ass_multiple != NULL).if {
+ (ass_multiple != NULL).if {
lst_idf := ass_multiple.list_name;
(lst_idf.lower).to (lst_idf.upper-1) do { i:INTEGER;
j := affect (lst_idf.item i) with val_multiple index j in lst_exp;
- };
- j := affect (lst_idf.last) with val_multiple index j in lst_exp;
+ };
+ j := affect (lst_idf.last) with val_multiple index j in lst_exp;
} else {
itm_read ?= assign;
? {itm_read != NULL};
- j := affect (itm_read.name) with val_multiple index j in lst_exp;
+ j := affect (itm_read.name) with val_multiple index j in lst_exp;
};
(j <= val_multiple.upper).if {
semantic_error (position,"Incorrect size vector.");
@@ -77,30 +77,30 @@ Section Public
} else {
//
// Assignment simple.
- //
- itm_read ?= assign;
- ? {itm_read != NULL};
+ //
+ itm_read ?= assign;
+ ? {itm_read != NULL};
result := affect (itm_read.name) with val;
};
result
);
Section Private
-
- - affect idf:STRING_CONSTANT with val:EXPR_MULTIPLE
+
+ - affect idf:STRING_CONSTANT with val:EXPR_MULTIPLE
index n:INTEGER in lst:FAST_ARRAY(EXPR) :INTEGER <-
( + loc:LOCAL;
+ result:INTEGER;
+ slot:SLOT;
+ typ_multi:ITM_TYPE_MULTI;
+ lst_expr:FAST_ARRAY(EXPR);
-
+
(n > val.upper).if {
semantic_error (position,"Incorrect size vector.");
};
-
+
loc := lookup idf;
- (loc != NULL).if {
+ (loc != NULL).if {
lst.add_last (affect_local loc with (val.item n));
result := n + 1;
} else {
@@ -120,10 +120,10 @@ Section Private
semantic_error (position,"Incorrect size vector.");
};
//BSBS: Recycle les EXPR_MULTIPLE
- lst_expr := FAST_ARRAY(EXPR).create_with_capacity (typ_multi.count);
+ lst_expr := FAST_ARRAY(EXPR).create_with_capacity (typ_multi.count);
0.to (typ_multi.upper) do { i:INTEGER;
lst_expr.add_last (val.item (n+i));
- };
+ };
lst.add_last (affect_slot idf with (EXPR_MULTIPLE.create lst_expr));
} else {
lst.add_last (affect_slot idf with (val.item n));
diff --git a/src/lip/lip_affect.li b/src/lip/lip_affect.li
index 85595ae..9d87664 100644
--- a/src/lip/lip_affect.li
+++ b/src/lip/lip_affect.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_AFFECT;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,11 +32,11 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ name:STRING_CONSTANT;
-
+
+ value:LIP_CODE;
-
+
//
// Creation.
//
@@ -49,20 +49,20 @@ Section Public
);
- make p:POSITION name n:STRING_CONSTANT value val:LIP_CODE <-
- (
+ (
position := p;
name := n;
value := val;
);
-
+
//
// Run.
//
-
+
- run <-
( + slot:LIP_SLOT_DATA;
+ val:LIP_CONSTANT;
-
+
slot := get_data name;
(slot = NULL).if {
string_tmp.copy "Slot `";
diff --git a/src/lip/lip_binary.li b/src/lip/lip_binary.li
index 077ee6a..35cdc14 100644
--- a/src/lip/lip_binary.li
+++ b/src/lip/lip_binary.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_BINARY;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,13 +32,13 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ left:LIP_CODE;
-
+
+ right:LIP_CODE;
-
+
+ operator:CHARACTER;
-
+
//
// Creation.
//
@@ -51,23 +51,23 @@ Section Public
);
- make p:POSITION with l:LIP_CODE operator op:CHARACTER and r:LIP_CODE<-
- (
+ (
position := p;
left := l;
right := r;
operator := op;
);
-
+
//
// Run.
//
-
+
- run_expr:LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ lv,rv:LIP_CONSTANT;
-
+
lv := left.run_expr;
- rv := right.run_expr;
+ rv := right.run_expr;
(operator)
.when '|' then { result := lv | rv; }
.when '&' then { result := lv & rv; }
@@ -83,7 +83,7 @@ Section Public
operator.print; '\n'.print;
lv.print; '\n'.print;
rv.print; '\n'.print;
- semantic_error (position,"Incorrect type operator.");
+ semantic_error (position,"Incorrect type operator.");
};
- result
+ result
);
diff --git a/src/lip/lip_boolean.li b/src/lip/lip_boolean.li
index f55af7e..96d5d7a 100644
--- a/src/lip/lip_boolean.li
+++ b/src/lip/lip_boolean.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_BOOLEAN;
- copyright := "2003-2008 Sonntag Benoit";
@@ -30,31 +30,31 @@ Section Header
Section Inherit
+ parent_lip_constant:Expanded LIP_CONSTANT;
-
+
Section Private
-
- - true:LIP_BOOLEAN :=
+
+ - true:LIP_BOOLEAN :=
( + result:LIP_BOOLEAN;
result := clone;
result.set_value TRUE;
result
);
-
+
- false:LIP_BOOLEAN := LIP_BOOLEAN;
-
+
- set_value i:BOOLEAN <-
(
value := i;
);
-
+
Section Public
+ value:BOOLEAN;
-
+
//
// Creation.
//
-
+
- get b:BOOLEAN :LIP_BOOLEAN <-
( + result:LIP_BOOLEAN;
b.if {
@@ -64,45 +64,44 @@ Section Public
};
result
);
-
+
- free; // Nothing.
-
+
//
// Operation.
//
-
+
- name:STRING_CONSTANT <- "BOOLEAN";
-
+
- '!' Self:SELF :LIP_CONSTANT <- get (! value);
-
+
- copy:LIP_CONSTANT <- Self;
-
+
- print <-
(
value.print;
);
Section LIP_CONSTANT
-
+
- my_copy other:SELF :LIP_CONSTANT <- other;
-
- - Self:SELF '|#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '|#' other:SELF :LIP_CONSTANT <-
+ (
get (value | other.value)
);
-
- - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
+ (
get (value & other.value)
);
-
- - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
+ (
get (value = other.value)
);
-
- - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
+ (
get (value != other.value)
);
-
\ No newline at end of file
diff --git a/src/lip/lip_call.li b/src/lip/lip_call.li
index cce486f..21f4acb 100644
--- a/src/lip/lip_call.li
+++ b/src/lip/lip_call.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_CALL;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,13 +32,13 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ receiver:LIP_CODE;
-
+
+ name:STRING_CONSTANT;
-
+
+ argument:LIP_CODE;
-
+
//
// Creation.
//
@@ -54,7 +54,7 @@ Section Public
[
-? {p.code != 0};
]
- (
+ (
position := p;
receiver := rec;
name := n;
@@ -64,34 +64,34 @@ Section Public
//
// Run.
//
-
+
- run <-
( + slot:LIP_SLOT_CODE;
- + val,rec:LIP_CONSTANT;
- + str:LIP_STRING;
+ + val,rec:LIP_CONSTANT;
+ + str:LIP_STRING;
+ int:LIP_INTEGER;
+ path:STRING_CONSTANT;
+ is_rec:BOOLEAN;
+ idx:INTEGER;
-
-
+
+
(receiver != NULL).if {
rec := receiver.run_expr;
};
(argument != NULL).if {
- val := argument.run_expr;
- };
+ val := argument.run_expr;
+ };
(name = ALIAS_STR.slot_print).if {
(rec = NULL).if {
semantic_error (position,"Incorrect type.");
- };
- (val != NULL).if {
+ };
+ (val != NULL).if {
warning_error (position,"No argument for `print' method.");
};
- rec.print;
- }.elseif {name = ALIAS_STR.slot_die_with_code} then {
+ rec.print;
+ }.elseif {name = ALIAS_STR.slot_die_with_code} then {
int ?= val;
- (int = NULL).if {
+ (int = NULL).if {
semantic_error (position,"Integer argument needed.");
};
die_with_code (int.value);
@@ -110,22 +110,22 @@ Section Public
(str = NULL).if {
semantic_error (position,"String argument needed.");
};
- path := str.value;
+ path := str.value;
((! path.is_empty) && {path.last = '*'}).if {
- string_tmp.copy path;
- string_tmp.remove_last 1;
+ string_tmp.copy path;
+ string_tmp.remove_last 1;
path := ALIAS_STR.get string_tmp;
is_rec := TRUE;
- };
+ };
((path.is_empty) || {path.first != '/'}).if {
- string_tmp.copy (position.prototype.filename);
+ string_tmp.copy (position.prototype.filename);
idx := last_index_str (string_tmp,'/');
(idx < string_tmp.lower).if {
string_tmp.copy "./";
} else {
string_tmp.remove_last (string_tmp.upper-idx);
};
- string_tmp.append path;
+ string_tmp.append path;
path := ALIAS_STR.get string_tmp;
};
(path.is_empty).if_false {
@@ -135,11 +135,11 @@ Section Public
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 {
+ ENVIRONMENT.execute_command string_tmp;
+ } else {
slot := get_method name;
(slot = NULL).if {
string_tmp.copy "Slot `";
@@ -158,25 +158,25 @@ Section Public
val.free;
};
);
-
+
- run_expr:LIP_CONSTANT <-
( + slot:LIP_SLOT_DATA;
+ str:LIP_STRING;
+ val:LIP_CONSTANT;
+ result:LIP_CONSTANT;
+ res:INTEGER;
-
+
(argument != NULL).if {
- val := argument.run_expr;
- };
+ 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;
+ res := ENVIRONMENT.execute_command string_tmp;
result := LIP_INTEGER.get res;
}.elseif {name = ALIAS_STR.slot_get_integer} then {
{
@@ -184,8 +184,8 @@ Section Public
(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);
+ }.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));
@@ -199,7 +199,7 @@ Section Public
string_tmp.append "' not found.";
semantic_error (position,string_tmp);
};
- };
+ };
result := slot.get_value;
};
(val != NULL).if {
@@ -207,22 +207,22 @@ Section Public
};
result
);
-
+
- load_directory path:ABSTRACT_STRING is_recursive is_rec:BOOLEAN <-
( + entry:ENTRY;
+ dir:DIRECTORY;
-
- entry := FILE_SYSTEM.get_entry path;
+
+ entry := FILE_SYSTEM.get_entry path;
((entry != NULL) && {entry.is_directory} && {entry.open}).if {
- dir ?= entry;
+ 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);
+ 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;
diff --git a/src/lip/lip_code.li b/src/lip/lip_code.li
index 94aeda6..9aecc01 100644
--- a/src/lip/lip_code.li
+++ b/src/lip/lip_code.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_CODE;
- copyright := "2003-2008 Sonntag Benoit";
@@ -28,29 +28,29 @@ Section Header
- comment := "The main prototype";
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
Section Public
-
+
- 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_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;
@@ -60,11 +60,11 @@ Section Public
};
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 {
@@ -76,12 +76,12 @@ Section Public
"\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;
@@ -96,12 +96,12 @@ Section Public
};
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;
@@ -116,12 +116,12 @@ Section Public
};
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;
@@ -136,78 +136,78 @@ Section Public
};
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;
+ "' 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 {
+ "' not found.\n".print;
+ } else {
(d.set_value (LIP_BOOLEAN.get v)).if_false {
semantic_error (d.position,"BOOLEAN type is needed.");
- };
- };
+ };
+ };
);
-
+
//
// Run.
//
-
+
- run <-
(
warning_error (position,"Unreachable code.");
);
-
+
- run_expr:LIP_CONSTANT <-
(
semantic_error (position,"No expression result.");
NULL
);
-
+
- call_front_end <-
- ( + s:LIP_SLOT_CODE;
+ ( + s:LIP_SLOT_CODE;
// Executing `front_end':
s := LIP_CODE.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;
};
- s.run_with NULL;
+ s.run_with NULL;
);
-
+
- init_path_file order:BOOLEAN <-
( + k,i:INTEGER;
+ p1,p2:STRING_CONSTANT;
-
+
(order).if {
- path_file.bubble_sort_with { (a,b:STRING_CONSTANT);
+ path_file.bubble_sort_with { (a,b:STRING_CONSTANT);
b < a
- };
+ };
} else {
- path_file.bubble_sort_with { (a,b:STRING_CONSTANT);
+ path_file.bubble_sort_with { (a,b:STRING_CONSTANT);
b !< a
- };
+ };
};
k := path_file.upper;
path_begin := path_file.first.upper;
diff --git a/src/lip/lip_constant.li b/src/lip/lip_constant.li
index 6facb50..6ab138f 100644
--- a/src/lip/lip_constant.li
+++ b/src/lip/lip_constant.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_CONSTANT;
- copyright := "2003-2008 Sonntag Benoit";
@@ -28,19 +28,19 @@ Section Header
- comment := "The main prototype";
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Public
-
+
- name:STRING_CONSTANT <- ( deferred; NULL);
-
+
- copy:LIP_CONSTANT <-
(
deferred;
);
-
- - copy_of other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - copy_of other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -49,14 +49,14 @@ Section Public
};
result
);
-
+
- free <- deferred;
-
+
- '-' Self:SELF :LIP_CONSTANT <- NULL;
-
- - '!' Self:SELF :LIP_CONSTANT <- NULL;
- - Self:SELF '|' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - '!' Self:SELF :LIP_CONSTANT <- NULL;
+
+ - Self:SELF '|' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -65,8 +65,8 @@ Section Public
};
result
);
-
- - Self:SELF '&' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '&' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -75,8 +75,8 @@ Section Public
};
result
);
-
- - Self:SELF '+' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '+' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -85,8 +85,8 @@ Section Public
};
result
);
-
- - Self:SELF '-' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '-' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -95,8 +95,8 @@ Section Public
};
result
);
-
- - Self:SELF '>' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '>' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -106,7 +106,7 @@ Section Public
result
);
- - Self:SELF '<' other:LIP_CONSTANT :LIP_CONSTANT <-
+ - Self:SELF '<' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -115,7 +115,7 @@ Section Public
};
result
);
-
+
- Self:SELF '~=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
@@ -125,8 +125,8 @@ Section Public
};
result
);
-
- - Self:SELF '>=' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '>=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -135,8 +135,8 @@ Section Public
};
result
);
-
- - Self:SELF '<=' other:LIP_CONSTANT :LIP_CONSTANT <-
+
+ - Self:SELF '<=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
s ?= other;
@@ -145,7 +145,7 @@ Section Public
};
result
);
-
+
- Self:SELF '!~=' other:LIP_CONSTANT :LIP_CONSTANT <-
( + result:LIP_CONSTANT;
+ s:SELF;
@@ -155,30 +155,30 @@ Section Public
};
result
);
-
+
- print <- deferred;
-
+
Section LIP_CONSTANT
-
+
- my_copy other:SELF :LIP_CONSTANT <- NULL;
-
+
- Self:SELF '|#' other:SELF :LIP_CONSTANT <- NULL;
-
- - Self:SELF '&#' other:SELF :LIP_CONSTANT <- NULL;
-
+
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <- NULL;
+
- Self:SELF '+#' other:SELF :LIP_CONSTANT <- NULL;
-
- - Self:SELF '-#' other:SELF :LIP_CONSTANT <- NULL;
-
+
+ - Self:SELF '-#' other:SELF :LIP_CONSTANT <- NULL;
+
- Self:SELF '>#' other:SELF :LIP_CONSTANT <- NULL;
- Self:SELF '<#' other:SELF :LIP_CONSTANT <- NULL;
-
+
- Self:SELF '=#' other:SELF :LIP_CONSTANT <- NULL;
-
+
- Self:SELF '>=#' other:SELF :LIP_CONSTANT <- NULL;
-
+
- Self:SELF '<=#' other:SELF :LIP_CONSTANT <- NULL;
-
+
- Self:SELF '!=#' other:SELF :LIP_CONSTANT <- NULL;
diff --git a/src/lip/lip_if.li b/src/lip/lip_if.li
index 3e42fcc..a3637d5 100644
--- a/src/lip/lip_if.li
+++ b/src/lip/lip_if.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_IF;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,18 +32,18 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ condition:LIP_CODE;
-
+
+ then:FAST_ARRAY(LIP_CODE);
-
+
+ else:FAST_ARRAY(LIP_CODE);
-
+
//
// Creation.
//
- - create p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE)
+ - create p:POSITION if rec:LIP_CODE then the:FAST_ARRAY(LIP_CODE)
else els:FAST_ARRAY(LIP_CODE) :SELF <-
( + result:SELF;
result := clone;
@@ -51,9 +51,9 @@ Section Public
result
);
- - make p:POSITION if rec:LIP_CODE then the: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;
then := the;
@@ -65,14 +65,14 @@ Section Public
warning_error (else.last.position,"Unreachable expression.");
};
);
-
+
//
// Run.
//
-
+
- run <-
( + val:LIP_BOOLEAN;
-
+
val ?= condition.run_expr;
(val = NULL).if {
semantic_error (position,"BOOLEAN needed.");
@@ -80,7 +80,7 @@ Section Public
(val.value).if {
(then.lower).to (then.upper-1) do { i:INTEGER;
then.item i.run;
- };
+ };
}.elseif {else != NULL} then {
(else.lower).to (else.upper-1) do { i:INTEGER;
else.item i.run;
diff --git a/src/lip/lip_integer.li b/src/lip/lip_integer.li
index 18c1d6e..10f8567 100644
--- a/src/lip/lip_integer.li
+++ b/src/lip/lip_integer.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_INTEGER;
- copyright := "2003-2008 Sonntag Benoit";
@@ -30,24 +30,24 @@ Section Header
Section Inherit
+ parent_lip_constant:Expanded LIP_CONSTANT;
-
+
Section Private
-
+
- storage:FAST_ARRAY(LIP_INTEGER) := FAST_ARRAY(LIP_INTEGER).create_with_capacity 10;
-
+
- set_value v:INTEGER <-
(
value := v;
);
-
+
Section Public
-
+
+ value:INTEGER;
-
+
//
// Creation.
//
-
+
- get i:INTEGER :LIP_INTEGER <-
( + result:LIP_INTEGER;
(storage.is_empty).if {
@@ -59,113 +59,113 @@ Section Public
result.set_value i;
result
);
-
+
- free <-
(
storage.add_last Self;
);
-
+
//
// Operation.
//
-
+
- name:STRING_CONSTANT <- "INTEGER";
-
+
- '-' Self:SELF :LIP_CONSTANT <-
- (
+ (
value := - value;
Self
);
- '!' Self:SELF :LIP_CONSTANT <-
- (
+ (
value := ~ value;
Self
);
-
+
- copy:LIP_CONSTANT <-
(
get value
);
-
+
- print <-
(
value.print;
);
-
+
Section LIP_CONSTANT
-
+
- my_copy other:SELF :LIP_CONSTANT <-
(
value := other.value;
Self
);
-
+
- Self:SELF '|#' other:SELF :LIP_CONSTANT <-
- (
+ (
value := value | other.value;
other.free;
Self
);
-
- - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '&#' other:SELF :LIP_CONSTANT <-
+ (
value := value & other.value;
other.free;
Self
);
-
- - Self:SELF '+#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '+#' other:SELF :LIP_CONSTANT <-
+ (
value := value + other.value;
other.free;
- Self
+ Self
);
-
+
- Self:SELF '-#' other:SELF :LIP_CONSTANT <-
- (
+ (
value := value - other.value;
other.free;
Self
);
-
+
- Self:SELF '>#' other:SELF :LIP_CONSTANT <-
- (
+ (
other.free;
free;
LIP_BOOLEAN.get (value > other.value)
);
-
- - Self:SELF '<#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '<#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value < other.value)
);
-
- - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value = other.value)
);
-
- - Self:SELF '>=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '>=#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value >= other.value)
);
-
+
- Self:SELF '<=#' other:SELF :LIP_CONSTANT <-
- (
+ (
other.free;
free;
LIP_BOOLEAN.get (value <= other.value)
);
-
- - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value != other.value)
diff --git a/src/lip/lip_list.li b/src/lip/lip_list.li
index 8a4f5b6..2d791f1 100644
--- a/src/lip/lip_list.li
+++ b/src/lip/lip_list.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_LIST;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,9 +32,9 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ list:FAST_ARRAY(LIP_CODE);
-
+
//
// Creation.
//
@@ -47,15 +47,15 @@ Section Public
);
- make p:POSITION with v:FAST_ARRAY(LIP_CODE) <-
- (
+ (
position := p;
list := v;
);
-
+
//
// Run.
//
-
+
- run <-
(
run_intern;
@@ -63,18 +63,18 @@ Section Public
semantic_error (position,"Incorrect expression.");
};
);
-
+
- run_expr:LIP_CONSTANT <-
- (
+ (
run_intern;
(list.last = NULL).if {
semantic_error (position,"Unreachable expression.");
};
list.last.run_expr
);
-
+
Section Private
-
+
- run_intern <-
(
(list.lower).to (list.upper-1) do { i:INTEGER;
diff --git a/src/lip/lip_slot_code.li b/src/lip/lip_slot_code.li
index 9521613..59d9917 100644
--- a/src/lip/lip_slot_code.li
+++ b/src/lip/lip_slot_code.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_SLOT_CODE;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,94 +32,94 @@ Section Inherit
- parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ section:STRING_CONSTANT;
-
+
+ name:STRING_CONSTANT;
-
+
+ argument:LIP_SLOT_DATA;
-
+
+ code:LIP_CODE;
-
+
+ comment:STRING_CONSTANT;
-
+
// + comment_chapter:STRING_CONSTANT;
-
+
- set_comment c:STRING_CONSTANT <-
(
comment := c;
);
-
+
/*
- set_comment_chapter cmt:STRING_CONSTANT <-
(
comment_chapter := cmt;
);
*/
-
+
//
// Creation.
//
- - create p:POSITION section sec:STRING_CONSTANT
- name n:STRING_CONSTANT
+ - create p:POSITION section sec:STRING_CONSTANT
+ name n:STRING_CONSTANT
argument arg:LIP_SLOT_DATA
code c:LIP_CODE :LIP_SLOT_CODE <-
( + result:LIP_SLOT_CODE;
-
+
result := get_method n;
(result != NULL).if {
((arg = NULL) ^ (result.argument = NULL)).if {
semantic_error (result.position,"Incorrect redefinition.");
- };
- } else {
+ };
+ } else {
result := clone;
- result.make p section sec name n argument arg code c;
+ result.make p section sec name n argument arg code c;
};
result
);
- - make p:POSITION section sec:STRING_CONSTANT
- name n:STRING_CONSTANT
- argument arg:LIP_SLOT_DATA
+ - make p:POSITION section sec:STRING_CONSTANT
+ name n:STRING_CONSTANT
+ argument arg:LIP_SLOT_DATA
code c:LIP_CODE <-
- (
+ (
position := p;
section := sec;
name := n;
- argument := arg;
- code := c;
+ argument := arg;
+ code := c;
list_method.add_last Self;
);
-
+
//
// Operation.
//
-
+
- run_with val:LIP_CONSTANT :BOOLEAN <-
( + result:BOOLEAN;
-
+
result := ! ((val = NULL) ^ (argument = NULL));
- (result).if {
+ (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 {
+ (result).if {
code.run;
};
stack.remove_last;
};
result
);
-
+
//
// Print.
//
-
+
- print <-
(
" -".print;
@@ -130,7 +130,7 @@ Section Public
">".print;
};
":\n".print;
- (comment != NULL).if {
+ (comment != NULL).if {
'\t'.print;
(comment.lower).to (comment.upper) do { i:INTEGER;
comment.item i.print;
@@ -142,4 +142,4 @@ Section Public
"\t Sorry, no comment (see `make.lip').\n".print;
};
);
-
+
diff --git a/src/lip/lip_slot_data.li b/src/lip/lip_slot_data.li
index 0cb958e..e991274 100644
--- a/src/lip/lip_slot_data.li
+++ b/src/lip/lip_slot_data.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_SLOT_DATA;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,16 +32,16 @@ Section Inherit
+ parent_lip_slot:Expanded LIP_CODE;
Section Public
-
+
+ name:STRING_CONSTANT;
-
+
+ value:LIP_CONSTANT;
-
+
//
// Creation.
//
- - create p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
+ - create p:POSITION name n:STRING_CONSTANT value v:LIP_CONSTANT
argument is_arg:BOOLEAN :SELF <-
[
-? {v != NULL};
@@ -69,39 +69,38 @@ Section Public
(
position := p;
name := n;
- value := v;
+ value := v;
(is_arg).if_false {
list_data.add Self to n;
- };
+ };
);
-
+
//
// Value.
//
-
+
- set_value v:LIP_CONSTANT :BOOLEAN <-
( + new_val:LIP_CONSTANT;
-
+
new_val := value.copy_of v;
(new_val != NULL).if {
- value := new_val;
- }
+ value := new_val;
+ }
);
-
+
- get_value:LIP_CONSTANT <-
(
value.copy
);
-
+
//
// Print.
//
-
+
- print <-
(
name.print;
':'.print;
value.name.print;
);
-
-
\ No newline at end of file
+
diff --git a/src/lip/lip_string.li b/src/lip/lip_string.li
index 04f11a5..d87c851 100644
--- a/src/lip/lip_string.li
+++ b/src/lip/lip_string.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_STRING;
- copyright := "2003-2008 Sonntag Benoit";
@@ -30,13 +30,13 @@ Section Header
Section Inherit
+ parent_lip_constant:Expanded LIP_CONSTANT;
-
+
Section Private
-
+
- storage:FAST_ARRAY(LIP_STRING) := FAST_ARRAY(LIP_STRING).create_with_capacity 10;
-
+
Section Public
-
+
+ value:STRING_CONSTANT;
- set_value v:STRING_CONSTANT <-
@@ -47,64 +47,64 @@ Section Public
//
// Creation.
//
-
+
- get str:STRING_CONSTANT :LIP_STRING <-
( + result:LIP_STRING;
(storage.is_empty).if {
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";
-
+
- copy:LIP_CONSTANT <-
(
get value
);
-
+
- print <-
- (
- string_tmp.clear;
+ (
+ string_tmp.clear;
append_in string_tmp;
string_tmp.print;
);
-
+
- append_in str:STRING <-
( + i:INTEGER;
+ car:CHARACTER;
-
+
i := value.lower;
{i <= value.upper}.while_do {
car := value.item i;
- (car = '\\').if {
+ (car = '\\').if {
i := i + 1;
(i <= value.upper).if {
car := value.item i;
(car)
.when 'a' then { str.add_last '\a'; }
.when 'b' then { str.add_last '\b'; }
- .when 'f' then { str.add_last '\f'; }
- .when 'n' then { str.add_last '\n'; }
- .when 'r' then { str.add_last '\r'; }
- .when 't' then { str.add_last '\t'; }
- .when 'v' then { str.add_last '\v'; }
- .when '\\' then { str.add_last '\\'; }
- .when '?' then { str.add_last '\?'; }
- .when '\'' then { str.add_last '\''; }
+ .when 'f' then { str.add_last '\f'; }
+ .when 'n' then { str.add_last '\n'; }
+ .when 'r' then { str.add_last '\r'; }
+ .when 't' then { str.add_last '\t'; }
+ .when 'v' then { str.add_last '\v'; }
+ .when '\\' then { str.add_last '\\'; }
+ .when '?' then { str.add_last '\?'; }
+ .when '\'' then { str.add_last '\''; }
.when '\"' then { str.add_last '\"'; };
} else {
str.add_last car;
@@ -115,35 +115,34 @@ Section Public
i := i + 1;
};
);
-
+
Section LIP_CONSTANT
-
+
- my_copy other:SELF :LIP_CONSTANT <-
(
value := other.value;
Self
);
-
- - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '=#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value = other.value)
);
-
- - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
- (
+
+ - Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
+ (
other.free;
free;
LIP_BOOLEAN.get (value != other.value)
);
-
+
- Self:SELF '+#' other:SELF :LIP_CONSTANT <-
- (
+ (
string_tmp.copy value;
string_tmp.append (other.value);
value := ALIAS_STR.get string_tmp;
other.free;
Self
);
-
\ No newline at end of file
diff --git a/src/lip/lip_unary.li b/src/lip/lip_unary.li
index 979e143..10f5f2d 100644
--- a/src/lip/lip_unary.li
+++ b/src/lip/lip_unary.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_UNARY;
- copyright := "2003-2008 Sonntag Benoit";
@@ -29,14 +29,14 @@ Section Header
Section Inherit
- + parent_lip_code:Expanded LIP_CODE;
+ + parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ value:LIP_CODE;
-
+
+ operator:CHARACTER;
-
+
//
// Creation.
//
@@ -49,25 +49,25 @@ Section Public
);
- make p:POSITION operator op:CHARACTER with v:LIP_CODE <-
- (
- position := p;
+ (
+ position := p;
operator := op;
value := v;
);
-
+
//
// Run.
//
-
+
- run_expr:LIP_CONSTANT <-
( + result:LIP_CONSTANT;
-
- result := value.run_expr;
+
+ result := value.run_expr;
(operator)
.when '-' then { result := - result; }
.when '!' then { result := ! result; };
(result = NULL).if {
semantic_error (position,"Incorrect type.");
};
- result
+ result
);
diff --git a/src/lip/lip_value.li b/src/lip/lip_value.li
index 24a1179..24251c3 100644
--- a/src/lip/lip_value.li
+++ b/src/lip/lip_value.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LIP_VALUE;
- copyright := "2003-2008 Sonntag Benoit";
@@ -32,9 +32,9 @@ Section Inherit
+ parent_lip_code:Expanded LIP_CODE;
Section Public
-
+
+ value:LIP_CONSTANT;
-
+
//
// Creation.
//
@@ -47,15 +47,15 @@ Section Public
);
- make p:POSITION with v:LIP_CONSTANT <-
- (
+ (
position := p;
value := v;
);
-
+
//
// Run.
//
-
+
- run_expr:LIP_CONSTANT <-
(
value.copy
diff --git a/src/lisaac.li b/src/lisaac.li
index b82c3b7..b619a82 100644
--- a/src/lisaac.li
+++ b/src/lisaac.li
@@ -26,7 +26,7 @@ Section Header
- author := "Sonntag Benoit (sonntag at icps.u-strasbg.fr)";
- comment := "The main prototype";
-
+
// Top 5 memory record :
// 1 - LOCAL (>20MB) (il fo Aliaser les tmp !)
// 2 - READ_LOCAL (15MB)
@@ -47,7 +47,7 @@ Section Public
LIP_CODE.print_usage;
COMMON.command_line_footer.print;
);
-
+
- show_version <-
(
COMMON.command_line_header "Compiler".print;
@@ -59,9 +59,9 @@ Section Private
- output_name :STRING_CONSTANT;
- output_extension:STRING_CONSTANT;
-
+
- input_name:STRING_CONSTANT;
-
+
//
// Command.
//
@@ -74,7 +74,7 @@ Section Private
\ interpreted. \n\
\ \n\
\Options: \n";
-
+
- display_usage <-
(
@@ -357,7 +357,7 @@ Section Private
+ key:UINTEGER_32;
title "SOURCE LINE REFERENCE" in output_decl;
-
+
buf.append
"struct __source {\n\
\ unsigned int pos;\n\
@@ -365,7 +365,7 @@ Section Private
\} __src[";
src := PUSH.source_line;
src.count.append_in buf;
- buf.append "]={\n";
+ buf.append "]={\n";
(src.lower).to (src.upper) do { j:INTEGER;
key := src.key j;
output_decl.append "#define L";
@@ -374,7 +374,7 @@ Section Private
(j-1).append_in output_decl;
output_decl.add_last '\n';
//
- buf.append " {";
+ buf.append " {";
key.append_in buf;
buf.append ",\"";
buf.append (src.item j);
@@ -398,12 +398,12 @@ Section Private
\ die_with_code(1); \n\
\} \n\n";
};
-
+
//
// Stack manager.
//
- buf.append
+ buf.append
"void lisaac_push_first(_____CONTEXT *path,unsigned long code)\n\
\{ \n";
(debug_level_option = 20).if {
@@ -412,7 +412,7 @@ Section Private
\ cur = top_context; \n\
\ while ((cur != (void *)0) && (cur != path)) cur = cur->back; \n\
\ if (cur == path) {\n\
- \ loop.back = top_context;\n\
+ \ loop.back = top_context;\n\
\ loop.code = code; \n\
\ lisaac_stack_print(&loop);\n\
\ print_string(\"COMPILER: Debug context looping detected !\\n\");\n\
@@ -426,7 +426,7 @@ Section Private
\} \n\
\ \n\
\void lisaac_push(_____CONTEXT *path,unsigned long code)\n\
- \{ \n\
+ \{ \n\
\ path->code = code;\n\
\ top_context = path;\n\
\} \n\
@@ -461,8 +461,8 @@ Section Private
\ }; \n\
\ print_char('^'); \n\
\ print_char('\\n'); \n\
-\ }; \n";
-
+\ }; \n";
+
} else {
buf.append
" print_string(\"Line #\"); \n\
@@ -482,7 +482,7 @@ Section Private
\ \n\
\void print_integer(unsigned short n) \n\
\{ unsigned short val; \n\
- \ char car; \n\
+ \ char car; \n\
\ car = (n % 10) + '0'; \n\
\ val = n / 10; \n\
\ if (val != 0) print_integer(val); \n\
@@ -567,10 +567,10 @@ Section Private
);
Section Public
-
+
- tab:FAST_ARRAY(INTEGER) := FAST_ARRAY(INTEGER).create 128;
- tab_null:FAST_ARRAY(INTEGER) := FAST_ARRAY(INTEGER).create 128;
-
+
//
// Creation.
//
@@ -845,16 +845,16 @@ Section Public
tmp2.print;
'\n'.print;
};
-
+
(TYPE_GENERIC.paper_list.lower).to (TYPE_GENERIC.paper_list.upper) do { i:INTEGER;
+ var:VARIABLE;
- + t:TYPES;
+ + t:TYPES;
+ idx:INTEGER;
var := TYPE_GENERIC.paper_list.item i.native_array_variable;
t := var.type_set;
((var.is_static) || {t.count = 0}).if {
tab.put (tab.item 0+1) to 0;
- } else {
+ } else {
idx := t.count;
tab.put (tab.item idx+1) to idx;
(t.first = TYPE_NULL).if {
@@ -874,7 +874,7 @@ Section Public
i.print; '='.print; tab_null.item i.print; '\n'.print;
};
};
-
+
/*
// Counter on '==' and '!='
"\nCounter on '==' and '!=':".print;
diff --git a/src/make.lip b/src/make.lip
index 3fa2f03..2fbe470 100644
--- a/src/make.lip
+++ b/src/make.lip
@@ -25,9 +25,9 @@ Section Inherit
Section Private
+ is_valid:BOOLEAN;
-
+
+ is_shorter:BOOLEAN;
-
+
- src_path <-
(
path "./";
diff --git a/src/parameter_to_type.li b/src/parameter_to_type.li
index 50900ad..14bea7b 100644
--- a/src/parameter_to_type.li
+++ b/src/parameter_to_type.li
@@ -19,23 +19,23 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := PARAMETER_TO_TYPE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Type parameter -> type full";
-
+
Section Public
-
- - position:POSITION <-
+
+ - position:POSITION <-
( + result:POSITION;
deferred;
result
);
-
+
- parameter_to_type p:ITM_TYPE_PARAMETER :TYPE_FULL <-
(
deferred;
diff --git a/src/parser.li b/src/parser.li
index 0f8b3be..7aec4d9 100644
--- a/src/parser.li
+++ b/src/parser.li
@@ -67,7 +67,7 @@ Section Public
beg.to (end-1) do { j:INTEGER;
token.add_last (source.item j);
output_code.remove pos;
- };
+ };
short_derive := short_derive - token.count;
// Insert format.
fmt := short_dico.at key;
@@ -76,10 +76,10 @@ Section Public
add_text := token;
} else {
add_text := fmt.item j;
- };
+ };
output_code.insert_string add_text to pos;
pos := pos + add_text.count;
- short_derive := short_derive + add_text.count;
+ short_derive := short_derive + add_text.count;
};
};
};
@@ -89,7 +89,7 @@ Section Public
- short_remove begin:INTEGER to end:INTEGER <-
(
output_code.remove_between
- (begin + short_derive) to (end + short_derive);
+ (begin + short_derive) to (end + short_derive);
short_derive := short_derive - (end - begin + 1);
);
@@ -249,7 +249,7 @@ Section Private
.when 2 then { };
};
};
- position := position + 1;
+ position := position + 1;
};
(position < source.upper).if {
@@ -311,7 +311,7 @@ Section Private
// Skip C comment style :
pos2 := position;
((last_character = '/') && {source.item (position+1) = '*'}).if {
- position := position + 2;
+ position := position + 2;
level_comment := 1;
{
(last_character = 0.to_character) || {level_comment = 0}
@@ -605,7 +605,7 @@ Section Private
last_integer := string_tmp.to_binary;
position := position+1;
} else {
- (last_character='d').if {
+ (last_character='d').if {
position := position+1;
};
(! string_tmp.is_integer_64).if {
@@ -638,9 +638,9 @@ Section Private
};
position := position + 1;
};
- (last_character = '.').if {
+ (last_character = '.').if {
string_tmp.add_last '.';
- position := position + 1;
+ position := position + 1;
(last_character.is_digit).if {
result := TRUE;
string_tmp.add_last last_character;
@@ -664,7 +664,7 @@ Section Private
{last_character.is_digit}.while_do {
string_tmp.add_last last_character;
position := position + 1;
- };
+ };
} else {
syntax_error (current_position,"Incorrect real number.");
};
@@ -772,7 +772,7 @@ Section Private
read_escape_character;
count := count + 1;
} else {
- position := position+1;
+ position := position+1;
count := count + 1;
};
};
@@ -792,7 +792,7 @@ Section Private
};
result
);
-
+
//-- string -> '\"' string_char '\"'
//-- string_char -> escape
//-- | ascii
@@ -814,7 +814,7 @@ Section Private
position := position+1;
read_escape_character;
} else {
- position := position+1;
+ position := position+1;
};
};
(last_character='\"').if {
@@ -962,8 +962,8 @@ Section Private
// Public, Private, ...
(ALIAS_STR.is_section last_string).if_false {
syntax_error (current_position,"Incorrect type section.");
- };
- last_section := SECTION_.get_name last_string;
+ };
+ last_section := SECTION_.get_name last_string;
(last_section.is_mapping).if {
object.set_mapping;
}.elseif {last_section.is_external} then {
@@ -972,15 +972,15 @@ Section Private
(last_section.is_inherit_or_insert) &&
{object.last_slot != NULL} &&
{! object.last_slot.id_section.is_inherit_or_insert}
- } then {
+ } then {
syntax_error (current_position,
"`Section Inherit/Insert' must to be first section.");
- }.elseif {
+ }.elseif {
(last_section.is_inherit) &&
{object.type_style = ALIAS_STR.keyword_expanded} &&
{object.name != ALIAS_STR.prototype_true } &&
{object.name != ALIAS_STR.prototype_false}
- } then {
+ } then {
warning_error (current_position,
"`Section Inherit' is not possible with Expanded object (Use `Section Insert').");
};
@@ -1001,10 +1001,10 @@ Section Private
{last_section.is_private}
).if {
output_code.remove_between
- (pos_sec + old_derive) to (position + short_derive - 1);
+ (pos_sec + old_derive) to (position + short_derive - 1);
short_derive := old_derive - (position - pos_sec);
};
-
+
pos_sec:=position;
old_derive:=short_derive;
};
@@ -1051,7 +1051,7 @@ Section Private
} else {
affect := ' ';
};
-
+
// ':' (TYPE|'('TYPE_LIST')'
((affect = ' ') && {read_character ':'}).if {
(read_character '(').if {
@@ -1068,8 +1068,8 @@ Section Private
(t = NULL).if {
syntax_error (current_position,"Incorrect result type.");
};
- };
-
+ };
+
(read_affect).if {
affect := last_string.first;
};
@@ -1105,14 +1105,14 @@ Section Private
last_slot.set_comment last_comment_slot;
};
};
-
+
(is_shorter).if {
(
(! is_short_code) &&
{old_pos != 0} &&
{! last_section.is_header}
).if {
- (current_position.column<5).if {
+ (current_position.column<5).if {
{
(last_character != 0.to_character) &&
{last_character.is_separator} &&
@@ -1125,7 +1125,7 @@ Section Private
};
};
output_code.remove_between
- (old_pos + old_derive) to (position + short_derive - 1);
+ (old_pos + old_derive) to (position + short_derive - 1);
short_derive := old_derive - (position - old_pos);
};
};
@@ -1194,12 +1194,12 @@ Section Private
n.copy last_string;
arg := read_loc_arg FALSE with_self FALSE;
(arg != NULL).if {
- list_arg.add_last arg;
+ list_arg.add_last arg;
(read_identifier).if {
(last_section.is_external).if {
syntax_error (current_position,"Incorrect in `Section External'.");
- };
- {
+ };
+ {
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
n.append (ALIAS_STR.separate);
@@ -1263,7 +1263,7 @@ Section Private
(arg != NULL).if {
// Infix operator.
list_arg.add_last arg;
- name := operator (ALIAS_STR.slot_infix) name name;
+ name := operator (ALIAS_STR.slot_infix) name name;
(associativity = NULL).if {
associativity := ALIAS_STR.keyword_left;
};
@@ -1326,7 +1326,7 @@ Section Private
syntax_error (current_position,"Type `SELF' is needed.");
};
result := ITM_ARG.create pos name n type t;
-
+
(is_shorter).if {
short_local.add n;
};
@@ -1349,7 +1349,7 @@ Section Private
};
result
);
-
+
//++ LOCAL -> { identifier [ ':' TYPE ] ',' } identifier ':' TYPE
- read_local m:BOOLEAN :FAST_ARRAY(ITM_LOCAL) <-
( + t:ITM_TYPE_MONO;
@@ -1386,10 +1386,10 @@ Section Private
result := NULL;
} else {
syntax_error (current_position,"Incorrect local type.");
- };
+ };
} else {
result := ALIAS_ARRAY(ITM_LOCAL).copy result;
-
+
(is_shorter).if {
(result.lower).to (result.upper) do { j:INTEGER;
short_local.add (result.item j.name);
@@ -1439,7 +1439,7 @@ Section Private
(beg != name.upper + 1).if {
(mute).if_false {
syntax_error (current_position,"Incorrect argument type.");
- };
+ };
ALIAS_ARRAY(STRING_CONSTANT).free name;
ALIAS_ARRAY(ITM_TYPE_MONO).free type;
} else {
@@ -1467,7 +1467,7 @@ Section Private
tm := ITM_TYPE_MULTI.get type;
result := ITM_ARGS.create current_position name name type tm;
};
-
+
(is_shorter).if {
(name.lower).to (name.upper) do { j:INTEGER;
short_local.add (name.item j);
@@ -1533,13 +1533,13 @@ Section Private
syntax_error (current_position,"Incorrect type list.");
};
(lst.count = 1).if {
- typ_arg := lst.first;
+ typ_arg := lst.first;
} else {
typ_arg := ITM_TYPE_MULTI.get lst;
};
(! read_character ')').if {
warning_error (current_position,"Added ')'.");
- }; // if
+ }; // if
(! read_character ';').if {
warning_error (current_position,"Added ';'.");
}; // if
@@ -1547,7 +1547,7 @@ Section Private
} else {
lst := read_type_list FALSE;
(lst != NULL).if {
- (read_character ';').if {
+ (read_character ';').if {
(lst.count = 1).if {
typ_arg := lst.first;
} else {
@@ -1570,7 +1570,7 @@ Section Private
};
(! read_character '}').if {
warning_error (current_position,"Added '}'.");
- }; // if
+ }; // if
result := ITM_TYPE_BLOCK.get typ_arg and typ_res;
} else {
// Expanded | Strict
@@ -1627,7 +1627,7 @@ Section Private
}.do_while {continue};
nam := ALIAS_STR.get string_tmp2;
//
- (read_character '(').if {
+ (read_character '(').if {
// Multiple Genericity.
genericity := ALIAS_ARRAY(ITM_TYPE_MONO).new;
{
@@ -1642,8 +1642,8 @@ Section Private
(read_character ')').if_false {
warning_error (current_position,"Added ')'.");
};
- } else {
- // Simple type.
+ } else {
+ // Simple type.
(is_parameter_type).if {
(styl != NULL).if {
string_tmp.copy "Style `";
@@ -1733,22 +1733,22 @@ Section Private
};
name := ALIAS_STR.get string_tmp2;
l_assignment.add_last name;
-
+
(is_shorter).if {
- (! short_local.fast_has name).if {
- short (ALIAS_STR.short_slot_call) token p to position;
+ (! short_local.fast_has name).if {
+ short (ALIAS_STR.short_slot_call) token p to position;
};
};
-
+
(read_character ',').if {
again := TRUE;
};
};
}.do_while {again};
- ((! l_assignment.is_empty) && {read_character ')'} && {read_affect}).if {
+ ((! l_assignment.is_empty) && {read_character ')'} && {read_affect}).if {
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;
value := read_expr;
(value = NULL).if {
syntax_error (current_position,"Incorrect expression.");
@@ -1763,7 +1763,7 @@ Section Private
.when '?' then {
syntax_error (current_position,"Sorry, Not yet implemented !");
result := ITM_WRITE_CAST.create (result.position) assign result with value;
- };
+ };
} else {
ALIAS_ARRAY(STRING_CONSTANT).free l_assignment;
};
@@ -1777,14 +1777,14 @@ Section Private
name := ALIAS_STR.get string_tmp2;
(is_shorter).if {
- (! short_local.fast_has name).if {
- short (ALIAS_STR.short_slot_call) token p to position;
+ (! short_local.fast_has name).if {
+ short (ALIAS_STR.short_slot_call) token p to position;
};
};
(read_affect).if {
result := ITM_READ.create current_position name name;
- affect := last_string.first;
+ affect := last_string.first;
value := read_expr;
(value = NULL).if {
syntax_error (current_position,"Incorrect expression.");
@@ -1798,7 +1798,7 @@ Section Private
}
.when '?' then {
result := ITM_WRITE_CAST.create (result.position) assign result with value;
- };
+ };
};
};
(result = NULL).if {
@@ -1833,14 +1833,14 @@ Section Private
first_msg := l_expr.count;
{
last_msg := l_expr.count;
- l_expr.add_last expr;
+ l_expr.add_last expr;
(read_operator).if {
{
expr := ITM_OPERATOR.create current_position name last_string;
l_expr.add_last expr;
- }.do_while {read_operator};
+ }.do_while {read_operator};
expr := read_expr_message;
- } else {
+ } else {
expr := NULL;
};
}.do_while {expr != NULL};
@@ -1864,13 +1864,13 @@ Section Private
l_expr.put expr to first_msg;
first_msg := first_msg - 1;
l_expr.remove first_msg;
- };
+ };
};
(l_expr.count = 1).if {
- result := l_expr.first;
+ result := l_expr.first;
ALIAS_ARRAY(ITM_CODE).free l_expr;
}.elseif {l_expr.count = 3} then {
- // Simple binary message.
+ // Simple binary message.
itm_op ?= l_expr.second;
result := ITM_READ_ARG2.create (itm_op.position)
name (operator (ALIAS_STR.slot_infix) name (itm_op.name))
@@ -1910,7 +1910,7 @@ Section Private
(read_this_keyword (ALIAS_STR.keyword_old)).if {
old_value := read_expr;
- (old_value = NULL).if {
+ (old_value = NULL).if {
syntax_error (current_position,"Incorrect `Old' expression.");
};
result := ITM_OLD.create current_position value old_value;
@@ -1983,14 +1983,14 @@ Section Private
//
arg := read_loc_arg TRUE with_self FALSE;
//
- (arg != NULL).if {
+ (arg != NULL).if {
(read_character ';').if_false {
warning_error (current_position,"Added ';'.");
}; // if
} else {
-
+
restore_context; // !! RESTORE CONTEXT !!
-
+
};
result := ITM_BLOCK.create last_group argument arg;
@@ -2063,7 +2063,7 @@ Section Private
e := read_expr;
};
(e != NULL).if {
- (read_character ',').if {
+ (read_character ',').if {
{
e := ITM_RESULT.create e;
result.add_last e;
@@ -2074,8 +2074,8 @@ Section Private
};
(e = NULL).if {
syntax_error (current_position,"Incorrect multiple result expression.");
- };
- }.do_while {read_character ','};
+ };
+ }.do_while {read_character ','};
};
e := ITM_RESULT.create e;
result.add_last e;
@@ -2175,14 +2175,14 @@ Section Private
(read_character ';').if_false {
warning_error (current_position,"Added ';'.");
};
-
+
save_context; // !! SAVE CONTEXT !!
-
+
styl := read_style;
} else {
-
+
restore_context; // !! RESTORE CONTEXT !!
-
+
styl := ' ';
};
};
@@ -2221,12 +2221,12 @@ Section Private
l_arg := ALIAS_ARRAY(ITM_CODE).new;
arg := read_argument;
(arg != NULL).if {
- l_arg.add_last arg;
+ l_arg.add_last arg;
{read_identifier}.while_do {
-
+
short (ALIAS_STR.short_slot_call) token
(position-last_string.count) to position;
-
+
n.append (ALIAS_STR.separate);
n.append last_string;
arg := read_argument;
@@ -2265,7 +2265,7 @@ Section Private
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
@@ -2313,8 +2313,8 @@ Section Private
//
// Read `name' slot.
//
-
- (style = '-').if {
+
+ (style = '-').if {
semantic_error (current_position,"COP not yet implemented.");
is_cop := TRUE;
(is_java).if {
@@ -2417,31 +2417,31 @@ Section Private
\};\n\n";
};
};
-
+
// style "name" ':=' [type] cap_identifier [ '(' PARAM {',' PARAM}')' ]
// PARAM -> cap_identifier | identifier ':' TYPE
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
-
+
object.set_position current_position;
object.set_style style;
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if_false {
warning_error (current_position,"Added ':='.");
};
-
+
(
(read_this_keyword (ALIAS_STR.keyword_expanded)) ||
- {read_this_keyword (ALIAS_STR.keyword_strict)}
+ {read_this_keyword (ALIAS_STR.keyword_strict)}
).if {
- object.set_type_style last_string;
+ object.set_type_style last_string;
};
-
+
(! read_cap_identifier).if {
syntax_error (current_position,"Prototype identifier is needed.");
};
short (ALIAS_STR.short_prototype) token
(position-last_string.count) to position;
-
+
(object.shortname != last_string).if {
syntax_error (current_position,"Incorrect name (filename != name).");
};
@@ -2450,7 +2450,7 @@ Section Private
// Generic loader.
//
param := { + res:ITM_TYPE_PARAMETER;
- (read_identifier).if {
+ (read_identifier).if {
(read_character ':').if_false {
warning_error (current_position,"Added ':'.");
};
@@ -2470,7 +2470,7 @@ Section Private
res
};
- ((! is_shorter) && {! is_shorter2}).if {
+ ((! is_shorter) && {! is_shorter2}).if {
(object.generic_count = 0).if {
syntax_error (current_position,"Object can't be generic.");
};
@@ -2478,27 +2478,27 @@ Section Private
parameter_type := param.value;
(parameter_type = NULL).if {
syntax_error (current_position,"Identifier parameter type is needed.");
- };
-
- object.idf_generic_list.add_last parameter_type;
- {read_character ','}.while_do {
+ };
+
+ object.idf_generic_list.add_last parameter_type;
+ {read_character ','}.while_do {
parameter_type := param.value;
(parameter_type = NULL).if {
syntax_error (current_position,"Identifier parameter type is needed.");
- };
+ };
object.idf_generic_list.add_last parameter_type;
}; // loop
-
+
(! read_character ')').if {
warning_error (current_position,"Added ')'.");
};
-
- ((! is_shorter) && {! is_shorter2}).if {
+
+ ((! is_shorter) && {! is_shorter2}).if {
(object.idf_generic_list.count != object.generic_count).if {
syntax_error (current_position,"Invalid generic list number.");
};
};
- };
+ };
} else {
syntax_error (current_position,"Slot `name' must to be first slot.");
};
@@ -2526,7 +2526,7 @@ Section Private
//
// Read `external' slot.
//
-
+
// - "external" ':=' `<code_c>`
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
@@ -2540,17 +2540,17 @@ Section Private
output_decl.append "/* ";
output_decl.append (object.name);
output_decl.append " */\n";
- output_decl.append last_string;
+ output_decl.append last_string;
output_decl.add_last '\n';
}.elseif {read_word(ALIAS_STR.slot_default)} then {
//
// Read `default' slot.
//
-
+
// '-' "default" ':=' EXPR_PRIMARY
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
-
+
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if_false {
warning_error (current_position,"Added ':='.");
};
@@ -2566,11 +2566,11 @@ Section Private
//
// Read `type' slot.
//
-
+
// '-' "type" ':=' `<type C>`
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
-
+
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if_false {
warning_error (current_position,"Added ':='.");
};
@@ -2585,11 +2585,11 @@ Section Private
//
// Read `version' slot.
//
-
+
// '-' "version" ':=' integer
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
-
+
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if_false {
warning_error (current_position,"Added ':='.");
};
@@ -2629,22 +2629,22 @@ Section Private
{read_word (ALIAS_STR.slot_copyright)} ||
{read_word (ALIAS_STR.slot_bug_report)}
} then {
- //
+ //
// Read `date', `comment', `author', `bibliography',
// `language', `copyright' or `bug_report' slots.
//
-
+
// '-' ("date"|"comment"|"author"|"bibliography"|"language"|"copyright"|"bug_report")
// ':=' string
short (ALIAS_STR.short_slot) token
(position-last_string.count) to position;
-
+
(read_symbol (ALIAS_STR.symbol_affect_immediate)).if_false {
warning_error (current_position,"Added ':='.");
- };
+ };
(read_string).if_false {
syntax_error (current_position,"Incorrect string.");
- };
+ };
(is_shorter2).if {
object.set_comment_slot last_string;
};
diff --git a/src/profil.li b/src/profil.li
index 2375305..c74c78e 100644
--- a/src/profil.li
+++ b/src/profil.li
@@ -252,10 +252,10 @@ Section Public
(argument_list.lower).to (argument_list.upper) do { j:INTEGER;
loc := argument_list.item j;
val := args.item j;
- (loc != NULL).if {
+ (loc != NULL).if {
wrt := loc.write (val.position) value val;
result.add_last wrt;
- } else {
+ } else {
result.add_last NULL;
val.remove;
};
@@ -349,20 +349,20 @@ Section Public
{result_list.is_empty}
).if {
switch ?= code.last;
- (switch != NULL).if {
+ (switch != NULL).if {
// Verification cases:
(switch.list.lower).to (switch.list.upper) do { j:INTEGER;
lst := switch.list.item j.code;
(lst.is_empty).if_false {
msg ?= lst.last;
- ((msg != NULL) && {msg.profil = Self}).if {
+ ((msg != NULL) && {msg.profil = Self}).if {
count_recur := count_recur + 1;
};
};
};
(count_recur = switch.list.count).if {
semantic_error (slot.position,"Recursivity without end.");
- };
+ };
((count_intern_call - 1) = count_recur).if {
((link_count = count_intern_call) || {! is_context_sensitive}).if {
new_execute_pass;
@@ -385,21 +385,21 @@ Section Public
(stat = -1).if {
count_intern_call := count_intern_call + 1;
- (count_intern_call = 1).if {
+ (count_intern_call = 1).if {
old_list_current := list_current;
old_profil_current := profil_current;
//
profil_current := Self;
execute 3;
- //
+ //
list_current := old_list_current;
profil_current := old_profil_current;
? {code != NULL};
- (count_intern_call = 1).if {
+ (count_intern_call = 1).if {
stat := 0;
} else {
stat := recursivity_bit;
- };
+ };
};
};
);
@@ -499,7 +499,7 @@ Section Public
v := argument_list.item j;
(v != NULL).if {
? {(v.style = ' ') || {v.style = '!'}};
- genere v result FALSE in buffer;
+ genere v result FALSE in buffer;
buffer.add_last ',';
};
};
@@ -577,7 +577,7 @@ Section Public
{! t.is_expanded_c}
).if {
buffer.add_last '&';
- };
+ };
(loc.my_alias = NULL).if {
idf := loc.intern_name;
} else {
@@ -603,7 +603,7 @@ Section Public
buffer.append indent;
v := argument_list.first;
((v != NULL) && {v.name = ALIAS_STR.variable_self}).if {
- genere v result FALSE in buffer;
+ genere v result FALSE in buffer;
buffer.add_last '=';
put_cast_self buffer;
buffer.append "obj;\n";
@@ -615,12 +615,12 @@ Section Public
v := argument_list.item j;
(v != NULL).if {
buffer.append indent;
- genere v result FALSE in buffer;
+ genere v result FALSE in buffer;
buffer.append "=(";
ts := v.type;
ts.genere_declaration buffer;
buffer.add_last ' ';
- ts.genere_star_declaration buffer;
+ ts.genere_star_declaration buffer;
buffer.append ")((";
put_cast_self buffer;
buffer.append "obj)->param_";
@@ -674,7 +674,7 @@ Section Private
- put_cast_self buffer:STRING <-
(
buffer.add_last '(';
- type_self.genere_declaration buffer;
+ type_self.genere_declaration buffer;
buffer.add_last ' ';
type_self.genere_star_declaration buffer;
buffer.add_last ')';
@@ -800,7 +800,7 @@ Section Private
ts.genere_declaration buffer;
buffer.add_last ' ';
- ts.genere_star_declaration buffer;
+ ts.genere_star_declaration buffer;
(is_res).if {
buffer.add_last '*';
};
@@ -836,13 +836,13 @@ Section Private
switch ?= code.last;
(switch.list.lower).to (switch.list.upper) do { k:INTEGER;
body := switch.list.item k.code;
- (body.is_empty).if_false {
+ (body.is_empty).if_false {
msg_slot ?= body.last;
- ((msg_slot != NULL) && {msg_slot.profil = Self}).if {
+ ((msg_slot != NULL) && {msg_slot.profil = Self}).if {
link_count := link_count - 1;
msg_slot.argument_to_assignment body index (body.upper) alias FALSE style '!';
body.put (LOOP_END.create (msg_slot.position) loop loop) to (body.upper);
- };
+ };
};
};
count_intern_call := 1;
diff --git a/src/profil_block.li b/src/profil_block.li
index 440c1fe..b920067 100644
--- a/src/profil_block.li
+++ b/src/profil_block.li
@@ -265,7 +265,7 @@ Section Public
lst.add_last (loc.type.get_temporary_expr (loc.position));
};
result := EXPR_MULTIPLE.create lst;
- }.elseif {result_list.count = 1} then {
+ }.elseif {result_list.count = 1} then {
loc := result_list.first;
result := loc.type.get_temporary_expr (loc.position);
} else {
diff --git a/src/profil_list.li b/src/profil_list.li
index c6311d5..e06eba6 100644
--- a/src/profil_list.li
+++ b/src/profil_list.li
@@ -53,7 +53,7 @@ Section LISAAC
(
reduce_profil := profil_list.upper >= life_limit;
{profil_list.upper >= life_limit}.while_do {
- profil_list.last.remove;
+ profil_list.last.remove;
profil_list.remove_last;
};
);
@@ -105,11 +105,11 @@ Section Public
idx := p.life_index;
(idx < life_limit).if {
- life_limit := life_limit - 1;
+ life_limit := life_limit - 1;
(idx < life_limit).if {
(idx > current).if {
- swap idx with life_limit;
- } else {
+ swap idx with life_limit;
+ } else {
swap idx with current;
swap current with life_limit;
current := current - 1;
@@ -160,7 +160,7 @@ Section Public
list_current := NULL;
list_main.execute;
current := profil_list.lower;
- {current < life_limit}.while_do {
+ {current < life_limit}.while_do {
profil_current := profil_list.item current;
profil_current.execute inline_level_current;
current := current + 1;
diff --git a/src/profil_slot.li b/src/profil_slot.li
index d4000cb..d9f99d6 100644
--- a/src/profil_slot.li
+++ b/src/profil_slot.li
@@ -117,15 +117,15 @@ Section Public
tm ?= s.result_type;
(tm != NULL).if {
result_list.make_with_capacity (tm.count);
- (tm.lower).to (tm.upper) do { k:INTEGER;
- typ := tm.item k.to_run_for Self;
+ (tm.lower).to (tm.upper) do { k:INTEGER;
+ typ := tm.item k.to_run_for Self;
loc := typ.get (s.position) result (k+1);
result_list.add_last loc;
};
} else {
ts ?= s.result_type;
(ts != ITM_TYPE_SIMPLE.type_void).if {
- typ := ts.to_run_for Self;
+ typ := ts.to_run_for Self;
result_list.add_last (typ.get (s.position) result 0);
(is_external).if {
result_list.last.set_ensure_count 1;
diff --git a/src/shorter.li b/src/shorter.li
index f3f9441..6cbfb04 100644
--- a/src/shorter.li
+++ b/src/shorter.li
@@ -19,42 +19,42 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SHORTER;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- bibliography:= "http://IsaacOS.com";
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Shorter source code.";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Private
-
+
- is_lip:BOOLEAN;
-
+
- output_name : STRING_CONSTANT;
-
+
- input_name : STRING_CONSTANT;
-
+
- format_name : STRING_CONSTANT;
-
+
- proto_input:PROTOTYPE;
-
+
//
// Buffer.
//
-
+
- directory_list:STRING;
-
+
- file_list:STRING;
-
+
- current_list:STRING;
-
+
//
// Command.
//
@@ -77,7 +77,7 @@ Section Private
\ \n\
\Examples: \n\
\ * Output format file: \n\
- \ shorter -c -p -f latex hello_world.li \n\
+ \ shorter -c -p -f latex hello_world.li \n\
\ \n\
\ * Build html documentation: \n\
\ shorter -r -f html ~/lisaac/lib \n\
@@ -86,7 +86,7 @@ Section Private
\ - With directory: \n\
\ shorter -d -f belinda ~/lisaac/lib \n\
\ - With current `make.lip' \n\
- \ shorter -d -f belinda \n\
+ \ shorter -d -f belinda \n\
\ - With specific `make.lip' \n\
\ shorter -d -f belinda ../make.lip \n";
@@ -105,16 +105,16 @@ Section Private
COMMON.command_line_footer.print;
die_with_code exit_failure_code;
);
-
+
//
// Options.
//
-
+
- read_options <-
( + cmd:STRING;
+ j:INTEGER;
+ var_lisaac:STRING_CONSTANT;
-
+
// Read argument.
is_shorter := TRUE;
j := 1;
@@ -129,13 +129,13 @@ Section Private
j := j+1;
(j > COMMAND_LINE.count).if {
display_usage;
- };
+ };
output_name := ALIAS_STR.get (COMMAND_LINE.item j);
}.elseif {cmd.item 2 = 'f'} then {
j := j+1;
(j > COMMAND_LINE.count).if {
display_usage;
- };
+ };
format_name := ALIAS_STR.get (COMMAND_LINE.item j);
}.elseif {cmd.item 2 = 'c'} then {
is_short_code := TRUE;
@@ -144,7 +144,7 @@ Section Private
}.elseif {cmd.item 2 = 'r'} then {
is_short_recursive := TRUE;
}.elseif {cmd.item 2 = 'd'} then {
- is_shorter := FALSE;
+ is_shorter := FALSE;
is_shorter2 := TRUE;
is_short_recursive := TRUE;
}.elseif {cmd ~= "-version"} then {
@@ -160,14 +160,14 @@ Section Private
display_usage;
};
string_tmp.copy (COMMAND_LINE.item j);
- input_name := ALIAS_STR.get string_tmp;
+ input_name := ALIAS_STR.get string_tmp;
};
j := j+1;
};
-
+
(input_name = NULL).if {
- (is_shorter2).if {
- load_lip "make.lip";
+ (is_shorter2).if {
+ load_lip "make.lip";
is_lip := TRUE;
} else {
display_usage;
@@ -176,7 +176,7 @@ Section Private
load_lip input_name;
is_lip := TRUE;
};
-
+
(format_name != NULL).if {
var_lisaac := COMMON.path_lisaac;
string_tmp.copy var_lisaac;
@@ -190,26 +190,26 @@ Section Private
PARSER.parse_format (ALIAS_STR.get string_tmp);
};
);
-
+
- extract_proto_name st:ABSTRACT_STRING :STRING_CONSTANT <-
( + i:INTEGER;
-
+
string_tmp.copy st;
string_tmp.replace_all '\\' with '/';
i := last_index_str (string_tmp,'/');
- (i >= string_tmp.lower).if {
+ (i >= string_tmp.lower).if {
string_tmp.remove_first i;
};
i := last_index_str (string_tmp,'.');
- ? {i > string_tmp.lower};
- string_tmp.remove_last (string_tmp.upper-i+1);
+ ? {i > string_tmp.lower};
+ string_tmp.remove_last (string_tmp.upper-i+1);
string_tmp.to_upper;
ALIAS_STR.get string_tmp
);
-
+
- add_ext n:STRING_CONSTANT :STRING_CONSTANT <-
( + txt:STRING_CONSTANT;
- string_tmp.copy n;
+ string_tmp.copy n;
(PARSER.short_dico.fast_has (ALIAS_STR.short_type_file)).if {
txt := PARSER.short_dico.fast_at (ALIAS_STR.short_type_file).first;
string_tmp.append txt;
@@ -218,11 +218,11 @@ Section Private
};
ALIAS_STR.get string_tmp
);
-
+
- save_file n:STRING_CONSTANT with buf:STRING <-
( + file:FILE;
+ entry:ENTRY;
-
+
(is_short_recursive).if {
(output_name != NULL).if {
string_tmp.copy output_name;
@@ -256,13 +256,13 @@ Section Private
- build_with_path_file <-
( + tok:STRING_CONSTANT;
- + tok_lst:LINKED_LIST(STRING_CONSTANT);
+ + tok_lst:LINKED_LIST(STRING_CONSTANT);
+ idx:INTEGER;
-
- (path_file.lower).to (path_file.upper) do { i:INTEGER;
+
+ (path_file.lower).to (path_file.upper) do { i:INTEGER;
string_tmp.copy (path_file.item i);
idx := last_index_str (string_tmp,'/');
- (idx >= string_tmp.lower).if {
+ (idx >= string_tmp.lower).if {
string_tmp.remove_first idx;
};
string_tmp.remove_last 3;
@@ -280,11 +280,11 @@ Section Private
};
};
} else {
- current_list.append tok;
+ current_list.append tok;
current_list.add_last '\n';
file_list.append tok;
file_list.add_last '\n';
- };
+ };
// Creation prototype file.
(PROTOTYPE.prototype_dico.fast_has tok).if {
"Error: Double definition prototype:\n".print;
@@ -296,15 +296,15 @@ Section Private
//
PARSER.go_on proto_input;
(is_shorter).if {
- save_file (add_ext tok) with output_code;
+ save_file (add_ext tok) with output_code;
};
(
- (i = path_file.upper) ||
- {path_file.item (i+1).first_difference_index (path_file.item i) < idx} ||
+ (i = path_file.upper) ||
+ {path_file.item (i+1).first_difference_index (path_file.item i) < idx} ||
{last_index_str (path_file.item (i+1),'/') != idx}
).if {
// Detect new directory.
- current_list.is_empty.if_false {
+ current_list.is_empty.if_false {
(PARSER.short_dico.fast_has (ALIAS_STR.short_file_list_begin)).if {
tok := PARSER.short_dico.fast_at (ALIAS_STR.short_file_list_begin).first;
current_list.prepend tok;
@@ -317,9 +317,9 @@ Section Private
string_tmp.remove_last (string_tmp.upper-idx+1);
string_tmp.remove_first path_begin;
string_tmp.is_empty.if_false {
- string_tmp.replace_all '/' with '-';
- tok := ALIAS_STR.get string_tmp;
-
+ string_tmp.replace_all '/' with '-';
+ tok := ALIAS_STR.get string_tmp;
+
(PARSER.short_dico.fast_has (ALIAS_STR.short_directory_list_item)).if {
tok_lst := PARSER.short_dico.fast_at (ALIAS_STR.short_directory_list_item);
(tok_lst.lower).to (tok_lst.upper) do { j:INTEGER;
@@ -330,27 +330,27 @@ Section Private
};
};
} else {
- directory_list.append tok;
+ directory_list.append tok;
directory_list.add_last '\n';
};
-
+
save_file (add_ext tok) with current_list;
current_list.clear;
};
};
};
- };
+ };
);
-
+
- check_in entry:ENTRY begin n:INTEGER <-
- ( + name:STRING_CONSTANT;
- + dir:DIRECTORY;
+ ( + name:STRING_CONSTANT;
+ + dir:DIRECTORY;
(! entry.open).if {
"Warning: directory `".print;
entry.path.print;
"\' not open.\n".print;
- } else {
+ } else {
dir ?= entry;
// Directory
(dir.lower).to (dir.upper) do { i:INTEGER;
@@ -363,46 +363,46 @@ Section Private
(! dir.item i.is_directory).if {
name := dir.item i.name;
(name.has_suffix ".li").if {
- path_file.add_last (dir.item i.path);
+ path_file.add_last (dir.item i.path);
};
}; // Lisaac file `.li'
- };
+ };
};
);
-
-Section Public
-
+
+Section Public
+
//
// Creation.
//
- main <-
- ( + txt:STRING_CONSTANT;
+ ( + txt:STRING_CONSTANT;
+ p:PROTOTYPE;
-
+
ALIAS_STR.make;
-
+
//
read_options;
-
+
// SELF, NULL, VOID, CONTEXT
- TYPE_NULL.make_null;
+ TYPE_NULL.make_null;
TYPE_VOID.make_void;
TYPE_CONTEXT.make_context;
TYPE_ID.make_type_id; // Pas utile !
-
+
(is_short_recursive).if {
+ dir:DIRECTORY;
+ ent:ENTRY;
-
+
directory_list := STRING.create 100;
file_list := STRING.create 100;
current_list := STRING.create 100;
-
+
(is_lip).if {
LIP_CODE.call_front_end;
LIP_CODE.init_path_file TRUE;
- } else {
+ } else {
ent := FILE_SYSTEM.get_entry input_name;
((ent = NULL) || {! ent.is_directory}).if {
"Error: directory `".print;
@@ -441,7 +441,7 @@ Section Public
directory_list.append txt;
};
save_file (add_ext "directory_list") with directory_list;
-
+
// file_list file.
(PARSER.short_dico.fast_has (ALIAS_STR.short_file_list_begin)).if {
txt := PARSER.short_dico.fast_at (ALIAS_STR.short_file_list_begin).first;
@@ -451,24 +451,24 @@ Section Public
txt := PARSER.short_dico.fast_at (ALIAS_STR.short_file_list_end).first;
file_list.append txt;
};
- save_file (add_ext "file_list") with file_list;
+ save_file (add_ext "file_list") with file_list;
} else {
- // Input.
+ // Input.
(input_name.has_suffix ".li").if_false {
string_tmp.copy input_name;
string_tmp.append ".li";
input_name := ALIAS_STR.get string_tmp;
};
-
- proto_input := PROTOTYPE.create input_name
+
+ proto_input := PROTOTYPE.create input_name
name (extract_proto_name input_name)
generic_count 0;
PARSER.go_on proto_input;
-
+
(output_name = NULL).if {
output_name := add_ext (proto_input.name);
- };
- save_file output_name with output_code;
+ };
+ save_file output_name with output_code;
};
(is_shorter2).if {
(PROTOTYPE.prototype_list.lower).to (PROTOTYPE.prototype_list.upper) do { j:INTEGER;
@@ -477,7 +477,7 @@ Section Public
put "" to output_code like (ALIAS_STR.short_begin);
p.shorter_out output_code;
put "" to output_code like (ALIAS_STR.short_end);
- save_file (add_ext (p.name)) with output_code;
+ save_file (add_ext (p.name)) with output_code;
};
};
);
diff --git a/src/shorter_any/any_option.li b/src/shorter_any/any_option.li
index ed17ed4..7f450d9 100644
--- a/src/shorter_any/any_option.li
+++ b/src/shorter_any/any_option.li
@@ -19,36 +19,36 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ANY_OPTION;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
-
+
Section Inherit
-
+
- parent_object:OBJECT := OBJECT;
-
+
Section Public
-
+
- is_shorter2:BOOLEAN;
-
+
- is_shorter :BOOLEAN;
-
+
- is_short_code:BOOLEAN;
- is_short_private:BOOLEAN;
- is_short_recursive:BOOLEAN;
-
+
- put tok:ABSTRACT_STRING to buf:STRING like key:STRING_CONSTANT <-
( + lst:LINKED_LIST(STRING_CONSTANT);
-
+
(key != NULL).if {
lst := PARSER.short_dico.fast_reference_at key;
(lst != NULL).if {
(lst.lower).to (lst.upper) do { j:INTEGER;
- (lst.item j = NULL).if {
+ (lst.item j = NULL).if {
buf.append tok;
} else {
buf.append (lst.item j);
diff --git a/src/tools/couple.li b/src/tools/couple.li
index a5a4db0..c4a1d4c 100644
--- a/src/tools/couple.li
+++ b/src/tools/couple.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COUPLE(E,F);
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Couple object";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Public
-
+
+ first :E;
+ second:F;
-
+
- create elt1:E and elt2:F :SELF <-
( + result:SELF;
-
+
result := clone;
result.make elt1 and elt2;
result
);
-
+
- make elt1:E and elt2:F <-
(
first := elt1;
second := elt2;
- );
+ );
diff --git a/src/tools/coupled.li b/src/tools/coupled.li
index 5eefb49..095ad1c 100644
--- a/src/tools/coupled.li
+++ b/src/tools/coupled.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := COUPLED(E);
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Couple object";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Public
-
+
+ first :E;
+ second:E;
-
+
- create elt1:E and elt2:E :SELF <-
( + result:SELF;
-
+
result := clone;
result.make elt1 and elt2;
result
);
-
+
- make elt1:E and elt2:E <-
(
first := elt1;
second := elt2;
- );
+ );
diff --git a/src/tools/position.li b/src/tools/position.li
index ff9bb07..42a2240 100644
--- a/src/tools/position.li
+++ b/src/tools/position.li
@@ -19,35 +19,35 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := Expanded POSITION;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Coding position : \
\ 9 bits : Index prototype [1..511]. \
\ 8 bits : Column [0..255]. \
\ 15 bits : Line [1..32767].";
-
+
- type := `unsigned long`;
- default := ( CONVERT(INTEGER,POSITION).on 0 );
-
-Section Insert
-
+
+Section Insert
+
- parent_any:ANY := ANY;
-
+
Section Public
-
+
- object_size:INTEGER <- POINTER.object_size;
-
+
- code:UINTEGER_32 <- CONVERT(POSITION,UINTEGER_32).on Self;
-
+
//
// Creation.
//
-
+
- create proto:PROTOTYPE line l:INTEGER column c:INTEGER :POSITION <-
( + cod:UINTEGER_32;
? {l .in_range 0 to 131071};
@@ -56,7 +56,7 @@ Section Public
cod := proto.index.to_uinteger_32 | (c << 9) | (l << 17);
CONVERT(UINTEGER_32,POSITION).on cod
);
-
+
//
// Localization.
//
@@ -64,13 +64,13 @@ Section Public
- prototype:PROTOTYPE <- PROTOTYPE.prototype_list.item (code.to_integer & 01FFh);
- line:UINTEGER_32 <- code >> 17;
-
+
- column:UINTEGER_32 <- (code >> 9) & 0FFh;
//
// Information Generation.
//
-
+
- nb_warning:INTEGER;
- send_error <-
@@ -79,7 +79,7 @@ Section Public
is_verbose.if {
msg_err.print;
};
- (type_error = warning).if {
+ (type_error = warning).if {
nb_warning := nb_warning + 1;
} else {
die_with_code exit_failure_code;
@@ -102,20 +102,20 @@ Section Public
};
msg_err.append txt;
);
-
+
- put_position <-
( + pos:INTEGER;
+ c,cols:UINTEGER_32;
+ src:STRING;
+ char:CHARACTER;
? {code != 0};
-
+
msg_err.append "\nLine ";
- line.append_in msg_err;
+ line.append_in msg_err;
msg_err.append " column ";
column.append_in msg_err;
msg_err.append " in ";
- msg_err.append (prototype.name);
+ msg_err.append (prototype.name);
msg_err.add_last '(';
prototype.append_filename msg_err;
msg_err.append "):\n";
@@ -131,7 +131,7 @@ Section Public
// copy line :
string_tmp.clear;
cols := column;
- {(pos > src.upper) ||
+ {(pos > src.upper) ||
{src.item pos='\n'}}.until_do {
char := src.item pos;
msg_err.add_last char;
@@ -149,7 +149,7 @@ Section Public
msg_err.append string_tmp;
msg_err.append "^\n";
);
-
+
- extract_line:STRING <-
( + pos:INTEGER;
+ src:STRING;
@@ -165,32 +165,32 @@ Section Public
pos := pos + 1;
};
// copy line :
- string_tmp.clear;
+ string_tmp.clear;
{
- (pos > src.upper) ||
+ (pos > src.upper) ||
{src.item pos='\n'}
}.until_do {
char := src.item pos;
(char)
.when '\\' then { string_tmp.add_last '\\'; }
.when '\"' then { string_tmp.add_last '\\'; };
- string_tmp.add_last char;
+ string_tmp.add_last char;
pos := pos + 1;
- };
+ };
(string_tmp.last.code = 0Dh).if {
string_tmp.remove_last 1;
};
STRING.create_from_string string_tmp
);
-
-Section Private
-
+
+Section Private
+
//
// Service manager
//
-
+
- type_error:INTEGER;
-
+
- msg_err:STRING := STRING.create 256;
diff --git a/src/tools/slim_array.li b/src/tools/slim_array.li
index fe97746..086c5b1 100644
--- a/src/tools/slim_array.li
+++ b/src/tools/slim_array.li
@@ -19,7 +19,7 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := SLIM_ARRAY(E); // BSBS: A mettre en Expanded.
- copyright := "2003-2008 Sonntag Benoit";
@@ -30,15 +30,15 @@ Section Header
Section Insert
- parent_object:OBJECT := OBJECT;
-
+
Section Private
-
+
+ list:FAST_ARRAY(E);
-
+
Section Public
-
+
+ first:E;
-
+
- last:E <-
( + result:E;
(list != NULL).if {
@@ -48,10 +48,10 @@ Section Public
};
result
);
-
+
- lower:INTEGER <- 0;
-
- - upper:INTEGER <-
+
+ - upper:INTEGER <-
( + result:INTEGER;
(first = NULL).if {
result := -1;
@@ -60,14 +60,14 @@ Section Public
};
result
);
-
+
- count:INTEGER <- upper + 1;
-
+
- is_empty:BOOLEAN <- first = NULL;
-
+
- item i:INTEGER :E <-
( + result:E;
-
+
(i = 0).if {
result := first;
} else {
@@ -75,7 +75,7 @@ Section Public
};
result
);
-
+
- put e:E to i:INTEGER <-
(
(i = 0).if {
@@ -83,8 +83,8 @@ Section Public
} else {
list.put e to (i-1);
};
- );
-
+ );
+
- add_last e:E <-
(
(first = NULL).if {
@@ -96,7 +96,7 @@ Section Public
list.add_last e;
};
);
-
+
- make_with_capacity n:INTEGER <-
(
first := NULL;
@@ -104,4 +104,4 @@ Section Public
list := FAST_ARRAY(E).create_with_capacity (n-1);
};
);
-
+
diff --git a/src/tools/table.li b/src/tools/table.li
index aad188b..a9325a3 100644
--- a/src/tools/table.li
+++ b/src/tools/table.li
@@ -19,53 +19,53 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
- name := TABLE;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Display array manager.";
-
-Section Inherit
-
+
+Section Inherit
+
- parent_object:OBJECT := OBJECT;
-
+
Section Private
-
+
- table:FAST_ARRAY2(ABSTRACT_STRING) := FAST_ARRAY2(ABSTRACT_STRING).create (10,10);
-
+
- size:FAST_ARRAY(INTEGER) := FAST_ARRAY(INTEGER).create_with_capacity 10;
-
+
- line:INTEGER;
- column:INTEGER;
-
+
Section Public
-
+
- new_table (l,c:INTEGER) <-
(
table.make (l,c);
- line := column := 0;
+ line := column := 0;
);
-
+
- add n:ABSTRACT_STRING <-
(
? {n != NULL};
-
+
table.put n to (line,column);
(column = table.upper2).if {
column := 0;
line := line + 1;
} else {
column := column + 1;
- };
+ };
);
-
+
- append_in buffer:STRING <-
( + siz:INTEGER;
+ append_line,append_bar:BLOCK;
-
+
// Size column.
size.make (table.count2);
0.to (table.upper1) do { l:INTEGER;
@@ -76,15 +76,15 @@ Section Public
};
};
};
-
+
// Sub-code for one line.
- append_line :=
+ append_line :=
{ l:INTEGER;
+ n:ABSTRACT_STRING;
buffer.append "// ";
0.to (table.upper2) do { c:INTEGER;
n := table.item (l,c);
- buffer.append "| ";
+ buffer.append "| ";
buffer.append n;
buffer.extend_multiple ' ' by (size.item c - n.count + 1);
};
diff --git a/src/tools/types_tmp.li b/src/tools/types_tmp.li
index 4c019c1..9d1230f 100644
--- a/src/tools/types_tmp.li
+++ b/src/tools/types_tmp.li
@@ -168,8 +168,8 @@ Section Public
{(idx1 <= upper) && {item idx1.index < t2idx}}.while_do {
idx1 := idx1 + 1;
};
- ((idx1 > upper) || {item idx1 != t2}).if {
- add t2 to idx1;
+ ((idx1 > upper) || {item idx1 != t2}).if {
+ add t2 to idx1;
};
idx1 := idx1 + 1;
idx2 := idx2 + 1;
diff --git a/src/type/prototype.li b/src/type/prototype.li
index b321348..da0c7f2 100644
--- a/src/type/prototype.li
+++ b/src/type/prototype.li
@@ -127,9 +127,9 @@ Section Public
};
cur := cur.next;
};
- };
+ };
);
-
+
//
// Mapping / Late binding / Expanded
//
@@ -379,7 +379,7 @@ Section Public
PROFIL_LIST.execute_pass;
(SWITCH.switch_new_pass).if {
- new_execute_pass;
+ new_execute_pass;
};
(modify_count != 0).if {
pass_recur := TRUE;
@@ -400,7 +400,7 @@ Section Public
(is_optimization).if {
is_optimization_type_set := TRUE;
};
- (pass_recur).if_false {
+ (pass_recur).if_false {
exec.value;
};
}.do_while {pass_recur};
@@ -510,13 +510,13 @@ Section PROTOTYPE
s := first_slot;
{
- ((s.id_section.is_public) && {s.name = ALIAS_STR.slot_main}).if {
+ ((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.");
};
(s.argument_count != 1).if {
semantic_error (s.position,"Unix mode: Not argument list.");
- };
+ };
result := type_input.get_slot (s.name);
};
s := s.next;
diff --git a/src/type/type.li b/src/type/type.li
index 9f6f453..59bd8f3 100644
--- a/src/type/type.li
+++ b/src/type/type.li
@@ -128,9 +128,9 @@ Section Public
(styl = NULL).if {
result := base.default;
} else {
- (styl = ALIAS_STR.keyword_expanded).if {
- result := base.default + TYPE_FULL.expanded_bit;
- } else {
+ (styl = ALIAS_STR.keyword_expanded).if {
+ result := base.default + TYPE_FULL.expanded_bit;
+ } else {
result := base.default + TYPE_FULL.strict_bit;
};
};
@@ -155,7 +155,7 @@ Section Public
{
(j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
- {result = NULL}
+ {result = NULL}
}.while_do {
ts ?= slot_run.item j.result_type;
typ := ts.to_run_for Self.raw;
@@ -189,7 +189,7 @@ Section Public
{
(j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
- {result = NULL}
+ {result = NULL}
}.while_do {
ts ?= slot_run.item j.result_type;
typ := ts.to_run_for Self.raw;
@@ -240,7 +240,7 @@ Section Public
{
(j <= slot_run.upper) &&
{slot_run.item j.id_section.is_inherit_or_insert} &&
- {result = NULL}
+ {result = NULL}
}.while_do {
it ?= slot_run.item j.result_type;
result := it.to_run_for Self.get_slot n;
@@ -270,10 +270,10 @@ Section Public
};
*/
itm_slot := prototype.slot_list.fast_reference_at n;
- (itm_slot != NULL).if {
+ (itm_slot != NULL).if {
verify_itm_slot_parent itm_slot;
result := SLOT.create itm_slot type Self;
- slot_run.add_last result;
+ slot_run.add_last result;
};
};
result
@@ -335,11 +335,11 @@ Section Private
j := lst.lower;
{(j <= lst.upper) && {lst.item j.to_run_for profil_slot != t}}.while_do {
j := j + 1;
- };
+ };
(j <= lst.upper).if {
result := TRUE;
last_cast_name.copy msg;
- lst.item j.append_cast_name_in last_cast_name;
+ lst.item j.append_cast_name_in last_cast_name;
};
};
result
@@ -524,7 +524,7 @@ Section Public
(s.type.raw.is_block) ||
{is_far_expanded (s.type)}
}
- ).if {
+ ).if {
s.type.raw.genere_struct;
};
};
@@ -538,7 +538,7 @@ Section Public
};
// Sort slot.
(slot_run.lower).to (slot_run.upper) do { j:INTEGER;
- slot := slot_run.item j;
+ slot := slot_run.item j;
(slot.style = '+').if {
// In struct.
(slot.lower_style = 0).if {
@@ -577,7 +577,7 @@ Section Public
// BSBS: A tester sont utilité !
(! tab.is_empty).if {
semantic_error (tab.first.position,"Slot is not possible with a type C");
- };
+ };
};
(is_java).if_false {
@@ -590,12 +590,12 @@ Section Public
output_decl.add_last '\n';
} else {
genere_typedef_type_c;
- (is_late_binding).if {
+ (is_late_binding).if {
semantic_error (tab.first.position,"Late binding is not possible with a type C");
};
};
};
- } else {
+ } else {
output_decl.append "/* ";
output_decl.append intern_name;
output_decl.append " */\n";
@@ -609,24 +609,24 @@ Section Public
output_decl.append "__ ";
};
string_tmp.clear;
- (is_late_binding).if {
- id_counter_with_type.append_in output_decl;
+ (is_late_binding).if {
+ id_counter_with_type.append_in output_decl;
id_counter_with_type := id_counter_with_type + 1;
(prototype.style != '-').if {
string_tmp.append " unsigned int __id;\n";
};
- (prototype.is_mapping).if {
- semantic_error (prototype.position,
+ (prototype.is_mapping).if {
+ semantic_error (prototype.position,
"Late binding is not possible with `mapping' object.");
};
- } else {
- id_counter_without_type.append_in output_decl;
- id_counter_without_type := id_counter_without_type + 1;
+ } else {
+ id_counter_without_type.append_in output_decl;
+ id_counter_without_type := id_counter_without_type + 1;
};
(is_java).if {
output_decl.add_last ';';
};
- output_decl.add_last '\n';
+ output_decl.add_last '\n';
(prototype.style = '-').if {
string_tmp.append " lith_object thread;\n";
(param_count != 0).if {
@@ -640,21 +640,21 @@ Section Public
4.downto 0 do { j:INTEGER;
tab := slot_size.item j;
(tab.lower).to (tab.upper) do { i:INTEGER;
- slot_data := tab.item i;
+ slot_data := tab.item i;
((prototype.is_mapping) && {slot_data.type.is_expanded_c}).if {
string_tmp.append " volatile ";
} else {
- string_tmp.append " ";
+ string_tmp.append " ";
};
slot_data.genere string_tmp;
};
tab.clear;
};
-
+
(Self = type_block).if {
string_tmp.append " void *self;\n";
};
-
+
(string_tmp.is_empty).if {
string_tmp.append " void *Nothing;\n";
};
@@ -725,7 +725,7 @@ Section Public
} else {
output_decl.append "};\n";
};
- };
+ };
// Prototype declaration.
(is_java).if {
output_glob.append "private static __";
@@ -752,12 +752,12 @@ Section Public
output_glob.append intern_name;
output_glob.append "__}";
};
- output_glob.append ";\n";
+ output_glob.append ";\n";
output_glob.append "#define ";
output_glob.append intern_name;
output_glob.append "__ (&";
output_glob.append intern_name;
- output_glob.append "_)\n\n";
+ output_glob.append "_)\n\n";
};
};
};
@@ -779,7 +779,7 @@ Section Public
output_decl.append "typedef ";
output_decl.append type_c;
output_decl.append " __";
- output_decl.append intern_name;
+ output_decl.append intern_name;
output_decl.add_last ';';
output_decl.add_last '\n';
};
@@ -805,7 +805,7 @@ Section Public
output_decl.append (t.intern_name);
output_decl.append "_struct";
output_decl.append " __";
- output_decl.append intern_name;
+ output_decl.append intern_name;
output_decl.add_last ';';
(alias_slot != NULL).if {
output_decl.append " /* ALIAS with ";
@@ -988,7 +988,7 @@ Section Public
}.while_do {
(slot_run.item idx.id_section.is_inherit).if {
ts ?= slot_run.item idx.result_type;
- type_parent := ts.to_run_for Self.raw;
+ type_parent := ts.to_run_for Self.raw;
result := type_parent.is_sub_type_with_name n;
};
idx := idx + 1;
@@ -1260,7 +1260,7 @@ Section TYPE,PROTOTYPE
{slot_run.item idx.id_section.is_inherit_or_insert}
}.while_do {
ts ?= slot_run.item idx.result_type;
- type_parent := ts.to_run_for Self.raw;
+ type_parent := ts.to_run_for Self.raw;
other := type_parent.prototype.slot_list.fast_reference_at (ref.name);
(other != NULL).if {
ref.is_equal_profil other;
@@ -1283,7 +1283,7 @@ Section TYPE,PROTOTYPE
}.while_do {
s := slot_run.item idx;
ts ?= s.result_type;
- type_parent := ts.to_run_for Self.raw;
+ type_parent := ts.to_run_for Self.raw;
(type_parent = ref).if {
semantic_error (s.position,"Static cyclic inheritance.");
};
diff --git a/src/type/type_context.li b/src/type/type_context.li
index e09bcc1..67ce839 100644
--- a/src/type/type_context.li
+++ b/src/type/type_context.li
@@ -19,34 +19,34 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TYPE_CONTEXT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Type Context for debug mode";
-
+
Section Inherit
-
+
+ parent_type:Expanded TYPE;
-
+
Section Public
-
+
- name:STRING_CONSTANT <- ALIAS_STR.prototype_context;
-
+
- intern_name:STRING_CONSTANT <- name;
-
+
- type_c:STRING_CONSTANT <- "_____CONTEXT";
-
+
//
// Creation.
//
-
+
- make_context <-
- (
- dico_type.fast_put Self to name;
+ (
+ dico_type.fast_put Self to name;
//slot_run := FAST_ARRAY(SLOT).create_with_capacity 1; // BSBS: Plus utile !
default := TYPE_FULL.create Self with (TYPE_FULL.expanded_bit);
);
@@ -55,10 +55,10 @@ Section Public
(
// Nothing.
);
-
+
- genere_struct <-
- (
- output_decl.append
+ (
+ output_decl.append
"/* ___CONTEXT */\n\
\typedef struct ___CONTEXT_struct _____CONTEXT; \n\
\struct ___CONTEXT_struct {\n\
@@ -67,4 +67,3 @@ Section Public
\};\n\
\_____CONTEXT *top_context; \n\n";
);
-
\ No newline at end of file
diff --git a/src/type/type_full.li b/src/type/type_full.li
index e6eb18a..8a64f61 100644
--- a/src/type/type_full.li
+++ b/src/type/type_full.li
@@ -243,7 +243,7 @@ Section Public
result :=
((other.is_strict) && {raw ~= other.raw }) ||
{(raw = type_boolean) && {other.is_sub_type Self}} ||
- {(raw = type_pointer) && {other.raw = TYPE_NULL }};
+ {(raw = type_pointer) && {other.raw = TYPE_NULL }};
} else {
// A: Reference.
result :=
@@ -254,7 +254,7 @@ Section Public
(tb != NULL)
}
) && {other.is_sub_type Self};
- };
+ };
};
result
);
@@ -275,7 +275,7 @@ Section Public
( + result:EXPR;
((prototype != NULL) && {prototype.default_value != NULL}).if {
- // Prototype User definition.
+ // Prototype User definition.
(recursivity_test).if {
crash;
POSITION.put_error semantic text
diff --git a/src/type/type_generic.li b/src/type/type_generic.li
index 2aa2968..5469c3e 100644
--- a/src/type/type_generic.li
+++ b/src/type/type_generic.li
@@ -103,7 +103,7 @@ Section Private
(j <= lst.upper).if {
result := TRUE;
last_cast_name.copy msg;
- lstp.item j.append_cast_name_in last_cast_name;
+ lstp.item j.append_cast_name_in last_cast_name;
};
};
result
@@ -149,9 +149,9 @@ Section Public
(styl = NULL).if {
result := base.default;
} else {
- (styl = ALIAS_STR.keyword_expanded).if {
- result := base.default + TYPE_FULL.expanded_bit;
- } else {
+ (styl = ALIAS_STR.keyword_expanded).if {
+ result := base.default + TYPE_FULL.expanded_bit;
+ } else {
result := base.default + TYPE_FULL.strict_bit;
};
};
@@ -160,7 +160,7 @@ Section Public
//
// Life Type for collection (see PUT_TO and ITEM)
- //
+ //
+ native_array_variable:VARIABLE;
@@ -200,9 +200,9 @@ Section Public
);
Section Public
-
+
- paper_list:FAST_ARRAY(TYPE_GENERIC) := FAST_ARRAY(TYPE_GENERIC).create_with_capacity 8192;
-
+
- make itm_typ:ITM_TYPE_SIMPLE <-
(
crash_with_message "TYPE_GENERIC.make";
@@ -211,8 +211,8 @@ Section Public
- make itm_typ:ITM_TYPE_SIMPLE with proto:PROTOTYPE
generic gen:FAST_ARRAY(TYPE_FULL) key k:STRING_CONSTANT <-
( + mask_bit:UINTEGER_8;
-
-
+
+
index := index_count;
index_count := index_count + 1;
//
@@ -238,7 +238,7 @@ Section Public
native_array_variable := VARIABLE.create (proto.position) name intern_name type (gen.first);
paper_list.add_last Self;
};
-
+
//
prototype := proto;
itm_type := itm_typ;
diff --git a/src/type/type_id.li b/src/type/type_id.li
index ef7835b..11ebede 100644
--- a/src/type/type_id.li
+++ b/src/type/type_id.li
@@ -19,86 +19,86 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TYPE_ID;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Virtual type style slot segregation";
-
+
Section Inherit
-
+
+ parent_type:Expanded TYPE;
-
-Section Private
-
+
+Section Private
+
- list_id:FAST_ARRAY(TYPE_ID);
-
+
- create i:INTEGER :SELF <-
( + result:SELF;
-
+
result := clone;
result.make i;
result
);
-
+
- make i:INTEGER <-
(
index := i;
default := TYPE_FULL.create Self with 0;
);
-
-Section Public
-
+
+Section Public
+
- name:STRING_CONSTANT <- ALIAS_STR.prototype_type_id;
-
+
- intern_name:STRING_CONSTANT <- name;
-
+
- get_index idx:INTEGER :TYPE_ID <-
( + result:TYPE_ID;
-
+
(idx > list_id.upper).if {
result := TYPE_ID.create idx;
list_id.add_last result;
? {list_id.upper = idx};
} else {
result := list_id.item idx;
- };
+ };
result
);
- - make_type_id <-
- (
+ - make_type_id <-
+ (
list_id := FAST_ARRAY(TYPE_ID).create_with_capacity 3;
list_id.add_last (create 0);
list_id.add_last (create 1);
);
-
+
- add_genere_list; // Nothing.
-
+
- genere_struct; // Nothing.
- - is_sub_type other:TYPE :BOOLEAN <-
- (
+ - is_sub_type other:TYPE :BOOLEAN <-
+ (
other.name = name
);
-
+
//
// Declaration generation.
//
-
+
- put_generic_declaration buffer:STRING <- buffer.append "int";
-
+
- put_reference_star_declaration buffer:STRING; // Nothing.
-
+
//
// Code source generation.
//
-
+
- put_id buffer:STRING <- index.append_in buffer;
-
+
- put_access_id e:EXPR in buffer:STRING <- e.genere buffer;
-
+
- put_value buffer:STRING <- index.append_in buffer;
\ No newline at end of file
diff --git a/src/type/type_null.li b/src/type/type_null.li
index 4a511ab..f290378 100644
--- a/src/type/type_null.li
+++ b/src/type/type_null.li
@@ -19,106 +19,105 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TYPE_NULL;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Special type NULL";
-
+
Section Inherit
-
+
+ parent_type:Expanded TYPE;
-
+
Section Public
-
+
- name:STRING_CONSTANT <- ALIAS_STR.variable_null;
-
+
- intern_name:STRING_CONSTANT <- name;
-
+
//
// Creation.
//
- make_null <-
- (
+ (
index := index_count;
index_count := index_count + 1;
- dico_type.fast_put Self to name;
+ dico_type.fast_put Self to name;
slot_run := FAST_ARRAY(SLOT).create_with_capacity 1; // BSBS: Plus utile !
default := TYPE_FULL.create Self with 0;
);
-
- - get_local_slot n:STRING_CONSTANT :SLOT <- NULL;
-
+
+ - get_local_slot n:STRING_CONSTANT :SLOT <- NULL;
+
- get_path_slot n:STRING_CONSTANT :SLOT <- NULL;
-
+
//
// Error.
//
-
+
//- bug:INTEGER;
-
+
- product_error p:POSITION in lst:LIST with ctext:LOCAL <-
- (
- (debug_level_option != 0).if {
+ (
+ (debug_level_option != 0).if {
lst.add_last (
PUSH.create p context ctext first FALSE
- );
- };
- lst.add_last CALL_NULL;
+ );
+ };
+ lst.add_last CALL_NULL;
);
-
+
Section Public
-
+
//
// Import / Export
//
-
+
- is_export_to t:TYPE_FULL :BOOLEAN <- FALSE;
- is_import_to t:TYPE_FULL :BOOLEAN <- FALSE;
-
+
//
//
//
-
- - is_sub_type other:TYPE :BOOLEAN <- TRUE;
-
+
+ - is_sub_type other:TYPE :BOOLEAN <- TRUE;
+
- genere_typedef <-
(
);
-
+
- genere_struct <-
(
(is_java).if_false {
- output_decl.append
+ output_decl.append
"/* NULL */\n\
\#ifndef NULL\n\
\#define NULL ((void *)0)\n\
\#endif\n\n";
};
);
-
+
//
// Code source generation.
//
-
- - put_id buffer:STRING <-
+
+ - put_id buffer:STRING <-
(
put_value buffer;
);
-
- - put_access_id e:EXPR in buffer:STRING <- e.genere buffer;
-
- - put_value buffer:STRING <-
- (
+
+ - put_access_id e:EXPR in buffer:STRING <- e.genere buffer;
+
+ - put_value buffer:STRING <-
+ (
(is_java).if {
buffer.append "null";
} else {
buffer.append name;
};
);
-
\ No newline at end of file
diff --git a/src/type/type_void.li b/src/type/type_void.li
index 556a828..1202e3f 100644
--- a/src/type/type_void.li
+++ b/src/type/type_void.li
@@ -19,43 +19,43 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := TYPE_VOID;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Special virtual Void type";
-
+
Section Inherit
-
+
+ parent_type:Expanded TYPE;
-
+
Section Public
-
+
- name:STRING_CONSTANT <- ALIAS_STR.variable_void;
-
- - intern_name:STRING_CONSTANT <- name;
-
+
+ - intern_name:STRING_CONSTANT <- name;
+
//
// Creation.
//
-
+
- make_void <-
- (
- dico_type.fast_put Self to name;
+ (
+ dico_type.fast_put Self to name;
default := TYPE_FULL.create Self with 0;
);
-
+
//
// Import / Export
//
-
+
- is_export_to t:TYPE_FULL :BOOLEAN <- FALSE;
- is_import_to t:TYPE_FULL :BOOLEAN <- FALSE;
-
+
//
// Genere.
//
@@ -64,13 +64,13 @@ Section Public
(
// Nothing.
);
-
+
- genere_struct <-
(
// Nothing.
);
-
+
Section Public
-
- - is_sub_type other:TYPE :BOOLEAN <- FALSE;
+
+ - is_sub_type other:TYPE :BOOLEAN <- FALSE;
diff --git a/src/variable/argument.li b/src/variable/argument.li
index e054ab3..08af734 100644
--- a/src/variable/argument.li
+++ b/src/variable/argument.li
@@ -19,64 +19,63 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := ARGUMENT;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Argument runnable";
-
+
Section Inherit
-
+
+ parent_itm_object:Expanded ITM_OBJECT;
-
+
Section Public
-
+
+ name:STRING_CONSTANT;
-
+
+ type:TYPE_FULL;
-
+
//
// Creation.
//
-
+
- create p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL :SELF <-
( + result:SELF;
-
+
result := clone;
result.make p name n type t;
result
);
-
+
- make p:POSITION name n:STRING_CONSTANT type t:TYPE_FULL <-
(
position := p;
name := n;
type := t;
);
-
+
//
// To profil
//
-
+
- to_local:LOCAL <-
(
LOCAL.create position name name style ' ' type (type.fix)
);
-
+
//
// Display.
//
-
+
- print <-
- (
+ (
string_tmp.clear;
string_tmp.append name;
string_tmp.add_last ':';
type.append_name_in string_tmp;
string_tmp.print;
);
-
-
\ No newline at end of file
+
diff --git a/src/variable/local.li b/src/variable/local.li
index 66657ce..82fc942 100644
--- a/src/variable/local.li
+++ b/src/variable/local.li
@@ -70,7 +70,7 @@ Section Public
(my_alias = NULL).if {
my_alias := my_copy;
my_alias.set_type_set type_set;
- list_alias.add_last Self;
+ list_alias.add_last Self;
};
my_alias
);
@@ -244,14 +244,14 @@ Section Public
} ||
{ // Global propagation.
(g != NULL) && {g.style = '-'} && {
- (
+ (
(g.last_write != NULL) && {g.last_seq_index < last_seq.last_seq_index} &&
{last_seq.last_seq_call_and_loop = seq_call_and_loop} &&
{is_seq_list (g.last_list_current)}
) || {g.require_count = 1}
}
}
- ).if {
+ ).if {
result := val.my_copy;
}.elseif {
// Propagation step by step.
@@ -259,10 +259,10 @@ Section Public
{ensure_count = 1} &&
{list_current.index > list_current.lower} &&
{list_current.item (list_current.index - 1) = last_seq.last_write}
- } then {
+ } then {
unwrite (last_seq.last_write);
last_seq.set_last_write NULL;
- list_current.put NOP to (list_current.index - 1);
+ list_current.put NOP to (list_current.index - 1);
result := val;
};
};
@@ -347,7 +347,7 @@ Section Public
val := type.default_value position;
(ALIAS_STR.is_integer (type.raw.name)).if {
int ?= val;
- (int != NULL).if {
+ (int != NULL).if {
int.cast_type type;
};
} else {
diff --git a/src/variable/local_seq.li b/src/variable/local_seq.li
index 5901e36..2f0cfa1 100644
--- a/src/variable/local_seq.li
+++ b/src/variable/local_seq.li
@@ -19,54 +19,54 @@
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
-
+
+ name := LOCAL_SEQ;
- copyright := "2003-2007 Benoit Sonntag";
-
+
- author := "Sonntag Benoit (bsonntag at loria.fr)";
- comment := "Local slot";
-
+
Section Inherit
-
+
- parent_any:ANY := ANY;
-
+
Section Private
-
+
- list_busy:FAST_ARRAY(LOCAL) := FAST_ARRAY(LOCAL).create_with_capacity 512;
-
+
- list_free:FAST_ARRAY(LOCAL_SEQ) := FAST_ARRAY(LOCAL_SEQ).create_with_capacity 512;
-
+
- clean <-
(
last_write := NULL;
);
-
-Section Public
-
+
+Section Public
+
+ last_write:WRITE;
+ last_seq_index:UINTEGER_32;
+ last_seq_or_and:UINTEGER_32;
- + last_seq_call_and_loop:UINTEGER_32;
+ + last_seq_call_and_loop:UINTEGER_32;
+ last_seq_call_local_and_loop:UINTEGER_32;
-
+
+ last_list_current:LIST;
+ last_index:INTEGER;
-
+
- set_last_write w:WRITE <-
(
last_write := w;
);
-
+
- set_last_index i:INTEGER <-
(
last_index := i;
);
-
+
- new l:LOCAL <-
( + result:LOCAL_SEQ;
-
+
(list_free.is_empty).if {
result := clone;
} else {
@@ -77,7 +77,7 @@ Section Public
list_busy.add_last l;
l.set_last_seq result;
);
-
+
- set_seq w:WRITE <-
(
// Save context
@@ -85,18 +85,18 @@ Section Public
last_seq_index := seq_index;
last_seq_or_and := seq_or_and;
last_seq_call_and_loop := seq_call_and_loop;
- last_seq_call_local_and_loop:= seq_call_local_and_loop;
+ last_seq_call_local_and_loop:= seq_call_local_and_loop;
//
last_list_current := list_current;
- last_index := list_current.index;
+ last_index := list_current.index;
);
-
+
- clear <-
( + l:LOCAL;
-
+
(list_busy.upper).downto (list_busy.lower) do { j:INTEGER;
l := list_busy.item j;
- list_free.add_last (l.last_seq);
+ list_free.add_last (l.last_seq);
l.set_last_seq NULL;
};
list_busy.clear;
diff --git a/src/variable/section_.li b/src/variable/section_.li
index 7eadb6d..53158f4 100644
--- a/src/variable/section_.li
+++ b/src/variable/section_.li
@@ -108,7 +108,7 @@ Section Public
(type_list.lower).to (type_list.upper - 1) do { j:INTEGER;
type_list.item j.append_in buf;
buf.add_last ',';
- buf.add_last ' ';
+ buf.add_last ' ';
};
type_list.last.append_in buf;
};
@@ -135,7 +135,7 @@ Section Public
j := type_list.lower;
{(j <= type_list.upper) && {! result}}.while_do {
ts ?= type_list.item j;
- result := client.is_sub_type_with_name (ts.name);
+ result := client.is_sub_type_with_name (ts.name);
j := j + 1;
};
};
diff --git a/src/variable/slot.li b/src/variable/slot.li
index cdcb201..5421852 100644
--- a/src/variable/slot.li
+++ b/src/variable/slot.li
@@ -167,7 +167,7 @@ Section Public
tm ?= result_type;
(tm != NULL).if {
slot_data_list := FAST_ARRAY(SLOT_DATA).create_with_capacity (tm.count-1);
- (tm.lower).to (tm.upper-1) do { k:INTEGER;
+ (tm.lower).to (tm.upper-1) do { k:INTEGER;
typ := tm.item k.to_run_for receiver_type;
slot_data_list.add_last (
SLOT_DATA.create common_slot type_full typ
diff --git a/src/variable/slot_code.li b/src/variable/slot_code.li
index 6c11464..2298963 100644
--- a/src/variable/slot_code.li
+++ b/src/variable/slot_code.li
@@ -67,7 +67,7 @@ Section Public
(args = NULL).if {
// For auto-load external section.
- result := PROFIL_SLOT.clone;
+ result := PROFIL_SLOT.clone;
profil.add_last result;
is_new := TRUE;
} else {
@@ -108,12 +108,12 @@ Section Public
};
(result = NULL).if {
- result := PROFIL_SLOT.clone;
+ result := PROFIL_SLOT.clone;
result.set_context_sensitive;
typ_block.profil_list.add_last result;
- is_new := TRUE;
+ is_new := TRUE;
};
- } else {
+ } else {
// Select classic Profil (no block).
(id_section.is_external).if {
result := profil.first;
@@ -125,13 +125,13 @@ Section Public
result := pro;
i := args.lower + 1;
{(i <= args.upper) && {result != NULL}}.while_do {
- loc := pro.argument_list.item i;
+ loc := pro.argument_list.item i;
(
- (loc != NULL) && {loc.require_first != NULL} &&
+ (loc != NULL) && {loc.require_first != NULL} &&
{args.item i.static_type != loc.require_first.value.static_type} &&
{loc.type.raw != type_boolean}
).if {
- result := NULL;
+ result := NULL;
};
i := i + 1;
};
@@ -139,8 +139,8 @@ Section Public
j := j + 1;
};
};
- (result = NULL).if {
- result := PROFIL_SLOT.clone;
+ (result = NULL).if {
+ result := PROFIL_SLOT.clone;
profil.add_last result;
((id_section.is_external) && {profil.count > 1}).if {
semantic_error (position,"Polymorphic External slot is not possible.");
@@ -167,13 +167,13 @@ Section Public
result.make base with val;
result
);
-
+
- count_slot:INTEGER;
-
+
- make base:SLOT with val:ITM_CODE <-
(
count_slot := count_slot + 1;
-
+
parent_slot := base;
value := val;
profil := FAST_ARRAY(PROFIL_SLOT).create_with_capacity 1;
diff --git a/src/variable/slot_data.li b/src/variable/slot_data.li
index 29538d5..91c6674 100644
--- a/src/variable/slot_data.li
+++ b/src/variable/slot_data.li
@@ -149,7 +149,7 @@ Section Public
l := rd_loc.local;
wrt_slot ?= require_first;
rd_loc ?= wrt_slot.receiver;
- (rd_loc.local = l).if {
+ (rd_loc.local = l).if {
my_require_count := 1;
} else {
my_require_count := 0;
@@ -157,7 +157,7 @@ Section Public
(require_list.lower).to (require_list.upper) do { j:INTEGER;
wrt_slot ?= require_list.item j;
rd_loc ?= wrt_slot.receiver;
- (rd_loc.local = l).if {
+ (rd_loc.local = l).if {
my_require_count := my_require_count + 1;
};
};
@@ -172,8 +172,8 @@ Section Public
).if {
// Receiver test.
(rec = NULL).if {
- is_rec_ok := TRUE;
- }.elseif {rec.is_constant} then {
+ is_rec_ok := TRUE;
+ }.elseif {rec.is_constant} then {
wrt_slot ?= last_write;
is_rec_ok := rec ~= wrt_slot.receiver;
} else {
@@ -184,7 +184,7 @@ Section Public
wrt_slot ?= last_write;
rd ?= wrt_slot.receiver;
is_rec_ok := (rd != NULL) && {
- (
+ (
{l = rd.variable} && {is_seq_list last_list_current} && {
(
(l.last_seq != NULL) && {l.last_seq.last_write != NULL} &&
@@ -202,7 +202,7 @@ Section Public
) || {g.require_count = 1}
}
}
- };
+ };
};
};
(is_rec_ok).if {
@@ -210,7 +210,7 @@ Section Public
rd ?= val;
(rd = NULL).if {
l := NULL;
- g := NULL;
+ g := NULL;
} else {
l ?= rd.variable;
g ?= rd.variable;
@@ -219,8 +219,8 @@ Section Public
( // Constant propagation.
val.is_constant
) ||
- { // Local propagation.
- (l != NULL) && {is_seq_list last_list_current} && {
+ { // Local propagation.
+ (l != NULL) && {is_seq_list last_list_current} && {
(
(l.last_seq != NULL) && {l.last_seq.last_write != NULL} &&
{l.last_seq.last_seq_index < last_seq_index} &&
@@ -237,10 +237,10 @@ Section Public
) || {g.require_count = 1}
}
}
- ).if {
+ ).if {
(rec != NULL).if {
rec.remove;
- };
+ };
result := val.my_copy;
}.elseif {
// Propagation step by step.
@@ -248,7 +248,7 @@ Section Public
{ensure_count = 1} &&
{list_current.index > list_current.lower} &&
{list_current.item (list_current.index - 1) = last_write}
- } then {
+ } then {
(rec != NULL).if {
rec.remove;
wrt_slot ?= last_write;
@@ -263,16 +263,16 @@ Section Public
{last_index.in_range (last_list_current.lower) to (last_list_current.upper)} &&
{last_list_current.item last_index = last_write}
} then {
- // Local conversion.
+ // Local conversion.
l := type.get_temporary position;
i := l.write (last_write.position) value val;
last_list_current.put i to last_index;
result := l.read (rec.position);
- //
+ //
rec.remove;
wrt_slot ?= last_write;
wrt_slot.receiver.remove;
- unwrite last_write;
+ unwrite last_write;
};
};
};
@@ -349,8 +349,8 @@ Section Public
(Self = slot_id).if {
val := PROTOTYPE_CST.create position type type;
- } else {
- // Code.
+ } else {
+ // Code.
(value != NULL).if {
rd ?= value;
((rd != NULL) && {rd.arg = NULL}).if {
@@ -362,7 +362,7 @@ Section Public
} else {
val := type.default_value position;
};
- val := val.check_type type with position;
+ val := val.check_type type with position;
};
(style = '+').if {
rec := PROTOTYPE_CST.create position type (receiver_type.default);
@@ -414,7 +414,7 @@ Section Public
(lst.lower).to (lst.upper) do { j:INTEGER;
s := lst.item j;
(s.style = '+').if {
- slot := s.slot_data_intern;
+ slot := s.slot_data_intern;
(slot != NULL).if {
slot.execute;
};
diff --git a/src/variable/variable.li b/src/variable/variable.li
index 28c36f9..dda5c2e 100644
--- a/src/variable/variable.li
+++ b/src/variable/variable.li
@@ -151,7 +151,7 @@ Section Public
};
} else {
((level_type < level_pass) && {! is_static}).if {
- ((is_executing_pass) || {require_first != NULL}).if {
+ ((is_executing_pass) || {require_first != NULL}).if {
level_type := level_pass;
busy_set.fast_add Self;
tmp_type := TYPES_TMP.new;
@@ -168,14 +168,14 @@ Section Private
- sub_get_type t:TYPES_TMP <-
(
- (require_first != NULL).if {
- require_first.get_type t;
+ (require_first != NULL).if {
+ require_first.get_type t;
(require_list != NULL).if {
- (require_list.lower).to (require_list.upper) do { j:INTEGER;
+ (require_list.lower).to (require_list.upper) do { j:INTEGER;
require_list.item j.get_type t;
};
};
- };
+ };
);
Section Public
@@ -228,9 +228,9 @@ Section Public
tmp_type := TYPES_TMP.new;
(type_set != NULL).if {
tmp_type.union type_set;
- };
+ };
wrt.value.get_type tmp_type;
- type_set := tmp_type.update type_set;
+ type_set := tmp_type.update type_set;
};
);
@@ -243,15 +243,15 @@ Section Public
(
write_direct p with r value val
);
-
+
- cnt:INTEGER;
- wrt:WRITE;
-
+
- write_direct p:POSITION with r:EXPR value val:EXPR :WRITE <-
( + e:WRITE;
-
+
e := new_write p with r value val;
- add_write e;
+ add_write e;
e.set_create;
e
);
@@ -268,7 +268,7 @@ Section Public
- unwrite e:WRITE <-
( + idx:INTEGER;
-
+
(e.is_delete).if {
crash;
};
@@ -295,7 +295,7 @@ Section Public
e.debug_display;
intern_name.print; '\n'.print;
"require_first =".print;
- (require_first = NULL).if {
+ (require_first = NULL).if {
"NULL\n".print;
} else {
require_first.debug_display;
@@ -308,13 +308,13 @@ Section Public
(idx > require_list.upper).if {
e.debug_display;
- intern_name.print; '\n'.print;
+ intern_name.print; '\n'.print;
"\n--------\n".print;
require_first.debug_display;
(require_list.lower).to (require_list.upper) do { j:INTEGER;
require_list.item j.debug_display;
};
-
+
//warning_error (position,"ICI");
crash_with_message "******** VARIABLE.unwrite : BUG !!! **********\n";
@@ -325,7 +325,7 @@ Section Public
require_list := NULL;
};
};
-
+
);
//
diff --git a/tests/bootstrap/make.lip b/tests/bootstrap/make.lip
index e02067f..8b61990 100644
--- a/tests/bootstrap/make.lip
+++ b/tests/bootstrap/make.lip
@@ -36,5 +36,5 @@ Section Private
(
exit_true;
);
-
+
--
Lisaac compiler
More information about the Lisaac-commits
mailing list