Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / popupmenu / staticlib / pm_exlst.c
blob309512496ad2ee6e31387e3f5d4b57f0b91191fd
1 /*
2 Copyright © 2010, The AROS Development Team.
3 All rights reserved.
5 $Id$
6 */
8 //#define DEBUG 1
9 #include <aros/debug.h>
11 #include <utility/tagitem.h>
12 #include <proto/alib.h>
14 /*****************************************************************************
16 NAME */
17 #define NO_INLINE_STDARG /* turn off inline def */
18 #include <proto/popupmenu.h>
19 extern struct PopupMenuBase * PopupMenuBase;
21 struct PM_IDLst *PM_ExLst(
23 /* SYNOPSIS */
24 ULONG id,
25 ...)
27 /* FUNCTION
29 INPUTS
31 RESULT
33 NOTES
35 EXAMPLE
37 BUGS
39 SEE ALSO
41 INTERNALS
43 HISTORY
45 *****************************************************************************/
47 struct PM_IDLst *retval = NULL;
49 #ifdef NO_LINEAR_VARARGS
50 ULONG size = 1; // for initial value
51 ULONG val;
52 ULONG *values;
53 ULONG idx;
54 va_list ap;
56 va_start(ap, id);
58 // count IDs
59 for (val = id; val != 0; val = va_arg(ap, ULONG))
61 size++;
64 D(bug("[PM_ExLst] size %d\n", size));
66 values = AllocVec(size * sizeof(ULONG), MEMF_ANY);
68 if (values)
70 values[0] = id; // initial value
72 va_start(ap, id);
74 // fill the array
75 for (idx = 1; idx < size; idx++)
77 values[idx] = va_arg(ap, ULONG);
78 D(bug("[PM_ExLst] i %d value %d\n", idx, values[idx]));
81 retval = PM_ExLstA(values);
84 va_end(ap);
86 FreeVec(values);
87 #else
88 retval = PM_ExLstA((ULONG *)&id);
89 #endif
91 return retval;
93 } /* PM_ExLst */