Commit 53060c99 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Give access to fprint_3Dmatrix in C

parent 52900043
......@@ -103,6 +103,10 @@ typedef struct blc_array
START_EXTERN_C
void blc_array_fatal_error(blc_array const *array, const char *name_of_file, const char* name_of_function, int numero_of_line, const char *message, ...);
void blc_array_destroy(blc_array *array);
/**Display a 3D matrix ( tipically a image). The interface will change to be simplified*/
void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int length0, int step1, int width, int step2, int height, int ansi_terminal);
END_EXTERN_C
///@}
......
......@@ -569,7 +569,33 @@ void blc_array::save_tsv_file(char const *filename){
}
static void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int length0, int step1, int width, int step2, int height, int ansi_terminal)
void blc_array::fprint_surface_uchars(FILE *file, int ansi_terminal){
fprint_3Dmatrix(file, this, 0, 1, 1, dims[0].step, dims[0].length, dims[1].step, dims[1].length, ansi_terminal);
}
/* C wrapper */
START_EXTERN_C
// Envoie un message d'erreur avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. Puis exit le programme avec le parametre EXIT_FAILURE. To be used with EXIT_ON_ERROR.
void blc_array_fatal_error(blc_array const *array, const char *name_of_file, const char* name_of_function, int numero_of_line, const char *message, ...){
va_list arguments;
va_start(arguments, message);
fprintf(stderr, "\n%s: %s \t %s \t %i :\nError: ", blc_program_name, name_of_file, name_of_function, numero_of_line);
color_vfprintf(BLC_BRIGHT_RED, stderr, message, arguments);
va_end(arguments);
array->fprint_debug(stderr);
fprintf(stderr, "\n\n");
fflush(stderr);
raise(SIGABRT);
exit(EXIT_FAILURE);
}
void blc_array_destroy(blc_array *array){
array->~blc_array();
}
void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int length0, int step1, int width, int step2, int height, int ansi_terminal)
{
char *data;
char tmp_string[8];
......@@ -643,27 +669,4 @@ static void fprint_3Dmatrix(FILE *file, blc_mem *mem, int offset, int step0, int
}
void blc_array::fprint_surface_uchars(FILE *file, int ansi_terminal){
fprint_3Dmatrix(file, this, 0, 1, 1, dims[0].step, dims[0].length, dims[1].step, dims[1].length, ansi_terminal);
}
/* C wrapper */
START_EXTERN_C
// Envoie un message d'erreur avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. Puis exit le programme avec le parametre EXIT_FAILURE. To be used with EXIT_ON_ERROR.
void blc_array_fatal_error(blc_array const *array, const char *name_of_file, const char* name_of_function, int numero_of_line, const char *message, ...){
va_list arguments;
va_start(arguments, message);
fprintf(stderr, "\n%s: %s \t %s \t %i :\nError: ", blc_program_name, name_of_file, name_of_function, numero_of_line);
color_vfprintf(BLC_BRIGHT_RED, stderr, message, arguments);
va_end(arguments);
array->fprint_debug(stderr);
fprintf(stderr, "\n\n");
fflush(stderr);
raise(SIGABRT);
exit(EXIT_FAILURE);
}
void blc_array_destroy(blc_array *array){
array->~blc_array();
}
END_EXTERN_C
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment