An incomplete list of changes:
1) Added functionality for string arguments
2) Fixed bug in efcn_compute: mr_list is now passed in
3) Fixed potential bugs in the signal trapping code
4) Fixed up EF error messages a little
5) Altered efcn_match_template to act like match_template.F
.

git-svn-id: 0ef30dc7da0b07cedfa074587325a6c153c0ae55@6589 fdbf22ae-c210-0410-be80-ca943da6b8f8

--- fer/ccr/EF_InternalUtil.c
+++ fer/ccr/EF_InternalUtil.c
@@ -114,13 +114,13 @@
 int  efcn_gather_info_( int * );
 void efcn_get_custom_axes_( int *, int * );
 void efcn_get_result_limits_( int *, float *, int *, int * );
-void efcn_compute_( int *, int *, int *, int *, float *, int *, float *, int * );
+void efcn_compute_( int *, int *, int *, int *, int *, float *, int *, float *, int * );

 void efcn_get_custom_axis_sub_( int *, int *, float *, float *, float *, char *, int * );

 int  efcn_get_id_( char * );
-int  efcn_match_template_( char * );
+int  efcn_match_template_( int *, char * );

 void efcn_get_name_( int *, char * );
 void efcn_get_version_( int *, float * );
@@ -135,6 +135,7 @@
 void efcn_get_axis_extend_lo_( int *, int *, int * );
 void efcn_get_axis_extend_hi_( int *, int *, int * );
 void efcn_get_axis_limits_( int *, int *, int *, int * );
+int  efcn_get_arg_type_( int *, int *);
 void efcn_get_arg_name_( int *, int *, char * );
 void efcn_get_arg_unit_( int *, int *, char * );
 void efcn_get_arg_desc_( int *, int *, char * );
@@ -147,9 +148,13 @@
 void efcn_get_workspace_addr_(float *, int *, float *);

 static void EF_signal_handler(int);
+static void (*fpe_handler)(int);
+static void (*segv_handler)(int);
+static void (*int_handler)(int);
+static void (*bus_handler)(int);
+

 void ef_err_bail_out_(int *, char *);
-void ef_err_not_found(int);

 void EF_store_globals(float *, int *, int *, int *, float *);

@@ -332,6 +337,7 @@
   void *handle;
   void (*f_init_ptr)(int *);

+
   /*
    * Find the external function.
    */
@@ -365,9 +371,9 @@
      advice of jc - osf didn't have a definition for RTLD_GLOBAL */
   if ( (ef_ptr->handle = dlopen(ef_object, RTLD_NOW)) == NULL ) {
     fprintf(stderr, "\n\
-ERROR in efcn_gather_info:\n\
-dlopen(%s, RTLD_NOW) generates the error:\n\
-\t\"%s\"\n", ef_object, dlerror());
+ERROR in External Function %s:\n\
+Dynamic linking call dlopen() returns --\n\
+\"%s\".\n", ef_ptr->name, dlerror());
     return -1;
   }

@@ -400,19 +406,19 @@
      * environment with sigsetjmp (for the signal handler) and setjmp
      * (for the "bail out" utility function).
      */
-    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
+    if ( (fpe_handler = signal(SIGFPE, EF_signal_handler)) == SIG_ERR ) {
       fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGFPE.\n");
       return;
     }
-    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
+    if ( (segv_handler = signal(SIGSEGV, EF_signal_handler)) == SIG_ERR ) {
       fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGSEGV.\n");
       return;
     }
-    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
+    if ( (int_handler = signal(SIGINT, EF_signal_handler)) == SIG_ERR ) {
       fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGINT.\n");
       return;
     }
-    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
+    if ( (bus_handler = signal(SIGBUS, EF_signal_handler)) == SIG_ERR ) {
       fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGBUS.\n");
       return;
     }
@@ -437,21 +443,21 @@
     (*f_init_ptr)(id_ptr);

     /*
-     * Restore the default signal handlers.
+     * Restore the old signal handlers.
      */
-    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
+    if (signal(SIGFPE, (*fpe_handler)) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGFPE handler.\n");
       return;
     }
-    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
+    if (signal(SIGSEGV, (*segv_handler)) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGSEGV handler.\n");
       return;
     }
-    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
+    if (signal(SIGINT, (*int_handler)) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGINT handler.\n");
       return;
     }
-    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
+    if (signal(SIGBUS, (*bus_handler)) == SIG_ERR) {
       fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGBUS handler.\n");
       return;
     }
@@ -492,20 +498,20 @@
      * environment with sigsetjmp (for the signal handler) and setjmp
      * (for the "bail out" utility function).
      */
