Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc.h	(revision 821)
@@ -11,12 +11,4 @@
 #define __NRALLOC_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nralloc.h ***")
-#endif
 
 #include "nralloc1.h"
@@ -24,7 +16,4 @@
 #include "nralloc3.h"
 
-#ifdef __cplusplus
-}
-#endif
+#endif /* __NRALLOC_H__ */
 
-#endif /* __NRALLOC_H__ */
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc1.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc1.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc1.h	(revision 821)
@@ -11,25 +11,8 @@
 #define __NRALLOC1_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nralloc1.h ***")
-#endif
+#include <stdint.h>
 
-
-//NR_END est maintenant defini dans nrutil.h
-
-#define NR_END 0
-#define FREE_ARG char*
-
-//long nr_end = NR_END;
-
-//void nrerror(char error_text[]);
-//void nrerror(char *format, ...);
-//void Error  (char *format, ...);
-//void Warning(char *format, ...);
+#include "nrc_os_config.h"
+#include "nrtype.h"
 
 /*
@@ -39,86 +22,110 @@
  */
 
-// do: allocate a float vector with subscript range v[nl..nh]
+#define type_vector(t) \
+t * short_name(t,,vector)(int32_t nl, int32_t nh)
 
-//IMAGE_EXPORT(byte*)      bvector(long nl, long nh);
-IMAGE_EXPORT(sint8*)   si8vector(long nl, long nh);
-IMAGE_EXPORT(uint8*)   ui8vector(long nl, long nh);
-IMAGE_EXPORT(sint16*) si16vector(long nl, long nh);
-IMAGE_EXPORT(uint16*) ui16vector(long nl, long nh);
-IMAGE_EXPORT(sint32*) si32vector(long nl, long nh);
-IMAGE_EXPORT(uint32*) ui32vector(long nl, long nh);
-IMAGE_EXPORT(sint64*) si64vector(long nl, long nh);
-IMAGE_EXPORT(uint64*) ui64vector(long nl, long nh);
+type_vector(int8_t);
+type_vector(uint8_t);
+type_vector(int16_t);
+type_vector(uint16_t);
+type_vector(int32_t);
+type_vector(uint32_t);
+type_vector(int64_t);
+type_vector(uint64_t);
+type_vector(float);
+type_vector(double);
+type_vector(rgb8);
+type_vector(rgbx8);
+type_vector(rgb32);
+type_vector(void_p);
 
-IMAGE_EXPORT(float32*) f32vector(long nl, long nh);
-IMAGE_EXPORT(float64*) f64vector(long nl, long nh);
 
-IMAGE_EXPORT(rgb8*)   rgb8vector(long nl, long nh);
-IMAGE_EXPORT(rgbx8*) rgbx8vector(long nl, long nh);
-IMAGE_EXPORT(rgb32*) rgb32vector(long nl, long nh);
 
-IMAGE_EXPORT(void**)     vvector(long nl, long nh);
+#if TARGET_OS == GIETVM
+#define remote_type_vector(t) \
+t * short_name(t,remote_,vector)(int32_t nl, int32_t nh, int32_t x, int32_t y)
+
+remote_type_vector(int8_t);
+remote_type_vector(uint8_t);
+remote_type_vector(int16_t);
+remote_type_vector(uint16_t);
+remote_type_vector(int32_t);
+remote_type_vector(uint32_t);
+remote_type_vector(int64_t);
+remote_type_vector(uint64_t);
+remote_type_vector(float);
+remote_type_vector(double);
+remote_type_vector(rgb8);
+remote_type_vector(rgbx8);
+remote_type_vector(rgb32);
+remote_type_vector(void_p);
+
+//void ** remote_vvector(long nl, long nh, int x, int y);
+#endif
+
+#define type_vector0(t) \
+t * short_name(t,,vector0)(int32_t nl, int32_t nh)
+
+type_vector0(int8_t);
+type_vector0(uint8_t);
+type_vector0(int16_t);
+type_vector0(uint16_t);
+type_vector0(int32_t);
+type_vector0(uint32_t);
+type_vector0(int64_t);
+type_vector0(uint64_t);
+type_vector0(float);
+type_vector0(double);
+type_vector0(rgb8);
+type_vector0(rgbx8);
+type_vector0(rgb32);
+type_vector0(void_p);
+
+#define realloc_type_vector(t) \
+t * short_name(t,realloc_,vector)(t * v, int32_t nl, int32_t nh)
+
+realloc_type_vector(int8_t);
+realloc_type_vector(uint8_t);
+realloc_type_vector(int16_t);
+realloc_type_vector(uint16_t);
+realloc_type_vector(int32_t);
+realloc_type_vector(uint32_t);
+realloc_type_vector(int64_t);
+realloc_type_vector(uint64_t);
+realloc_type_vector(float);
+realloc_type_vector(double);
+realloc_type_vector(rgb8);
+realloc_type_vector(rgbx8);
+realloc_type_vector(rgb32);
+realloc_type_vector(void_p);
+
+
+#define free_type_vector(t) \
+void short_name(t,free_,vector)(t * v, long nl, long nh)
+
+free_type_vector(int8_t);
+free_type_vector(uint8_t);
+free_type_vector(int16_t);
+free_type_vector(uint16_t);
+free_type_vector(int32_t);
+free_type_vector(uint32_t);
+free_type_vector(int64_t);
+free_type_vector(uint64_t);
+free_type_vector(float);
+free_type_vector(double);
+free_type_vector(rgb8);
+free_type_vector(rgbx8);
+free_type_vector(rgb32);
+free_type_vector(void_p);
+
+
 
 /*
- * ---------------
- * --- vector0 ---
- * ---------------
- */
-
-// do: allocate a vector and set it to 0
-
-//IMAGE_EXPORT(byte*)       bvector0(long nl, long nh);
-IMAGE_EXPORT(sint8*)    si8vector0(long nl, long nh);
-IMAGE_EXPORT(uint8*)    ui8vector0(long nl, long nh);
-IMAGE_EXPORT(sint16*)  si16vector0(long nl, long nh);
-IMAGE_EXPORT(uint16*)  ui16vector0(long nl, long nh);
-IMAGE_EXPORT(sint32*)  si32vector0(long nl, long nh);
-IMAGE_EXPORT(uint32*)  ui32vector0(long nl, long nh);
-
-IMAGE_EXPORT(float32*) f32vector0(long nl, long nh);
-IMAGE_EXPORT(float64*) f64vector0(long nl, long nh);
-
-IMAGE_EXPORT(rgb8*)   rgb8vector0(long nl, long nh);
-IMAGE_EXPORT(rgbx8*) rgbx8vector0(long nl, long nh);
-IMAGE_EXPORT(rgb32*) rgb32vector0(long nl, long nh);
-
-IMAGE_EXPORT(void**)     vvector0(long nl, long nh);
-/*
- * ----------------------
- * --- realloc_vector ---
- * ----------------------
- */
-
-// realloc a vector to [nl..nh]
-IMAGE_EXPORT(void**)  realloc_vvector(void   **v, long nl, long nh);
-
-/*
- * -------------------
- * --- free_vector ---
- * -------------------
- */
-
-//IMAGE_EXPORT(void) free_bvector    (byte    *v, long nl, long nh);
-IMAGE_EXPORT(void) free_si8vector  (sint8   *v, long nl, long nh);
-IMAGE_EXPORT(void) free_ui8vector  (uint8   *v, long nl, long nh);
-IMAGE_EXPORT(void) free_si16vector (sint16  *v, long nl, long nh);
-IMAGE_EXPORT(void) free_ui16vector (uint16  *v, long nl, long nh);
-IMAGE_EXPORT(void) free_si32vector (sint32  *v, long nl, long nh);
-IMAGE_EXPORT(void) free_ui32vector (uint32  *v, long nl, long nh);
-IMAGE_EXPORT(void) free_si64vector (sint64  *v, long nl, long nh);
-IMAGE_EXPORT(void) free_ui64vector (uint64  *v, long nl, long nh);
-
-IMAGE_EXPORT(void) free_f32vector  (float32 *v, long nl, long nh);
-IMAGE_EXPORT(void) free_f64vector  (float64 *v, long nl, long nh);
-
-IMAGE_EXPORT(void) free_rgb8vector (rgb8    *v, long nl, long nh);
-IMAGE_EXPORT(void) free_rgbx8vector(rgbx8   *v, long nl, long nh);
-IMAGE_EXPORT(void) free_rgb32vector(rgb32   *v, long nl, long nh);
-
-IMAGE_EXPORT(void) free_vvector    (void   **v, long nl, long nh);
-
-#ifdef __cplusplus
-}
-#endif
+void ** vvector(long nl, long nh);
+void ** vvector0(long nl, long nh);
+void ** realloc_vvector(void ** v, long nl, long nh);
+void free_vvector(void ** v, long nl, long nh);
+*/
 
 #endif /* __NRALLOC1_H__ */
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2.h	(revision 821)
@@ -16,12 +16,5 @@
 #define __NRALLOC2_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nralloc2.h ***")
