Index: trunk/libs/libalmosmkh/almosmkh.c
===================================================================
--- trunk/libs/libalmosmkh/almosmkh.c	(revision 661)
+++ trunk/libs/libalmosmkh/almosmkh.c	(revision 678)
@@ -118,6 +118,6 @@
 }
 
-///////////////////////////////////////
-int get_uint32( unsigned int * buffer )
+////////////////////////////////////////
+void get_uint32( unsigned int * buffer )
 {
     unsigned int  i;
@@ -201,10 +201,9 @@
     } 
 
-    // final evaluation 
+    // write value to buffer
     if ( overflow == 0 )
     {
         // return value
         *buffer = value;
-        return 0;
     }
     else
@@ -221,17 +220,15 @@
         // return 0 value 
         *buffer = 0;
-        return -1;
     }
 }  // end get_uint32()
 
-//////////////////////////////
+///////////////////////////////
 int get_string( char * string,
                 int    maxlen )
 {
     int c;
-    int done   = 0;
     int length = 0;
 
-    while( done == 0 )
+    while( 1 )
     {
         // check buffer overflow
@@ -256,8 +253,9 @@
             length++;                       // update length
         }
-        else if (c == 0x0A)                 // LF character marks end of string
-        {
-            putchar( c );
-            done = 1;
+        else if( c == 0x0A )                // LF character marks end of string
+        {
+            putchar( c );                   // echo
+            string[length] = 0;             // register NUL character in string
+            return length + 1;
         }
         else if ( (c == 0x7F) ||            // DEL character
@@ -270,21 +268,52 @@
             }
         }
-        else if ( c == 0 )                  // EOF character
-        {
-            // cancel all echo characters
-            while( length )
+    }
+
+    // set NUL character in string and return success
+
+}  // end get_string()
+
+
+/////////////////////////////
+int fget_string( int    fdid,
+                 char * string,
+                 int    maxlen )
+{
+    int  ret;
+    char c;
+    int  length = 0;
+
+    while( 1 )
+    {
+        // check buffer overflow
+        if( length >= maxlen-1 )  length = 0;                  
+
+        // read one character from stream
+        ret = read( fdid , &c , 1 );
+
+        if( ret == 1 )
+        {
+            if ( (c >= 0x20) && (c < 0x7F) )    // printable character
             {
-               printf("\b \b");             // cancel one echo character
-               length--;                    
+                string[length] = (char)c;       // register character in string
+                length++;                       // update length
             }
-            return -1;                      // return failure
-        }
-    }
-
-    // set NUL character in string and return success
-    string[length] = 0;
-    return length + 1;
-
-}  // end get_string()
+            else if ( c == 0 )                  // end of string
+            {
+                string[length] = (char)c;       // register character in string
+                length++;                       // update length
+                break;                          // exit loop
+            }
+            // discard all characters not printable or NUL
+        }
+        else 
+        {
+            printf("\n[%s] cannot read stream %d\n", __FUNCTION__, fdid );
+            length = 0;
+            break;
+        }
+    }
+}  // end fget_string()
+
 
 //////////////////////////////////////////////////////////////////////////////////////
@@ -418,4 +447,20 @@
 }
 
+////////////////////////////////////////
+int display_fd_array( unsigned int pid )
+{
+    return hal_user_syscall( SYS_DISPLAY,
+                             DISPLAY_FD,
+                             (reg_t)pid, 0, 0 );
+}
+
+///////////////////////////////////////////
+int display_fbf_windows( unsigned int pid )
+{
+    return hal_user_syscall( SYS_DISPLAY,
+                             DISPLAY_WINDOWS,
+                             (reg_t)pid, 0, 0 );
+}
+
 ///////////////////////////////
 int trace( unsigned int active,
@@ -433,5 +478,4 @@
 {
    char          cmd;
-   int           error;
 
    while( 1 )
@@ -450,10 +494,10 @@
 
             printf("b / pid = ");
-            error = get_uint32( &pid );
+            get_uint32( &pid );
 
             printf(" / trdid = ");
-            error |= get_uint32( &trdid );
-
-            if( error == 0 ) display_busylocks( pid , trdid );
+            get_uint32( &trdid );
+
+            display_busylocks( pid , trdid );
         }
         // return to calling process
@@ -470,10 +514,10 @@
 
             printf(" / min = ");
-            error = get_uint32( &min );
+            get_uint32( &min );
 
             printf(" / slots = ");
-            error |= get_uint32( &slots );
-
-            if( error == 0 ) display_fat( min , slots );
+            get_uint32( &slots );
+
+            display_fat( min , slots );
         }
         // list all supported commands
@@ -503,13 +547,13 @@
 
             printf("m / path = ");
-            error = get_string( path , 128 );
+            get_string( path , 128 );
 
             printf(" / page = ");
-            error |= get_uint32( &page );
+            get_uint32( &page );
 
             printf(" / nbytes = ");
-            error |= get_uint32( &nbytes );
-
-            if( error == 0 ) display_mapper( path , page , nbytes );
+            get_uint32( &nbytes );
+
+            display_mapper( path , page , nbytes );
         }
         // display all processes in cluster(cxy)
@@ -519,7 +563,7 @@
 
             printf("p / cxy = ");
-            error = get_uint32( &cxy );
-
-            if( error == 0 ) display_cluster_processes( cxy , 0 );
+            get_uint32( &cxy );
+
+            display_cluster_processes( cxy , 0 );
         }
         // display DQDT
@@ -536,10 +580,10 @@
 
             printf("s / cxy = ");
