headers/os: Make headers generator-friendly

Make Haiku headers a bit more friendly to binding generators by:
- Giving some `enum`s names (especially those that appear in
default arguments).
- Converting an internal `inline` function into a macro so that
the result could be evaluated in compile time.

Change-Id: I770674ad8fa7b24ac30b6b447d52a4b4c2530b8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6716
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Trung Nguyen 2023-07-09 23:33:32 +10:00 committed by waddlesplash
parent 14a0c87fd9
commit 3cb845283e
6 changed files with 22 additions and 22 deletions

View File

@ -17,6 +17,7 @@
#include <Locker.h>
#include <StopWatch.h>
#include <String.h>
#include <StringList.h>
#include <SupportDefs.h>
#include <TypeConstants.h>
#include <UTF8.h>

View File

@ -25,7 +25,7 @@ extern const BCursor *B_CURSOR_I_BEAM;
// System Message Codes
enum {
enum system_message_code {
B_ABOUT_REQUESTED = '_ABR',
B_WINDOW_ACTIVATED = '_ACT',
B_APP_ACTIVATED = '_ACT', // Same as B_WINDOW_ACTIVATED
@ -93,7 +93,7 @@ enum {
// Other Commands
enum {
enum command_code {
B_SET_PROPERTY = 'PSET',
B_GET_PROPERTY = 'PGET',
B_CREATE_PROPERTY = 'PCRT',

View File

@ -37,7 +37,7 @@ struct app_info {
#define _B_APP_INFO_RESERVED1_ (0x10000000)
// watching request flags
enum {
enum watching_request_flags {
B_REQUEST_LAUNCHED = 0x00000001,
B_REQUEST_QUIT = 0x00000002,
B_REQUEST_ACTIVATED = 0x00000004,

View File

@ -10,7 +10,7 @@
#include <Picture.h>
enum {
enum picture_button_behavior {
B_ONE_STATE_BUTTON,
B_TWO_STATE_BUTTON
};

View File

@ -51,13 +51,13 @@ enum {
// will filter out older mouse moved messages)
};
enum {
enum rect_tracking_style {
B_TRACK_WHOLE_RECT,
B_TRACK_RECT_CORNER
};
// set font mask
enum {
enum set_font_mask {
B_FONT_FAMILY_AND_STYLE = 0x00000001,
B_FONT_SIZE = 0x00000002,
B_FONT_SHEAR = 0x00000004,
@ -104,25 +104,24 @@ const uint32 _VIEW_BOTTOM_ = 3UL;
const uint32 _VIEW_RIGHT_ = 4UL;
const uint32 _VIEW_CENTER_ = 5UL;
inline uint32 _rule_(uint32 r1, uint32 r2, uint32 r3, uint32 r4)
{ return ((r1 << 12) | (r2 << 8) | (r3 << 4) | r4); }
#define _rule_(r1, r2, r3, r4) (((r1) << 12) | ((r2) << 8) | ((r3) << 4) | (r4))
#define B_FOLLOW_NONE 0
#define B_FOLLOW_ALL_SIDES _rule_(_VIEW_TOP_, _VIEW_LEFT_, _VIEW_BOTTOM_, \
_VIEW_RIGHT_)
#define B_FOLLOW_ALL B_FOLLOW_ALL_SIDES
const uint32 B_FOLLOW_NONE = 0;
const uint32 B_FOLLOW_ALL_SIDES = _rule_(_VIEW_TOP_, _VIEW_LEFT_,
_VIEW_BOTTOM_, _VIEW_RIGHT_);
const uint32 B_FOLLOW_ALL = B_FOLLOW_ALL_SIDES;
#define B_FOLLOW_LEFT _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_)
#define B_FOLLOW_RIGHT _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_)
#define B_FOLLOW_LEFT_RIGHT _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_)
#define B_FOLLOW_H_CENTER _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_)
const uint32 B_FOLLOW_LEFT = _rule_(0, _VIEW_LEFT_, 0, _VIEW_LEFT_);
const uint32 B_FOLLOW_RIGHT = _rule_(0, _VIEW_RIGHT_, 0, _VIEW_RIGHT_);
const uint32 B_FOLLOW_LEFT_RIGHT = _rule_(0, _VIEW_LEFT_, 0, _VIEW_RIGHT_);
const uint32 B_FOLLOW_H_CENTER = _rule_(0, _VIEW_CENTER_, 0, _VIEW_CENTER_);
#define B_FOLLOW_TOP _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0)
#define B_FOLLOW_BOTTOM _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0)
#define B_FOLLOW_TOP_BOTTOM _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0)
#define B_FOLLOW_V_CENTER _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0)
const uint32 B_FOLLOW_TOP = _rule_(_VIEW_TOP_, 0, _VIEW_TOP_, 0);
const uint32 B_FOLLOW_BOTTOM = _rule_(_VIEW_BOTTOM_, 0, _VIEW_BOTTOM_, 0);
const uint32 B_FOLLOW_TOP_BOTTOM = _rule_(_VIEW_TOP_, 0, _VIEW_BOTTOM_, 0);
const uint32 B_FOLLOW_V_CENTER = _rule_(_VIEW_CENTER_, 0, _VIEW_CENTER_, 0);
#define B_FOLLOW_LEFT_TOP B_FOLLOW_TOP | B_FOLLOW_LEFT
const uint32 B_FOLLOW_LEFT_TOP = B_FOLLOW_TOP | B_FOLLOW_LEFT;
class BBitmap;
class BCursor;

View File

@ -46,7 +46,7 @@ PasswordWindow::PasswordWindow()
bounds.top += 10.0;
fPassword = new BTextControl(bounds, "password",
B_TRANSLATE("Enter password:"), "VeryLongPasswordPossible",
B_FOLLOW_NONE);
NULL, B_FOLLOW_NONE);
customBox->AddChild(fPassword);
fPassword->MakeFocus(true);
fPassword->ResizeToPreferred();