[SCM] Lisaac compiler branch, master, updated. lisaac-0.12-492-ge17dc68
Benoit Sonntag
sonntag at icps.u-strasbg.fr
Wed Sep 16 13:55:39 UTC 2009
The following commit has been merged in the master branch:
commit 002db8b8f74ad06e40b45470c0115e46dd35cb11
Author: Benoit Sonntag <sonntag at icps.u-strasbg.fr>
Date: Wed Sep 16 15:53:02 2009 +0200
qqs modifs
diff --git a/example/gui/transparent/photo.bmp b/example/gui/transparent/photo.bmp
index 0bdcb8a..24f4a9f 100644
Binary files a/example/gui/transparent/photo.bmp and b/example/gui/transparent/photo.bmp differ
diff --git a/lib/collection/low_level/native_array.li b/lib/collection/low_level/native_array.li
index ee8bc03..13c9946 100644
--- a/lib/collection/low_level/native_array.li
+++ b/lib/collection/low_level/native_array.li
@@ -87,7 +87,7 @@ Section Public
result
)
[ ...
- +? {Result.all_default (nb_elements-1)};
+// +? {Result.all_default (nb_elements-1)};
];
- realloc old_nb_elts:INTEGER with new_nb_elts:INTEGER :NATIVE_ARRAY(V) <-
@@ -142,7 +142,7 @@ Section Public
force_put element to index;
)
[ ...
- +? {element = item index};
+// +? {element = item index};
];
//
diff --git a/lib/format/bmp/bmp_file.li b/lib/format/bmp/bmp_file.li
deleted file mode 100644
index a173dfc..0000000
--- a/lib/format/bmp/bmp_file.li
+++ /dev/null
@@ -1,190 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Lisaac Library //
-// //
-// LSIIT - ULP - CNRS - INRIA - FRANCE //
-// //
-// This program is free software: you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation, either version 3 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program. If not, see <http://www.gnu.org/licenses/>. //
-// //
-// http://isaacproject.u-strasbg.fr/ //
-///////////////////////////////////////////////////////////////////////////////
-Section Header
-
- + name := BMP_FILE;
-
-
- - copyright := "2003-2005 Jérome Boutet, 2003-2007 Benoit Sonntag";
-
- - comment := "Mapping BMP Image File (V < 4.0)";
-
-Section Inherit
-
- + parent_std_file:Expanded STD_FILE;
-
-Section Public
-
- - pos_buffer:INTEGER;
-
- - bmp_buffer:FAST_ARRAY(UINTEGER_8);
-
- //
-
- - header:BMP_HEADER;
-
- - color_map:FAST_ARRAY(Expanded PIXEL_24);
-
- //
-
- - read_header <-
- (
- (bmp_buffer = NULL).if {
- bmp_buffer := FAST_ARRAY(UINTEGER_8).create_with_capacity size;
- }.elseif {bmp_buffer.capacity < size.to_integer} then {
- bmp_buffer.set_capacity (size.to_integer);
- bmp_buffer.clear;
- } else {
- bmp_buffer.clear;
- };
- read bmp_buffer size size;
- header := CONVERT(NATIVE_ARRAY(UINTEGER_8),BMP_HEADER).on (bmp_buffer.storage);
- pos_buffer := BMP_HEADER.object_size;
- );
-
- - init_color_map <-
- ( + code,nb_colors:INTEGER;
- ? {header != NULL};
- //
- // Init Color Table
- //
- header.is_bgr_format.if {
- code := 3;
- } else {
- code := 4;
- };
- nb_colors := header.get_nb_colors;
- (color_map = NULL).if {
- color_map := FAST_ARRAY(PIXEL_24).create 256;
- };
- 0.to (nb_colors-1) do { j:INTEGER;
- color_map.item j
- .make_rgb (
- bmp_buffer.item (pos_buffer + 2),
- bmp_buffer.item (pos_buffer + 1),
- bmp_buffer.item pos_buffer
- );
- pos_buffer := pos_buffer + code;
- };
- );
-
- - buf_item :UINTEGER_8 <-
- ( + result:UINTEGER_8;
- result := bmp_buffer.item pos_buffer;
- pos_buffer := pos_buffer + 1;
- result
- );
-
- // JBJB POUR AFFICHAGE EN MODE TEXTE
- - fill_bitmap b:ABSTRACT_BITMAP <-
- ( + end:BOOLEAN;
- + x,y:INTEGER;
- + line_24:BMP_LINE(PIXEL_24);
- //+ line_ascii:BMP_LINE_ASCII;
- + tmp_pix:PIXEL_24;
- + escape,cmd:UINTEGER_8;
- + align:UINTEGER_32;
- ? {header != NULL};
-
- is_valid_bmp.if {
- ? {(b.width = header.width) && {b.height = header.height}};
-
- //line_ascii := BMP_LINE_ASCII.create (header.width);
- header.is_8bit.if {
- //
- // 8 Bit
- //
- line_24 := BMP_LINE(PIXEL_24).create (header.width);
- init_color_map;
-
- header.is_rle8_compressed.if {
- pos_buffer := header.bitmap_offset.to_integer;
- y := header.height;
- {end}.until_do {
- escape := buf_item;
- ? { x <= header.width};
- ? { y >= 0};
- (escape = 00h).if {
- cmd := buf_item;
- (cmd = 00h).if {
- b.line_h (0,y) until (header.width - 1) image line_24;
- x := 0;
- y := y - 1;
- }.elseif {cmd = 01h} then {
- // End of file
- b.line_h (0,y) until (header.width - 1) image line_24;
- end := TRUE;
- }.elseif {cmd = 02h} then {
- // Move cursor: usually not used except for MS icons
- buf_item;
- buf_item;
- } else {
- // Pixel not compressed
- 1.to cmd do { j:INTEGER;
- line_24.item_24 x.make (color_map.item buf_item.get_color);
- x := x + 1;
- };
- cmd.is_odd.if {
- buf_item;
- };
- };
- } else {
- // Pixel compressed
- tmp_pix := color_map.item buf_item;
- 1.to escape do { j:INTEGER;
- line_24.item_24 x.make (tmp_pix.get_color);
- x := x + 1;
- };
- };
- };
- };
- }.elseif {header.is_24bit} then {
- //
- // 24 Bit
- //
- line_24 := BMP_LINE(PIXEL_24).create_with_capacity (header.width);
- align := ((header.width * -3) & 011b).to_uinteger_32;
- set_cursor (header.bitmap_offset);
- // No compression
- 0.to (header.height - 1) do { i:INTEGER;
- read line_24 size (header.width);
- set_cursor (cursor + align);
- b.line_h (0,(header.height - i - 1)) until (header.width - 1) image line_24;
- line_24.clear;
- };
- };
- };
- );
-
- - is_type n:ABSTRACT_STRING :BOOLEAN <-
- // Return true if the file name has '.bmp' or '.BMP' suffix
- (
- ? {n != NULL};
- ? {! n.is_empty};
- (n.has_suffix ".bmp") || { n.has_suffix ".BMP"}
- );
-
- - is_valid_bmp:BOOLEAN <-
- (
- ? {header != NULL};
- header.is_valid_bmp
- );
-
diff --git a/lib/format/bmp/format_bmp.li b/lib/format/bmp/format_bmp.li
index d688733..1d38429 100644
--- a/lib/format/bmp/format_bmp.li
+++ b/lib/format/bmp/format_bmp.li
@@ -153,16 +153,20 @@ Section Public
0.to (header.height - 1) do { i:INTEGER;
1.to (header.width) do { j:INTEGER;
line_24.item_24 (j-1).make_rgb (
- buffer_item pos,
+ buffer_item (pos + 2),
buffer_item (pos + 1),
- buffer_item (pos + 2)
+ buffer_item (pos)
);
pos := pos + 3;
};
pos := pos + align;
+ /*
+ "bmp.width : ".print; bmp.width.print; '\n'.print;
+ "header.width : ".print; header.width.print; '\n'.print;
+ "line_24.width: ".print; line_24.count.print; '\n'.print;
+ */
bmp.line_h (0,header.height - i - 1)
- until (header.width - 1) image line_24;
- line_24.clear;
+ until (header.width - 1) image line_24;
};
};
);
diff --git a/lib_os/unix/video/timer.li b/lib_os/unix/video/timer.li
index 729b527..37a0657 100644
--- a/lib_os/unix/video/timer.li
+++ b/lib_os/unix/video/timer.li
@@ -115,8 +115,13 @@ Section Public
p := p_beg;
{ p != p_end }.while_do {
evt := buffer_event.item p;
+ /*
+ "Timer! ".print;
+ evt.count.print;
+ '\n'.print;
+ */
(list_client.lower).to (list_client.upper) do { j:INTEGER;
- list_client.item j.receive (buffer_event.item p);
+ list_client.item j.receive (buffer_event.item p);
};
p := (p + 1) & 03h;
};
diff --git a/lib_os/unix/video/timer.li~ b/lib_os/unix/video/timer.li~
index 0376d89..729b527 100644
--- a/lib_os/unix/video/timer.li~
+++ b/lib_os/unix/video/timer.li~
@@ -122,6 +122,10 @@ Section Public
};
);
+ - clear <-
+ (
+ p_beg := p_end;
+ );
/*
//Other solution :
diff --git a/lib_os/unix/video/video.li b/lib_os/unix/video/video.li
index 89fe94f..ffd5ee5 100644
--- a/lib_os/unix/video/video.li
+++ b/lib_os/unix/video/video.li
@@ -247,7 +247,7 @@ Section Public
"MERDE Y\n".print;
};
*/
- ofs := (y * screen_width + x) * 3;
+ ofs := (y * screen_width + x) * 4;
(view_screen.item ofs .to_uinteger_32 ) |
(view_screen.item (ofs+1).to_uinteger_32 << 8) |
(view_screen.item (ofs+2).to_uinteger_32 << 16)
diff --git a/lib_os/unix/video/video.li~ b/lib_os/unix/video/video.li~
index ca73094..89fe94f 100644
--- a/lib_os/unix/video/video.li~
+++ b/lib_os/unix/video/video.li~
@@ -51,6 +51,9 @@ Section Public //VIDEO
Section Public
+ - screen_width:INTEGER;
+ - screen_height:INTEGER;
+
- message str:ABSTRACT_STRING <-
(
"Message : ".print; str.print; '\n'.print;
@@ -96,8 +99,10 @@ Section Public
planes := `PlanesOfScreen(screen)`:UINTEGER_32;
"Video mode: ".print;
planes.print; "bits\n".print;
+
+ screen_width := w_max := `WidthOfScreen(screen)`:INTEGER;
+ screen_height := `HeightOfScreen(screen)`:INTEGER;
- w_max := `WidthOfScreen(screen)`:INTEGER;
planes
.when 15 then {
@@ -203,7 +208,65 @@ Section Public
(
not_yet_implemented;
);
+
+ //
+ // Frame buffer.
+ //
+
+ - open_frame_buffer <-
+ ( + fb,w,h:INTEGER;
+
+ fb := `open("/dev/fb0", O_RDWR)`:INTEGER;
+ (fb = 0).if {
+ "Error: cannot open framebuffer device.\n".print;
+ die_with_code 0;
+ };
+
+ w := screen_width;
+ h := screen_height;
+ view_screen := `mmap(0, @w*@h*4, PROT_READ | PROT_WRITE,MAP_SHARED, at fb, 0)`:
+ NATIVE_ARRAY(UINTEGER_8);
+
+ (CONVERT(NATIVE_ARRAY(UINTEGER_8),INTEGER).on view_screen = -1).if {
+ "Error: failed to map framebuffer device to memory.\n".print;
+ die_with_code 0;
+ };
+ );
+
+ - get_pixel_screen (x,y:INTEGER) :UINTEGER_32 <-
+ [
+ -? {x.in_range 0 to (screen_width -1)};
+ -? {y.in_range 0 to (screen_height-1)};
+ ]
+ ( + ofs:INTEGER;
+ /*
+ (x.in_range 0 to (screen_width -1)).if_false {
+ "MERDE\n".print;
+ };
+ (y.in_range 0 to (screen_height-1)).if_false {
+ "MERDE Y\n".print;
+ };
+ */
+ ofs := (y * screen_width + x) * 3;
+ (view_screen.item ofs .to_uinteger_32 ) |
+ (view_screen.item (ofs+1).to_uinteger_32 << 8) |
+ (view_screen.item (ofs+2).to_uinteger_32 << 16)
+ );
+
+ - set_pixel_screen (x,y:INTEGER) color col:UINTEGER_32 <-
+ ( + ofs:INTEGER;
+
+ ofs := (y * screen_width + x) * 4;
+ view_screen.put ((col >> 16).to_uinteger_8) to (ofs+2);
+ view_screen.put (((col >> 8) & 0FFh).to_uinteger_8) to (ofs+1);
+ view_screen.put ((col & 0FFh).to_uinteger_8) to (ofs+0);
+ );
+
+Section Private
+
+ - view_screen:NATIVE_ARRAY(UINTEGER_8);
+
/* A voir pour bloquer la size minimum
// pointer to the size hints structure.
diff --git a/src/aliaser_local.li b/src/aliaser_local.li
index b7ba8f6..b605723 100644
--- a/src/aliaser_local.li
+++ b/src/aliaser_local.li
@@ -49,7 +49,7 @@ Section ALIASER_LOCAL,LIST
Section Public
- - is_on:BOOLEAN := TRUE;
+ - is_on:BOOLEAN := FALSE; // BSBS: Bug with Cortex (vector result)
- reset <-
(
diff --git a/src/code_life/write_local.li b/src/code_life/write_local.li
index 7818690..a1c9290 100644
--- a/src/code_life/write_local.li
+++ b/src/code_life/write_local.li
@@ -107,14 +107,14 @@ Section Public
idf := ALIASER_LOCAL.write Self;
(quiet_generation).if_false {
- (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
+ (local.is_result).if {
buffer.add_last '*';
};
buffer.append idf;
//
((value.static_type.raw = TYPE_NULL) && {variable.type.raw.is_block}).if {
buffer.append ".__id=0";
- } else {
+ } else {
buffer.add_last '=';
genere_value buffer;
};
@@ -125,10 +125,10 @@ Section Public
( + idf:STRING_CONSTANT;
idf := ALIASER_LOCAL.write Self;
- (variable.ensure_count = -1).if { // BSBS : Bidouille !!!
+ (local.is_result).if {
buffer.add_last '*';
};
- buffer.append idf;
+ buffer.append idf;
//
buffer.add_last '=';
);
--
Lisaac compiler
More information about the Lisaac-commits
mailing list