/// =========================== LIBRERIA STRCONS =========================== ///
/// di Aldo Carpanelli ///
/// v1.1, 13/11-6/12 2016 ///
/// ======================================================================== ///
#ifndef STRCONS_H
#define STRCONS_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <locale.h>
/// ===> gestione degli errori <============================================ ///
enum {
STRCONSErr_no_str = -2, // l'input e' una stringa vuota
STRCONSErr_troncato, // buffer insufficiente, input troncato
STRCONSErr_no_err, // nessun errore, tutto bene
STRCONSErr_no_mem, // memoria insufficiente
STRCONSErr_enorme, // dimensioni del buffer insensate
STRCONSErr_no_fgets, // errore in fgets()
STRCONSErr_no_num // il buffer non rappresenta un numero
};
#define STRCONSErr_MaxIndStrErr 7 // indice massimo delle stringhe d'errore
const char *STRCONSErr_Descrizione( int codice );
/// ===> inizializzazione e dismissione <=================================== ///
int STRCONS_Inizializza( size_t dim );
void STRCONS_Dismetti( void );
/// ===> modifica dello stato della libreria <============================== ///
int STRCONS_Dimensiona( size_t dim );
int STRCONS_Chiedi( void );
/// ===> informazioni sullo stato della libreria <========================== ///
size_t STRCONS_Capacita( void );
size_t STRCONS_Lunghezza( void );
char *STRCONS_PStr( void );
int STRCONS_Long( long *l, int base );
int STRCONS_UnsignedLong( unsigned long *ul, int base );
int STRCONS_Double( double *d );
/// ===> funzioni accessorie <============================================== ///
size_t STRCONS_EliminaNewline( char *str, size_t lung );
size_t STRCONS_SvuotaStdin();
void STRCONS_AdattaPuntoDecimale( void );
#endif // STR_CONS_H