2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
10 #include "rexxsyslib_intern.h"
12 /*****************************************************************************
15 #include <clib/rexxsyslib_protos.h>
17 AROS_LH3(BOOL
, FillRexxMsg
,
20 AROS_LHA(struct RexxMsg
*, msgptr
, A0
),
21 AROS_LHA(ULONG
, count
, D0
),
22 AROS_LHA(ULONG
, mask
, D1
),
25 struct RxsLib
*, RexxSysBase
, 27, RexxSys
)
28 This function will convert the value(s) provided in rm_Args of the
29 RexxMsg. The input can be either a string or a number.
32 msgptr - RexxMsg to create the RexxArgs for.
33 count - The number of ARGs in the rm_Args structure field that is
34 filled with a value and has to be converted.
35 mask - Bit 0-count from this mask indicate wether the value in
36 rm_Args is a string or a number. When the bit is cleared the
37 value is a pointer to a string. When it is set it is treated
41 Returns TRUE if succeeded, FALSE otherwise. When FALSE is returned all
42 memory already allocated will be Freed before returning.
47 This code will convert a string and a number to RexxArgs:
53 rm->rm_Args[0] = "Test";
54 rm->rm_Args[1] = (UBYTE *)5;
56 if (!FillRexxMsg(rm, 2, 1<<1))
62 ClearRexxMsg(), CreateRexxMsg(), CreateArgstring()
67 *****************************************************************************/
74 for (i
= 0; i
< count
; i
++)
76 /* Is argument i an integer ? */
79 /* Convert int to string */
80 sprintf(number
, "%ld", (long)msgptr
->rm_Args
[i
]);
81 args
[i
] = (STRPTR
)CreateArgstring(number
, strlen(number
));
83 /* Clean up if error in CreateArgstring */
86 for (j
= 0; j
< i
; j
++)
87 if (args
[j
] != NULL
) DeleteArgstring((UBYTE
*)args
[j
]);
88 ReturnBool("FillRexxMsg", FALSE
);
93 /* CreateArgstring with null terminated string if pointer is not null */
94 if (msgptr
->rm_Args
[i
] == 0) args
[i
] = NULL
;
97 args
[i
] = (STRPTR
)CreateArgstring(RXARG(msgptr
,i
), strlen(RXARG(msgptr
,i
)));
99 /* Clean up if error in CreateArgstring */
102 for (j
= 0; j
< i
; j
++)
103 if (args
[j
] != NULL
) DeleteArgstring((UBYTE
*)args
[j
]);
104 ReturnBool("FillRexxMsg", FALSE
);
110 CopyMem(args
, msgptr
->rm_Args
, count
* sizeof(STRPTR
));
111 ReturnBool("FillRexxMsg", TRUE
);