Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move varargs wrappers into OS4Support.cpp #53

Merged
merged 1 commit into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions OS4Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ APTR AllocSysObject(ULONG a_type, const struct TagItem *a_tags)
return retVal;
}

/**
* Convenience wrapper around AllocSysObject.
* This wrapper simply takes the pointer to the list of tags passed in on the stack and calls AllocSysObject
* using them.
*
* @date Monday 15-Apr-2024 6:02 am, Code HQ Tokyo Tsukuda
* @param a_type The type of object to be allocated, such as ASOT_PORT
* @param a_tag The first tag of the stack-based list of tags to use
* @return The return value from AllocSysObject
*/

APTR AllocSysObjectTags(ULONG a_type, Tag a_tag, ...)
{
return AllocSysObject(a_type, (struct TagItem *) &a_tag);
}

/**
* Converts a BCPL string to a C string.
* Safely copies a BSTR into a user supplied buffer, NULL terminating it at the appropriate length, and checking
Expand Down Expand Up @@ -177,3 +193,22 @@ void RefreshSetGadgetAttrsA(struct Gadget *a_gadget, struct Window *a_window, st
RefreshGList(a_gadget, a_window, a_requester, 1);
}
}

/**
* Convenience wrapper around RefreshSetGadgetAttrs.
* This wrapper simply takes the pointer to the list of tags passed in on the stack and calls RefreshSetGadgetAttrs
* using them.
*
* @date Monday 15-Apr-2024 6:10 am, Code HQ Tokyo Tsukuda
* @param a_gadget Pointer to the BOOPSI gadget object
* @param a_window Pointer to the window in which the gadget resides, or NULL
* @param a_requester Pointer to the requester in which the gadget resides, or NULL
* @param a_tag The first tag of the stack-based list of tags to use
* @return The return value from RefreshSetGadgetAttrs
*/

void RefreshSetGadgetAttrs(struct Gadget *a_gadget, struct Window *a_window, struct Requester *a_requester,
Tag a_tag, ...)
{
RefreshSetGadgetAttrsA(a_gadget, a_window, a_requester, (struct TagItem *) &a_tag);
}
36 changes: 9 additions & 27 deletions OS4Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@

#if defined(__amigaos__) && !defined(__amigaos4__)

APTR AllocSysObject(ULONG a_type, const struct TagItem *a_tags);
ULONG CopyStringBSTRToC(BSTR a_bstring, STRPTR a_dest, ULONG a_size);
ULONG DateStampToSeconds(const struct DateStamp *a_dateStamp);
void FreeSysObject(ULONG a_type, APTR a_object);
void RefreshSetGadgetAttrsA(struct Gadget *a_gadget, struct Window *a_window, struct Requester *a_requester,
struct TagItem *a_taglist);

/* New entries in dos/dos.h */

#define EXDB_NO_READ 3
Expand Down Expand Up @@ -43,26 +36,15 @@ enum enAllocSysObjectTypes
ASOT_SEMAPHORE = 8
};

inline APTR AllocSysObjectTags(ULONG a_type, Tag a_tag, ...)
{
va_list args;

va_start(args, a_tag);
APTR retVal = AllocSysObject(a_type, (struct TagItem *) &a_tag);
va_end(args);

return retVal;
}

inline void RefreshSetGadgetAttrs(struct Gadget *a_gadget, struct Window *a_window, struct Requester *a_requester,
Tag a_tag, ...)
{
va_list args;

va_start(args, a_tag);
RefreshSetGadgetAttrsA(a_gadget, a_window, a_requester, (struct TagItem *) &a_tag);
va_end(args);
}
APTR AllocSysObject(ULONG a_type, const struct TagItem *a_tags);
APTR AllocSysObjectTags(ULONG a_type, Tag a_tag, ...);
ULONG CopyStringBSTRToC(BSTR a_bstring, STRPTR a_dest, ULONG a_size);
ULONG DateStampToSeconds(const struct DateStamp *a_dateStamp);
void FreeSysObject(ULONG a_type, APTR a_object);
void RefreshSetGadgetAttrsA(struct Gadget *a_gadget, struct Window *a_window, struct Requester *a_requester,
struct TagItem *a_taglist);
void RefreshSetGadgetAttrs(struct Gadget *a_gadget, struct Window *a_window, struct Requester *a_requester,
Tag a_tag, ...);

#endif /* defined(__amigaos__) && !defined(__amigaos4__) */

Expand Down
Loading