Index: trunk/libs/libalmosmkh/almosmkh.h
===================================================================
--- trunk/libs/libalmosmkh/almosmkh.h	(revision 661)
+++ trunk/libs/libalmosmkh/almosmkh.h	(revision 678)
@@ -141,5 +141,5 @@
 
 /***************************************************************************************
- * This syscall returns an 32 bits integer from the standard "stdin" stream.
+ * This syscall returns an 32 bits integer from the TXT terminal.
  * The value is copied in buffer pointed by the <buf> argument
  * Both decimal numbers and hexadecimal numbers (prefixed by 0x) are supported.
@@ -148,11 +148,12 @@
  * @ returns 0 if success / returns -1 if failure.
  **************************************************************************************/
-int get_uint32( unsigned int * buffer );
+void get_uint32( unsigned int * buffer );
+
 
 /***************************************************************************************
- * This syscall returns a character string from the standard "stdin" stream.
- * The string is copied in buffer pointed by the <string> argument. 
- * If the number of characters exceed the buffer length, all character are canceled
- * in both the buffer & the echoed string, and a new string capture start. 
+ * These syscalls return a NUL terminated character string from the TXT terminal.
+ * The characters are copied in buffer pointed by the <string> argument. 
+ * If the number of characters exceeds <maxlen>, all read characters are discarded,
+ * and removed from the <string> buffer, and a new string capture start. 
  * - Only printable characters c such as (0x20 <= c) and (c < 0x7f) are echoed
  *   and copied in the target buffer. 
@@ -162,7 +163,7 @@
  *   used to correct both the buffer content and the echoed string.
  ***************************************************************************************
- * @ string   : pointer on the string buffer.
+ * @ string   : pointer on the user space string buffer.
  * @ maxlen   : max number of bytes in string buffer, including the terminating NUL.
- * @ returns string length (including NUL) if success / returns -1 if failure.
+ * @ returns string length (including NUL) if success / returns 0 if failure.
  **************************************************************************************/
 int get_string( char * string,
@@ -327,28 +328,47 @@
                     unsigned int fdid );
 
-/***************************************************************************************** 
+/*************************************************************************************** 
+ * This debug syscall displays on the kernel terminal the set of open file descriptors
+ * registered in the fd_array of a process identified by the <pid> argument.
+ * It can be called by any thread running in any cluster.
+ ***************************************************************************************
+ * @ pid        : target process identifier.
+ setoreturn 0 if success / return -1 if undefined pid.
+ **************************************************************************************/
+int display_fd_array( unsigned int pid );
+
+/*************************************************************************************** 
+ * This debug syscall displays on the kernel terminal the set of registered windows
+ * in the FBF device. It can be called by any thread running in any cluster.
+ ***************************************************************************************
+ * @ pid    : target process identifier / all processes when pid == 0
+ * return 0 if success / return -1 if undefined pid.
+ **************************************************************************************/
+int display_fbf_windows( unsigned int pid );
+
+/*************************************************************************************** 
 * This debug syscall is used to activate / desactivate the context switches trace
 * for a core identified by the <cxy> and <lid> arguments.
 * It can be called by any thread running in any cluster.
-***************************************************************************************** 
+**************************************************************************************** 
 * @ active     : activate trace if non zero / desactivate if zero.
 * @ cxy        : cluster identifier.
 * @ lid        : core local index.
 * @ returns O if success / returns -1 if illegal arguments.
-****************************************************************************************/
+***************************************************************************************/
 int trace( unsigned int active,
            unsigned int cxy, 
            unsigned int lid );
 
-/****************************************************************************************
+/***************************************************************************************
  * This syscall implements an user-level interactive debugger that can be
  * introduced in any user application to display various kernel distributed structures.
- ***************************************************************************************/
+ **************************************************************************************/
 void idbg( void );
 
 
-/****************** Non standard (ALMOS-MKH specific) malloc operations  ***************/
-
-/////////////////////////////////////////////////////////////////////////////////////////
+/****************** Non standard (ALMOS-MKH specific) malloc operations  **************/
+
+////////////////////////////////////////////////////////////////////////////////////////
 // General principles:
 // - In user space the HEAP zone spread between the ELF zone and the STACK zone,
