WIP: cleaning names in util.h ! WARNING ! GRAPHICS #include ../../util.h modified
This commit is contained in:
parent
961e470c2c
commit
6545c587d2
|
@ -34,6 +34,8 @@
|
|||
#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
|
||||
char *util_read_file(char *filename);
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// https://chgi.developpez.com/liste/ < ^c^v
|
||||
|
@ -50,27 +52,27 @@ typedef struct pile
|
|||
|
||||
/* Push empile une valeur sur la pile. */
|
||||
|
||||
void Push(pile **, int);
|
||||
void util_pile_push(pile **, int);
|
||||
|
||||
|
||||
/* Pop retire la dernière valeur empilée sur la pile. */
|
||||
|
||||
int Pop(pile **);
|
||||
int util_pile_pop(pile **);
|
||||
|
||||
|
||||
/* Clear vide la pile. */
|
||||
|
||||
void Clear(pile **);
|
||||
void util_pile_clear(pile **);
|
||||
|
||||
|
||||
/* Length retourne le nombre d'éléments de la pile. */
|
||||
|
||||
int Length(pile *p);
|
||||
int util_pile_length(pile *p);
|
||||
|
||||
|
||||
/* Affiche la totalité de la pile en commençant par le sommet. */
|
||||
|
||||
void View(pile *);
|
||||
void util_pile_view(pile *);
|
||||
|
||||
|
||||
|
||||
|
@ -79,4 +81,3 @@ void View(pile *);
|
|||
|
||||
void util_pile_test(); // def: scr/util/tests
|
||||
|
||||
char *read_file(char *filename);
|
||||
|
|
|
@ -102,7 +102,7 @@ void fsm_add_measure (char *measure_name) {fsm_debug_msg (2, 0, measure_name, 2)
|
|||
void fsm_measures_list_init ()
|
||||
{
|
||||
fsm_debug_msg (0,0, "fsm_measures_list_init()", 2); // sub_automaton 2
|
||||
util_pile_test();
|
||||
if (0) util_pile_test();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -382,7 +382,7 @@ bool graphics_init_shaders(const int stack_id)
|
|||
GLuint p = 0;
|
||||
|
||||
// Load vertex shader file
|
||||
vertex_shader = read_file(VERTEX_SHADER_FILE);
|
||||
vertex_shader = util_read_file(VERTEX_SHADER_FILE);
|
||||
if (vertex_shader == NULL)
|
||||
return false;
|
||||
vertex = graphics_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
|
||||
|
@ -394,7 +394,7 @@ bool graphics_init_shaders(const int stack_id)
|
|||
}
|
||||
|
||||
// Load fragment shader file
|
||||
fragment_shader = read_file(FRAG_SHADER_FILE);
|
||||
fragment_shader = util_read_file(FRAG_SHADER_FILE);
|
||||
if (fragment_shader == NULL)
|
||||
return false;
|
||||
fragment = graphics_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);
|
||||
|
|
|
@ -42,9 +42,6 @@
|
|||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
|
||||
//#include <glib-2.0/glib.h>
|
||||
//#include <gtk-4.0/gtk/gtk.h>
|
||||
|
||||
#include "../../include/util.h"
|
||||
|
||||
|
||||
|
@ -57,7 +54,7 @@
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
char *read_file(char *filename)
|
||||
char *util_read_file(char *filename)
|
||||
{
|
||||
int fd;
|
||||
int filesize;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
void Push(pile **p, int Val)
|
||||
void util_pile_push(pile **p, int Val)
|
||||
{
|
||||
pile *element = malloc(sizeof(pile));
|
||||
if(!element) exit(EXIT_FAILURE); /* Si l'allocation a échoué. */
|
||||
|
@ -52,7 +52,7 @@ void Push(pile **p, int Val)
|
|||
}
|
||||
/*************************************************************************/
|
||||
|
||||
int Pop(pile **p)
|
||||
int util_pile_pop(pile **p)
|
||||
{
|
||||
int Val;
|
||||
pile *tmp;
|
||||
|
@ -66,7 +66,7 @@ int Pop(pile **p)
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
void Clear(pile **p)
|
||||
void util_pile_clear(pile **p)
|
||||
{
|
||||
pile *tmp;
|
||||
while(*p)
|
||||
|
@ -78,7 +78,7 @@ void Clear(pile **p)
|
|||
}
|
||||
/*************************************************************************/
|
||||
|
||||
int Length(pile *p)
|
||||
int util_pile_length(pile *p)
|
||||
{
|
||||
int n=0;
|
||||
while(p)
|
||||
|
@ -91,7 +91,7 @@ int Length(pile *p)
|
|||
|
||||
/*************************************************************************/
|
||||
|
||||
void View(pile *p)
|
||||
void util_pile_view(pile *p)
|
||||
{
|
||||
while(p)
|
||||
{
|
||||
|
|
|
@ -36,35 +36,34 @@ void util_pile_test() // https://chgi.developpez.com/liste/ < ^c^v
|
|||
{
|
||||
pile *MaPile = NULL; /* Impératif de l'initialiser à NULL */
|
||||
|
||||
Push(&MaPile, 10);
|
||||
Push(&MaPile, 25);
|
||||
Push(&MaPile, 33);
|
||||
|
||||
Push(&MaPile, 12); /* Empile 4 valeurs. */
|
||||
util_pile_push(&MaPile, 10);
|
||||
util_pile_push(&MaPile, 25);
|
||||
util_pile_push(&MaPile, 33);
|
||||
util_pile_push(&MaPile, 12); /* Empile 4 valeurs. */
|
||||
|
||||
puts("Affichage de la pile :");
|
||||
View(MaPile); /* Affiche la totalité de la pile. */
|
||||
util_pile_view(MaPile); /* Affiche la totalité de la pile. */
|
||||
puts("------");
|
||||
|
||||
printf("Nb d'elements : %d\n",Length(MaPile));
|
||||
printf("Nb d'elements : %d\n",util_pile_length(MaPile));
|
||||
puts("------");
|
||||
|
||||
puts("Deux valeurs soutirees de la pile :");
|
||||
printf("%d\n",Pop(&MaPile)); /* Affiche deux valeurs */
|
||||
printf("%d\n",Pop(&MaPile)); /* soutirées de la pile. */
|
||||
printf("%d\n",util_pile_pop(&MaPile)); /* Affiche deux valeurs */
|
||||
printf("%d\n",util_pile_pop(&MaPile)); /* soutirées de la pile. */
|
||||
puts("------");
|
||||
|
||||
puts("Affichage de la pile :");
|
||||
View(MaPile); /* Affiche la totalité de la pile. */
|
||||
util_pile_view(MaPile); /* Affiche la totalité de la pile. */
|
||||
puts("------");
|
||||
|
||||
Clear(&MaPile); /* Vide la pile. */
|
||||
util_pile_clear(&MaPile); /* Vide la pile. */
|
||||
|
||||
Push(&MaPile, 18); /* Empile une valeur. */
|
||||
util_pile_push(&MaPile, 18); /* Empile une valeur. */
|
||||
|
||||
puts("Affichage de la pile apres vidage et ajout d'une valeur :");
|
||||
View(MaPile); /* Affiche la totalité de la pile. */
|
||||
util_pile_view(MaPile); /* Affiche la totalité de la pile. */
|
||||
puts("------\n");
|
||||
|
||||
Clear(&MaPile); /* Vider la pile avant de quitter. */
|
||||
util_pile_clear(&MaPile); /* Vider la pile avant de quitter. */
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
|
|||
void *widget_get_text_from_address (gchar *text_address) {
|
||||
GtkWidget *view = gtk_text_view_new ();
|
||||
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
|
||||
gtk_text_buffer_set_text (buffer, util_read_file (text_address), -1);
|
||||
gtk_text_buffer_set_modified (buffer, FALSE);
|
||||
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new());
|
||||
|
|
Loading…
Reference in New Issue