Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / compiler / alib / easyrequest.c
blob871e58baed6e2bdc48d13b051fbc506bdbaed166
1 /*
2 Copyright (C) 1995-2016, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stdarg.h>
7 #include "alib_intern.h"
8 #include <proto/intuition.h>
9 #include <proto/exec.h>
10 #include <proto/alib.h>
12 static STRPTR CreateFormatStringFromEasyStruct(struct EasyStruct *easyStruct)
14 STRPTR format = NULL;
15 LONG lentext = 0, lengadget = 0;
17 if (easyStruct->es_TextFormat) lentext = STRLEN(easyStruct->es_TextFormat);
18 if (easyStruct->es_GadgetFormat) lengadget = STRLEN(easyStruct->es_GadgetFormat);
20 format = AllocVec(lentext + lengadget + 1, MEMF_PUBLIC);
21 CopyMem(easyStruct->es_TextFormat, format, lentext);
22 CopyMem(easyStruct->es_GadgetFormat, format + lentext, lengadget);
23 format[lentext + lengadget] = '\0';
25 return format;
28 static void FreeFormatString(STRPTR format)
30 FreeVec(format);
33 /*****************************************************************************
35 NAME */
37 LONG EasyRequest (
39 /* SYNOPSIS */
40 struct Window *window,
41 struct EasyStruct *easyStruct,
42 ULONG *IDCMP_ptr,
43 ...)
45 /* FUNCTION
47 INPUTS
49 RESULT
51 NOTES
53 EXAMPLE
55 BUGS
57 SEE ALSO
59 INTERNALS
61 *****************************************************************************/
63 LONG retval;
64 STRPTR format = CreateFormatStringFromEasyStruct(easyStruct);
66 AROS_SLOWSTACKFORMAT_PRE_USING(IDCMP_ptr, format);
67 retval = EasyRequestArgs(window, easyStruct, IDCMP_ptr, AROS_SLOWSTACKFORMAT_ARG(format));
68 AROS_SLOWSTACKFORMAT_POST(format);
70 FreeFormatString(format);
72 return retval;
73 } /* EasyRequest */
77 /*****************************************************************************
79 NAME */
81 struct Window * BuildEasyRequest (
83 /* SYNOPSIS */
84 struct Window *RefWindow,
85 struct EasyStruct *easyStruct,
86 ULONG IDCMP,
87 ...)
89 /* FUNCTION
91 INPUTS
93 RESULT
95 NOTES
97 EXAMPLE
99 BUGS
101 SEE ALSO
103 INTERNALS
105 *****************************************************************************/
107 struct Window * retval;
108 STRPTR format = CreateFormatStringFromEasyStruct(easyStruct);
110 AROS_SLOWSTACKFORMAT_PRE_USING(IDCMP, format);
111 retval = BuildEasyRequestArgs(RefWindow, easyStruct, IDCMP, AROS_SLOWSTACKFORMAT_ARG(format));
112 AROS_SLOWSTACKFORMAT_POST(format);
114 FreeFormatString(format);
116 return retval;
117 } /* BuildEasyRequest */