@@ -367,6 +387,6 @@
 //        is allocated on demand in each cluster.
 //        We should introduce the possibility to dynamically allocate
-//        several vsegs in each cluster, using several mmap when required. 
-/////////////////////////////////////////////////////////////////////////////////////////
+//        several vsegs in each cluster (using several mmap) when required. 
+////////////////////////////////////////////////////////////////////////////////////////
 // Free blocks organisation in each cluster :
 // - All free blocks have a size that is a power of 2, larger or equal
@@ -379,5 +399,5 @@
 // - The pointers on the first free block for each size are stored in an
 //   array of pointers free[32] in the storage(x,y) descriptor.
-/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
 // Allocation policy:
 // - The block size required by the user can be any value, but the allocated
@@ -400,5 +420,5 @@
 //   If the vseg is aligned (the vseg base is a multiple of the
 //   vseg size), all allocated blocks are aligned on the actual_size.
-/////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////
 // Free policy:
 // - Each allocated block is registered in an alloc[] array of unsigned char.
@@ -598,5 +618,5 @@
 
 /*****************************************************************************************
- * This function returns in the <width>, <height> and <type> arguments 
+ * This syscall returns in the <width>, <height> and <type> arguments 
  * the implementation specific frame buffer features.
  *****************************************************************************************
@@ -606,14 +626,14 @@
  * @ returns 0 if success / returns -1 if not found.
  ****************************************************************************************/
-int fbf_get_config( unsigned int * width,
-                    unsigned int * height,
-                    unsigned int * type );
-
-/*****************************************************************************************
- * This function creates a new window defined by the <l_zero>, <p_zero>, <nlines>,
- * and <npixels> arguments for the calling process, and register the process PID, the
- * allocated <wid>, and the window size and coordinates in the FBF device descriptor.
- * It returns in the output argument <buffer> the pointer on the buffer associated to
- * the window, mapped in user space.
+int fbf_get_config( int * width,
+                    int * height,
+                    int * type );
+
+/*****************************************************************************************
+ * This syscall creates a new window defined by the <l_zero>, <p_zero>, <nlines>,
+ * and <npixels> arguments for the calling process, and register the client process PID,
+ * the allocated <wid>, and the window size and coordinates in the list of windows rooted
+ * in the FBF device descriptor. It returns in the output argument <buffer> the pointer 
+ * on the buffer associated to the window, mapped in user space.
  * Warning : Both pixel [p_zero,l_zero] and pixel [p_zero+npixels-1,l_zero+nlines-1]
  * must be contained in the frame buffer.
@@ -623,41 +643,64 @@
  * @ nlines  : [in]  number of lines in the window.
  * @ npixels : [in]  number of pixels per line in the window.
- * @ buffer  : [out] pointer on 
- * @ returns <wid> if success / returns -1 if illegal size or coordinates.
- ****************************************************************************************/
-int fbf_create_window( unsigned int   l_zero,
-                       unsigned int   p_zero,
-                       unsigned int   nlines,
-                       unsigned int   npixels,
-                       void        ** buffer );
-
-/*****************************************************************************************
- * This function deletes an existing window, identified by the <wid> argument.
+ * @ buffer  : [out] pointer on buffer associated to window, mapped in user space.
+ * @ returns <kern_wid> if success / returns -1 if illegal size or coordinates.
+ ****************************************************************************************/
+int fbf_create_window( int     l_zero,
+                       int     p_zero,
+                       int     nlines,
+                       int     npixels,
+                       void ** buffer );
+
+/*****************************************************************************************
+ * This syscall activates/desactivates the window identified by the <wid> argument,
+ * according to the <active> argument.  The calling process must be the window owner.
+ *****************************************************************************************
+ * @ wid        : window identifier.
+ * @ active     : activate window if non zero / desactivate window if zero.
+ * @ returns 0 if success / returns -1 if illegal wid argument.
+ ****************************************************************************************/
+int fbf_active_window( int   wid,
+                       int   active );
+
+/*****************************************************************************************
+ * This syscall deletes an existing window, identified by the <wid> argument.
  * The calling process must be the window owner.
  *****************************************************************************************
  * @ wid     : window identifier.
- * @ returns 0 if success / returns -1 if not found or process not owner.
- ****************************************************************************************/
-int fbf_delete_window( unsigned int  wid );
-
-/*****************************************************************************************
- * This function refreshes in FBF all lines of a window identified by the <wid> argument,
+ * @ returns 0 if success / returns -1 if illegal wid argument.
+ ****************************************************************************************/
+int fbf_delete_window( int  wid );
+
+/*****************************************************************************************
+ * This syscall refreshes in FBF all lines of a window identified by the <wid> argument,
  * when the line index is in the interval [line_first,line_last[.
  * It scans all registered windows to take into account the windows overlap.
+ * The calling process must be the window owner, and the line_fist / line_last indexes
+ * must be compatible with the window height.
  *****************************************************************************************
  * @ wid        : window identifier.
- * @ line_first : first line index.
- * @ line_last  : last line index (excluded).
- * @ returns 0 if success / returns -1 if illegal argument.
- ****************************************************************************************/
-int fbf_refresh_window( unsigned int   wid,
-                        unsigned int   line_first,
-                        unsigned int   line_last );
-
-/*****************************************************************************************
- * This function changes the size of a window identified by the <wid> argument as defined
+ * @ line_first : first line index in window.
+ * @ line_last  : last line index in window (excluded).
+ * @ returns 0 if success / returns -1 if illegal arguments.
+ ****************************************************************************************/
+int fbf_refresh_window( int   wid,
+                        int   line_first,
+                        int   line_last );
+
+/*****************************************************************************************
+ * This syscall gives the highest priority to the window identified by the <wid> 
+ * argument, and refresh the FBF to take into account the new windows overlap priorities.
+ * The calling process must be the window owner.
+ *****************************************************************************************
+ * @ wid        : window identifier.
+ * @ returns 0 if success / returns -1 if wid illegal argument.
+ ****************************************************************************************/
+int fbf_front_window( int   wid );
+
+/*****************************************************************************************
+ * This syscall changes the size of a window identified by the <wid> argument as defined
  * by the <width> and height> arguments. The calling process must be the window owner.
- * WARNING : Both pixel [p_zero,l_zero] and pixel [p_zero+width-1,l_zero+height-1]
- * must be contained in the frame buffer.
+ * Both pixel [p_zero,l_zero] and pixel [p_zero+width-1,l_zero+height-1] must be
+ * contained in the frame buffer.
  *****************************************************************************************
  * @ wid     : window identifier.
@@ -666,12 +709,12 @@
  * @ returns 0 if success / returns -1 if illegal arguments.
  ****************************************************************************************/