-#endif
+#include "nrc_os_config.h"
 
 /*
@@ -31,74 +24,111 @@
  */
 
-IMAGE_EXPORT(sint8**)     si8matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint8**)     ui8matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint16**)   si16matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint16**)   ui16matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint32**)   si32matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint32**)   ui32matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint64**)   si64matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint64**)   ui64matrix(long nrl, long nrh, long ncl, long nch);
 
-IMAGE_EXPORT(float32**)   f32matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(float64**)   f64matrix(long nrl, long nrh, long ncl, long nch);
+#undef type_matrix
+#define type_matrix(t) \
+t ** short_name(t,,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
 
-IMAGE_EXPORT(complex32**) c32matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(complex64**) c64matrix(long nrl, long nrh, long ncl, long nch);
 
-IMAGE_EXPORT(rgb8**)     rgb8matrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgbx8**)   rgbx8matrix(long nrl, long nrh, long ncl, long nch);
-//IMAGE_EXPORT(rgb32**)   rgb32matrix(long nrl, long nrh, long ncl, long nch);
-//IMAGE_EXPORT(rgbx32**) rgbx32matrix(long nrl, long nrh, long ncl, long nch);
+type_matrix(int8_t);
+type_matrix(uint8_t);
+type_matrix(int16_t);
+type_matrix(uint16_t);
+type_matrix(int32_t);
+type_matrix(uint32_t);
+type_matrix(int64_t);
+type_matrix(uint64_t);
+type_matrix(float);
+type_matrix(double);
+type_matrix(void_p);
+type_matrix(rgb8);
+type_matrix(rgbx8);
+type_matrix(rgb32);
+type_matrix(rgbx32);
+type_matrix(complex32);
+type_matrix(complex64);
 
-/*
- * ---------------
- * --- matrix0 ---
- * ---------------
- */
 
-IMAGE_EXPORT(sint8**)     si8matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint8**)     ui8matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint16**)   si16matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint16**)   ui16matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint32**)    i32matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint32**)   ui32matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint64**)   si64matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint64**)   ui64matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgb8**)     rgb8matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgbx8**)   rgbx8matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgb32**)   rgb32matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgbx32**) rgbx32matrix0(long nrl, long nrh, long ncl, long nch);
+#undef type_matrix0
+#define type_matrix0(t) \
+t ** short_name(t,,matrix0)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
 