-            error = get_uint32( &cxy );
+            get_uint32( &cxy );
 
             printf(" / lid = ");
-            error |= get_uint32( &lid );
-
-            if( error == 0 ) display_sched( cxy , lid );
+            get_uint32( &lid );
+
+            display_sched( cxy , lid );
         }
         // display all processes attached to TXT(txt_id)
@@ -549,7 +593,7 @@
 
             printf("t / txt_id = ");
-            error = get_uint32( &txt_id );
-
-            if( error == 0 ) display_txt_processes( txt_id );
+            get_uint32( &txt_id );
+
+            display_txt_processes( txt_id );
         }
         // display vmm state for process(cxy, pid)
@@ -561,13 +605,13 @@
 
             printf("v / cxy = ");
-            error = get_uint32( &cxy );
+            get_uint32( &cxy );
 
             printf(" / pid = ");
-            error |= get_uint32( &pid );
+            get_uint32( &pid );
 
             printf(" / mapping = ");
-            error |= get_uint32( &map );
-
-            if( error == 0 ) display_vmm( cxy , pid , map );
+            get_uint32( &map );
+
+            display_vmm( cxy , pid , map );
         }
         // force the calling process to exit
@@ -585,13 +629,13 @@
 
             printf("y / active = ");
-            error = get_uint32( &active );
+            get_uint32( &active );
 
             printf(" / cxy = ");
-            error |= get_uint32( &cxy );
+            get_uint32( &cxy );
 
             printf(" / lid = ");
-            error |= get_uint32( &lid );
-
-            if( error == 0 ) trace( active , cxy , lid );
+            get_uint32( &lid );
+
+            trace( active , cxy , lid );
         }
     }  // en while
@@ -1366,5 +1410,5 @@
                 if( child_sts[i][j] < 0 )  // failure => report error
                 {
-                    printf("\n[ERROR] in %s select core for child[%d,%d] of <build> thread[%d,%d]\n",
+                    printf("\n[ERROR] in %s : child[%d,%d] of <build> thread[%d,%d]\n",
                     __FUNCTION__ , i , j , cid , level );
 
@@ -1558,8 +1602,8 @@
 /////////////////////////////////////////////////////////////////////////////////////////
 
-/////////////////////////////////////////
-int fbf_get_config( unsigned int * width,
-                    unsigned int * height,
-                    unsigned int * type )
+////////////////////////////////
+int fbf_get_config( int * width,
+                    int * height,
+                    int * type )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1570,9 +1614,11 @@
 }
 
-////////////////////////////////////
-int fbf_read( void         * buffer,
-              unsigned int   length,
-              unsigned int   offset )
-{
+////////////////////////////
+int fbf_read( void * buffer,
+              int    length,
+              int    offset )
+{
+    printf("[WARNING] the <%s> syscall is deprecated\n", __FUNCTION__ );
+
     return hal_user_syscall( SYS_FBF,
                              (reg_t)FBF_DIRECT_READ, 
@@ -1582,9 +1628,11 @@
 }
 
-/////////////////////////////////////
-int fbf_write( void         * buffer,
-               unsigned int   length,
-               unsigned int   offset )
-{
+/////////////////////////////
+int fbf_write( void * buffer,
+               int    length,
+               int    offset )
+{
+    printf("[WARNING] the <%s> syscall is deprecated\n", __FUNCTION__ );
+
     return hal_user_syscall( SYS_FBF,
                              (reg_t)FBF_DIRECT_WRITE,
@@ -1594,10 +1642,10 @@
 }
 
-//////////////////////////////////////////////
-int fbf_create_window( unsigned int    l_zero,
-                       unsigned int    p_zero,
-                       unsigned int    nlines,
-                       unsigned int    npixels,
-                       void         ** buffer )
+//////////////////////////////////////
+int fbf_create_window( int     l_zero,
+                       int     p_zero,
+                       int     nlines,
+                       int     npixels,
+                       void ** buffer )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1608,6 +1656,16 @@
 }
 
-//////////////////////////////////////////
-int fbf_delete_window( unsigned int  wid )
+///////////////////////////////
+int fbf_active_window( int wid,
+                       int active )
+{
+    return hal_user_syscall( SYS_FBF, 
+                             (reg_t)FBF_ACTIVE_WINDOW,
+                             (reg_t)wid,
+                             (reg_t)active, 0 );
+}
+
+/////////////////////////////////
+int fbf_delete_window( int  wid )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1616,8 +1674,8 @@
 }
 
-///////////////////////////////////////
-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 )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1628,8 +1686,8 @@
 }
 
-/////////////////////////////////////////
-int fbf_resize_window( unsigned int  wid,
-                       unsigned int  width,
-                       unsigned int  height )
+////////////////////////////////
+int fbf_resize_window( int  wid,
+                       int  width,
+                       int  height )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1640,8 +1698,8 @@
 }
 
-//////////////////////////////////////////
-int fbf_refresh_window( unsigned int  wid,
-                        unsigned int  line_first,
-                        unsigned int  line_last )
+/////////////////////////////////
+int fbf_refresh_window( int  wid,
+                        int  line_first,
+                        int  line_last )
 {
     return hal_user_syscall( SYS_FBF,
@@ -1652,4 +1710,11 @@
 }
 
+/////////////////////////////////
+int fbf_front_window( int   wid )
+{
+    return hal_user_syscall( SYS_FBF,
+                             (reg_t)FBF_FRONT_WINDOW,
+                             (reg_t)wid, 0, 0 );
+}
 
 // Local Variables:
