2022-06-27 09:48:18 +11:00
|
|
|
/*
|
|
|
|
tga_outils.h
|
|
|
|
------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include "../tthimage.h"
|
|
|
|
|
2022-08-23 21:10:16 +11:00
|
|
|
#define TGA_OUTILS_VERSION "0.61"
|
2022-06-27 09:48:18 +11:00
|
|
|
/*
|
|
|
|
* 13 Dec 2001: v0.11 a cause du 'mustopen' pour les palettes.
|
|
|
|
* 11 Fev 2002: v0.12 a cause du '-ansi' (hein Kerdeuzz, on y vient)
|
2022-06-27 17:53:59 +11:00
|
|
|
* 21 Nov 2002: v0.13 a cause du parser de parametres.
|
2022-06-27 09:48:18 +11:00
|
|
|
* 14 Jan 2006: v0.14 parce que je remet le truc dans le net.
|
|
|
|
* 05 Jan 2007: v0.15 pour etre synchrone avec la doc.
|
|
|
|
* 11 Dec 2007: v0.22 pour le parser de parametres (hexadecimal)
|
|
|
|
* 05 May 2009: v0.36 grand nettoyage du code en chantier
|
|
|
|
* 27 Dec 2009: v0.42 prise en compte des champs d'altitude.
|
|
|
|
* 06 Mar 2010: v0.43 introduction du 'df3 tool'.
|
|
|
|
* 27 Jan 2014: V0.52 added : 'parse_rect_param'.
|
2022-11-26 21:39:22 +11:00
|
|
|
* 18 Nov 2022: Vx.xx added parse_size_param
|
2022-06-27 09:48:18 +11:00
|
|
|
*/
|
|
|
|
|
2022-08-23 21:10:16 +11:00
|
|
|
#define TGA_OUTILS_COPYLEFT "(dwtfywl) TontonTh 2022"
|
2022-06-27 09:48:18 +11:00
|
|
|
#define TGA_WWW_SITE "http://la.buvette.org/devel/libimage/"
|
|
|
|
|
|
|
|
#define PERR(txt) fprintf(stderr, "\t| %s\n", (txt))
|
|
|
|
#define PERL fprintf(stderr, "\t+-----------------------------------------\n")
|
|
|
|
|
|
|
|
#define NOM_VAR_ENV_VERBOSE "TGA_OUTILS_VERBOSE" /* flag ON = "yes" */
|
|
|
|
#define NOM_VAR_ENV_TIMING "TGA_OUTILS_TIMING" /* flag ON = "yes" */
|
|
|
|
|
|
|
|
int must_be_verbose(void);
|
|
|
|
int set_new_seed(int k);
|
|
|
|
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* structure de description d'un mot-clef
|
|
|
|
* --------------------------------------
|
|
|
|
*
|
2022-06-27 17:53:59 +11:00
|
|
|
* types des parametres (chaine pointee par ptype)
|
2022-06-27 09:48:18 +11:00
|
|
|
*
|
|
|
|
* i entier 32 bits / char parameter
|
2022-06-27 17:53:59 +11:00
|
|
|
* s chaine de caracteres
|
2022-06-27 09:48:18 +11:00
|
|
|
* d double flottant
|
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char *nom;
|
|
|
|
int code;
|
2022-06-27 17:53:59 +11:00
|
|
|
char *ptypes; /* type des parametres */
|
2022-06-27 09:48:18 +11:00
|
|
|
char *aide;
|
2022-06-27 17:53:59 +11:00
|
|
|
/* char *longhelp; XXX */
|
2022-06-27 09:48:18 +11:00
|
|
|
} mot_clef;
|
|
|
|
|
|
|
|
#define NB_PARAMS 16 /* max number of allowed parameters */
|
|
|
|
|
|
|
|
/*
|
2022-06-27 17:53:59 +11:00
|
|
|
* structure contenant un parametre.
|
2022-06-27 09:48:18 +11:00
|
|
|
*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char type;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
char *s;
|
|
|
|
double d;
|
|
|
|
} p;
|
|
|
|
} Param;
|
|
|
|
|
|
|
|
int cherche_mot_clef(char *mot, mot_clef *liste, int *pmode, int *pnbarg);
|
|
|
|
|
|
|
|
/* le flag ne sert a rien, mais il faut le mettre a 42 */
|
|
|
|
int liste_mots_clefs(mot_clef *liste, int flag);
|
|
|
|
|
2022-11-26 21:39:22 +11:00
|
|
|
int get_verbosity(void);
|
|
|
|
int set_verbosity(int level);
|
|
|
|
|
2022-06-27 09:48:18 +11:00
|
|
|
int parse_int_param(char *str, int *pval, int k);
|
|
|
|
int parse_rect_param(char *str, Image_Rect *prect, int k);
|
2022-11-26 21:39:22 +11:00
|
|
|
int parse_size_param(char *str, int *pw, int *ph);
|
2022-06-27 09:48:18 +11:00
|
|
|
|
|
|
|
int parse_parametres(int ac, char *av[], char *types, int prem);
|
|
|
|
void print_parametres(void);
|
|
|
|
|
|
|
|
int GIP(int rang);
|
|
|
|
int GCP(int rang);
|
|
|
|
int GIPdef(int rang, int def);
|
|
|
|
char * GSP(int rang);
|
|
|
|
double GDP(int rang);
|
|
|
|
int GFP(int rang); /* get flag */
|
|
|
|
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* fonctions de bavardage
|
|
|
|
*/
|
|
|
|
int dump_command_line(int argc, char *argv[], int force);
|
|
|
|
|
|
|
|
/*::------------------------------------------------------------------::*/
|
|
|
|
/*
|
|
|
|
* pour plus de details, for more informations
|
|
|
|
* http://la.buvette.org/devel/libimage/img-outils.html
|
|
|
|
* ----------------------------------------------------
|
|
|
|
*/
|
|
|
|
|