-IMAGE_EXPORT(float32**)   f32matrix0(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(float64**)   f64matrix0(long nrl, long nrh, long ncl, long nch);
 
-/*
- * -------------------
- * --- free_matrix ---
- * -------------------
- */ 
+type_matrix0(int8_t);
+type_matrix0(uint8_t);
+type_matrix0(int16_t);
+type_matrix0(uint16_t);
+type_matrix0(int32_t);
+type_matrix0(uint32_t);
+type_matrix0(int64_t);
+type_matrix0(uint64_t);
+type_matrix0(float);
+type_matrix0(double);
+type_matrix0(void_p);
+type_matrix0(rgb8);
+type_matrix0(rgbx8);
+type_matrix0(rgb32);
+type_matrix0(rgbx32);
+type_matrix0(complex32);
+type_matrix0(complex64);
 
-IMAGE_EXPORT(void) free_si8matrix  (sint8  **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui8matrix  (uint8  **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_si16matrix (sint16 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui16matrix (uint16 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_si32matrix (sint32 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui32matrix (uint32 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_si64matrix (sint64 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui64matrix (uint64 **m, long nrl, long nrh, long ncl, long nch);
 
-IMAGE_EXPORT(void) free_f32matrix (float32   **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_f64matrix (float64   **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_c32matrix (complex32 **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_c64matrix (complex64 **m, long nrl, long nrh, long ncl, long nch);
+#if TARGET_OS == GIETVM
 
-IMAGE_EXPORT(void) free_rgb8matrix  (rgb8   **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_rgbx8matrix (rgbx8  **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_rgb32matrix (rgb32  **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_rgbx32matrix(rgbx32 **m, long nrl, long nrh, long ncl, long nch);
+#undef remote_type_matrix
+#define remote_type_matrix(t) \
+t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
 
-#ifdef __cplusplus
-}
+remote_type_matrix(int8_t);
+remote_type_matrix(uint8_t);
+remote_type_matrix(int16_t);
+remote_type_matrix(uint16_t);
+remote_type_matrix(int32_t);
+remote_type_matrix(uint32_t);
+remote_type_matrix(int64_t);
+remote_type_matrix(uint64_t);
+remote_type_matrix(float);
+remote_type_matrix(double);
+remote_type_matrix(void_p);
+remote_type_matrix(rgb8);
+remote_type_matrix(rgbx8);
+remote_type_matrix(rgb32);
+remote_type_matrix(rgbx32);
+remote_type_matrix(complex32);
+remote_type_matrix(complex64);
+
 #endif
 
+
+#undef free_type_matrix
+#define free_type_matrix(t) \
+void short_name(t,free_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
+
+free_type_matrix(int8_t);
+free_type_matrix(uint8_t);
+free_type_matrix(int16_t);
+free_type_matrix(uint16_t);
+free_type_matrix(int32_t);
+free_type_matrix(uint32_t);
+free_type_matrix(int64_t);
+free_type_matrix(uint64_t);
+free_type_matrix(float);
+free_type_matrix(double);
+free_type_matrix(void_p);
+free_type_matrix(rgb8);
+free_type_matrix(rgbx8);
+free_type_matrix(rgb32);
+free_type_matrix(rgbx32);
+free_type_matrix(complex32);
+free_type_matrix(complex64);
+
+
 #endif /* __NRALLOC2_H__ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2x.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2x.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2x.h	(revision 821)
@@ -16,43 +16,9 @@
 #define __NRALLOC2X_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nralloc2x.h ***")
-#endif
 
+#include "nrc_os_config.h"
 #include "nrtype.h"
 #include "nrtypex.h"
 
-/* ---------------------------------- */
-/* --- composite user type matrix --- */
-/* ---------------------------------- */
-
-IMAGE_EXPORT(si16Point**)   si16Pmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(ui16Point**)   ui16Pmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(si32Point**)   si32Pmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(ui32Point**)   ui32Pmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(f32Point**)     f32Pmatrix(long nrl, long nrh, long ncl, long nch);
-
-IMAGE_EXPORT(si16Triplet**) si16Tmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(ui16Triplet**) ui16Tmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(si32Triplet**) si32Tmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(ui32Triplet**) ui32Tmatrix(long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(f32Triplet**)   f32Tmatrix(long nrl, long nrh, long ncl, long nch);
-
-IMAGE_EXPORT(void) free_si16Pmatrix(si16Point **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui16Pmatrix(ui16Point **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_si32Pmatrix(si32Point **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui32Pmatrix(ui32Point **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_f32Pmatrix(f32Point   **m, long nrl, long nrh, long ncl, long nch);
-
-IMAGE_EXPORT(void) free_si16Tmatrix(si16Triplet **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui16Tmatrix(ui16Triplet **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_si32Tmatrix(si32Triplet **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_ui32Tmatrix(ui32Triplet **m, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(void) free_f32Tmatrix ( f32Triplet **m, long nrl, long nrh, long ncl, long nch);
 
 /* ----------------- */
@@ -60,15 +26,25 @@
 /* ----------------- */
 
-IMAGE_EXPORT(byte**)      btrimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(sint16**) si16trimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(uint16**) ui16trimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(sint32**) si32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(uint32**) ui32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(float32**) f32trimatrix(long nrl, long nrh, long ncl, long nch, long step);
-IMAGE_EXPORT(float64**) f64trimatrix(long nrl, long nrh, long ncl, long nch, long step);
+#define type_trimatrix(t) \
+t ** short_name(t,,trimatrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t step)
 
-#ifdef __cplusplus
-}
-#endif
+type_trimatrix(int8_t);
+type_trimatrix(uint8_t);
+type_trimatrix(int16_t);
+type_trimatrix(uint16_t);
+type_trimatrix(int32_t);
+type_trimatrix(uint32_t);
+type_trimatrix(float);
+type_trimatrix(double);
+
 
 #endif /* __NRALLOC2X_H__ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc3.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc3.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc3.h	(revision 821)
@@ -13,43 +13,52 @@
 #define __NRALLOC3_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nralloc3.h ***")
-#endif
+#include "nrc_os_config.h"
 
-double*** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
-void free_d3tensor(double  ***t,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
+//double*** d3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
+//void free_d3tensor(double  ***t,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
+
+#define type_cube(t) \
+t *** short_name(t,,cube)(int32_t ndl, int32_t ndh, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \
 
 
+type_cube(int8_t);
+type_cube(uint8_t);
+type_cube(int16_t);
+type_cube(uint16_t);
+type_cube(int32_t);
+type_cube(uint32_t);
+type_cube(int64_t);
+type_cube(uint64_t);
+type_cube(float);
+type_cube(double);
+type_cube(rgb8);
+type_cube(rgbx8);
 
-IMAGE_EXPORT(sint8***)   si8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint8***)   ui8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint16***) si16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint16***) ui16cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(sint32***) si32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(uint32***) ui32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(float32***) f32cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(float64***) f64cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgb8***)   rgb8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
-IMAGE_EXPORT(rgbx8***) rgbx8cube(long ndl, long ndh, long nrl, long nrh, long ncl, long nch);
+#define free_type_cube(t) \
+void short_name(t,free_,cube)(t *** c, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ndl, int32_t ndh) \
 
-IMAGE_EXPORT(void) free_si8cube  (sint8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_ui8cube  (uint8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_si16cube (sint16  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_ui16cube (uint16  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_si32cube (sint32  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_ui32cube (uint32  ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_f32cube  (float32 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_f64cube  (float64 ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_rgb8cube (rgb8    ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
-IMAGE_EXPORT(void) free_rgbx8cube(rgbx8   ***c,long nrl,long nrh,long ncl,long nch,long ndl,long ndh);
+free_type_cube(int8_t);
+free_type_cube(uint8_t);
+free_type_cube(int16_t);
+free_type_cube(uint16_t);
+free_type_cube(int32_t);
+free_type_cube(uint32_t);
+free_type_cube(int64_t);
+free_type_cube(uint64_t);
+free_type_cube(float);
+free_type_cube(double);
+free_type_cube(rgb8);
+free_type_cube(rgbx8);
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif /* __NRALLOC3_H__ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith0.h	(revision 821)
@@ -11,25 +11,20 @@
 #define __NRARITH0_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-
-#ifdef VERBOSE_PRAGMA
-//#pragma message(" -include nrarith0.h")
-#endif
-
 /* ---------- */
 /* -- Swap -- */
 /* ---------- */
 
-ROUTINE(void)   i8swap(int8    *a, int8    *b);
-ROUTINE(void)  i16swap(int16   *a, int16   *b);
-ROUTINE(void)  i32swap(int32   *a, int32   *b);
-ROUTINE(void)  i64swap(int64   *a, int64   *b);
-ROUTINE(void)  f32swap(float32 *a, float32 *b);
-ROUTINE(void)  f64swap(float64 *a, float64 *b);
-ROUTINE(void)  rgb8swap(rgb8   *a, rgb8    *b);
-ROUTINE(void) rgbx8swap(rgbx8  *a, rgbx8   *b);
+#define type_swap(t)                   \
+void short_name(t,,swap)(t * a, t * b)
+
+type_swap(int8_t);
+type_swap(int16_t);
+type_swap(int32_t);
+type_swap(int64_t);
+type_swap(float);
+type_swap(double);
+type_swap(rgb8);
+type_swap(rgbx8);
+
 
 /* --------- */
@@ -37,78 +32,43 @@
 /* --------- */
 
-ROUTINE(float32) f32min (float32 x1, float32 x2);
-ROUTINE(float32) f32min2(float32 x1, float32 x2);
-ROUTINE(float32) f32min3(float32 x1, float32 x2, float32 x3);
-ROUTINE(float32) f32min4(float32 x1, float32 x2, float32 x3, float32 x4);
-ROUTINE(float32) f32min5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5);
+#define type_min(t)                                 \
+t short_name(t,,min)(t x1, t x2);                   \
+t short_name(t,,min2)(t x1, t x2);                  \
+t short_name(t,,min3)(t x1, t x2, t x3);            \
+t short_name(t,,min4)(t x1, t x2, t x3, t x4);      \
+t short_name(t,,min5)(t x1, t x2, t x3, t x4, t x5) \
 
-ROUTINE(float64) f64min (float64 x1, float64 x2);
-ROUTINE(float64) f64min2(float64 x1, float64 x2);
-ROUTINE(float64) f64min3(float64 x1, float64 x2, float64 x3);
-ROUTINE(float64) f64min4(float64 x1, float64 x2, float64 x3, float64 x4);
-ROUTINE(float64) f64min5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5);
+type_min(float);
+type_min(double);
+type_min(int8_t);
+type_min(uint8_t);
+type_min(int16_t);
+type_min(uint16_t);
+type_min(int32_t);
+type_min(uint32_t);
+type_min(rgb8);
 
-ROUTINE(byte)  bmin (byte x1, byte x2);
-ROUTINE(byte)  bmin2(byte x1, byte x2);
-ROUTINE(byte)  bmin3(byte x1, byte x2, byte x3);
-ROUTINE(byte)  bmin4(byte x1, byte x2, byte x3, byte x4);
-ROUTINE(byte)  bmin5(byte x1, byte x2, byte x3, byte x4, byte x5);
-
-ROUTINE(uint16) ui16min (uint16 x1, uint16 x2);
-ROUTINE(uint16) ui16min2(uint16 x1, uint16 x2);
-ROUTINE(uint16) ui16min3(uint16 x1, uint16 x2, uint16 x3);
-ROUTINE(uint16) ui16min4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);
-ROUTINE(uint16) ui16min5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);
-
-ROUTINE(int32) i32min (int32 x1, int32 x2);
-ROUTINE(int32) i32min2(int32 x1, int32 x2);
-ROUTINE(int32) i32min3(int32 x1, int32 x2, int32 x3);
-ROUTINE(int32) i32min4(int32 x1, int32 x2, int32 x3, int32 x4);
-ROUTINE(int32) i32min5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);
-
-ROUTINE(rgb8) rgb8min (rgb8 x1, rgb8 x2);
-ROUTINE(rgb8) rgb8min2(rgb8 x1, rgb8 x2);
-ROUTINE(rgb8) rgb8min3(rgb8 x1, rgb8 x2, rgb8 x3);
-ROUTINE(rgb8) rgb8min4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);
-ROUTINE(rgb8) rgb8min5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);
 
 /* --------- */
 /* -- Max -- */
 /* --------- */
-ROUTINE(float32) f32max (float32 x1, float32 x2);
-ROUTINE(float32) f32max2(float32 x1, float32 x2);
-ROUTINE(float32) f32max3(float32 x1, float32 x2, float32 x3);
-ROUTINE(float32) f32max4(float32 x1, float32 x2, float32 x3, float32 x4);
-ROUTINE(float32) f32max5(float32 x1, float32 x2, float32 x3, float32 x4, float32 x5);
 
-ROUTINE(float64) f64max (float64 x1, float64 x2);
-ROUTINE(float64) f64max2(float64 x1, float64 x2);
-ROUTINE(float64) f64max3(float64 x1, float64 x2, float64 x3);
-ROUTINE(float64) f64max4(float64 x1, float64 x2, float64 x3, float64 x4);
-ROUTINE(float64) f64max5(float64 x1, float64 x2, float64 x3, float64 x4, float64 x5);
+#define type_max(t)                                 \
+t short_name(t,,max)(t x1, t x2);                   \
+t short_name(t,,max2)(t x1, t x2);                  \
+t short_name(t,,max3)(t x1, t x2, t x3);            \
+t short_name(t,,max4)(t x1, t x2, t x3, t x4);      \
+t short_name(t,,max5)(t x1, t x2, t x3, t x4, t x5) \
 
-ROUTINE(byte)  bmax (byte x1,  byte x2);
-ROUTINE(byte)  bmax2(byte x1,  byte x2);
-ROUTINE(byte)  bmax3(byte x1,  byte x2, byte x3);
-ROUTINE(byte)  bmax4(byte x1,  byte x2, byte x3, byte x4);
-ROUTINE(byte)  bmax5(byte x1,  byte x2, byte x3, byte x4, byte x5);
+type_max(float);
+type_max(double);
+type_max(int8_t);
+type_max(uint8_t);
+type_max(int16_t);
+type_max(uint16_t);
+type_max(int32_t);
+type_max(uint32_t);
+type_max(rgb8);
 
-ROUTINE(uint16) ui16max (uint16 x1, uint16 x2);
-ROUTINE(uint16) ui16max2(uint16 x1, uint16 x2);
-ROUTINE(uint16) ui16max3(uint16 x1, uint16 x2, uint16 x3);
-ROUTINE(uint16) ui16max4(uint16 x1, uint16 x2, uint16 x3, uint16 x4);
-ROUTINE(uint16) ui16max5(uint16 x1, uint16 x2, uint16 x3, uint16 x4, uint16 x5);
-
-ROUTINE(int32) i32max (int32 x1, int32 x2);
-ROUTINE(int32) i32max2(int32 x1, int32 x2);
-ROUTINE(int32) i32max3(int32 x1, int32 x2, int32 x3);
-ROUTINE(int32) i32max4(int32 x1, int32 x2, int32 x3, int32 x4);
-ROUTINE(int32) i32max5(int32 x1, int32 x2, int32 x3, int32 x4, int32 x5);
-
-ROUTINE(rgb8) rgb8max (rgb8 x1, rgb8 x2);
-ROUTINE(rgb8) rgb8max2(rgb8 x1, rgb8 x2);
-ROUTINE(rgb8) rgb8max3(rgb8 x1, rgb8 x2, rgb8 x3);
-ROUTINE(rgb8) rgb8max4(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4);
-ROUTINE(rgb8) rgb8max5(rgb8 x1, rgb8 x2, rgb8 x3, rgb8 x4, rgb8 x5);
 
 /* ----------- */
@@ -116,17 +76,20 @@
 /* ----------- */
 
-ROUTINE(byte) ibit(int32 x, int n);
-ROUTINE(int32) sym_int32(int32 x);
-ROUTINE(int) myLog2(int x);
-ROUTINE(int) next_power2(int x);
-ROUTINE(int) myGCD(int u, int v);
-ROUTINE(int) myLCM(int u, int v);
+int32_t i32bit(int32_t x, int32_t n);
+int32_t sym_int32(int32_t x);
+int32_t myLog2(int32_t x);
+int32_t next_power2(int32_t x);
+int32_t myGCD(int32_t u, int32_t v);
+int32_t myLCM(int32_t u, int32_t v);
 
-#ifdef __cplusplus
-}
 #endif
 
-#else
-//#pragma message(" Warning : attempt to re-include nrarith0.h") 
-#endif
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
 
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith1.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith1.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith1.h	(revision 821)
@@ -11,78 +11,98 @@
 #define _NRARITH1_H_
 
-#ifdef __cplusplus
-#ifdef PRAGMA_VERBOSE
-#pragma message ("C++")
-#endif
-extern "C" {
-#endif
-
-#ifdef PRAGMA_VERBOSE
-//#pragma message("- include nrarith1.h")
-#endif
-
-/* ======================================================================== */
-/* === Beta reduction ===================================================== */
-/* ======================================================================== */
-
-IMAGE_EXPORT(int32) sum_bvector (byte  *v, long nl, long nh);
-IMAGE_EXPORT(int32) sum_si16vector (sint16  *v, long nl, long nh);
-IMAGE_EXPORT(int32) sum_si32vector (sint32   *v, long nl, long nh);
-IMAGE_EXPORT(float) sum_f32vector  (float32 *v, long nl, long nh);
-
-// ==================
-// === min_vector ===
-// ==================
-
-IMAGE_EXPORT(sint8)   min_si8vector  (sint8   *v, long nl, long nh);
-IMAGE_EXPORT(uint8)   min_ui8vector  (uint8   *v, long nl, long nh);
-IMAGE_EXPORT(sint16)  min_si16vector (sint16  *v, long nl, long nh);
-IMAGE_EXPORT(uint16)  min_ui16vector (uint16  *v, long nl, long nh);
-IMAGE_EXPORT(sint32)  min_si32vector (sint32  *v, long nl, long nh);
-IMAGE_EXPORT(uint32)  min_ui32vector (uint32  *v, long nl, long nh);
-IMAGE_EXPORT(float32) min_f32vector  (float32 *v, long nl, long nh);
-IMAGE_EXPORT(float64) min_f64vector  (float64 *v, long nl, long nh);
-
-// ==================
-// === max_vector ===
-// ==================
-
-IMAGE_EXPORT(sint8)  max_si8vector  (sint8   *v, long nl, long nh);
-IMAGE_EXPORT(uint8)  max_ui8vector  (uint8   *v, long nl, long nh);
-IMAGE_EXPORT(sint16) max_si16vector (sint16  *v, long nl, long nh);
-IMAGE_EXPORT(uint16) max_ui16vector (uint16  *v, long nl, long nh);
-IMAGE_EXPORT(sint32) max_si32vector (sint32  *v, long nl, long nh);
-IMAGE_EXPORT(uint32) max_ui32vector (uint32  *v, long nl, long nh);
-
-IMAGE_EXPORT(float32) max_f32vector (float32 *v, long nl, long nh);
-IMAGE_EXPORT(float64) max_f64vector (float64 *v, long nl, long nh);
-
-// ======================
-// === min_vector_pos ===
-// ======================
-
-IMAGE_EXPORT(sint8)  min_si8vector_pos  (sint8  *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint8)  min_ui8vector_pos  (uint8  *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(sint16) min_si16vector_pos (sint16 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint16) min_ui16vector_pos (uint16 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(sint32) min_si32vector_pos (sint32 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint32) min_ui32vector_pos (uint32 *v, long nl, long nh, int *pos);
-
-IMAGE_EXPORT(float32)min_f32vector_pos (float32 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(float64)min_f64vector_pos (float64 *v, long nl, long nh, int *pos);
-
-// ======================
-// === max_vector_pos ===
-// ======================
-
-IMAGE_EXPORT(sint8)  max_si8vector_pos  (sint8  *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint8)  max_ui8vector_pos  (uint8  *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(sint16) max_si16vector_pos (sint16 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint16) max_ui16vector_pos (uint16 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(sint32) max_si32vector_pos (sint32 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(uint32) max_ui32vector_pos (uint32 *v, long nl, long nh, int *pos);
-
-IMAGE_EXPORT(float32)max_f32vector_pos (float32 *v, long nl, long nh, int *pos);
-IMAGE_EXPORT(float64)max_f64vector_pos (float64 *v, long nl, long nh, int *pos);
+/*
+ * ------------------
+ * --- sum_vector ---
+ * ------------------
+ */
+
+#define sum_type_vector(t,r) \
+r short_name(t,sum_,vector)(t * v, int32_t nl, int32_t nh)
+
+sum_type_vector(int8_t, int32_t);
+sum_type_vector(uint8_t, uint32_t);
+sum_type_vector(int16_t, int32_t);
+sum_type_vector(uint16_t, uint32_t);
+sum_type_vector(int32_t, int32_t);
+sum_type_vector(uint32_t, uint32_t);
+sum_type_vector(float, float);
+sum_type_vector(double, double);
+
+/*
+ * ------------------
+ * --- min_vector ---
+ * ------------------
+ */
+
+#define min_type_vector(t) \
+t short_name(t,min_,vector)(t * v, int32_t nl, int32_t nh)
+
+min_type_vector(int8_t);
+min_type_vector(uint8_t);
+min_type_vector(int16_t);
+min_type_vector(uint16_t);
+min_type_vector(int32_t);
+min_type_vector(uint32_t);
+min_type_vector(float);
+min_type_vector(double);
+
+
+/*
+ * ------------------
+ * --- max_vector ---
+ * ------------------
+ */
+
+#define max_type_vector(t) \
+t short_name(t,max_,vector)(t * v, int32_t nl, int32_t nh)
+
+max_type_vector(int8_t);
+max_type_vector(uint8_t);
+max_type_vector(int16_t);
+max_type_vector(uint16_t);
+max_type_vector(int32_t);
+max_type_vector(uint32_t);
+max_type_vector(float);
+max_type_vector(double);
+
+
+/*
+ * ----------------------
+ * --- min_vector_pos ---
+ * ----------------------
+ */
+
+
+#define min_type_vector_pos(t) \
+t short_name(t,min_,vector_pos)(t * v, int32_t nl, int32_t nh, int32_t * pos)
+
+min_type_vector_pos(int8_t);
+min_type_vector_pos(uint8_t);
+min_type_vector_pos(int16_t);
+min_type_vector_pos(uint16_t);
+min_type_vector_pos(int32_t);
+min_type_vector_pos(uint32_t);
+min_type_vector_pos(float);
+min_type_vector_pos(double);
+
+
+/*
+ * ----------------------
+ * --- max_vector_pos ---
+ * ----------------------
+ */
+
+#define max_type_vector_pos(t) \
+t short_name(t,max_,vector_pos)(t * v, int32_t nl, int32_t nh, int32_t * pos)
+
+max_type_vector_pos(int8_t);
+max_type_vector_pos(uint8_t);
+max_type_vector_pos(int16_t);
+max_type_vector_pos(uint16_t);
+max_type_vector_pos(int32_t);
+max_type_vector_pos(uint32_t);
+max_type_vector_pos(float);
+max_type_vector_pos(double);
+
 
 // =============
@@ -90,27 +110,110 @@
 // =============
 
-IMAGE_EXPORT(void) beta_sum_rgb32vector    (rgb32 *S,long nl,long nh, rgb32 *D);
-IMAGE_EXPORT(void) beta_average_rgb32vector(rgb32 *S,long nl,long nh, rgb32 *D);
-
-IMAGE_EXPORT(void) add_i32vector(int32 *S1, long nl,long nh, int32 *S2, int32 *D);
-IMAGE_EXPORT(void) sub_i32vector(int32 *S1, long nl,long nh, int32 *S2, int32 *D);
-
-IMAGE_EXPORT(void) cumulleft_i32vector  (int32 *S, long nl, long nh, int32 *D);
-IMAGE_EXPORT(void) cumulleft_rgb32vector(rgb32 *S, long nl, long nh, rgb32 *D);
-
-IMAGE_EXPORT(void) cumulright_i32vector  (int32 *S, long nl, long nh, int32 *D);
-IMAGE_EXPORT(void) cumulright_rgb32vector(rgb32 *S, long nl, long nh, rgb32 *D);
-
-IMAGE_EXPORT(void) mulc_i32vector     (int32 *S, long nl, long nh, int32 c, int32 *D);
-IMAGE_EXPORT(void) mulc_rgb32vector   (rgb32 *S, long nl, long nh, int32 c, rgb32 *D);
-IMAGE_EXPORT(void) divc_i32vector     (int32 *S, long nl, long nh, int32 c, int32 *D);
-IMAGE_EXPORT(void) divc_rgb32vector   (rgb32 *S, long nl, long nh, int32 c, rgb32 *D);
-
-IMAGE_EXPORT(void) mulfrac_i32vector  (int32 *S, long nl, long nh, int32 a, int32 b, int32 *D);
-IMAGE_EXPORT(void) mulfrac_rgb32vector(rgb32 *S, long nl, long nh, int32 a, int32 b, rgb32 *D);
-
-#ifdef __cplusplus
-}
-#endif
+#define add_type_vector(t) \
+void short_name(t,add_,vector)(t * S1, int32_t nl, int32_t nh, t * S2, t * D)
+
+add_type_vector(int8_t);
+add_type_vector(uint8_t);
+add_type_vector(int16_t);
+add_type_vector(uint16_t);
+add_type_vector(int32_t);
+add_type_vector(uint32_t);
+add_type_vector(float);
+add_type_vector(double);
+
+#define sub_type_vector(t) \
+void short_name(t,sub_,vector)(t * S1, int32_t nl, int32_t nh, t * S2, t * D)
+
+sub_type_vector(int8_t);
+sub_type_vector(uint8_t);
+sub_type_vector(int16_t);
+sub_type_vector(uint16_t);
+sub_type_vector(int32_t);
+sub_type_vector(uint32_t);
+sub_type_vector(float);
+sub_type_vector(double);
+
+#define mulc_type_vector(t) \
+void short_name(t,mulc_,vector)(t * S, int32_t nl, int32_t nh, int32_t c, t * D)
+
+mulc_type_vector(int8_t);
+mulc_type_vector(uint8_t);
+mulc_type_vector(int16_t);
+mulc_type_vector(uint16_t);
+mulc_type_vector(int32_t);
+mulc_type_vector(uint32_t);
+mulc_type_vector(float);
+mulc_type_vector(double);
+
+#define divc_type_vector(t) \
+void short_name(t,divc_,vector)(t * S, int32_t nl, int32_t nh, int32_t c, t * D)
+
+divc_type_vector(int8_t);
+divc_type_vector(uint8_t);
+divc_type_vector(int16_t);
+divc_type_vector(uint16_t);
+divc_type_vector(int32_t);
+divc_type_vector(uint32_t);
+divc_type_vector(float);
+divc_type_vector(double);
+
+
+#define cumulleft_type_vector(t) \
+void short_name(t,cumulleft_,vector)(t * S, int32_t nl, int32_t nh, int32_t * D)
+
+cumulleft_type_vector(int8_t);
+cumulleft_type_vector(uint8_t);
+cumulleft_type_vector(int16_t);
+cumulleft_type_vector(uint16_t);
+cumulleft_type_vector(int32_t);
+cumulleft_type_vector(uint32_t);
+cumulleft_type_vector(float);
+cumulleft_type_vector(double);
+
+#define cumulright_type_vector(t) \
+void short_name(t,cumulright_,vector)(t * S, int32_t nl, int32_t nh, int32_t * D)
+
+cumulright_type_vector(int8_t);
+cumulright_type_vector(uint8_t);
+cumulright_type_vector(int16_t);
+cumulright_type_vector(uint16_t);
+cumulright_type_vector(int32_t);
+cumulright_type_vector(uint32_t);
+cumulright_type_vector(float);
+cumulright_type_vector(double);
+
+
+#define mulfrac_type_vector(t) \
+void short_name(t,mulfrac_,vector)(t * S, int32_t nl, int32_t nh, int32_t a, int32_t b, t * D)
+
+mulfrac_type_vector(int8_t);
+mulfrac_type_vector(uint8_t);
+mulfrac_type_vector(int16_t);
+mulfrac_type_vector(uint16_t);
+mulfrac_type_vector(int32_t);
+mulfrac_type_vector(uint32_t);
+mulfrac_type_vector(float);
+mulfrac_type_vector(double);
+
+
+
+void beta_sum_rgb32vector    (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
+void beta_average_rgb32vector(rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
+void cumulleft_rgb32vector   (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
+void cumulright_rgb32vector  (rgb32 * S, int32_t nl, int32_t nh, rgb32 * D);
+void mulc_rgb32vector        (rgb32 * S, int32_t nl, int32_t nh, int32 c, rgb32 * D);
+void divc_rgb32vector        (rgb32 * S, int32_t nl, int32_t nh, int32 c, rgb32 * D);
+void mulfrac_rgb32vector     (rgb32 * S, int32_t nl, int32_t nh, int32 a, int32 b, rgb32 * D);
+
 
 #endif /* _NRARITH1_H_ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2.h	(revision 821)
@@ -11,14 +11,5 @@
 #define _NRARITH2_H_
 
-#ifdef __cplusplus
-#ifdef PRAGMA_VERBOSE
-#pragma message ("C++")
-#endif
-extern "C" {
-#endif
-
-#ifdef PRAGMA_VERBOSE
-//#pragma message("- include nrarith.h")
-#endif
+#include "nrc_os_config.h"
 
 /* ------------------ */
@@ -26,14 +17,18 @@
 /* ------------------ */
 
-IMAGE_EXPORT(sint8)   min_si8matrix  (sint8    **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint8)   min_ui8matrix  (uint8    **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint16)  min_si16matrix (sint16   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint16)  min_ui16matrix (uint16   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint32)  min_si32matrix (sint32   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint32)  min_ui32matrix (uint32   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint64)  min_si64matrix (sint64   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint64)  min_ui64matrix (uint64   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(float32) min_f32matrix  (float32  **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(float64) min_f64matrix  (float64  **m, long nrl,long nrh,long ncl, long nch);
+#define min_type_matrix(t) \
+t short_name(t,min_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
+
+min_type_matrix(int8_t);
+min_type_matrix(uint8_t);
+min_type_matrix(int16_t);
+min_type_matrix(uint16_t);
+min_type_matrix(int32_t);
+min_type_matrix(uint32_t);
+min_type_matrix(int64_t);
+min_type_matrix(uint64_t);
+min_type_matrix(float);
+min_type_matrix(double);
+
 
 /* ------------------ */
@@ -41,14 +36,18 @@
 /* ------------------ */
 
-IMAGE_EXPORT(sint8)   max_si8matrix  (sint8    **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint8)   max_ui8matrix  (uint8    **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint16)  max_si16matrix (sint16   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint16)  max_ui16matrix (uint16   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint32)  max_si32matrix (sint32   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint32)  max_ui32matrix (uint32   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(sint64)  max_si64matrix (sint64   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(uint64)  max_ui64matrix (uint64   **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(float32) max_f32matrix  (float32  **m, long nrl,long nrh,long ncl, long nch);
-IMAGE_EXPORT(float64) max_f64matrix  (float64  **m, long nrl,long nrh,long ncl, long nch);
+#define max_type_matrix(t) \
+t short_name(t,max_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch)
+
+max_type_matrix(int8_t);
+max_type_matrix(uint8_t);
+max_type_matrix(int16_t);
+max_type_matrix(uint16_t);
+max_type_matrix(int32_t);
+max_type_matrix(uint32_t);
+max_type_matrix(int64_t);
+max_type_matrix(uint64_t);
+max_type_matrix(float);
+max_type_matrix(double);
+
 
 /* ------------------ */
@@ -56,18 +55,21 @@
 /* ------------------ */
 
-IMAGE_EXPORT(void) add_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   **Y, sint8   **Z);
-IMAGE_EXPORT(void) add_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   **Y, uint8   **Z);
-IMAGE_EXPORT(void) add_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  **Y, sint16  **Z);
-IMAGE_EXPORT(void) add_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  **Y, uint16  **Z);
-IMAGE_EXPORT(void) add_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  **Y, sint32  **Z);
-IMAGE_EXPORT(void) add_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  **Y, uint32  **Z);
-IMAGE_EXPORT(void) add_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  **Y, sint64  **Z);
-IMAGE_EXPORT(void) add_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  **Y, uint64  **Z);
-
-IMAGE_EXPORT(void) add_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y, float32 **Z);
-IMAGE_EXPORT(void) add_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y, float64 **Z);
-
-IMAGE_EXPORT(void) add_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    **Y, rgb8    **Z);
-IMAGE_EXPORT(void) add_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   **Y, rgbx8   **Z);
+#define add_type_matrix(t) \
+void short_name(t,add_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
+
+add_type_matrix(int8_t);
+add_type_matrix(uint8_t);
+add_type_matrix(int16_t);
+add_type_matrix(uint16_t);
+add_type_matrix(int32_t);
+add_type_matrix(uint32_t);
+add_type_matrix(int64_t);
+add_type_matrix(uint64_t);
+add_type_matrix(float);
+add_type_matrix(double);
+
+void add_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
+void add_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z);
+
 
 /* -------------------- */
@@ -75,18 +77,21 @@
 /* -------------------- */
 
-IMAGE_EXPORT(void) addc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
-IMAGE_EXPORT(void) addc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
-IMAGE_EXPORT(void) addc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
-IMAGE_EXPORT(void) addc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
-IMAGE_EXPORT(void) addc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
-IMAGE_EXPORT(void) addc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
-IMAGE_EXPORT(void) addc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
-IMAGE_EXPORT(void) addc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
-
-IMAGE_EXPORT(void) addc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
-IMAGE_EXPORT(void) addc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
-
-IMAGE_EXPORT(void) addc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
-IMAGE_EXPORT(void) addc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
+#define addc_type_matrix(t) \
+void short_name(t,addc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
+
+addc_type_matrix(int8_t);
+addc_type_matrix(uint8_t);
+addc_type_matrix(int16_t);
+addc_type_matrix(uint16_t);
+addc_type_matrix(int32_t);
+addc_type_matrix(uint32_t);
+addc_type_matrix(int64_t);
+addc_type_matrix(uint64_t);
+addc_type_matrix(float);
+addc_type_matrix(double);
+
+void addc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
+void addc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
+
 
 /* ----------- */
@@ -94,18 +99,21 @@
 /* ----------- */
 
-IMAGE_EXPORT(void) sub_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   **Y, sint8   **Z);
-IMAGE_EXPORT(void) sub_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   **Y, uint8   **Z);
-IMAGE_EXPORT(void) sub_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  **Y, sint16  **Z);
-IMAGE_EXPORT(void) sub_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  **Y, uint16  **Z);
-IMAGE_EXPORT(void) sub_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  **Y, sint32  **Z);
-IMAGE_EXPORT(void) sub_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  **Y, uint32  **Z);
-IMAGE_EXPORT(void) sub_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  **Y, sint64  **Z);
-IMAGE_EXPORT(void) sub_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  **Y, uint64  **Z);
-
-IMAGE_EXPORT(void) sub_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y, float32 **Z);
-IMAGE_EXPORT(void) sub_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y, float64 **Z);
-
-IMAGE_EXPORT(void) sub_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    **Y, rgb8    **Z);
-IMAGE_EXPORT(void) sub_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   **Y, rgbx8   **Z);
+#define sub_type_matrix(t) \
+void short_name(t,sub_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y, t ** Z)
+
+sub_type_matrix(int8_t);
+sub_type_matrix(uint8_t);
+sub_type_matrix(int16_t);
+sub_type_matrix(uint16_t);
+sub_type_matrix(int32_t);
+sub_type_matrix(uint32_t);
+sub_type_matrix(int64_t);
+sub_type_matrix(uint64_t);
+sub_type_matrix(float);
+sub_type_matrix(double);
+
+void sub_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  ** Y, rgb8  ** Z);
+void sub_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 ** Y, rgbx8 ** Z);
+
 
 /* --------------------- */
@@ -113,75 +121,108 @@
 /* --------------------- */
 
-IMAGE_EXPORT(void) subc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
-IMAGE_EXPORT(void) subc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
-IMAGE_EXPORT(void) subc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
-IMAGE_EXPORT(void) subc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
-IMAGE_EXPORT(void) subc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
-IMAGE_EXPORT(void) subc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
-IMAGE_EXPORT(void) subc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
-IMAGE_EXPORT(void) subc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
-
-IMAGE_EXPORT(void) subc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
-IMAGE_EXPORT(void) subc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
-
-IMAGE_EXPORT(void) subc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
-IMAGE_EXPORT(void) subc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
-
-/* --------------------- */
-/* --- Sub constante --- */
+#define subc_type_matrix(t) \
+void short_name(t,subc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
+
+subc_type_matrix(int8_t);
+subc_type_matrix(uint8_t);
+subc_type_matrix(int16_t);
+subc_type_matrix(uint16_t);
+subc_type_matrix(int32_t);
+subc_type_matrix(uint32_t);
+subc_type_matrix(int64_t);
+subc_type_matrix(uint64_t);
+subc_type_matrix(float);
+subc_type_matrix(double);
+
+void subc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
+void subc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
+
+/* --------------------- */
+/* --- Mul constante --- */
 /* --------------------- */
 
 // Z = X * y
-IMAGE_EXPORT(void) mulc_si8matrix  (sint8   **X, long nrl,long nrh,long ncl, long nch, sint8   y, sint8   **Z);
-IMAGE_EXPORT(void) mulc_ui8matrix  (uint8   **X, long nrl,long nrh,long ncl, long nch, uint8   y, uint8   **Z);
-IMAGE_EXPORT(void) mulc_si16matrix (sint16  **X, long nrl,long nrh,long ncl, long nch, sint16  y, sint16  **Z);
-IMAGE_EXPORT(void) mulc_ui16matrix (uint16  **X, long nrl,long nrh,long ncl, long nch, uint16  y, uint16  **Z);
-IMAGE_EXPORT(void) mulc_si32matrix (sint32  **X, long nrl,long nrh,long ncl, long nch, sint32  y, sint32  **Z);
-IMAGE_EXPORT(void) mulc_ui32matrix (uint32  **X, long nrl,long nrh,long ncl, long nch, uint32  y, uint32  **Z);
-IMAGE_EXPORT(void) mulc_si64matrix (sint64  **X, long nrl,long nrh,long ncl, long nch, sint64  y, sint64  **Z);
-IMAGE_EXPORT(void) mulc_ui64matrix (uint64  **X, long nrl,long nrh,long ncl, long nch, uint64  y, uint64  **Z);
-
-IMAGE_EXPORT(void) mulc_f32matrix  (float32 **X, long nrl,long nrh,long ncl, long nch, float32 y, float32 **Z);
-IMAGE_EXPORT(void) mulc_f64matrix  (float64 **X, long nrl,long nrh,long ncl, long nch, float64 y, float64 **Z);
-
-IMAGE_EXPORT(void) mulc_rgb8matrix (rgb8    **X, long nrl,long nrh,long ncl, long nch, rgb8    y, rgb8    **Z);
-IMAGE_EXPORT(void) mulc_rgbx8matrix(rgbx8   **X, long nrl,long nrh,long ncl, long nch, rgbx8   y, rgbx8   **Z);
+
+#define mulc_type_matrix(t) \
+void short_name(t,mulc_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t y, t ** Z)
+
+mulc_type_matrix(int8_t);
+mulc_type_matrix(uint8_t);
+mulc_type_matrix(int16_t);
+mulc_type_matrix(uint16_t);
+mulc_type_matrix(int32_t);
+mulc_type_matrix(uint32_t);
+mulc_type_matrix(int64_t);
+mulc_type_matrix(uint64_t);
+mulc_type_matrix(float);
+mulc_type_matrix(double);
+
+void mulc_rgb8matrix (rgb8  ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8  y, rgb8  ** Z);
+void mulc_rgbx8matrix(rgbx8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx8 y, rgbx8 ** Z);
+
 
 /* --------------- */
 /* --- MulFrac --- */
 /* --------------- */
-// m2 = (a*m1)/b
-IMAGE_EXPORT(void) mulfrac_bmatrix    (byte   **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, byte    **m2);
-IMAGE_EXPORT(void) mulfrac_si16matrix (sint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, sint16  **m2);
-IMAGE_EXPORT(void) mulfrac_ui16matrix (uint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, uint16  **m2);
-IMAGE_EXPORT(void) mulfrac_si32matrix (sint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, sint32  **m2);
-IMAGE_EXPORT(void) mulfrac_ui32matrix (uint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  b, uint32  **m2);
-IMAGE_EXPORT(void) mulfrac_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, rgb32  a, rgb32  b, rgb8    **m2);
-IMAGE_EXPORT(void) mulfrac_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, rgbx32 a, rgbx32 b, rgbx8   **m2);
-
-IMAGE_EXPORT(void) mulfrack_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 b, rgb8    **m2);
-IMAGE_EXPORT(void) mulfrack_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 b, rgbx8   **m2);
+
+// m2 = (a * m1) / b
+
+#define mulfrac_type_matrix(t) \
+void short_name(t,mulfrac_,matrix)(t ** X, int32_t nrl, int32_t nrh, \
+        int32_t ncl, int32_t nch, int32_t a, int32_t b, t ** Y)
+
+mulfrac_type_matrix(int8_t);
+mulfrac_type_matrix(uint8_t);
+mulfrac_type_matrix(int16_t);
+mulfrac_type_matrix(uint16_t);
+mulfrac_type_matrix(int32_t);
+mulfrac_type_matrix(uint32_t);
+mulfrac_type_matrix(int64_t);
+mulfrac_type_matrix(uint64_t);
+mulfrac_type_matrix(float);
+mulfrac_type_matrix(double);
+
+void mulfrack_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgb8  ** m2);
+void mulfrack_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 b, rgbx8 ** m2);
+
 
 /* ---------------- */
 /* --- MulShift --- */
 /* ---------------- */
-// m3 = (a*m1)>>s
-IMAGE_EXPORT(void) mulshift_bmatrix    (byte   **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, byte    **m2);
-IMAGE_EXPORT(void) mulshift_i16matrix  (int16  **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, int16   **m2);
-IMAGE_EXPORT(void) mulshift_ui16matrix (uint16 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, uint16  **m2);
-IMAGE_EXPORT(void) mulshift_i32matrix  (int32  **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, int32   **m2);
-IMAGE_EXPORT(void) mulshift_ui32matrix (uint32 **m1, long nrl,long nrh,long ncl, long nch, int32  a, int32  s, uint32  **m2);
-IMAGE_EXPORT(void) mulshift_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, rgb32  a, rgb32  s, rgb8    **m2);
-IMAGE_EXPORT(void) mulshift_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, rgbx32 a, rgbx32 s, rgbx8   **m2);
-
-IMAGE_EXPORT(void) mulshiftk_rgb8matrix (rgb8   **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 s, rgb8    **m2);
-IMAGE_EXPORT(void) mulshiftk_rgbx8matrix(rgbx8  **m1, long nrl,long nrh,long ncl, long nch, int32 a, int32 s, rgbx8   **m2);
-
-IMAGE_EXPORT(void) quadratic_error_si16matrix(sint16 **m1,long nrl,long nrh,long ncl, long nch, sint16 **m2, sint16 **m3);
-
-
-#ifdef __cplusplus
-}
-#endif
+// m3 = (a * m1) >> s
+
+#define mulshift_type_matrix(t) \
+void short_name(t,mulshift_,matrix)(t ** X, int32_t nrl, int32_t nrh, \
+        int32_t ncl, int32_t nch, int32_t a, int32_t s, t ** Y)
+
+mulshift_type_matrix(int8_t);
+mulshift_type_matrix(uint8_t);
+mulshift_type_matrix(int16_t);
+mulshift_type_matrix(uint16_t);
+mulshift_type_matrix(int32_t);
+mulshift_type_matrix(uint32_t);
+mulshift_type_matrix(int64_t);
+mulshift_type_matrix(uint64_t);
+mulshift_type_matrix(float);
+mulshift_type_matrix(double);
+
+void mulshift_rgb8matrix (rgb8  **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb32  a, rgb32  s, rgb8  ** m2);
+void mulshift_rgbx8matrix(rgbx8 **m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgbx32 a, rgbx32 s, rgbx8 ** m2);
+
+void mulshiftk_rgb8matrix (rgb8  ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgb8  ** m2);
+void mulshiftk_rgbx8matrix(rgbx8 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32 a, int32 s, rgbx8 ** m2);
+
+void quadratic_error_si16matrix(sint16 ** m1, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, sint16 ** m2, sint16 ** m3);
+
 
 #endif /* _NRARITH2_H_ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2x.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2x.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrarith2x.h	(revision 821)
@@ -11,35 +11,63 @@
 #define _NRARITH2X_H_
 
-#ifdef __cplusplus
-#ifdef PRAGMA_VERBOSE
-#pragma message ("C++")
-#endif
-extern "C" {
-#endif
+// Add conditionnel
 
-#ifdef PRAGMA_VERBOSE
-#pragma message("- include nrarith2x.h")
-#endif
+#define addcnz_type_matrix(t) \
+void short_name(t,addcnz_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t cte, t ** dst)
+
+addcnz_type_matrix(int8_t);
+addcnz_type_matrix(uint8_t);
+addcnz_type_matrix(int16_t);
+addcnz_type_matrix(uint16_t);
+addcnz_type_matrix(int32_t);
+addcnz_type_matrix(uint32_t);
+addcnz_type_matrix(int64_t);
+addcnz_type_matrix(uint64_t);
+addcnz_type_matrix(float);
+addcnz_type_matrix(double);
 
 
-    // Add conditionnel
-IMAGE_EXPORT(void) addc_bmatrix (byte   **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte   **dst);
-IMAGE_EXPORT(void) addc_smatrix (sint16  **src,long nrl,long nrh,long ncl, long nch, short cte, sint16  **dst);
-IMAGE_EXPORT(void) addc_usmatrix(uint16 **src,long nrl,long nrh,long ncl, long nch, short cte, uint16 **dst);
+#define addandc_type_matrix(t) \
+void short_name(t,addandc_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t cte, t ** dst)
 
-IMAGE_EXPORT(void) addandc_bmatrix    (byte   **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte   **dst);
-IMAGE_EXPORT(void) addandc_si16matrix (sint16 **src,long nrl,long nrh,long ncl, long nch, short cte, sint16  **dst);
-IMAGE_EXPORT(void) addandc_ui16matrix (uint16 **src,long nrl,long nrh,long ncl, long nch, short cte, uint16 **dst);
+addandc_type_matrix(int8_t);
+addandc_type_matrix(uint8_t);
+addandc_type_matrix(int16_t);
+addandc_type_matrix(uint16_t);
+addandc_type_matrix(int32_t);
+addandc_type_matrix(uint32_t);
+addandc_type_matrix(int64_t);
+addandc_type_matrix(uint64_t);
+addandc_type_matrix(float);
+addandc_type_matrix(double);
 
-IMAGE_EXPORT(void) addcnz_bmatrix(byte  **src,long nrl,long nrh,long ncl, long nch, byte  cte, byte  **dst);
 
-IMAGE_EXPORT(int) count_bmatrix(byte **m, long nrl,long nrh,long ncl, long nch);
-/*
- * renvoie la somme des points de la matrice
- */
+/* renvoie la somme des points de la matrice */
 
-#ifdef __cplusplus
-}
-#endif
+#define sum_type_matrix(t,rt) \
+rt short_name(t,sum_,matrix)(t ** m, int32_t nrl, int32_t nrh,int32_t ncl, int32_t nch)
+
+sum_type_matrix(int8_t, int32_t);
+sum_type_matrix(uint8_t, uint32_t);
+sum_type_matrix(int16_t, int32_t);
+sum_type_matrix(uint16_t, uint32_t);
+sum_type_matrix(int32_t, int64_t);
+sum_type_matrix(uint32_t, uint64_t);
+sum_type_matrix(int64_t, int64_t);
+sum_type_matrix(uint64_t, uint64_t);
+sum_type_matrix(float, float);
+sum_type_matrix(double, double);
+
+
 
 #endif /* _NRUTIL_H_ */
+
+// Local Variables:
+// tab-width: 4
+// c-basic-offset: 4
+// c-file-offsets:((innamespace . 0)(inline-open . 0))
+// indent-tabs-mode: nil
+// End:
+
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
+
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h	(revision 821)
@@ -7,12 +7,26 @@
     #define printf(...)  giet_tty_printf(__VA_ARGS__)
 
-    #define open(x, y)      giet_fat_open(x, y)
-    #define close(x)        giet_fat_close(x)
-    #define read(x, y, z)   giet_fat_read(x, y, z)
-    #define write(x, y, z)  giet_fat_write(x, y, z)
-    #define fprintf(x, ...) giet_fat_fprintf(x, __VA_ARGS__)
-    #define fscanf(x, ...)  ;
-    #define exit(x)         giet_pthread_exit(NULL)
-#else
+    #define open(x, y)         giet_fat_open(x, y)
+    #define close(x)           giet_fat_close(x)
+    #define read(x, y, z)      giet_fat_read(x, y, z)
+    #define write(x, y, z)     giet_fat_write(x, y, z)
+    #define fprintf(x, ...)    giet_fat_fprintf(x, __VA_ARGS__)
+    //#define fscanf(x, ...)  ;
+    #define exit(x)            giet_pthread_exit(NULL)
+
+    #define pthread_barrier_t           giet_barrier_t
+    #define pthread_spinlock_t          user_lock_t
+    #define pthread_spin_lock(x)        lock_acquire(x)
+    #define pthread_spin_unlock(x)      lock_release(x)
+    #define pthread_spin_init(x, y)     lock_init(x)
+    #define pthread_mutexlock_t         user_lock_t
+    #define pthread_mutex_lock(x)       lock_acquire(x)
+    #define pthread_mutex_unlock(x)     lock_release(x)
+    #define pthread_mutex_init(x, y)    lock_init(x)
+    #define pthread_barrier_init(x,y,z) barrier_init(x, z)
+    #define pthread_barrier_wait(x)     barrier_wait(x)
+    #define pthread_barrier_destroy(x)
+    #define pthread_create(x,y,z,t)     giet_pthread_create(x,y,z,t)
+    #define pthread_join(x,y)           giet_pthread_join(x,y)
 #endif
 
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrkernel.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrkernel.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrkernel.h	(revision 821)
@@ -11,24 +11,21 @@
 #define __NRKERNEL_H__
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- *** include nrkernel.h ***")
+
+#if TARGET_OS == GIETVM
+    #define nrerror(...) ({                        \
+            printf("*** NRC Runtime Error:\n   "); \
+            printf(__VA_ARGS__);                   \
+            exit(1);                               \
+    })
+#else
+    #define nrerror(...) ({                                 \
+            fprintf(stderr, "*** NRC Runtime Error:\n   "); \
+            fprintf(stderr, __VA_ARGS__);                   \
+            exit(1);                                        \
+    })
 #endif
 
