2024-08-23 23:30:39 +02:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* *
|
|
|
|
* Gem-graph client *
|
|
|
|
* *
|
|
|
|
* Finite State Machine (fsm) header *
|
|
|
|
* *
|
|
|
|
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
|
|
|
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
|
|
|
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
|
|
|
* *
|
|
|
|
* This file is part of Gem-graph. *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU Affero General Public License *
|
|
|
|
* as published by the Free Software Foundation, *
|
|
|
|
* either version 3 of the License, *
|
|
|
|
* or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; *
|
|
|
|
* without even the implied warranty of MERCHANTABILITY *
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* See the GNU Affero General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Affero General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
|
|
|
|
|
|
|
2024-08-25 22:03:16 +02:00
|
|
|
char *util_read_file (char *filename);
|
2024-08-23 23:30:39 +02:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2024-08-25 22:03:16 +02:00
|
|
|
// https://chgi.developpez.com/liste/ < ^c^v
|
|
|
|
// Copyright © 2016 CGi.
|
|
|
|
// Aucune reproduction, même partielle, ne peut être faite de ce site
|
|
|
|
// ni de l'ensemble de son contenu : textes, documents, images, etc.
|
|
|
|
// sans l'autorisation expresse de l'auteur.
|
|
|
|
// Sinon vous encourez selon la loi jusqu'à trois ans de prison
|
|
|
|
// et jusqu'à 300 000 € de dommages et intérêts.
|
|
|
|
|
|
|
|
typedef struct pile {int valeur; struct pile *prec;} pile; // structure d'un élément
|
|
|
|
void util_pile_push (pile **, int); // empile une valeur sur la pile
|
|
|
|
int util_pile_pop (pile **); // pop retire la dernière valeur empilée
|
|
|
|
void util_pile_clear (pile **); // vide la pile
|
|
|
|
int util_pile_length (pile *p); // retourne le nombre d'éléments de la pile
|
|
|
|
void util_pile_view (pile *); // affiche la pile en commençant par le sommet
|
2024-08-23 23:30:39 +02:00
|
|
|
|
|
|
|
|
2024-08-25 22:03:16 +02:00
|
|
|
//------------------------------------------------------------------------------
|
2024-08-24 10:52:28 +02:00
|
|
|
|
2024-08-25 22:03:16 +02:00
|
|
|
typedef struct elem {int value; struct elem *prev; struct elem *next;} elem ;
|
|
|
|
typedef struct {elem *first; elem *last;} dblist; // structure d'accès à la liste
|
|
|
|
void list_2x2_init (dblist *l); // initialisation
|
|
|
|
void list_2x2_push_back (dblist *l, int val); // ajout d'une valeur en fin de liste
|
|
|
|
void list_2x2_push_front (dblist *l, int val); // ajout d'une valeur en début de liste
|
|
|
|
int list_2x2_pop_back (dblist *l); // retrait d'une valeur en fin de liste
|
|
|
|
int list_2x2_pop_front (dblist *l); // retrait d'une valeur en début de liste
|
|
|
|
void list_2x2_view (dblist l); // affichage de toute la liste
|
|
|
|
void list_2x2_clear (dblist *l); // vidage de toute la liste
|
2024-08-24 10:52:28 +02:00
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
2024-08-25 22:03:16 +02:00
|
|
|
void util_pile_test();
|
2024-08-25 11:35:43 +02:00
|
|
|
void util_double_list_test();
|
|
|
|
|