-    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGFPE.\n");
-      return;
-    }
-    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGSEGV.\n");
-      return;
-    }
-    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGINT.\n");
-      return;
-    }
-    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() catching SIGBUS.\n");
+    if ( (fpe_handler = signal(SIGFPE, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGFPE.\n");
+      return;
+    }
+    if ( (segv_handler = signal(SIGSEGV, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGSEGV.\n");
+      return;
+    }
+    if ( (int_handler = signal(SIGINT, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGINT.\n");
+      return;
+    }
+    if ( (bus_handler = signal(SIGBUS, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGBUS.\n");
       return;
     }
     if (sigsetjmp(sigjumpbuffer, 1) != 0) {
@@ -522,22 +528,22 @@
     (*fptr)( id_ptr );

     /*
-     * Restore the default signal handlers.
+     * Restore the old signal handlers.
      */
-    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGFPE handler.\n");
-      return;
-    }
-    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGSEGV handler.\n");
-      return;
-    }
-    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGINT handler.\n");
-      return;
-    }
-    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_custom_axes() restoring default SIGBUS handler.\n");
+    if (signal(SIGFPE, (*fpe_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGFPE handler.\n");
+      return;
+    }
+    if (signal(SIGSEGV, (*segv_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGSEGV handler.\n");
+      return;
+    }
+    if (signal(SIGINT, (*int_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGINT handler.\n");
+      return;
+    }
+    if (signal(SIGBUS, (*bus_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGBUS handler.\n");
       return;
     }

@@ -581,20 +587,20 @@
      * environment with sigsetjmp (for the signal handler) and setjmp
      * (for the "bail out" utility function).
      */
-    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGFPE.\n");
-      return;
-    }
-    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGSEGV.\n");
-      return;
-    }
-    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGINT.\n");
-      return;
-    }
-    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() catching SIGBUS.\n");
+    if ( (fpe_handler = signal(SIGFPE, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGFPE.\n");
+      return;
+    }
+    if ( (segv_handler = signal(SIGSEGV, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGSEGV.\n");
+      return;
+    }
+    if ( (int_handler = signal(SIGINT, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGINT.\n");
+      return;
+    }
+    if ( (bus_handler = signal(SIGBUS, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGBUS.\n");
       return;
     }
     if (sigsetjmp(sigjumpbuffer, 1) != 0) {
@@ -611,22 +617,22 @@
     (*fptr)( id_ptr);

     /*
-     * Restore the default signal handlers.
+     * Restore the old signal handlers.
      */
-    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGFPE handler.\n");
-      return;
-    }
-    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGSEGV handler.\n");
-      return;
-    }
-    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGINT handler.\n");
-      return;
-    }
-    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_get_result_limits() restoring default SIGBUS handler.\n");
+    if (signal(SIGFPE, (*fpe_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGFPE handler.\n");
+      return;
+    }
+    if (signal(SIGSEGV, (*segv_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGSEGV handler.\n");
+      return;
+    }
+    if (signal(SIGINT, (*int_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGINT handler.\n");
+      return;
+    }
+    if (signal(SIGBUS, (*bus_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGBUS handler.\n");
       return;
     }

@@ -645,7 +651,7 @@
  * pass the necessary information and the data and tell
  * the function to calculate the result.
  */
-void efcn_compute_( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *mres_ptr,
+void efcn_compute_( int *id_ptr, int *narg_ptr, int *cx_list_ptr, int *mr_list_ptr, int *mres_ptr,
 	float *bad_flag_ptr, int *mr_arg_offset_ptr, float *memory, int *status )
 {
   ExternalFunction *ef_ptr=NULL;
@@ -708,7 +714,7 @@
    * Store the memory pointer and various lists globally.
    */
   efcn_copy_array_dims_();
-  EF_store_globals(memory, mr_arg_offset_ptr, cx_list_ptr, mres_ptr, bad_flag_ptr);
+  EF_store_globals(memory, mr_list_ptr, cx_list_ptr, mres_ptr, bad_flag_ptr);

   /*
    * Find the external function.
@@ -801,23 +807,23 @@
      * environment with sigsetjmp (for the signal handler) and setjmp
      * (for the "bail out" utility function).
      */
-    if (signal(SIGFPE, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() catching SIGFPE.\n");
+    if ( (fpe_handler = signal(SIGFPE, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGFPE.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGSEGV, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() catching SIGSEGV.\n");
+    if ( (segv_handler = signal(SIGSEGV, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGSEGV.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGINT, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() catching SIGINT.\n");
+    if ( (int_handler = signal(SIGINT, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGINT.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGBUS, EF_signal_handler) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() catching SIGBUS.\n");
+    if ( (bus_handler = signal(SIGBUS, EF_signal_handler)) == SIG_ERR ) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() catching SIGBUS.\n");
       *status = FERR_EF_ERROR;
       return;
     }
@@ -1010,25 +1016,25 @@
     }

     /*
-     * Restore the default signal handlers.
+     * Restore the old signal handlers.
      */
-    if (signal(SIGFPE, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGFPE handler.\n");
+    if (signal(SIGFPE, (*fpe_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGFPE handler.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGSEGV, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGSEGV handler.\n");
+    if (signal(SIGSEGV, (*segv_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGSEGV handler.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGINT, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGINT handler.\n");
+    if (signal(SIGINT, (*int_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGINT handler.\n");
       *status = FERR_EF_ERROR;
       return;
     }
-    if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
-      fprintf(stderr, "\nERROR in efcn_compute() restoring default SIGBUS handler.\n");
+    if (signal(SIGBUS, (*bus_handler)) == SIG_ERR) {
+      fprintf(stderr, "\nERROR in efcn_gather_info() restoring default SIGBUS handler.\n");
       *status = FERR_EF_ERROR;
       return;
     }
@@ -1063,14 +1069,34 @@
  */
 static void EF_signal_handler(int signo) {

-  if (canjump == 0) return;
+  if (canjump == 0) return; /* unexpected signal, ignore */
+
+  /*
+   * Restore the old signal handlers.
+   */
+  if (signal(SIGFPE, (*fpe_handler)) == SIG_ERR) {
+    fprintf(stderr, "\nERROR in EF_signal_handler() restoring old SIGFPE handler.\n");
+    return;
+  }
+  if (signal(SIGSEGV, (*segv_handler)) == SIG_ERR) {
+    fprintf(stderr, "\nERROR in EF_signal_handler() restoring old SIGSEGV handler.\n");
+	return;
+  }
+  if (signal(SIGINT, (*int_handler)) == SIG_ERR) {
+    fprintf(stderr, "\nERROR in EF_signal_handler() restoring old SIGINT handler.\n");
+    return;
+  }
+  if (signal(SIGBUS, (*bus_handler)) == SIG_ERR) {
+    fprintf(stderr, "\nERROR in EF_signal_handler() restoring old SIGBUS handler.\n");
+    return;
+  }

   if (signo == SIGFPE) {
-    fprintf(stderr, "\n\nERROR inexternal function: Floating Point Error\n");
+    fprintf(stderr, "\n\nERROR in external function: Floating Point Error\n");
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
   } else if (signo == SIGSEGV) {
-    fprintf(stderr, "\n\nERROR inexternal function: Segmentation Violation\n");
+    fprintf(stderr, "\n\nERROR in external function: Segmentation Violation\n");
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
   } else if (signo == SIGINT) {
@@ -1078,11 +1104,11 @@
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
   } else if (signo == SIGBUS) {
-    fprintf(stderr, "\n\nERROR inexternal function: Hardware Fault\n");
+    fprintf(stderr, "\n\nERROR in external function: Hardware Fault\n");
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
   } else {
-    fprintf(stderr, "\n\nERROR inexternal function: signo = %d\n", signo);
+    fprintf(stderr, "\n\nERROR in external function: signo = %d\n", signo);
     canjump = 0;
     siglongjmp(sigjumpbuffer, 1);
   }
@@ -1092,7 +1118,7 @@

 /*
  * Find an external function based on its name and
- * fill in the integer ID associated with that funciton.
+ * return the integer ID associated with that funciton.
  */
 int efcn_get_id_( char name[] )
 {
@@ -1123,31 +1149,30 @@

 /*
- * Find an external function based on a template and
- * fill in the integer ID associated with first function
- * that matches the template.
- */
-int efcn_match_template_( char name[] )
+ * Determine whether a function name matches a template.
+ * Return 1 if the name matchs.
+ */
+int efcn_match_template_( int *id_ptr, char template[] )
 {
   ExternalFunction *ef_ptr=NULL;
   int status=LIST_OK;
+  int EF_LT_MT_return;

   static int return_val=0; /* static because it needs to exist after the return statement */

-  status = list_traverse(GLOBAL_ExternalFunctionList, name, EF_ListTraverse_MatchTemplate,
-			 (LIST_FRNT | LIST_FORW | LIST_ALTR));
-
-  /*
-   * If the search failed, set the id_ptr to 0
-   */
-  if ( status != LIST_OK ) {
-    return_val = ATOM_NOT_FOUND;
-    return return_val;
-  }
-
-  ef_ptr=(ExternalFunction *)list_curr(GLOBAL_ExternalFunctionList);
-
-  return_val = ef_ptr->id;
+  if ( (ef_ptr = ef_ptr_from_id_ptr(id_ptr)) == NULL ) { return return_val; }
+
+  EF_LT_MT_return = EF_ListTraverse_MatchTemplate((char *)template, (char *)ef_ptr);
+
+  /* The list package forces 'list traversal' functions to return
+   * 0 whenever a match is found.  We want to return a more reasonable
+   * 1 (=true) if we find a match.
+   */
+  if ( EF_LT_MT_return == FALSE ) {
+	return_val = 1;
+  } else {
+    return_val = 0;
+  }

   return return_val;
 }
@@ -1177,7 +1202,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the name.
+ * return the name.
  */
 void efcn_get_name_( int *id_ptr, char *name )
 {
@@ -1193,7 +1218,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the version number.
+ * return the version number.
  */
 void efcn_get_version_( int *id_ptr, float *version )
 {
@@ -1209,7 +1234,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the description.
+ * return the description.
  */
 void efcn_get_descr_( int *id_ptr, char *descr )
 {
@@ -1225,7 +1250,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill return the number of arguments.
+ * return the number of arguments.
  */
 int efcn_get_num_reqd_args_( int *id_ptr )
 {
@@ -1243,7 +1268,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the flag stating whether the function has
+ * return the flag stating whether the function has
  * a variable number of arguments.
  */
 void efcn_get_has_vari_args_( int *id_ptr, int *has_vari_args_ptr )
@@ -1260,7 +1285,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the axis sources (merged, normal, abstract, custom).
+ * return the axis sources (merged, normal, abstract, custom).
  */
 void efcn_get_axis_will_be_( int *id_ptr, int *array_ptr )
 {
@@ -1279,7 +1304,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the axis_reduction (retained, reduced) information.
+ * return the axis_reduction (retained, reduced) information.
  */
 void efcn_get_axis_reduction_( int *id_ptr, int *array_ptr )
 {
@@ -1298,7 +1323,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the piecemeal_ok information.  This lets Ferret
+ * return the piecemeal_ok information.  This lets Ferret
  * know if it's ok to break up a calculation along an axis
  * for memory management reasons.
  */
@@ -1319,7 +1344,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the (boolean) 'axis_implied_from' information for
+ * return the (boolean) 'axis_implied_from' information for
  * a particular argument to find out if its axes should
  * be merged in to the result grid.
  */
@@ -1342,7 +1367,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the 'arg_extend_lo' information for a particular
+ * return the 'arg_extend_lo' information for a particular
  * argument which tells Ferret how much to extend axis limits
  * when providing input data (e.g. to compute a derivative).
  */
@@ -1364,7 +1389,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the 'arg_extend_lo' information for a particular
+ * return the 'arg_extend_hi' information for a particular
  * argument which tells Ferret how much to extend axis limits
  * when providing input data (e.g. to compute a derivative).
  */
@@ -1386,9 +1411,8 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the 'arg_extend_lo' information for a particular
- * argument which tells Ferret how much to extend axis limits
- * when providing input data (e.g. to compute a derivative).
+ * return the 'axis_limits' information for a particular
+ * argument.
  */
 void efcn_get_axis_limits_( int *id_ptr, int *axis_ptr, int *lo_ptr, int *hi_ptr )
 {
@@ -1406,7 +1430,27 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the name of a particular argument.
+ * return the 'arg_type' information for a particular
+ * argument which tells Ferret whether an argument is a
+ * float or a string.
+ */
+int efcn_get_arg_type_( int *id_ptr, int *iarg_ptr )
+{
+  ExternalFunction *ef_ptr=NULL;
+  static int return_val=0; /* static because it needs to exist after the return statement */
+  int index = *iarg_ptr - 1; /* C indices are 1 less than Fortran */
+
+  if ( (ef_ptr = ef_ptr_from_id_ptr(id_ptr)) == NULL ) { return; }
+
+  return_val = ef_ptr->internals_ptr->arg_type[index];
+
+  return return_val;
+}
+
+
+/*
+ * Find an external function based on its integer ID and
+ * return the name of a particular argument.
  */
 void efcn_get_arg_name_( int *id_ptr, int *iarg_ptr, char *string )
 {
@@ -1418,7 +1462,7 @@

   /*
    * JC_NOTE: if the argument has no name then memory gets overwritten, corrupting
-   * the address of iarg_ptr annd causing a core dump.  I need to catch that case
+   * the address of iarg_ptr and causing a core dump.  I need to catch that case
    * here.
    */

@@ -1441,7 +1485,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the units for a particular argument.
+ * return the units for a particular argument.
  */
 void efcn_get_arg_unit_( int *id_ptr, int *iarg_ptr, char *string )
 {
@@ -1460,7 +1504,7 @@

 /*
  * Find an external function based on its integer ID and
- * fill in the description of a particular argument.
+ * return the description of a particular argument.
  */
 void efcn_get_arg_desc_( int *id_ptr, int *iarg_ptr, char *string )
 {
@@ -1480,19 +1524,11 @@
 {
   ExternalFunction *ef_ptr=NULL;

-  if ( (ef_ptr = ef_ptr_from_id_ptr(id_ptr)) == NULL ) { ef_err_not_found(*id_ptr); return; }
+  if ( (ef_ptr = ef_ptr_from_id_ptr(id_ptr)) == NULL ) { return; }

   fprintf(stderr, "\n\
 Bailing out of external function \"%s\":\n\
 \t%s\n", ef_ptr->name, text);
-
-  longjmp(jumpbuffer, 1);
-}
-
-
-void ef_err_not_found(int id)
-{
-  fprintf(stderr, "\nERROR: external function id [%d] not found.\n", id);

   longjmp(jumpbuffer, 1);
 }
@@ -1562,6 +1598,7 @@
       i_ptr->axis_extend_lo[i][j] = 0;
       i_ptr->axis_extend_hi[i][j] = 0;
     }
+    i_ptr->arg_type[i] = FLOAT_ARG;
     strcpy(i_ptr->arg_name[i], "");
     strcpy(i_ptr->arg_unit[i], "");
     strcpy(i_ptr->arg_desc[i], "");


Maildir: If there are multiple :2,<flags> in filename, use the last one both getting and setting the flags.

--- src/lib-storage/index/maildir/maildir-filename.c
+++ src/lib-storage/index/maildir/maildir-filename.c
@@ -44,7 +44,7 @@
 	array_clear(keywords_r);
 	*flags_r = 0;

-	info = strchr(fname, MAILDIR_INFO_SEP);
+	info = strrchr(fname, MAILDIR_INFO_SEP);
 	if (info == NULL || info[1] != '2' || info[2] != MAILDIR_FLAGS_SEP)
 		return;


. only include sys/time.h on non windoows platforms. Originally thought to use ifdef HAVE_SYS_TIME_H but that would require applications knowing that they needed to define that...whereas this way the right thing happens naturally.

--- src/log4c/logging_event.h
+++ src/log4c/logging_event.h
@@ -23,7 +23,9 @@
 #include <log4c/defs.h>
 #include <log4c/buffer.h>
 #include <log4c/location_info.h>
+#ifndef _WIN32
 #include <sys/time.h>
+#endif

 __LOG4C_BEGIN_DECLS


Create 6A1.c

Create 6A1.c

error: pathspec 'Problems/6A1.c' did not match any file(s) known to git

--- Problems/6A1.c
+++ Problems/6A1.c
@@ -0,0 +1,45 @@
+#include<stdio.h>
+int main()
+{
+int arr[4]; //form array
+printf("\n enter 4 digits : "); // print digits
+for(int i=0;i<4;i++){
+   scanf("%d",&arr[i]);
+}
+for(int i=0;i<4;i++){
+   switch(arr[i]){ // create columns
+       case 1:
+           printf("one ");
+           break;
+   case 2:
+           printf("TWO ");
+           break;
+           case 3:
+           printf("three ");
+           break;
+           case 4:
+           printf("four ");
+           break;
+           case 5:
+           printf("five ");
+           break;
+           case 6:
+           printf("six ");
+           break;
+           case 7:
+           printf("seven ");
+           break;
+           case 8:
+           printf("eight ");
+           break;
+           case 9:
+           printf("nine "); // for printing numbers
+           break;
+           default:
+           printf(" ");
+           break;
+   }
+}
+
+   return 0;
+}


parse of the HOA unfortunately now requires the ltstype

This way we can delegate to ltl_parse_file and be more homogeneous with
the normal LTL path.

--- src/ltsmin-lib/ltl2spot.h
+++ src/ltsmin-lib/ltl2spot.h
@@ -15,7 +15,7 @@
 // transform the spot::twa automaton built by ltl2spot to an ltsmin_buchi_t
 ltsmin_buchi_t *ltsmin_hoa_buchi(ltsmin_parse_env_t env);
 // directly parse the given HOA file and build an ltsmin_buchi_t
-ltsmin_buchi_t *ltsmin_parse_hoa_buchi(const char * hoa_file, int to_tgba, ltsmin_parse_env_t env);
+ltsmin_buchi_t *ltsmin_parse_hoa_buchi(const char * hoa_file, int to_tgba, ltsmin_parse_env_t env, lts_type_t ltstype);
 void ltsmin_hoa_destroy();

 #ifdef __cplusplus


Minor, code style

Minor, code style


remove unused old var

remove unused old var

--- src/ogv-decoder-video-theora.c
+++ src/ogv-decoder-video-theora.c
@@ -14,7 +14,6 @@
 #include "ogv-ogg-support.h"

 /* Video decode state */
-ogg_stream_state  theoraStreamState;
 th_info           theoraInfo;
 th_comment        theoraComment;
 th_setup_info    *theoraSetupInfo;


Lex Glitch Removal

Lex Glitch Removal

--- machine.c
+++ machine.c
@@ -110,6 +110,7 @@
 int
 machine_serve_instruction (char _output_ *buffer, unsigned long _output_ *read_bytes, int _input_ max)
 {
+
    int ip_val, i;
    xsm_word *ip_reg;
    int bytes_to_read;
@@ -122,19 +123,23 @@

    ip_val = machine_translate_address(ip_val, FALSE);
    instr_mem = machine_memory_get_word(ip_val);
-
-   memcpy (buffer, instr_mem, bytes_to_read);
-
+
+   memcpy (buffer, instr_mem->val, bytes_to_read);
+
+   instr_mem = machine_memory_get_word(ip_val+1);
+
    /* Trim. */
    for (i = 0; i < bytes_to_read; ++i)
    {
-      if (buffer[i] == '\0')
-         buffer[i] = ' ';
+      if (buffer[i] == '\0'){
+         for(int j=i;j<bytes_to_read/2;j++)
+			buffer[j] = ' ';
+	 }
    }

    buffer[bytes_to_read - 1] = '\0';
    *read_bytes = bytes_to_read;
-
+
    return TRUE;
 }


Plug a mem leak in g_environ_unsetenv

Plug a mem leak in g_environ_unsetenv

And clarify the memory allocation requirement of the string arrays passed to
g_environ_{,un}setenv().

==9458== 10 bytes in 1 blocks are definitely lost in loss record 16 of 39
==9458==    at 0x402AD89: malloc (vg_replace_malloc.c:236)
==9458==    by 0x4221A1F: vasprintf (vasprintf.c:78)
==9458==    by 0x40C6065: g_vasprintf (gprintf.c:314)
==9458==    by 0x409D894: g_strdup_vprintf (gstrfuncs.c:509)
==9458==    by 0x409D8C9: g_strdup_printf (gstrfuncs.c:535)
==9458==    by 0x40672E9: g_environ_setenv (genviron.c:156)
==9458==    by 0x80490E7: test_environ_array (environment.c:78)
==9458==    by 0x40A3DB5: test_case_run (gtestutils.c:1662)
==9458==    by 0x40A40B2: g_test_run_suite_internal (gtestutils.c:1715)
==9458==    by 0x40A417C: g_test_run_suite_internal (gtestutils.c:1726)
==9458==    by 0x40A42F9: g_test_run_suite (gtestutils.c:1771)
==9458==    by 0x40A3441: g_test_run (gtestutils.c:1319)
==9458==    by 0x80493F1: main (environment.c:108)

Bug #669412.

--- glib/genviron.c
+++ glib/genviron.c
@@ -109,7 +109,7 @@
 /**
  * g_environ_setenv:
  * @envp: (array zero-terminated=1) (transfer full): an environment
- *     list (eg, as returned from g_get_environ())
+ *     list that can be freed using g_strfreev() (e.g., as returned from g_get_environ())
  * @variable: the environment variable to set, must not contain '='
  * @value: the value for to set the variable to
  * @overwrite: whether to change the variable if it already exists
@@ -122,7 +122,7 @@
  * arbitrary byte strings. On Windows, they should be in UTF-8.
  *
  * Return value: (array zero-terminated=1) (transfer full): the
- *     updated environment
+ *     updated environment list. Free it using g_strfreev().
  *
  * Since: 2.32
  */
@@ -160,30 +160,13 @@
   return envp;
 }

-/**
- * g_environ_unsetenv:
- * @envp: (array zero-terminated=1) (transfer full): an environment
- *     list (eg, as returned from g_get_environ())
- * @variable: the environment variable to remove, must not contain '='
- *
- * Removes the environment variable @variable from the provided
- * environment @envp.
- *
- * Return value: (array zero-terminated=1) (transfer full): the
- *     updated environment
- *
- * Since: 2.32
- */
-gchar **
-g_environ_unsetenv (gchar       **envp,
-                    const gchar  *variable)
+static gchar **
+g_environ_unsetenv_internal (gchar        **envp,
+                             const gchar   *variable,
+                             gboolean       free_value)
 {
   gint len;
   gchar **e, **f;
-
-  g_return_val_if_fail (envp != NULL, NULL);
-  g_return_val_if_fail (variable != NULL, NULL);
-  g_return_val_if_fail (strchr (variable, '=') == NULL, NULL);

   len = strlen (variable);

@@ -198,11 +181,43 @@
           *f = *e;
           f++;
         }
+      else
+        {
+          if (free_value)
+            g_free (*e);
+        }
+
       e++;
     }
   *f = NULL;

   return envp;
+}
+
+
+/**
+ * g_environ_unsetenv:
+ * @envp: (array zero-terminated=1) (transfer full): an environment
+ *     list that can be freed using g_strfreev() (e.g., as returned from g_get_environ())
+ * @variable: the environment variable to remove, must not contain '='
+ *
+ * Removes the environment variable @variable from the provided
+ * environment @envp.
+ *
+ * Return value: (array zero-terminated=1) (transfer full): the
+ *     updated environment list. Free it using g_strfreev().
+ *
+ * Since: 2.32
+ */
+gchar **
+g_environ_unsetenv (gchar       **envp,
+                    const gchar  *variable)
+{
+  g_return_val_if_fail (envp != NULL, NULL);
+  g_return_val_if_fail (variable != NULL, NULL);
+  g_return_val_if_fail (strchr (variable, '=') == NULL, NULL);
+
+  return g_environ_unsetenv_internal (envp, variable, TRUE);
 }

 /* UNIX implemention {{{1 */
@@ -346,7 +361,7 @@
   /* Mess directly with the environ array.
    * This seems to be the only portable way to do this.
    */
-  g_environ_unsetenv (environ, variable);
+  g_environ_unsetenv_internal (environ, variable, FALSE);
 #endif /* !HAVE_UNSETENV */
 }


Fixed comment typo under commons.c.

Fixed comment typo under commons.c.

--- src/commons.h
+++ src/commons.h
@@ -211,7 +211,7 @@
   struct GAgentItem_ *items;
 } GAgents;

-/* Generic Single linked-list */
+/* Generic Singly linked-list */
 typedef struct GSLList_
 {
   void *data;
@@ -250,7 +250,7 @@
 void display_storage (void);
 void display_version (void);

-/* single linked-list */
+/* singly linked-list */
 GSLList *list_create (void *data);
 GSLList *list_find (GSLList * node, int (*func) (void *, void *), void *data);
 GSLList *list_insert_append (GSLList * node, void *data);


Ensure g_key_file_load_from_file() strips a \r on a 4 KB boundary

When g_key_file_parse_data() encountered \n, it was checking the previous
character in the current input buffer for a \r to erase, rather than the
previous character in the parse buffer.  If g_key_file_load_from_file()
was given a file with a \r\n sequence straddling a 4 KB boundary, the \n
would be the first character in the input buffer, so the \r would not be
properly stripped.

Bug #640695.

Found-by: Jan Harkes <4f1a5e5a56d3352d4f3e456b1f2cee6192a5a7a3@cs.cmu.edu>

--- glib/gkeyfile.c
+++ glib/gkeyfile.c
@@ -953,7 +953,9 @@
     {
       if (data[i] == '\n')
         {
-	  if (i > 0 && data[i - 1] == '\r')
+	  if (key_file->parse_buffer->len > 0
+	      && (key_file->parse_buffer->str[key_file->parse_buffer->len - 1]
+		  == '\r'))
 	    g_string_erase (key_file->parse_buffer,
 			    key_file->parse_buffer->len - 1,
 			    1);


Avoided a warning when compiling with Gtk+ 3

--- src/compare.c
+++ src/compare.c
@@ -1,5 +1,5 @@
 /* $Id$ */
-/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
+/* Copyright (c) 2011-2013 Pierre Pronchery <khorben@defora.org> */
 /* This file is part of DeforaOS Desktop Accessories */
 /* 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
@@ -57,7 +57,11 @@
 	gtk_window_set_title(GTK_WINDOW(window), "Compare strings");
 	g_signal_connect_swapped(G_OBJECT(window), "delete-event", G_CALLBACK(
 				_compare_on_closex), window);
+#if GTK_CHECK_VERSION(3, 0, 0)
+	vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
+#else
 	vbox = gtk_vbox_new(FALSE, 4);
+#endif
 	compare.entry1 = gtk_entry_new();
 	if(string1 != NULL)
 		gtk_entry_set_text(GTK_ENTRY(compare.entry1), string1);


Need errno.h for glibc systems (among others) - sopwith

--- glib/gscanner.c
+++ glib/gscanner.c
@@ -23,6 +23,7 @@
 #include	<stdlib.h>
 #include	<string.h>
 #include	<unistd.h>
+#include	<errno.h>
 #include	"glib.h"


Nested parens working

Nested parens working

--- src/compile.c
+++ src/compile.c
@@ -236,48 +236,54 @@
         if ((err = process_op(cp)) < 0)
             return err;

-    } else if (cp->tok == LITERAL) {
-        set_op_char(&inst, *lp1);
-        cp->operand = stack_add_head(parens[0], &inst);
-        cp->buf = parens[0];
-
-    } else if (cp->tok == ANY) {
-        set_op_any(&inst);
-        cp->operand = stack_add_head(parens[0], &inst);
-        cp->buf = parens[0];
-
-    } else if (cp->tok == CHARC_OPEN) {
-         *state = STATE_CHARC;
-
-    } else if (cp->tok == LPAREN) {
-        if (cp->pdepth + 1 > MAXNESTPARENS)
-            return RVM_ENEST;
-
-        stack_cat(cp->target, parens[0]);
-        parens[0] = create_stack();
-        parens[++cp->pdepth] = create_stack();
-
-        if (parens[0] == NULL || parens[cp->pdepth] == NULL)
-            return RVM_EMEM;
-
-        cp->target = parens[cp->pdepth];
-
-    } else if (cp->tok == RPAREN) {
-        if (cp->pdepth < 1) {
-            return RVM_BADPAREN;
-
-        } else {
+    } else {
+        if (cp->lasttok == RPAREN && cp->buf->size > 0) {
+            stack_cat(cp->prog, cp->buf);
+        }
+
+        if (cp->tok == LITERAL) {
+            set_op_char(&inst, *lp1);
+            cp->operand = stack_add_head(parens[0], &inst);
+            cp->buf = parens[0];
+
+        } else if (cp->tok == ANY) {
+            set_op_any(&inst);
+            cp->operand = stack_add_head(parens[0], &inst);
+            cp->buf = parens[0];
+
+        } else if (cp->tok == CHARC_OPEN) {
+            *state = STATE_CHARC;
+
+        } else if (cp->tok == LPAREN) {
+            if (cp->pdepth + 1 > MAXNESTPARENS)
+                return RVM_ENEST;
+
             stack_cat(cp->target, parens[0]);
-            if ((parens[0] = create_stack()) == NULL)
+            parens[0] = create_stack();
+            parens[++cp->pdepth] = create_stack();
+
+            if (parens[0] == NULL || parens[cp->pdepth] == NULL)
                 return RVM_EMEM;

-            cp->operand = parens[cp->pdepth]->tail;
-            cp->buf = parens[cp->pdepth--];
-            cp->target = (cp->pdepth < 1) ? cp->prog : parens[cp->pdepth];
+            cp->target = parens[cp->pdepth];
+
+        } else if (cp->tok == RPAREN) {
+            if (cp->pdepth < 1) {
+                return RVM_BADPAREN;
+
+            } else {
+                stack_cat(cp->target, parens[0]);
+                if ((parens[0] = create_stack()) == NULL)
+                    return RVM_EMEM;
+
+                cp->operand = parens[cp->pdepth]->tail;
+                cp->buf = parens[cp->pdepth--];
+                cp->target = (cp->pdepth < 1) ? cp->prog : parens[cp->pdepth];
+            }
+
+        } else if (cp->tok == CHARC_CLOSE) {
+            return RVM_BADCLASS;
         }
-
-    } else if (cp->tok == CHARC_CLOSE) {
-        return RVM_BADCLASS;
     }

     return 0;
@@ -359,6 +365,10 @@
         cp->lasttok = cp->tok;
     }

+    if (cp->lasttok == RPAREN && cp->buf->size > 0) {
+        stack_cat(cp->prog, cp->buf);
+    }
+
     if (cp->pdepth)
         return RVM_EPAREN;
     if (state == STATE_CHARC)


fix bug in time_serv_handle

fix bug in time_serv_handle

--- example/net_time_serv/time_serv_handle.c
+++ example/net_time_serv/time_serv_handle.c
@@ -1,4 +1,31 @@
 #include "time_serv_handle.h"
+
+#if MUGGLE_BUILD_TRACE
+
+void trace_output_peers(struct peer_container *container)
+{
+	char buf[4096];
+	int offset = 0;
+
+	char straddr[MUGGLE_SOCKET_ADDR_STRLEN];
+	offset += snprintf(buf + offset, sizeof(buf) - offset, "peer container: ");
+	int cnt = 0;
+	for (int i = 0; i < container->cnt_peer; ++i)
+	{
+		if (cnt >= 8)
+		{
+			offset += snprintf(buf + offset, sizeof(buf) - offset, " ...");
+			break;
+		}
+		muggle_socket_peer_t *tmp_peer = container->peers[i];
+		muggle_socket_ntop((struct sockaddr*)&tmp_peer->addr, straddr, MUGGLE_SOCKET_ADDR_STRLEN, 0);
+		offset += snprintf(buf + offset, sizeof(buf) - offset, "%d[%s]<%d> | ", tmp_peer->fd, straddr, (int)(intptr_t)tmp_peer->data);
+		++cnt;
+	}
+    MUGGLE_INFO(buf);
+}
+
+#endif

 int on_connect(
 	struct muggle_socket_event *ev, struct muggle_socket_peer *listen_peer, struct muggle_socket_peer *peer)
@@ -16,6 +43,10 @@
 	container->peers[container->cnt_peer] = peer;
 	peer->data = (void*)(intptr_t)container->cnt_peer;
 	++container->cnt_peer;
+
+#if MUGGLE_BUILD_TRACE
+	trace_output_peers(container);
+#endif

 	return 0;
 }
@@ -36,8 +67,13 @@
 	if (idx != container->cnt_peer - 1)
 	{
 		container->peers[idx] = container->peers[container->cnt_peer - 1];
+		container->peers[idx]->data = (void*)(intptr_t)idx;
 	}
 	--container->cnt_peer;
+
+#if MUGGLE_BUILD_TRACE
+	trace_output_peers(container);
+#endif

 	return 0;
 }


Fix read_mailmap to handle a caller uninterested in repo abbreviation

The only such a caller builtin-blame.c would pass NULL as the place
where to store the abbreviation.

Signed-off-by: Alex Riesen <053ce55f4869b7f450d1d77b8f162c6f2bb9e137@gmail.com>
Signed-off-by: Junio C Hamano <dc50d1021234060e53ec42a77d526afa2fe07479@cox.net>

--- mailmap.c
+++ mailmap.c
@@ -16,6 +16,9 @@
 			static const char abbrev[] = "# repo-abbrev:";
 			int abblen = sizeof(abbrev) - 1;
 			int len = strlen(buffer);
+
+			if (!repo_abbrev)
+				continue;

 			if (len && buffer[len - 1] == '\n')
 				buffer[--len] = 0;


refactor towards getting disk service_time

--- src/os/solaris/solaris_sigar.c
+++ src/os/solaris/solaris_sigar.c
@@ -1569,8 +1569,9 @@
     return SIGAR_OK;
 }

-int sigar_disk_usage_get(sigar_t *sigar, const char *name,
-                         sigar_disk_usage_t *disk)
+
+static int sigar_kstat_disk_usage_get(sigar_t *sigar, const char *name,
+                                      sigar_disk_usage_t *disk)
 {
     kstat_t *ksp;

@@ -1592,7 +1593,65 @@
         }
     }

-    return ENOENT;
+    return ENXIO;
+}
+
+static int simple_hash(const char *s)
+{
+    int hash = 0;
+    while (*s) {
+        hash = 31*hash + *s++;
+    }
+    return hash;
+}
+
+int sigar_disk_usage_get(sigar_t *sigar, const char *name,
+                         sigar_disk_usage_t *disk)
+{
+    int status;
+    iodev_t *iodev;
+    sigar_cache_entry_t *ent;
+    sigar_uint64_t id;
+
+    if (!sigar->fsdev) {
+        if (create_fsdev_cache(sigar) != SIGAR_OK) {
+            return SIGAR_OK;
+        }
+    }
+
+    if (*name == '/') {
+        struct stat sb;
+
+        if (stat(name, &sb) < 0) {
+            return errno;
+        }
+
+        id = SIGAR_FSDEV_ID(sb);
+        ent = sigar_cache_get(sigar->fsdev, id);
+        if (ent->value == NULL) {
+            return ENXIO;
+        }
+        iodev = (iodev_t *)ent->value;
+        status = sigar_kstat_disk_usage_get(sigar, iodev->name, disk);
+    }
+    else {
+        status = sigar_kstat_disk_usage_get(sigar, name, disk);
+        if (status != SIGAR_OK) {
+            return status;
+        }
+        id = simple_hash(name); /*XXX*/
+        ent = sigar_cache_get(sigar->fsdev, id);
+        if (ent->value) {
+            iodev = (iodev_t *)ent->value;
+        }
+        else {
+            ent->value = iodev = malloc(sizeof(*iodev));
+            SIGAR_SSTRCPY(iodev->name, name);
+            SIGAR_DISK_STATS_INIT(&iodev->disk);
+        }
+    }
+
+    return status;
 }

 int sigar_file_system_usage_get(sigar_t *sigar,
@@ -1600,9 +1659,6 @@
                                 sigar_file_system_usage_t *fsusage)
 {
     struct statvfs buf;
-    struct stat sb;
-    sigar_cache_entry_t *ent;
-    iodev_t *iodev;

     if (statvfs(dirname, &buf) != 0) {
         return errno;
@@ -1616,23 +1672,7 @@
     fsusage->free_files = buf.f_ffree;
     fsusage->use_percent = sigar_file_system_usage_calc_used(sigar, fsusage);

-    SIGAR_DISK_STATS_NOTIMPL(fsusage);
-
-    if (!sigar->fsdev) {
-        if (create_fsdev_cache(sigar) != SIGAR_OK) {
-            return SIGAR_OK;
-        }
-    }
-
-    if (stat(dirname, &sb) < 0) {
-        return SIGAR_OK;
-    }
-    ent = sigar_cache_get(sigar->fsdev, SIGAR_FSDEV_ID(sb));
-    if (ent->value == NULL) {
-        return SIGAR_OK;
-    }
-    iodev = (iodev_t *)ent->value;
-    sigar_disk_usage_get(sigar, iodev->name, &fsusage->disk);
+    sigar_disk_usage_get(sigar, dirname, &fsusage->disk);

     return SIGAR_OK;
 }


fix -Wreorder warning

fix -Wreorder warning

--- src/osgPlugins/dxf/dxfEntity.h
+++ src/osgPlugins/dxf/dxfEntity.h
@@ -78,13 +78,13 @@
 protected:
     std::string    _layer;
     unsigned short    _color;
-    double  _lineWidth;
-    double  _lineThickness;

     bool _useAccuracy;          // true to specify a maximum deviation for curve rendering
     double _maxError;         // the error in model units, if _useAccuracy==true
     bool _improveAccuracyOnly;// if true only use _maxError where it would increase the quality of curves compared to the previous algorithm

+    double  _lineWidth;
+    double  _lineThickness;
 };


Attempt to fix bogus gcc -Wall warnings reported by Marc-Andre Lemburg, by making the DUP_TOPX code utterly straightforward.  This also gets rid of all normal-case internal DUP_TOPX if/branches, and allows replacing one POP() with TOP() in each case, so is a good idea regardless.

--- Python/ceval.c
+++ Python/ceval.c
@@ -708,49 +708,79 @@

 		case DUP_TOPX:
 			switch (oparg) {
+			case 1:
+				x = TOP();
+				Py_INCREF(x);
+				PUSH(x);
+				continue;
+			case 2:
+				x = POP();
+				Py_INCREF(x);
+				w = TOP();
+				Py_INCREF(w);
+				PUSH(x);
+				PUSH(w);
+				PUSH(x);
+				continue;
+			case 3:
+				x = POP();
+				Py_INCREF(x);
+				w = POP();
+				Py_INCREF(w);
+				v = TOP();
+				Py_INCREF(v);
+				PUSH(w);
+				PUSH(x);
+				PUSH(v);
+				PUSH(w);
+				PUSH(x);
+				continue;
+			case 4:
+				x = POP();
+				Py_INCREF(x);
+				w = POP();
+				Py_INCREF(w);
+				v = POP();
+				Py_INCREF(v);
+				u = TOP();
+				Py_INCREF(u);
+				PUSH(v);
+				PUSH(w);
+				PUSH(x);
+				PUSH(u);
+				PUSH(v);
+				PUSH(w);
+				PUSH(x);
+				continue;
 			case 5:
-			case 4:
-			case 3:
-			case 2:
-			case 1:
 				x = POP();
-				if (oparg == 1) break;
+				Py_INCREF(x);
 				w = POP();
-				if (oparg == 2) break;
+				Py_INCREF(w);
 				v = POP();
-				if (oparg == 3) break;
+				Py_INCREF(v);
 				u = POP();
-				if (oparg == 4) break;
-				t = POP();
-				break;
+				Py_INCREF(u);
+				t = TOP();
+				Py_INCREF(t);
+				PUSH(u);
+				PUSH(v);
+				PUSH(w);
+				PUSH(x);
+				PUSH(t);
+				PUSH(u);
+				PUSH(v);
+				PUSH(w);
+				PUSH(x);
+				continue;
 			default:
 				fprintf(stderr, "Invalid argument to DUP_TOPX: %d!\n", oparg);
 				PyErr_SetString(PyExc_SystemError,
 					"invalid argument to DUP_TOPX");
 				x = NULL;
-			}
-			if (x == NULL)
 				break;
-			switch (oparg) {
-			case 5: PUSH(t);
-				Py_INCREF(t); /* Fallthrough */
-			case 4: PUSH(u);
-				Py_INCREF(u); /* Fallthrough */
-			case 3: PUSH(v);
-				Py_INCREF(v); /* Fallthrough */
-			case 2: PUSH(w);
-				Py_INCREF(w); /* Fallthrough */
-			case 1: PUSH(x);
-				Py_INCREF(x); /* Fallthrough */
-			}
-			switch (oparg) {
-			case 5: PUSH(t); /* Fallthrough */
-			case 4: PUSH(u); /* Fallthrough */
-			case 3: PUSH(v); /* Fallthrough */
-			case 2: PUSH(w); /* Fallthrough */
-			case 1: PUSH(x); /* Fallthrough */
-			}
-			continue;
+			}
+			break;

 		case UNARY_POSITIVE:
 			v = POP();


core: unpack: Regenerate pack index after unpacking

--- src/ostree/ot-builtin-unpack.c
+++ src/ostree/ot-builtin-unpack.c
@@ -275,6 +275,9 @@
       g_print ("Deleted packfile '%s'\n", pack_checksum);
     }

+  if (!ostree_repo_regenerate_pack_index (repo, cancellable, error))
+    goto out;
+
   ret = TRUE;
  out:
   if (in_transaction)


Initial commit

Initial commit

--- RASDemo/Main.c
+++ RASDemo/Main.c
@@ -155,6 +155,16 @@
 	else //down
 		arm_pos-= 0.01f;

+	if (arm_pos>10.0f)
+	{
+		arm_pos=10.0f;
+	}
+
+	else if (arm_pos< 0.0f)
+	{
+		arm_pos=0.0f;
+	}
+
 	SetMotor(Arm, arm_pos);

 }


Fix g_type_class_add_private() documentation

This fixes commit 81e2aa941bbfd02bf1b6235da12834d282ceda0c

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=614185

--- gobject/gtype.c
+++ gobject/gtype.c
@@ -4373,12 +4373,52 @@
  * the type and all of its parent types are allocated
  * sequentially in the same memory block as the public
  * structures. This function should be called in the
+ * type's class_init() function. The private structure can
+ * be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro.
+ * The following example shows attaching a private structure
+ * <structname>MyObjectPrivate</structname> to an object
+ * <structname>MyObject</structname> defined in the standard GObject
+ * fashion.
  * type's class_init() function.
  *
- * The private structure can be retrieved using the
- * G_TYPE_CLASS_GET_PRIVATE() macro.
-
- * Since: 2.24
+ * |[
+ * typedef struct _MyObject        MyObject;
+ * typedef struct _MyObjectPrivate MyObjectPrivate;
+ *
+ * struct _MyObject {
+ *  GObject parent;
+ *
+ *  MyObjectPrivate *priv;
+ * };
+ *
+ * struct _MyObjectPrivate {
+ *   int some_field;
+ * };
+ *
+ * static void
+ * my_object_class_init (MyObjectClass *klass)
+ * {
+ *   g_type_class_add_private (klass, sizeof (MyObjectPrivate));
+ * }
+ *
+ * static void
+ * my_object_init (MyObject *my_object)
+ * {
+ *   my_object->priv = G_TYPE_INSTANCE_GET_PRIVATE (my_object,
+ *                                                  MY_TYPE_OBJECT,
+ *                                                  MyObjectPrivate);
+ * }
+ *
+ * static int
+ * my_object_get_some_field (MyObject *my_object)
+ * {
+ *   MyObjectPrivate *priv = my_object->priv;
+ *
+ *   return priv->some_field;
+ * }
+ * ]|
+ *
+ * Since: 2.4
  */
 void
 g_type_class_add_private (gpointer g_class,


In cfg_setopt, do not lose the old value if the new value fails to parse.

Especially do not free val->string and leave the pointer on ->parsecb
failure, causing a double free later.

Signed-off-by: Peter Rosin <3a0ad89228e0bf11d9bd43fb0f453cf9d7ca9376@lysator.liu.se>

--- src/confuse.c
+++ src/confuse.c
@@ -632,11 +632,10 @@
             {
                 if((*opt->parsecb)(cfg, opt, value, &i) != 0)
                     return 0;
-                val->number = i;
             }
             else
             {
-                val->number = strtol(value, &endptr, 0);
+                i = strtol(value, &endptr, 0);
                 if(*endptr != '\0')
                 {
                     cfg_error(cfg, _("invalid integer value for option '%s'"),
@@ -651,6 +650,7 @@
                     return 0;
                 }
             }
+            val->number = i;
             break;

         case CFGT_FLOAT:
@@ -658,11 +658,10 @@
             {
                 if((*opt->parsecb)(cfg, opt, value, &f) != 0)
                     return 0;
-                val->fpnumber = f;
             }
             else
             {
-                val->fpnumber = strtod(value, &endptr);
+                f = strtod(value, &endptr);
                 if(*endptr != '\0')
                 {
                     cfg_error(cfg,
@@ -678,19 +677,20 @@
                     return 0;
                 }
             }
+            val->fpnumber = f;
             break;

         case CFGT_STR:
-            free(val->string);
             if(opt->parsecb)
             {
                 s = 0;
                 if((*opt->parsecb)(cfg, opt, value, &s) != 0)
                     return 0;
-                val->string = strdup(s);
             }
             else
-                val->string = strdup(value);
+                s = value;
+            free(val->string);
+            val->string = strdup(s);
             break;

         case CFGT_SEC:


Tweak meta counter messages.

Tweak meta counter messages.

--- src/counter.c
+++ src/counter.c
@@ -82,14 +82,14 @@
 	{
 		logp("Files:                     %llu\n", c->filecounter);
 		pcounter("Encrypted files:           %llu\n", c->encryptedcounter);
-		logp("Meta data:                 %llu\n", c->metadatacounter);
+		pcounter("Meta data:                 %llu\n", c->metadatacounter);
 		pcounter("Encrypted meta data:       %llu\n", c->encmetadatacounter);
 	}
 	else if(act==ACTION_VERIFY)
 	{
 		logp("Verified files:            %llu\n", c->filecounter);
 		pcounter("Verified encrypted files:  %llu\n", c->encryptedcounter);
-		logp("Verified meta data:        %llu\n", c->metadatacounter);
+		pcounter("Verified meta data:        %llu\n", c->metadatacounter);
 		pcounter("Verified encrypted meta:   %llu\n", c->encmetadatacounter);
 	}
 	else


src: change chunk size to 1 GiB

src: change chunk size to 1 GiB

--- src/cowsync.c
+++ src/cowsync.c
@@ -18,7 +18,22 @@
 #include <unistd.h>

-#define CHUNK_SIZE (1024 * 1024 * 1024)
+/* TODO: fix serialization of mlock(2) calls
+ * (1) use threads to do the mlocks simultaneously
+ * (2) ditch mlock and rely on MADV_SEQUENTIAL
+ * (3) mlock with interleaved 1MB blocks until the while 1GB is locked
+ *     (and hope that this actually does both IO's at once; unlikely)
+ */
+
+/* alternative plan:
+ * use asynchronous reads (read into local memory)
+ * and use poll(3) or something
+ */
+
+/* TODO: show average rate and ETA */
+
+
+#define CHUNK_SIZE (100 * 1024 * 1024)
 #define BLOCK_SIZE 4096
 #define STAT_FREQ  (1024 * 1024)


Adding more maths symbols

Adding more maths symbols

--- src/plugins/maths-mode/maths.c
+++ src/plugins/maths-mode/maths.c
@@ -32,23 +32,54 @@

 /* specific Maths commands */
 static CmdDef maths_commands[] = {
+
+    CMD1( KEY_META('a'), KEY_NONE, "math-alpha", do_char,             L'α')
+    CMD1( KEY_META('b'), KEY_NONE, "math-beta", do_char,              L'β')
+
+    CMD1( KEY_META('d'), KEY_NONE, "math-differential", do_char,      L'∂')
+    CMD1( KEY_META('D'), KEY_NONE, "math-delta-u", do_char,           L'Δ')
+
+    CMD1( KEY_META('g'), KEY_NONE, "math-gamma", do_char,             L'γ')
+    CMD1( KEY_META('t'), KEY_NONE, "math-theta", do_char,             L'ϴ')
+    CMD1( KEY_META('o'), KEY_NONE, "math-omega", do_char,             L'Ω')
+
+    CMD1( KEY_META('m'), KEY_NONE, "math-micro", do_char,             L'µ')
+
+    CMD1( KEY_META('r'), KEY_NONE, "math-real", do_char,              L'ℝ')
+    CMD1( KEY_META('c'), KEY_NONE, "math-complex", do_char,           L'ℂ')
+    CMD1( KEY_META('n'), KEY_NONE, "math-natural", do_char,           L'ℕ')
+
     CMD1( KEY_META('s'), KEY_NONE, "math-sqrt", do_char,              L'√')
-    CMD1( KEY_META('S'), KEY_NONE, "math-cube-root", do_char,         L'∛')
+    CMD1( KEY_NONE,      KEY_NONE, "math-cube-root", do_char,         L'∛')
+    CMD1( KEY_META('S'), KEY_NONE, "math-summation", do_char,         L'∏')
+
     CMD1( KEY_META('i'), KEY_NONE, "math-integral", do_char,          L'∫')
-    CMD1( KEY_META('a'), KEY_NONE, "math-angle", do_char,             L'∠')
-    CMD1( KEY_META('o'), KEY_NONE, "math-omega", do_char,             L'Ω')
+    CMD1( KEY_META('A'), KEY_NONE, "math-angle", do_char,             L'∠')
     CMD1( KEY_META('p'), KEY_NONE, "math-pi", do_char,                L'π')
-    CMD1( KEY_META('+'), KEY_NONE, "math-sigma", do_char,             L'∑')
+    CMD1( KEY_META('P'), KEY_NONE, "math-prime", do_char,             L'′')
+
+    CMD1( KEY_META('+'), KEY_NONE, "math-summation", do_char,         L'∑')
+    CMD1( KEY_META('='), KEY_NONE, "math-plus-minus", do_char,        L'±')
+
     CMD1( KEY_META('8'), KEY_NONE, "math-infinity", do_char,          L'∞')
     CMD1( KEY_META('('), KEY_NONE, "math-epsilon-l", do_char,         L'ϵ')
     CMD1( KEY_META(')'), KEY_NONE, "math-epsilon-r", do_char,         L'϶')
-    CMD1( KEY_META('t'), KEY_NONE, "math-theta", do_char,             L'ϴ')
+    CMD1( KEY_META('9'), KEY_NONE, "math-subset", do_char,            L'⊂')
+    CMD1( KEY_META('0'), KEY_NONE, "math-superset", do_char,          L'⊃')
+    CMD1( KEY_META('e'), KEY_NONE, "math-empyset", do_char,           L'∅')
+
+    CMD1( KEY_META('u'), KEY_NONE, "math-union", do_char,             L'∪')
+    CMD1( KEY_META('U'), KEY_NONE, "math-intersection", do_char,      L'∩')
+
+    CMD1( KEY_META('&'), KEY_NONE, "math-and", do_char,               L'∧')
+    CMD1( KEY_META('7'), KEY_NONE, "math-or", do_char,                L'∨')
+
     CMD1( KEY_META('T'), KEY_NONE, "math-therefore", do_char,         L'∴')
     CMD1( KEY_META('/'), KEY_NONE, "math-div", do_char,               L'÷')
-    CMD1( KEY_NONE,      KEY_NONE, "math-cross", do_char,             L'⨯')
+    CMD1( KEY_META('x'), KEY_NONE, "math-cross", do_char,             L'⨯')
     CMD1( KEY_NONE,      KEY_NONE, "math-degree", do_char,            L'°')
     CMD1( KEY_META('*'), KEY_NONE, "math-dot", do_char,               L'∙')
-
+
     CMD1( KEY_META('1'), KEY_NONE, "math-sub-1", do_char,             L'₁')
     CMD1( KEY_META('2'), KEY_NONE, "math-sup-2", do_char,             L'²')
     CMD1( KEY_META('3'), KEY_NONE, "math-sup-3", do_char,             L'³')
@@ -62,9 +93,10 @@
     CMD1( KEY_META('_'), KEY_NONE, "math-horz-bar", do_char,          L'―')

     // XXX: Doing this messes up the cursor position becuase we are not taking
-    // combined chars into account when doing utf8 length
+    // combined chars into account when doing utf8 length. Makes everything off
+    // by one
     CMD1( KEY_META('h'), KEY_NONE, "math-vector-arrow", do_char,      0x20D7)// x⃗
-    // XXX: can not meta with arrow keys
+
     CMD1( KEY_META(KEY_UP), KEY_NONE, "math-up-arrow", do_char,       L'⭡')
     CMD1( KEY_META(KEY_DOWN), KEY_NONE, "math-down-arrow", do_char,   L'⭣')
     CMD1( KEY_META(KEY_LEFT), KEY_NONE, "math-left-arrow", do_char,   L'⭠')


Be more like grep, optional read from a file, always print to stdout

--- src/csvgrep.c
+++ src/csvgrep.c
@@ -24,7 +24,6 @@

 static struct {
 	FILE* source;
-	FILE* target;
 	char separator;
 	char newline[2];
 	size_t newline_length;
@@ -77,7 +76,7 @@
 		}
 	}
 	if (config.count_only) {
-		fprintf(config.target, "%llu\n", _count);
+		fprintf(stdout, "%llu\n", _count);
 	}
 	if (_tokenizer != NULL) {
 		free_tokenizer(_tokenizer);
@@ -119,16 +118,17 @@
 }

 static void print_help() {
+	fprintf(stderr,"usage: csvgrep [OPTIONS] [FILE]");
 	fprintf(stderr, "-s ,\n");
-	fprintf(stderr, "  Which character to use as separator (default is ,)\n");
+	fprintf(stderr, "\tWhich character to use as separator (default is ,)\n");
 	fprintf(stderr, "-p column/pattern/\n");
-	fprintf(stderr, "  Multiple -p are allowed, they work as an AND \n");
-	fprintf(stderr, "-c \n");
-	fprintf(stderr, "  Only count the rows that match\n");
-	fprintf(stderr, "-o \n");
-	fprintf(stderr, " Make the match into an OR, changes the behavior of -p and -v\n");
-	fprintf(stderr, "-v \n");
-	fprintf(stderr, " Print only the rows that did not match all patterns\n");
+	fprintf(stderr, "\tMultiple -p are allowed, they work as an AND \n");
+	fprintf(stderr, "-c\n");
+	fprintf(stderr, "\tOnly count the rows that match\n");
+	fprintf(stderr, "-o\n");
+	fprintf(stderr, "\tMake the match into an OR, changes the behavior of -p and -v\n");
+	fprintf(stderr, "-v\n");
+	fprintf(stderr, "\tPrint only the rows that did not match all patterns\n");
 }

 static struct {
@@ -140,7 +140,6 @@

 static void parse_config(int argc, char** argv) {
 	config.source = stdin;
-	config.target = stdout;
 	config.separator = ',';
 	config.count_only = false;
 	config.negative = false;
@@ -185,6 +184,13 @@
 				break;
 		}
 	}
+	if (optind < argc) {
+		config.source = fopen(argv[optind], "r");
+		if (!config.source) {
+			fprintf(stderr, "Could not open file %s for reading\n", argv[optind]);
+			exit(1);
+		}
+	}

 	if (half_config.n_patterns == 0) {
 		fprintf(stderr, "You should at least provide one pattern\n");
@@ -205,9 +211,9 @@
 		if (!config.count_only) {
 			// also immediatly print the header
 			if (current_cell != _cells) {
-				fwrite(&(config.separator),sizeof(char),1, config.target);
-			}
-			fwrite(current_cell->start, sizeof(char), current_cell->length, config.target);
+				fwrite(&(config.separator),sizeof(char),1, stdout);
+			}
+			fwrite(current_cell->start, sizeof(char), current_cell->length, stdout);
 		}
 		current_cell++;
 	}
@@ -221,7 +227,7 @@
 		config.newline_length = 2;
 	}
 	if (!config.count_only) {
-		fwrite(config.newline, sizeof(char), config.newline_length, config.target);
+		fwrite(config.newline, sizeof(char), config.newline_length, stdout);
 	}

 	config.patterns = calloc(sizeof(Regex),config.column_count);
@@ -303,12 +309,12 @@
 					}
 					else {
 						if (first_line && _half_line) {
-							fwrite(_prev_line, sizeof(char), _prev_line_length, config.target);
+							fwrite(_prev_line, sizeof(char), _prev_line_length, stdout);
 							first_line = false;
 							_prev_line_length = 0;
 						}
-						fwrite(current_line_start, sizeof(char), current_line_length, config.target);
-						fwrite(config.newline, sizeof(char), config.newline_length, config.target);
+						fwrite(current_line_start, sizeof(char), current_line_length, stdout);
+						fwrite(config.newline, sizeof(char), config.newline_length, stdout);
 					}
 				}
 				if (first_line) {


*  FASTSPI_READ_RAM_LE(p,a,c,n) for completeness.


vm: initialize nil reg with nilreg()

vm: initialize nil reg with nilreg()

--- src/cvm/cvm.h
+++ src/cvm/cvm.h
@@ -558,8 +558,9 @@

     void instcall(const DabValue &recv, dab_symbol_t symbol, size_t n_args,
                   dab_symbol_t block_symbol = DAB_SYMBOL_NIL, const DabValue &capture = nullptr,
-                  dab_register_t outreg = -1, std::vector<dab_register_t> reglist = {},
-                  DabValue *return_value = nullptr, size_t stack_pos = 0);
+                  dab_register_t              outreg  = dab_register_t::nilreg(),
+                  std::vector<dab_register_t> reglist = {}, DabValue *return_value = nullptr,
+                  size_t stack_pos = 0);

     DabClass &define_builtin_class(const std::string &name, dab_class_t class_index,
                                    dab_class_t superclass_index = CLASS_OBJECT);


vm: fix dab_class_t usage in DabFunctionReflection

--- src/cvm/cvm.h
+++ src/cvm/cvm.h
@@ -32,7 +32,7 @@
 struct DabFunctionReflection
 {
     std::vector<std::string> arg_names;
-    std::vector<size_t>      arg_klasses;
+    std::vector<dab_class_t> arg_klasses;
     size_t                   ret_klass;
 };


module_dns: null -> empty list on ICMPs (complete)

Missed a code path with the previous commit.

--- src/probe_modules/module_dns.c
+++ src/probe_modules/module_dns.c
@@ -987,10 +987,10 @@
 		fs_add_null(fs, "dns_nscount");
 		fs_add_null(fs, "dns_arcount");

-		fs_add_null(fs, "dns_questions");
-		fs_add_null(fs, "dns_answers");
-		fs_add_null(fs, "dns_authorities");
-		fs_add_null(fs, "dns_additionals");
+		fs_add_repeated(fs, "dns_questions", fs_new_repeated_fieldset());
+		fs_add_repeated(fs, "dns_answers", fs_new_repeated_fieldset());
+		fs_add_repeated(fs, "dns_authorities", fs_new_repeated_fieldset());
+		fs_add_repeated(fs, "dns_additionals", fs_new_repeated_fieldset());

 		fs_add_uint64(fs, "dns_unconsumed_bytes", 0);
 		fs_add_uint64(fs, "dns_parse_err", 1);


sampling timer better restart

sampling timer better restart

--- src/profiler/sampling/sample.c
+++ src/profiler/sampling/sample.c
@@ -97,6 +97,11 @@

 int start_profiler(int interval) {
 	int i;
+
+	if (is_running) {
+		stop_profiler();
+	}
+
 	is_running = true;
 	pow[0] = 1, hash_array[0] = 0;
 	for (i = 1; i < SAMPLE_HASH_SIZE; i++) {


[Core/General] added optional dynamic allocation of cartridge/CD hardware buffer (continued)

--- core/loadrom.c
+++ core/loadrom.c
@@ -531,6 +531,14 @@
 {
   int i, size;

+#ifdef USE_DYNAMIC_ALLOC
+  /* allocate memory for Cartridge /CD hardware buffer if required */
+  if (ext == NULL)
+  {
+    ext = (external_t *)malloc(sizeof(external_t));
+  }
+#endif
+
   /* clear any existing patches */
   ggenie_shutdown();
   areplay_shutdown();


fix streams log too

fix streams log too

--- libs/system/include/mrpt/system/COutputLogger.h
+++ libs/system/include/mrpt/system/COutputLogger.h
@@ -233,7 +233,8 @@

 	bool isLoggingLevelVisible(VerbosityLevel level) const
 	{
-		return m_min_verbosity_level <= level;
+		return (m_min_verbosity_level <= level) ||
+			(m_min_verbosity_level_callbacks <= level);
 	}

 	/** Fill the provided string with the contents of the logger's history in
@@ -401,9 +402,7 @@
 	do                                                                         \
 	{                                                                          \
 		if (this->isLoggingLevelVisible(_LVL))                                 \
-		{                                                                      \
-			this->logFmt(_LVL, _FMT_STRING, __VA_ARGS__);                      \
-		}                                                                      \
+		{ this->logFmt(_LVL, _FMT_STRING, __VA_ARGS__); }                      \
 	} while (0)

 #define INTERNAL_MRPT_LOG_STREAM(_LVL, __CONTENTS)                             \


file: fix multiple calls to open/save

file: fix multiple calls to open/save

--- bin/file.c
+++ bin/file.c
@@ -14,8 +14,13 @@
 static void
 _fs_show(Editor *ed)
 {
+   if (inwin_id_is(ed, INWIN_FILE_SELECTOR))
+     inwin_activate(ed);
+   else
+     inwin_set(ed, ed->fs,
+               INWIN_FILE_SELECTOR,
+               NULL, NULL, NULL, NULL);
    evas_object_show(ed->fs);
-   inwin_set(ed, ed->fs, INWIN_FILE_SELECTOR, NULL, NULL, NULL, NULL);
 }

 static void


doh!  forgot to commit this, which wasn't very sensible.

--- groups_parser.c
+++ groups_parser.c
@@ -1,6 +1,7 @@
+/* -*- mode: c; c-file-style: "elvin" -*- */
 /***************************************************************

-  Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 1999-2000.
+  Copyright (C) DSTC Pty Ltd (ACN 052 372 577) 1999-2002.
   Unpublished work.  All Rights Reserved.

   The software contained on this media is the property of the
@@ -28,7 +29,7 @@
 ****************************************************************/

 #ifndef lint
-static const char cvsid[] = "$Id: groups_parser.c,v 1.26 2002/07/02 15:19:22 phelps Exp $";
+static const char cvsid[] = "$Id: groups_parser.c,v 1.27 2002/07/04 06:55:47 arnold Exp $";
 #endif /* lint */

 #ifdef HAVE_CONFIG_H
@@ -205,6 +206,9 @@
 				 ELVIN_KEY_SHA1_DUAL_PRODUCER_INDEX,
 				 self -> private_keys[i],
 				 self -> private_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                 NULL,
+#endif
 				 NULL))
 	    {
 		return -1;
@@ -222,6 +226,9 @@
 				     ELVIN_KEY_SHA1_DUAL_CONSUMER_INDEX,
 				     self -> public_keys[i],
 				     self -> public_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                     NULL,
+#endif
 				     NULL))
 		{
 		    return -1;
@@ -234,6 +241,9 @@
 				 ELVIN_KEY_SHA1_CONSUMER_INDEX,
 				 self -> public_keys[i],
 				 self -> public_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                 NULL,
+#endif
 				 NULL))
 	    {
 		return -1;
@@ -249,6 +259,9 @@
 				 ELVIN_KEY_SHA1_DUAL_CONSUMER_INDEX,
 				 self -> private_keys[i],
 				 self -> private_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                 NULL,
+#endif
 				 NULL))
 	    {
 		return -1;
@@ -266,6 +279,9 @@
 				     ELVIN_KEY_SHA1_DUAL_PRODUCER_INDEX,
 				     self -> public_keys[i],
 				     self -> public_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                     NULL,
+#endif
 				     NULL))
 		{
 		    return -1;
@@ -278,6 +294,9 @@
 				 ELVIN_KEY_SHA1_PRODUCER_INDEX,
 				 self -> public_keys[i],
 				 self -> public_key_lengths[i],
+#if defined(ELVIN_VERSION_AT_LEAST)
+                                 NULL,
+#endif
 				 NULL))
 	    {
 		return -1;


Fixed to close the graphics file when we are done writing too it

svn path=/trunk/; revision=7163


Added setting of _gst_debug_cothread_index for debugging

Original commit message from CVS:
Added setting of _gst_debug_cothread_index for debugging

--- gst/cothreads.c
+++ gst/cothreads.c
@@ -618,6 +618,8 @@
 	    ctx->current, thread->cothreadnum);
   ctx->current = thread->cothreadnum;

+  g_static_private_set (&_gst_debug_cothread_index, (void *)ctx->current, NULL);
+
   /* save the current stack pointer, frame pointer, and pc */
 #ifdef GST_ARCH_PRESETJMP
   GST_ARCH_PRESETJMP ();


preset: implement child_proxy support

preset: implement child_proxy support

Elements such as the GstIirEqualizerNBands would so far not store the properties
of their children. Now we also grab the properties of child elements and try to
restore them.

--- gst/gstpreset.c
+++ gst/gstpreset.c
@@ -55,10 +55,6 @@
  *      wide
  *     - can we use a lock inside a names shared memory segment?
  *
- * - need to add support for GstChildProxy
- *   we can do this in a next iteration, the format is flexible enough
- *   http://www.buzztard.org/index.php/Preset_handling_interface
- *
  * - should there be a 'preset-list' property to get the preset list
  *   (and to connect a notify:: to to listen for changes)
  *   we could use gnome_vfs_monitor_add() to monitor the user preset_file.
@@ -66,33 +62,14 @@
  * - should there be a 'preset-name' property so that we can set a preset via
  *   gst-launch, or should we handle this with special syntax in gst-launch:
  *   gst-launch element preset:<preset-name> property=value ...
- *   - this would alloow to hanve preset-bundles too (a preset on bins that
+ *   - this would allow to have preset-bundles too (a preset on bins that
  *     specifies presets for children
- *
- * - GstChildProxy suport
- *   - if we stick with GParamSpec **_list_properties()
- *     we need to use g_param_spec_set_qdata() to specify the instance on each GParamSpec
- *     OBJECT_LOCK(obj);  // ChildProxy needs GstIterator support
- *     num=gst_child_proxy_get_children_count(obj);
- *     for(i=0;i<num;i++) {
- *       child=gst_child_proxy_get_child_by_index(obj,i);
- *       // v1 ----
- *       g_object_class_list_properties(child,&num);
- *       // foreach prop
- *       //   g_param_spec_set_qdata(prop, quark, (gpointer)child);
- *       //   add to result
- *       // v2 ----
- *       // children have to implement preset-iface too tag the returned GParamSpec* with the owner
- *       props=gst_preset_list_properties(child);
- *       // add props to result
- *     }
- *     OBJECT_UNLOCK(obj);
- *
  */

 #include "gst_private.h"

 #include "gstpreset.h"
+#include "gstchildproxy.h"
 #include "gstinfo.h"
 #include "gstvalue.h"

@@ -119,7 +96,7 @@

 /*static GQuark property_list_quark = 0;*/

-/* the application can set a custom path that is checked in addition to standart
+/* the application can set a custom path that is checked in addition to standard
  * system and user dirs. This helps to develop new presets first local to the
  * application.
  */
@@ -149,7 +126,7 @@
   gchar *preset_path;
   const gchar *element_name;

-  /* we use the element name when we must contruct the paths */
+  /* we use the element name when we must construct the paths */
   element_name = G_OBJECT_TYPE_NAME (preset);
   GST_INFO_OBJECT (preset, "element_name: '%s'", element_name);

@@ -236,7 +213,7 @@

   /* parse version (e.g. 0.10.15.1) to guint64 */
   num = sscanf (str_version, "%u.%u.%u.%u", &major, &minor, &micro, &nano);
-  /* make sure we have atleast "major.minor" */
+  /* make sure we have at least "major.minor" */
   if (num > 1) {
     guint64 version;

@@ -486,42 +463,66 @@
 gst_preset_default_get_property_names (GstPreset * preset)
 {
   GParamSpec **props;
-  guint i, j, n_props;
+  guint i, j = 0, n_props;
   GObjectClass *gclass;
-  gchar **result;
+  gboolean is_child_proxy;
+  gchar **result = NULL;

   gclass = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (preset));
-
-  /* get a list of normal properties.
-   * FIXME, change this for childproxy support. */
+  is_child_proxy = GST_IS_CHILD_PROXY (preset);
+
+  /* get a list of object properties */
   props = g_object_class_list_properties (gclass, &n_props);
-  if (!props)
-    goto no_properties;
-
-  /* allocate array big enough to hold the worst case, including a terminating
-   * NULL pointer. */
-  result = g_new (gchar *, n_props + 1);
-
-  /* now filter out the properties that we can use for presets */
-  GST_DEBUG_OBJECT (preset, "  filtering properties: %u", n_props);
-  for (i = j = 0; i < n_props; i++) {
-    if (preset_skip_property (props[i]))
-      continue;
-
-    /* copy and increment out pointer */
-    result[j++] = g_strdup (props[i]->name);
-  }
-  result[j] = NULL;
-  g_free (props);
-
+  if (props) {
+    /* allocate array big enough to hold the worst case, including a terminating
+     * NULL pointer. */
+    result = g_new (gchar *, n_props + 1);
+
+    /* now filter out the properties that we can use for presets */
+    GST_DEBUG_OBJECT (preset, "  filtering properties: %u", n_props);
+    for (i = 0; i < n_props; i++) {
+      if (preset_skip_property (props[i]))
+        continue;
+      GST_DEBUG_OBJECT (preset, "    using: %s", props[i]->name);
+      result[j++] = g_strdup (props[i]->name);
+    }
+    g_free (props);
+  }
+
+  if (is_child_proxy) {
+    guint c, n_children;
+    GstObject *child;
+
+    n_children = gst_child_proxy_get_children_count ((GstChildProxy *) preset);
+    for (c = 0; c < n_children; c++) {
+      child = gst_child_proxy_get_child_by_index ((GstChildProxy *) preset, c);
+      gclass = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (child));
+
+      props = g_object_class_list_properties (gclass, &n_props);
+      if (props) {
+        /* resize property name array */
+        result = g_renew (gchar *, result, j + n_props + 1);
+
+        /* now filter out the properties that we can use for presets */
+        GST_DEBUG_OBJECT (preset, "  filtering properties: %u", n_props);
+        for (i = 0; i < n_props; i++) {
+          if (preset_skip_property (props[i]))
+            continue;
+          GST_DEBUG_OBJECT (preset, "    using: %s::%s",
+              GST_OBJECT_NAME (child), props[i]->name);
+          result[j++] = g_strdup_printf ("%s::%s", GST_OBJECT_NAME (child),
+              props[i]->name);
+        }
+        g_free (props);
+      }
+    }
+  }
+  if (!result) {
+    GST_INFO_OBJECT (preset, "object has no properties");
+  } else {
+    result[j] = NULL;
+  }
   return result;
-
-  /* ERRORS */
-no_properties:
-  {
-    GST_INFO_OBJECT (preset, "object has no properties");
-    return NULL;
-  }
 }

 /* load the presets of @name for the instance @preset. Returns %FALSE if something
@@ -533,6 +534,7 @@
   gchar **props;
   guint i;
   GObjectClass *gclass;
+  gboolean is_child_proxy;

   /* get the presets from the type */
   if (!(presets = preset_get_keyfile (preset)))
@@ -549,13 +551,14 @@
     goto no_properties;

   gclass = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (preset));
+  is_child_proxy = GST_IS_CHILD_PROXY (preset);

   /* for each of the property names, find the preset parameter and try to
    * configure the property with its value */
   for (i = 0; props[i]; i++) {
     gchar *str;
     GValue gvalue = { 0, };
-    GParamSpec *property;
+    GParamSpec *property = NULL;

     /* check if we have a settings for this element property */
     if (!(str = g_key_file_get_value (presets, name, props[i], NULL))) {
@@ -567,8 +570,12 @@
     GST_DEBUG_OBJECT (preset, "setting value '%s' for property '%s'", str,
         props[i]);

-    /* FIXME, change for childproxy to get the property and element.  */
-    if (!(property = g_object_class_find_property (gclass, props[i]))) {
+    if (is_child_proxy) {
+      gst_child_proxy_lookup ((GstObject *) preset, props[i], NULL, &property);
+    } else {
+      property = g_object_class_find_property (gclass, props[i]);
+    }
+    if (!property) {
       /* the parameter was in the keyfile, the element said it supported it but
        * then the property was not found in the element. This should not happen. */
       GST_WARNING_OBJECT (preset, "property '%s' not in object", props[i]);
@@ -580,8 +587,11 @@
      * the object property */
     g_value_init (&gvalue, property->value_type);
     if (gst_value_deserialize (&gvalue, str)) {
-      /* FIXME, change for childproxy support */
-      g_object_set_property (G_OBJECT (preset), props[i], &gvalue);
+      if (is_child_proxy) {
+        gst_child_proxy_set_property ((GstObject *) preset, props[i], &gvalue);
+      } else {
+        g_object_set_property ((GObject *) preset, props[i], &gvalue);
+      }
     } else {
       GST_WARNING_OBJECT (preset,
           "deserialization of value '%s' for property '%s' failed", str,
@@ -701,6 +711,7 @@
   gchar **props;
   guint i;
   GObjectClass *gclass;
+  gboolean is_child_proxy;

   GST_INFO_OBJECT (preset, "saving new preset: %s", name);

@@ -713,16 +724,21 @@
     goto no_properties;

   gclass = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (preset));
+  is_child_proxy = GST_IS_CHILD_PROXY (preset);

   /* loop over the object properties and store the property value in the
    * keyfile */
   for (i = 0; props[i]; i++) {
     GValue gvalue = { 0, };
     gchar *str;
-    GParamSpec *property;
-
-    /* FIXME, change for childproxy to get the property and element.  */
-    if (!(property = g_object_class_find_property (gclass, props[i]))) {
+    GParamSpec *property = NULL;
+
+    if (is_child_proxy) {
+      gst_child_proxy_lookup ((GstObject *) preset, props[i], NULL, &property);
+    } else {
+      property = g_object_class_find_property (gclass, props[i]);
+    }
+    if (!property) {
       /* the element said it supported the property but then it does not have
        * that property. This should not happen. */
       GST_WARNING_OBJECT (preset, "property '%s' not in object", props[i]);
@@ -730,8 +746,11 @@
     }

     g_value_init (&gvalue, property->value_type);
-    /* FIXME, change for childproxy */
-    g_object_get_property (G_OBJECT (preset), props[i], &gvalue);
+    if (is_child_proxy) {
+      gst_child_proxy_get_property ((GstObject *) preset, props[i], &gvalue);
+    } else {
+      g_object_get_property ((GObject *) preset, props[i], &gvalue);
+    }

     if ((str = gst_value_serialize (&gvalue))) {
       g_key_file_set_string (presets, name, props[i], (gpointer) str);


Fix TCP response indentation

Fix TCP response indentation

--- gstd/gstd_tcp.c
+++ gstd/gstd_tcp.c
@@ -328,7 +328,7 @@
   /* Prepend the code to the output */
   description = gstd_return_code_to_string(ret);
   response =
-      g_strdup_printf ("{\n  \"code\" : %d,\n  \"description\" : \"%s\",\n \"response\" : %s\n}", ret, description,
+      g_strdup_printf ("{\n  \"code\" : %d,\n  \"description\" : \"%s\",\n  \"response\" : %s\n}", ret, description,
       output ? output : "null");
   g_free (output);


move Value to initializer

move Value to initializer

Signed-off-by: Rosen Penev <cd9d359349c2d33dfd3bf458517d943871c7c054@gmail.com>

--- ebml/EbmlId.h
+++ ebml/EbmlId.h
@@ -55,11 +55,10 @@
 class EBML_DLL_API EbmlId {
   public:
     EbmlId(const binary aValue[4], const unsigned int aLength)
-      :Length(aLength)
+      :Value(0)
+      ,Length(aLength)
     {
-      Value = 0;
-      unsigned int i;
-      for (i=0; i<aLength; i++) {
+      for (unsigned int i=0; i<aLength; i++) {
         Value <<= 8;
         Value += aValue[i];
       }


- First and Last enum for fplAudioFormatType - First and Last enum for fplLogLevel

--- final_platform_layer.h
+++ final_platform_layer.h
@@ -3669,12 +3669,12 @@
 	fplLogLevel_Debug = 5,
 	//! Trace
 	fplLogLevel_Trace = 6,
+
+	//! First @ref fplLogLevel
+	fplLogLevel_First = fplLogLevel_All,
+	//! Last @ref fplLogLevel
+	fplLogLevel_Last = fplLogLevel_Trace,
 } fplLogLevel;
-
-//! Defines the first @ref fplLogLevel value
-#define FPL_FIRST_LOGLEVEL fplLogLevel_All
-//! Defines the last @ref fplLogLevel value
-#define FPL_LAST_LOGLEVEL fplLogLevel_Trace

 #if defined(FPL__ENABLE_LOGGING)
 /**
@@ -6123,27 +6123,42 @@

 //! An enumeration of audio results
 typedef enum fplAudioResultType {
+	//! No result
 	fplAudioResultType_None = 0,
+	//! Success
 	fplAudioResultType_Success,
+	//! The audio device is not initialized
 	fplAudioResultType_DeviceNotInitialized,
+	//! The audio device is already stopped
 	fplAudioResultType_DeviceAlreadyStopped,
+	//! The audio device is already started
 	fplAudioResultType_DeviceAlreadyStarted,
+	//! The audio device is busy/waiting
 	fplAudioResultType_DeviceBusy,
+	//! No audio device is found
 	fplAudioResultType_NoDeviceFound,
+	//! Failed to load the audio api
 	fplAudioResultType_ApiFailed,
+	//! The platform is not initialized
 	fplAudioResultType_PlatformNotInitialized,
+	//! The audio driver is already initialized
 	fplAudioResultType_DriverAlreadyInitialized,
+	//! The @ref fplAudioFormatType is not set
 	fplAudioResultType_UnsetAudioFormat,
+	//! The number of audio channels is not set
 	fplAudioResultType_UnsetAudioChannels,
+	//! The sample rate is not set
 	fplAudioResultType_UnsetAudioSampleRate,
+	//! The audio buffer size is not set
 	fplAudioResultType_UnsetAudioBufferSize,
+	//! Unknown error
 	fplAudioResultType_Failed,
+
+	//! First @ref fplAudioResultType
+	fplAudioResultType_First = fplAudioResultType_None,
+	//! Last @ref fplAudioResultType
+	fplAudioResultType_Last = fplAudioResultType_Failed,
 } fplAudioResultType;
-
-//! Defines the first @ref fplAudioResultType value
-#define FPL_FIRST_AUDIO_RESULT_TYPE fplAudioResultType_None
-//! Defines the last @ref fplAudioResultType value
-#define FPL_LAST_AUDIO_RESULT_TYPE fplAudioResultType_Failed

 /**
 * @brief Gets the current audio driver
@@ -6446,7 +6461,7 @@
 #if defined(FPL__ENABLE_LOGGING)
 fpl_globalvar fplLogSettings fpl__global__LogSettings = fplZeroInit;

-#define FPL__LOGLEVEL_COUNT FPL__ENUM_COUNT(FPL_FIRST_LOGLEVEL, FPL_LAST_LOGLEVEL)
+#define FPL__LOGLEVEL_COUNT FPL__ENUM_COUNT(fplLogLevel_First, fplLogLevel_Last)
 fpl_globalvar const char *fpl__LogLevelNameTable[] = {
 	"All", // fplLogLevel_All (-1)
 	"Critical", // fplLogLevel_Critical (0)
@@ -6460,7 +6475,7 @@
 fplStaticAssert(fplArrayCount(fpl__LogLevelNameTable) == FPL__LOGLEVEL_COUNT);

 fpl_internal const char *fpl__LogLevelToString(const fplLogLevel level) {
-	uint32_t index = FPL__ENUM_VALUE_TO_ARRAY_INDEX(level, FPL_FIRST_LOGLEVEL, FPL_LAST_LOGLEVEL);
+	uint32_t index = FPL__ENUM_VALUE_TO_ARRAY_INDEX(level, fplLogLevel_First, fplLogLevel_Last);
 	const char *result = fpl__LogLevelNameTable[index];
 	return(result);
 }
@@ -19456,7 +19471,7 @@
 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #if defined(FPL__ENABLE_AUDIO)

-#define FPL__AUDIO_RESULT_TYPE_COUNT FPL__ENUM_COUNT(FPL_FIRST_AUDIO_RESULT_TYPE, FPL_LAST_AUDIO_RESULT_TYPE)
+#define FPL__AUDIO_RESULT_TYPE_COUNT FPL__ENUM_COUNT(fplAudioResultType_First, fplAudioResultType_Last)
 fpl_globalvar const char *fpl__global_audioResultTypeNameTable[] = {
 	"None", // fplAudioResultType_None = 0,
 	"Success", // fplAudioResultType_Success,
@@ -19477,7 +19492,7 @@
 fplStaticAssert(fplArrayCount(fpl__global_audioResultTypeNameTable) == FPL__AUDIO_RESULT_TYPE_COUNT);

 fpl_common_api const char *fplGetAudioResultName(const fplAudioResultType type) {
-	uint32_t index = FPL__ENUM_VALUE_TO_ARRAY_INDEX(type, FPL_FIRST_AUDIO_RESULT_TYPE, FPL_LAST_AUDIO_RESULT_TYPE);
+	uint32_t index = FPL__ENUM_VALUE_TO_ARRAY_INDEX(type, fplAudioResultType_First, fplAudioResultType_Last);
 	const char *result = fpl__global_audioResultTypeNameTable[index];
 	return(result);
 }


access: allow rx to controller directories themselves

Signed-off-by: Serge Hallyn <3df611b026e4639bee8aef7a4beb2e39fcebb313@ubuntu.com>

--- bindings.c
+++ bindings.c
@@ -1791,8 +1791,10 @@
 	if (!controller)
 		return -EIO;
 	cgroup = find_cgroup_in_path(path);
-	if (!cgroup)
-		return -EINVAL;
+	if (!cgroup) {
+		// access("/sys/fs/cgroup/systemd", mode) - rx allowed, w not
+		return mode & W_OK == 0 ? 0 : -EACCES;
+	}

 	get_cgdir_and_path(cgroup, &cgdir, &last);
 	if (!last) {


Add eglib g_io_channel_write implementation

--- eglib/gmain.c
+++ eglib/gmain.c
@@ -84,8 +84,39 @@
 GIOError g_io_channel_write(GIOChannel *channel, const gchar *buf, gsize count,
 				gsize *bytes_written)
 {
-	/* Not implemented */
-	return G_IO_STATUS_ERROR;
+	int fd = channel->fd;
+	gssize result;
+
+	if (channel->closed)
+		return G_IO_STATUS_ERROR;
+
+	/* At least according to the Debian manpage for read */
+	if (count > SSIZE_MAX)
+		count = SSIZE_MAX;
+
+retry:
+	result = write(fd, buf, count);
+
+	if (result < 0) {
+		*bytes_read = 0;
+
+		switch (errno) {
+#ifdef EINTR
+		case EINTR:
+			goto retry;
+#endif
+#ifdef EAGAIN
+		case EAGAIN:
+			return G_IO_STATUS_AGAIN;
+#endif
+		default:
+			return G_IO_STATUS_ERROR;
+		}
+	}
+
+	*bytes_written = result;
+
+	return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
 }

 void g_io_channel_close(GIOChannel *channel)


Document that init & prepare in TfLiteRegistration are called once and many times for lifetime of the op, respectively.

PiperOrigin-RevId: 409448545
Change-Id: I5e608829136a5b3797730df22783f26ffd80c651

--- tensorflow/lite/c/common.h
+++ tensorflow/lite/c/common.h
@@ -841,6 +841,9 @@

 typedef struct TfLiteRegistration {
   // Initializes the op from serialized data.
+  // Called only *once* for the lifetime of the op, so any one-time allocations
+  // should be made here (unless they depend on tensor sizes).
+  //
   // If a built-in op:
   //   `buffer` is the op's params data (TfLiteLSTMParams*).
   //   `length` is zero.
@@ -863,6 +866,7 @@
   // prepare is called when the inputs this node depends on have been resized.
   // context->ResizeTensor() can be called to request output tensors to be
   // resized.
+  // Can be called multiple times for the lifetime of the op.
   //
   // Returns kTfLiteOk on success.
   TfLiteStatus (*prepare)(TfLiteContext* context, TfLiteNode* node);


Improve docs of two style properties

Improve docs of two style properties

See discussion in bug 561334. Based on a patch by Paul Bolle.

--- gtk/gtkbutton.c
+++ gtk/gtkbutton.c
@@ -428,17 +428,33 @@
 		  G_TYPE_NONE, 0);
   widget_class->activate_signal = button_signals[ACTIVATE];

+  /**
+   * GtkButton:default-border:
+   *
+   * The "default-border" style property defines the extra space to add
+   * around a button that can become the default widget of its window.
+   * For more information about default widgets, see gtk_widget_grab_default().
+   */
+
   gtk_widget_class_install_style_property (widget_class,
 					   g_param_spec_boxed ("default-border",
 							       P_("Default Spacing"),
-							       P_("Extra space to add for CAN_DEFAULT buttons"),
+							       P_("Extra space to add for GTK_CAN_DEFAULT buttons"),
 							       GTK_TYPE_BORDER,
 							       GTK_PARAM_READABLE));

+  /**
+   * GtkButton:default-outside-border:
+   *
+   * The "default-outside-border" style property defines the extra outside
+   * space to add around a button that can become the default widget of its
+   * window. Extra outside space is always drawn outside the button border.
+   * For more information about default widgets, see gtk_widget_grab_default().
+   */
   gtk_widget_class_install_style_property (widget_class,
 					   g_param_spec_boxed ("default-outside-border",
 							       P_("Default Outside Spacing"),
-							       P_("Extra space to add for CAN_DEFAULT buttons that is always drawn outside the border"),
+							       P_("Extra space to add for GTK_CAN_DEFAULT buttons that is always drawn outside the border"),
 							       GTK_TYPE_BORDER,
 							       GTK_PARAM_READABLE));
   gtk_widget_class_install_style_property (widget_class,


* fixed a STUPID bug, which cost me a lot of time.  * I am going to clean up mcns a little bit

--- bam_mcns.c
+++ bam_mcns.c
@@ -14,12 +14,30 @@
 	int n, M;
 	int ref, alt, alt2;
 	double *q2p, *pdg; // pdg -> P(D|g)
-	double *phi;
+	double *phi, *alpha, *CMk; // CMk=\binom{M}{k}
 	double *z, *zswap; // aux for afs
-	double *CMk; // \binom{M}{k}
 	double *afs, *afs1; // afs: accumulative AFS; afs1: site posterior distribution
 	int *qsum, *bcnt;
 };
+
+static void precal_alpha(mc_aux_t *ma) // \alpha[k]=\binom{M}{k}\sum_l\phi_l(l/M)^k(1-l/M)^{M-k}
+{
+	int k, l;
+	memset(ma->alpha, 0, sizeof(double) * (ma->M + 1));
+	for (l = 0; l <= ma->M; ++l)
+		ma->alpha[0] += ma->phi[l] * pow(1. - (double)l / ma->M, ma->M);
+	for (k = 1; k < ma->M; ++k) {
+		for (l = 1; l < ma->M; ++l) { // for k!=0 and k!=ma->M, l=0 and l=ma->M leads to zero
+			double x = exp((lgamma(ma->M + 1) - lgamma(k + 1) - lgamma(ma->M - k + 1))
+						   + k * log((double)l / ma->M)
+						   + (ma->M - k) * log(1. - (double)l / ma->M));
+			ma->alpha[k] += x * ma->phi[l];
+		}
+	}
+	for (l = 0; l <= ma->M; ++l)
+		ma->alpha[ma->M] += ma->phi[l] * pow((double)l / ma->M, ma->M);
+	fflush(stdout);
+}

 void mc_init_prior(mc_aux_t *ma, int type, double theta)
 {
@@ -36,6 +54,7 @@
 			sum += (ma->phi[i] = theta / (2 * ma->n - i));
 		ma->phi[2 * ma->n] = 1. - sum;
 	}
+	precal_alpha(ma);
 }

 mc_aux_t *mc_init(int n) // FIXME: assuming diploid
@@ -48,16 +67,17 @@
 	ma->qsum = calloc(4 * ma->n, sizeof(int));
 	ma->bcnt = calloc(4 * ma->n, sizeof(int));
 	ma->pdg = calloc(3 * ma->n, sizeof(double));
-	ma->phi = calloc(2 * ma->n + 1, sizeof(double));
+	ma->phi = calloc(ma->M + 1, sizeof(double));
+	ma->alpha = calloc(ma->M + 1, sizeof(double));
+	ma->CMk = calloc(ma->M + 1, sizeof(double));
 	ma->z = calloc(2 * ma->n + 1, sizeof(double));
 	ma->zswap = calloc(2 * ma->n + 1, sizeof(double));
 	ma->afs = calloc(2 * ma->n + 1, sizeof(double));
 	ma->afs1 = calloc(2 * ma->n + 1, sizeof(double));
-	ma->CMk = calloc(ma->M + 1, sizeof(double));
 	for (i = 0; i <= MC_MAX_SUMQ; ++i)
 		ma->q2p[i] = pow(10., -i / 10.);
 	for (i = 0; i <= ma->M; ++i)
-		ma->CMk[i] = exp(lgamma(ma->M+1) - lgamma(ma->M-i+1) - lgamma(i+1));
+		ma->CMk[i] = exp(lgamma(ma->M + 1) - lgamma(i + 1) - lgamma(ma->M - i + 1));
 	mc_init_prior(ma, MC_PTYPE_FULL, 1e-3); // the simplest prior
 	return ma;
 }
@@ -67,10 +87,9 @@
 	if (ma) {
 		free(ma->qsum); free(ma->bcnt);
 		free(ma->q2p); free(ma->pdg);
-		free(ma->phi);
+		free(ma->phi); free(ma->alpha); free(ma->CMk);
 		free(ma->z); free(ma->zswap);
 		free(ma->afs); free(ma->afs1);
-		free(ma->CMk);
 		free(ma);
 	}
 }
@@ -215,6 +234,7 @@
 		for (i = 2; i <= max; ++i)
 			z[1][i] = p[0] * z[0][i] + p[1] * z[0][i-1] + p[2] * z[0][i-2];
 		if (j < ma->n - 1) z[1][max+1] = z[1][max+2] = 0.;
+//		int k; for (k = 0; k <= max; ++k) printf("%d:%.3lg ", k, z[1][k]); putchar('\n');
 		tmp = z[0]; z[0] = z[1]; z[1] = tmp;
 	}
 	if (z[0] != ma->z) memcpy(ma->z, z[0], sizeof(double) * (2 * ma->n + 1));
@@ -222,24 +242,21 @@

 static double mc_add_afs(mc_aux_t *ma)
 {
-	int k, l;
-	double sum = 0., avg = 0.;
+	int k;
+	long double sum = 0.;
 	memset(ma->afs1, 0, sizeof(double) * (ma->M + 1));
 	mc_cal_z(ma);
+	for (k = 0, sum = 0.; k <= ma->M; ++k)
+		sum += (long double)ma->alpha[k] * ma->z[k] / ma->CMk[k];
 	for (k = 0; k <= ma->M; ++k) {
-		for (l = 0, sum = 0.; l <= ma->M; ++l)
-			sum += ma->phi[l] * ma->z[l];
-		ma->afs1[k] = ma->phi[k] * ma->z[k] / sum;
-	}
-	for (k = 0; k <= ma->M; ++k)
+		ma->afs1[k] = ma->alpha[k] * ma->z[k] / ma->CMk[k] / sum;
 		if (isnan(ma->afs1[k]) || isinf(ma->afs1[k])) return -1.;
-	for (k = 0, sum = avg = 0.; k <= ma->M; ++k) {
+	}
+	for (k = 0, sum = 0.; k <= ma->M; ++k) {
 		ma->afs[k] += ma->afs1[k];
-		sum += ma->afs1[k];
-		avg += k * ma->afs1[k];
-	}
-//	for (k = 0; k <= ma->M; ++k) printf("^%lg:%lg:%lg ", ma->z[k], ma->phi[k], ma->afs1[k]);
-	return avg / ma->M;
+		sum += k * ma->afs1[k];
+	}
+	return sum / ma->M;
 }

 int mc_cal(int ref, int *n, const bam_pileup1_t **plp, mc_aux_t *ma, mc_rst_t *rst, int level)


--- final_platform_layer.h
+++ final_platform_layer.h
@@ -133,6 +133,8 @@
 	@tableofcontents

 	## v0.9.6-beta
+	- New: Added fplAsm macro to handle different inline assembler keywords (clang, gcc, msvc)
+
 	- Fixed: [Win32] Removed the manual handling of ALT + F4 shut down of event handling

 	## v0.9.5-beta
@@ -1444,6 +1446,18 @@
 #else
 #	error "This platform is not supported!"
 #endif // FPL_PLATFORM
+
+// Assembler keyword is compiler specific
+#if defined(FPL_COMPILER_CLANG)
+#define fpl__m_Asm __asm__
+#elif defined(FPL_COMPILER_MSVC)
+#define fpl__m_Asm __asm
+#else
+#define fpl__m_Asm asm
+#endif
+
+//! A assembler compiler instruction (asm)
+#define fplAsm fpl__m_Asm

 //
 // Defines required for POSIX (mmap, 64-bit file io, etc.)


button: Claim the sequence on multipress::pressed

In order to avoid the event from bubbling, as it used to (not) do.

--- gtk/gtkbutton.c
+++ gtk/gtkbutton.c
@@ -598,6 +598,7 @@
     gtk_widget_grab_focus (widget);

   g_signal_emit (button, button_signals[PRESSED], 0);
+  gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
 }

 static void


fixed a bug when coordinate-less reads are on the reverse strand

--- bam_sort.c
+++ bam_sort.c
@@ -204,7 +204,7 @@
 		h->i = i;
 		h->b = (bam1_t*)calloc(1, sizeof(bam1_t));
 		if (bam_iter_read(fp[i], iter[i], h->b) >= 0) {
-			h->pos = ((uint64_t)h->b->core.tid<<32) | (uint32_t)h->b->core.pos<<1 | bam1_strand(h->b);
+			h->pos = ((uint64_t)h->b->core.tid<<32) | (uint32_t)((int32_t)h->b->core.pos+1)<<1 | bam1_strand(h->b);
 			h->idx = idx++;
 		}
 		else h->pos = HEAP_EMPTY;
@@ -229,7 +229,7 @@
 		}
 		bam_write1_core(fpout, &b->core, b->data_len, b->data);
 		if ((j = bam_iter_read(fp[heap->i], iter[heap->i], b)) >= 0) {
-			heap->pos = ((uint64_t)b->core.tid<<32) | (uint32_t)b->core.pos<<1 | bam1_strand(b);
+			heap->pos = ((uint64_t)b->core.tid<<32) | (uint32_t)((int)b->core.pos+1)<<1 | bam1_strand(b);
 			heap->idx = idx++;
 		} else if (j == -1) {
 			heap->pos = HEAP_EMPTY;
@@ -303,8 +303,8 @@
 {
 	if (g_is_by_qname) {
 		int t = strnum_cmp(bam1_qname(a), bam1_qname(b));
-		return (t < 0 || (t == 0 && (((uint64_t)a->core.tid<<32|a->core.pos) < ((uint64_t)b->core.tid<<32|b->core.pos))));
-	} else return (((uint64_t)a->core.tid<<32|a->core.pos) < ((uint64_t)b->core.tid<<32|b->core.pos));
+		return (t < 0 || (t == 0 && (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1)))));
+	} else return (((uint64_t)a->core.tid<<32|(a->core.pos+1)) < ((uint64_t)b->core.tid<<32|(b->core.pos+1)));
 }
 KSORT_INIT(sort, bam1_p, bam1_lt)


Updating includes

Updating includes

--- firmware/IRremoteInt.h
+++ firmware/IRremoteInt.h
@@ -19,7 +19,7 @@
 #if defined(ARDUINO) && ARDUINO >= 100
 #include <Arduino.h>
 #else
-#include <WProgram.h>
+//#include <WProgram.h>
 #endif

 // define which timer to use


rbtree: Mark all debug sections as debug

--- gtk/gtkrbtree.c
+++ gtk/gtkrbtree.c
@@ -64,6 +64,7 @@
 static void
 _gtk_rbnode_free (GtkRBNode *node)
 {
+#ifdef G_ENABLE_DEBUG
   if (gtk_get_debug_flags () & GTK_DEBUG_TREE)
     {
       node->left = (gpointer) 0xdeadbeef;
@@ -74,6 +75,7 @@
       node->count = 56789;
       node->flags = 0;
     }
+#endif
   g_slice_free (GtkRBNode, node);
 }


Update BlynkSparkCore.h

Update BlynkSparkCore.h

--- firmware/BlynkSparkCore.h
+++ firmware/BlynkSparkCore.h
@@ -75,6 +75,7 @@
                 uint16_t port      = BLYNK_DEFAULT_PORT)
     {
         Base::begin(auth);
+        this->conn.begin(domain, port);
     }

     void begin( const char* auth,