gem-graph-client/include/util.h

83 lines
3.1 KiB
C

/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* 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>
//------------------------------------------------------------------------------
// https://chgi.developpez.com/liste/ < ^c^v
/* Structure représentant un élément de la pile. */
typedef struct pile
{
int valeur;
struct pile *prec;
} pile ;
/* Push empile une valeur sur la pile. */
void Push(pile **, int);
/* Pop retire la dernière valeur empilée sur la pile. */
int Pop(pile **);
/* Clear vide la pile. */
void Clear(pile **);
/* Length retourne le nombre d'éléments de la pile. */
int Length(pile *p);
/* Affiche la totalité de la pile en commençant par le sommet. */
void View(pile *);
//------------------------------------------------------------------------------
void util_pile_test(); // def: scr/util/tests
char *read_file(char *filename);