-int fbf_resize_window( unsigned int   wid,
-                       unsigned int   width,
-                       unsigned int   height );
-
-/*****************************************************************************************
- * This function changes the <l_zero> & <p_zero> coordinates of a window identified
+int fbf_resize_window( int   wid,
+                       int   width,
+                       int   height );
+
+/*****************************************************************************************
+ * This syscall changes the <l_zero> & <p_zero> coordinates of a window identified
  * by the <wid> argument. The calling process must be the window owner.
- * WARNING : Both pixel [p_zero,l_zero] and pixel [p_zero+width-1,l_zero+height-1]
+ * Both pixel [p_zero,l_zero] and pixel [p_zero+width-1,l_zero+height-1]
  * must be contained in the frame buffer.
  *****************************************************************************************
@@ -681,7 +724,10 @@
  * @ returns 0 if success / returns -1 if illegal arguments.
  ****************************************************************************************/
-int fbf_move_window( unsigned int  wid,
-                     unsigned int  l_zero,
-                     unsigned int  p_zero );
+int fbf_move_window( int  wid,
+                     int  l_zero,
+                     int  p_zero );
+
+
+
 
 /*****************************************************************************************
@@ -695,7 +741,7 @@
  * @ returns 0 if success / returns -1 if illegal arguments.
  ****************************************************************************************/
-int fbf_write( void         * buffer,
-               unsigned int   length,
-               unsigned int   offset );
+int fbf_write( void * buffer,
+               int    length,
+               int    offset );
 
 /*****************************************************************************************
@@ -709,7 +755,7 @@
  * @ returns 0 if success / returns -1 if illegal arguments.
  ****************************************************************************************/
-int fbf_read( void         * buffer,
-              unsigned int   length,
-              unsigned int   offset );
+int fbf_read( void * buffer,
+              int    length,
+              int    offset );
 
 
