Fix for initialization of scalos preferences library. Library is now loaded only...
[AROS-Contrib.git] / rexx / lstring / bool.c
blob64c2bd1fcb60f8fe31d0328c584aac1114ec0d19
1 /*
2 * $Header$
3 * $Log$
4 * Revision 1.1 2001/04/04 05:43:37 wang
5 * First commit: compiles on Linux, Amiga, Windows, Windows CE, generic gcc
7 * Revision 1.2 1999/11/26 09:52:45 bnv
8 * Changed: To make use of the LastScannedNumber
10 * Revision 1.1 1998/07/02 17:16:35 bnv
11 * Initial revision
15 #include <lerror.h>
16 #include <lstring.h>
18 /* ------------------- Lbool ------------------ */
19 int
20 Lbool( const PLstr num )
22 long i = 0;
24 switch (LTYPE(*num)) {
25 case LSTRING_TY:
26 if (_Lisnum(num)==LSTRING_TY)
27 Lerror(ERR_UNLOGICAL_VALUE,0);
28 i = (long)lLastScannedNumber;
29 if ((double)i != lLastScannedNumber)
30 Lerror(ERR_UNLOGICAL_VALUE,0);
31 break;
32 case LREAL_TY:
33 i = (long)LREAL(*num);
34 if ((double)i != LREAL(*num))
35 Lerror(ERR_UNLOGICAL_VALUE,0);
36 break;
37 case LINTEGER_TY:
38 i = LINT(*num);
39 break;
41 if (i == 0 || i == 1) return i;
42 Lerror(ERR_UNLOGICAL_VALUE,0);
43 return -1; /* Never gets here but keep compiler happy :-) */
44 } /* Lbool */