Fix for initialization of scalos preferences library. Library is now loaded only...
[AROS-Contrib.git] / rexx / lstring / add.c
blob2fb58643abc276a55ddb3dda0803a23036735d7f
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.3 1999/11/26 09:50:50 bnv
8 * Cleaned up a little
10 * Revision 1.2 1999/03/10 16:55:55 bnv
11 * Corrected, the use of 'ta' and 'tb'
13 * Revision 1.1 1998/07/02 17:16:35 bnv
14 * Initial revision
18 #include <lerror.h>
19 #include <lstring.h>
21 /* ---------------- Ladd ------------------- */
22 void
23 Ladd( const PLstr to, const PLstr A, const PLstr B)
25 int ta, tb;
26 double r;
28 if (LTYPE(*A) == LSTRING_TY) {
29 ta = _Lisnum(A);
30 if (ta==LSTRING_TY) Lerror(ERR_BAD_ARITHMETIC,0);
31 r = lLastScannedNumber;
32 } else {
33 ta = LTYPE(*A);
34 r = TOREAL(*A);
37 if (LTYPE(*B) == LSTRING_TY) {
38 tb = _Lisnum(B);
39 if (tb==LSTRING_TY) Lerror(ERR_BAD_ARITHMETIC,0);
40 r += lLastScannedNumber;
41 } else {
42 tb = LTYPE(*B);
43 r += TOREAL(*B);
46 if ( (ta == LINTEGER_TY) && (tb == LINTEGER_TY) ) {
47 LINT(*to) = (long)r;
48 LTYPE(*to) = LINTEGER_TY;
49 LLEN(*to) = sizeof(long);
50 } else {
51 LREAL(*to) = r;
52 LTYPE(*to) = LREAL_TY;
53 LLEN(*to) = sizeof(double);
55 } /* Ladd */