home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************
- * *
- * Filename : GetNumber.c *
- * *
- *****************************************************************
- * *
- * Comment : Dieses File beinhaltet all Routinen um Zahlen *
- * Intuitionlike einzulesen. *
- * *
- * *
- * Rev : V1.0 *
- * *
- * History : V1.0 erstellen dieses Files 01.06.89 *
- * *
- * Bugs : keine bekannten *
- * *
- * Autor : Oesch Silvano *
- * *
- * Datum : 01.06.89 *
- * *
- ****************************************************************/
-
- /****************************************************************
- * *
- * allgemeine Includedateien *
- * *
- ****************************************************************/
-
- #include <exec/types.h>
- #include <exec/exec.h>
- #include <intuition/intuition.h>
- #include <intuition/screens.h>
- #include <intuition/intuitionbase.h>
- #include <devices/printer.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- #include <math.h>
- #include <errno.h>
-
- /****************************************************************
- * *
- * Funktion : ValidFloat() *
- * *
- *****************************************************************
- * *
- * Input : str *
- * *
- * Output : int *
- * *
- *****************************************************************
- * *
- * Comment : *
- * *
- * *
- * *
- * Rev : V1.0 *
- * *
- * History : V1.0 erstellen dieses Files 08.08.89 *
- * *
- * Bugs : keine bekannten *
- * *
- * Autor : Oesch Silvano *
- * *
- * Datum : 08.08.89 *
- * *
- ****************************************************************/
-
- static int ValidFloat(str)
- char *str; /* Inputstring */
- {
- int i= NULL; /* Charakter Position */
- char valid[]="0123456789.+-eE"; /* gültige Charakter */
-
- do
- {
- if (strchr(valid,str[i++]) == NULL)
- return(i); /* Gib inval. Zeichenpos */
- }
- while (str[i]); /* solange Zeichen da sind */
- return (-1); /* alles ok */
- }
-
- /****************************************************************
- * *
- * Funktion : GetNumber() *
- * *
- *****************************************************************
- * *
- * Input : zahl,string,text,typ *
- * *
- * Output : BOOLEAN *
- * *
- *****************************************************************
- * *
- * Rev : V1.0 *
- * *
- * History : V1.0 erstellen dieses Files *
- * *
- * Bugs : keine bekannten *
- * *
- * Autor : Oesch Silvano *
- * *
- * Datum : 08.08.89 *
- * *
- ****************************************************************/
-
- int GetFloat(title,value)
- char title[];
- double *value;
- {
-
- int erfolg,novalidchar;
-
- char buffer[20];
-
- buffer[0] = 0x00;
- erfolg = GetString(buffer,title,NULL,strlen(title)+10,19);
- if (erfolg)
- {
- novalidchar = ValidFloat(buffer);
- if (novalidchar == -1)
- *value = atof(buffer);
- else
- {
- DisplayBeep(NULL);
- erfolg = FALSE;
- }
- }
- return(erfolg);
- }
-
-