-void nrerror(char error_text[]);
-void nrerror0(char error_text[]);    
-void nrerror1(char *format, ...);
-    
-void Error  (char *format, ...);
-void Warning(char *format, ...);
 
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif // __NRKERNEL_H__
Index: soft/giet_vm/applications/rosenfeld/nrc2/include/nrtype.h
===================================================================
--- soft/giet_vm/applications/rosenfeld/nrc2/include/nrtype.h	(revision 798)
+++ soft/giet_vm/applications/rosenfeld/nrc2/include/nrtype.h	(revision 821)
@@ -16,14 +16,5 @@
 #define _NRTYPE_H_
 
-#ifdef __cplusplus
-#pragma message ("C++")
-extern "C" {
-#endif
-    
-#define VERBOSE_PRAGMA
-
-#ifdef VERBOSE_PRAGMA
-//#pragma message ("- include nrtype.h")
-#endif
+#include <stdint.h>
 
 // ---------------------------------- //
@@ -31,76 +22,80 @@
 // ---------------------------------- //
 
+
 #include "mypredef.h"
     
-typedef unsigned char BOOLEAN;
-typedef unsigned char boolean;
-typedef          int  BOOL;
-#ifdef VERBOSE_PRAGMA
-//#pragma message("boolean")
-#endif
 
-#ifndef TRUE
-#define TRUE 1
-#else
-#pragma message("  ATTENTION : TRUE  already defined")
-#endif
+// Short names
 
-#ifndef FALSE
-#define FALSE 0
-#else
-#pragma message("  ATTENTION : FALSE  already defined")
-#endif
+#define sn_int8_t(p,s)      p##i8##s
+#define sn_int16_t(p,s)     p##i16##s
+#define sn_int32_t(p,s)     p##i32##s
+#define sn_int64_t(p,s)     p##i64##s
+#define sn_uint8_t(p,s)     p##ui8##s
+#define sn_uint16_t(p,s)    p##ui16##s
+#define sn_uint32_t(p,s)    p##ui32##s
+#define sn_uint64_t(p,s)    p##ui64##s
+#define sn_float(p,s)       p##f32##s
+#define sn_double(p,s)      p##f64##s
+#define sn_void_p(p,s)      p##v##s
+#define sn_rgb8(p,s)        p##rgb8##s
+#define sn_rgbx8(p,s)       p##rgbx8##s
+#define sn_rgb32(p,s)       p##rgb32##s
+#define sn_rgbx32(p,s)      p##rgbx32##s
+#define sn_complex32(p,s)   p##c32##s
+#define sn_complex64(p,s)   p##c64##s
+#define sn_si16Point(p,s)   p##si16P##s
+#define sn_ui16Point(p,s)   p##ui16P##s
+#define sn_si32Point(p,s)   p##si32P##s
+#define sn_ui32Point(p,s)   p##ui32P##s
+#define sn_f32Point(p,s)    p##f32P##s
+#define sn_si16Triplet(p,s) p##si16T##s
+#define sn_ui16Triplet(p,s) p##ui16T##s
+#define sn_si32Triplet(p,s) p##si32T##s
+#define sn_ui32Triplet(p,s) p##ui32T##s
+#define sn_f32Triplet(p,s)  p##f32T##s
+
+#define short_name(t,p,s) sn_##t(p,s)
+
+#define NR_END 0
+#define FREE_ARG char*
+
+
+
 
 /* ------------------------------- */
 /* --- 8, 16, 32, 64 bit types --- */
 /* ------------------------------- */
-// old types to be removed
-//typedef sint16  usint16 ;
-//typedef int uint;
 
-// half-typed types
+typedef void * void_p;
+typedef char    byte;
 
-typedef char  byte;
-//typedef char  usint16 ;
-//typedef char  uint;
-
-typedef char  int8;
-typedef short int16;
-typedef int   int32;
-typedef long long  int64;
+typedef int8_t  int8;
+typedef int16_t int16;
+typedef int32_t int32;
+typedef int64_t int64;
     
-#ifdef LIBCOMP
-#if defined(myCompiler_ICC) || defined (myCompiler_MSC)
-typedef __int64  int64;
-#else
-typedef long long  int64;
-#endif
-#endif
 
 // full-typed types
-typedef   signed char sint8;
-typedef unsigned char uint8;
+typedef int8_t   sint8;
+typedef uint8_t  uint8;
 
-typedef   signed short  sint16;
-typedef unsigned short  uint16;
+typedef int16_t  sint16;
+typedef uint16_t uint16;
 
-typedef   signed int sint32;
-typedef unsigned int uint32;
+typedef int32_t  sint32;
+typedef uint32_t uint32;
 
-#if defined(myCompiler_ICC) || defined (myCompiler_MSC)
-typedef          __int64  int64;
-typedef   signed __int64 sint64;
-typedef unsigned __int64 uint64;
-#else
-typedef   signed long long sint64;
-typedef unsigned long long uint64;
-#endif
+typedef int64_t  sint64;
+typedef uint64_t uint64;
 
-typedef float   float32;
-typedef double  float64;
+typedef float    float32;
+typedef double   float64;
+
 
 /* -------------------- */
 /* --- complex type --- */
 /* -------------------- */
+
 typedef struct { float32 x; float32 y;} complex32;
 typedef struct { float64 x; float64 y;} complex64;
@@ -199,7 +194,5 @@
 } bitfield8;
 
-#ifdef __cplusplus
-}
-#endif
 
 #endif // _NR_TYPE_H_
+
