diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Polynom.c | 60 | 
1 files changed, 53 insertions, 7 deletions
diff --git a/src/Polynom.c b/src/Polynom.c index a7190c7..98b083d 100644 --- a/src/Polynom.c +++ b/src/Polynom.c @@ -5,6 +5,7 @@   */  #include <stdio.h> +#include <signal.h>  #include "main.h"  #include "hash.h"  #include "parser.h" @@ -12,27 +13,46 @@  #include "pile.h"  #include "exceptions.h"  #include "scalaires.h" -#ifdef HAVE_CONFIG_H +#include "interface.h" +#include "terminal.h"  #include "config.h" -#else -#define _(x) x -#endif  _TableauVariable variables;  char *mute;  char valid; +void segfaulthand(int i) +{ +    exception(2, _("Signal received: segfault")); +} + +void ctrlbreakhand(int i) +{ +    exception(1, _("Signal received: break")); +} + +void init_all(void) { +	Initialise(&variables); +	mute = "x"; +	display=DEC; +} + +void flush_all(void) { +} + +void invite(void) { +} +  int main(void)  {  	setlocale(LC_ALL, "");  	bindtextdomain(PACKAGE, LOCALEDIR);  	textdomain(PACKAGE); -	Initialise(&variables); -	mute = "x"; -	display=DEC;  	/* nom de la variable utilisee pour la saisie des polynomes, a recuperer en argv eventuellt   	   ATTENTION: elle est case sensitive */ + +/*  	parse_line("P=-4.5+2*x+3*x^2;");  	//parse_line("P(2);");  	//AfficheTableau(variables); @@ -52,6 +72,32 @@ int main(void)  	parse_line("x+0;");  	affichage_pile();  	AfficheTableau(variables); + +*/ + +    invite(); + +    signal(SIGSEGV, segfaulthand); +    signal(SIGINT, ctrlbreakhand); + +    fprintf(stderr, _("\nPerforming initialisation...\n\n")); +    init_all(); + +    openterm(); +    initterm(); +    ifloop(); +    clearterm(); + +    fprintf(stderr, _("\nPerforming shutdown...\n\n")); +    flush_all(); + +    signal(SIGSEGV, NULL); +    signal(SIGINT, NULL); + +    fprintf(stderr, _("Exitting, bye!\n")); + + +  	return 0;  | 
