Index: trunk/libs/libalmosmkh/almosmkh.c
===================================================================
--- trunk/libs/libalmosmkh/almosmkh.c	(revision 650)
+++ trunk/libs/libalmosmkh/almosmkh.c	(revision 657)
@@ -2,5 +2,5 @@
  * almosmkh.c - User level ALMOS-MKH specific library implementation.
  * 
- * Author     Alain Greiner (2016,2017,2018,2019)
+ * Author     Alain Greiner (2016,2017,2018,2019,2020)
  *
  * Copyright (c) UPMC Sorbonne Universites
@@ -122,6 +122,6 @@
 }
 
-///////////////////////////////
-unsigned int get_uint32( void )
+///////////////////////////////////////
+int get_uint32( unsigned int * buffer )
 {
     unsigned int  i;
@@ -168,5 +168,6 @@
         else if ( c == 0 )                                      // EOF character
         {
-            return -1;
+            overflow = 1;
+            done     = 1;
         }
 
@@ -208,5 +209,6 @@
     {
         // return value
-        return value;
+        *buffer = value;
+        return 0;
     }
     else
@@ -222,5 +224,6 @@
 
         // return 0 value 
-        return 0;
+        *buffer = 0;
+        return -1;
     }
 }  // end get_uint32()
@@ -388,11 +391,11 @@
 
 ///////////////////////////////////////
-int display_fat( unsigned int  page_id,
-                 unsigned int  nb_entries )
+int display_fat( unsigned int  min_slot,
+                 unsigned int  nb_slots )
 {
     return hal_user_syscall( SYS_DISPLAY,
                              DISPLAY_FAT,
-                             (reg_t)page_id,
-                             (reg_t)nb_entries, 0 );
+                             (reg_t)min_slot,
+                             (reg_t)nb_slots, 0 );
 } 
 
@@ -412,4 +415,5 @@
 {
    char          cmd;
+   int           error;
 
    while( 1 )
@@ -424,9 +428,14 @@
         if( cmd == 'b' )
         {
+            unsigned int pid;
+            unsigned int trdid;
+
             printf("b / pid = ");
-            unsigned int pid = get_uint32();
+            error = get_uint32( &pid );
+
             printf(" / trdid = ");
-            unsigned int trdid = get_uint32();
-            display_busylocks( pid , trdid );
+            error |= get_uint32( &trdid );
+
+            if( error == 0 ) display_busylocks( pid , trdid );
         }
         // return to calling process
@@ -436,12 +445,17 @@
             break;
         }
-        // display FAT mapper(page,entries)
+        // display FAT mapper(min,slots)
         else if( cmd == 'f' )
         {
-            printf("f / page = ");
-            unsigned int page = get_uint32();
-            printf(" / entries = ");
-            unsigned int entries = get_uint32();
-            display_fat( page , entries );
+            unsigned int min;
+            unsigned int slots;
+
+            printf(" / min = ");
+            error = get_uint32( &min );
+
+            printf(" / slots = ");
+            error |= get_uint32( &slots );
+
+            if( error == 0 ) display_fat( min , slots );
         }
         // list all supported commands
@@ -451,5 +465,5 @@
                    "- b : display on TXT0 busylocks taken by thread[pid,trdid]\n"
                    "- c : resume calling process execution\n"
-                   "- f : display on TXT0 FAT mapper[page,entries]\n"
+                   "- f : display on TXT0 FAT mapper[min_slot,nb_slotss]\n"
                    "- h : list of supported commands\n"
                    "- m : display on TXT0 mapper[path,page,nbytes]\n"
@@ -467,10 +481,16 @@
         {
             char  path[128];
+            unsigned int page;
+            unsigned int nbytes;
+
             printf("m / path = ");
-            int error = get_string( path , 128 );
+            error = get_string( path , 128 );
+
             printf(" / page = ");
-            unsigned int page = get_uint32();
+            error |= get_uint32( &page );
+
             printf(" / nbytes = ");
-            unsigned int nbytes = get_uint32();
+            error |= get_uint32( &nbytes );
+
             if( error == 0 ) display_mapper( path , page , nbytes );
         }
@@ -478,7 +498,10 @@
         else if( cmd == 'p' )
         {
+            unsigned int cxy;
+
             printf("p / cxy = ");
-            unsigned int cxy = get_uint32();
-            display_cluster_processes( cxy , 0 );
+            error = get_uint32( &cxy );
+
+            if( error == 0 ) display_cluster_processes( cxy , 0 );
         }
         // display DQDT
@@ -491,27 +514,42 @@
         else if( cmd == 's' )
         {
+            unsigned int cxy;
+            unsigned int lid;
+
             printf("s / cxy = ");
-            unsigned int cxy = get_uint32();
+            error = get_uint32( &cxy );
+
             printf(" / lid = ");
-            unsigned int lid = get_uint32();
-            display_sched( cxy , lid );
+            error |= get_uint32( &lid );
+
+            if( error == 0 ) display_sched( cxy , lid );
         }
         // display all processes attached to TXT(txt_id)
         else if( cmd == 't' )
         {
+            unsigned int txt_id;
+
             printf("t / txt_id = ");
-            unsigned int txt_id = get_uint32();
-            display_txt_processes( txt_id );
+            error = get_uint32( &txt_id );
+
+            if( error == 0 ) display_txt_processes( txt_id );
         }
         // display vmm state for process(cxy, pid)
         else if( cmd == 'v' )
         {
+            unsigned int cxy;
+            unsigned int pid;
+            unsigned int map;
+
             printf("v / cxy = ");
-            unsigned int cxy = get_uint32();
+            error = get_uint32( &cxy );
+
             printf(" / pid = ");
-            unsigned int pid = get_uint32();
+            error |= get_uint32( &pid );
+
             printf(" / mapping = ");
-            unsigned int map = get_uint32();
-            display_vmm( cxy , pid , map );
+            error |= get_uint32( &map );
+
+            if( error == 0 ) display_vmm( cxy , pid , map );
         }
         // force the calling process to exit
@@ -524,11 +562,18 @@
         else if( cmd == 'y' )
         {
+            unsigned int active;
+            unsigned int cxy;
+            unsigned int lid;
+
             printf("y / active = ");
-            unsigned int active = get_uint32();
+            error = get_uint32( &active );
+
             printf(" / cxy = ");
-            unsigned int cxy    = get_uint32();
+            error |= get_uint32( &cxy );
+
             printf(" / lid = ");
-            unsigned int lid    = get_uint32();
-            trace( active , cxy , lid );
+            error |= get_uint32( &lid );
+
+            if( error == 0 ) trace( active , cxy , lid );
         }
     }  // en while
@@ -1500,5 +1545,5 @@
 {
     return hal_user_syscall( SYS_FBF,
-                             FBF_GET_CONFIG, 
+                             (reg_t)FBF_GET_CONFIG, 
                              (reg_t)width,
                              (reg_t)height,                           
@@ -1512,5 +1557,5 @@
 {
     return hal_user_syscall( SYS_FBF,
-                             FBF_READ,
+                             (reg_t)FBF_DIRECT_READ, 
                              (reg_t)buffer,
                              (reg_t)length,                           
@@ -1524,8 +1569,66 @@
 {
     return hal_user_syscall( SYS_FBF,
-                             FBF_WRITE,
+                             (reg_t)FBF_DIRECT_WRITE,
                              (reg_t)buffer,
                              (reg_t)length,                           
                              (reg_t)offset );    
+}
+
+//////////////////////////////////////////////
+int fbf_create_window( unsigned int    l_zero,
+                       unsigned int    p_zero,
+                       unsigned int    nlines,
+                       unsigned int    npixels,
+                       void         ** buffer )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_CREATE_WINDOW,
+                             (reg_t)((l_zero << 16) | p_zero),
+                             (reg_t)((nlines << 16) | npixels),
+                             (reg_t)buffer );
+}
+
+//////////////////////////////////////////
+int fbf_delete_window( unsigned int  wid )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_DELETE_WINDOW,
+                             (reg_t)wid, 0, 0 );
+}
+
+///////////////////////////////////////
+int fbf_move_window( unsigned int  wid,
+                     unsigned int  l_zero,
+                     unsigned int  p_zero )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_MOVE_WINDOW,
+                             (reg_t)wid,
+                             (reg_t)l_zero,
+                             (reg_t)p_zero );
+}
+
+/////////////////////////////////////////
+int fbf_resize_window( unsigned int  wid,
+                       unsigned int  width,
+                       unsigned int  height )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_RESIZE_WINDOW,
+                             (reg_t)wid,
+                             (reg_t)width,
+                             (reg_t)height );
+}
+
+//////////////////////////////////////////
+int fbf_refresh_window( unsigned int  wid,
+                        unsigned int  line_first,
+                        unsigned int  line_last )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_REFRESH_WINDOW,
+                             (reg_t)wid,
+                             (reg_t)line_first,
+                             (reg_t)line_last );
 }
 
