Cleanup: use 'e' prefix for enum types

This commit is contained in:
Campbell Barton 2021-10-19 18:33:42 +11:00
parent 695dc07cb1
commit 9c8255d486
17 changed files with 73 additions and 73 deletions

View File

@ -90,12 +90,12 @@ typedef struct MainIDRelationsEntry {
} MainIDRelationsEntry;
/* MainIDRelationsEntry.tags */
typedef enum MainIDRelationsEntryTags {
typedef enum eMainIDRelationsEntryTags {
/* Generic tag marking the entry as to be processed. */
MAINIDRELATIONS_ENTRY_TAGS_DOIT = 1 << 0,
/* Generic tag marking the entry as processed. */
MAINIDRELATIONS_ENTRY_TAGS_PROCESSED = 1 << 1,
} MainIDRelationsEntryTags;
} eMainIDRelationsEntryTags;
typedef struct MainIDRelations {
/* Mapping from an ID pointer to all of its parents (IDs using it) and children (IDs it uses).
@ -209,7 +209,7 @@ void BKE_main_unlock(struct Main *bmain);
void BKE_main_relations_create(struct Main *bmain, const short flag);
void BKE_main_relations_free(struct Main *bmain);
void BKE_main_relations_tag_set(struct Main *bmain,
const MainIDRelationsEntryTags tag,
const eMainIDRelationsEntryTags tag,
const bool value);
struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);

View File

@ -40,27 +40,27 @@ extern "C" {
void BKE_reports_init(ReportList *reports, int flag);
void BKE_reports_clear(ReportList *reports);
void BKE_report(ReportList *reports, ReportType type, const char *message);
void BKE_reportf(ReportList *reports, ReportType type, const char *format, ...)
void BKE_report(ReportList *reports, eReportType type, const char *message);
void BKE_reportf(ReportList *reports, eReportType type, const char *format, ...)
ATTR_PRINTF_FORMAT(3, 4);
void BKE_reports_prepend(ReportList *reports, const char *prepend);
void BKE_reports_prependf(ReportList *reports, const char *prepend, ...) ATTR_PRINTF_FORMAT(2, 3);
ReportType BKE_report_print_level(ReportList *reports);
void BKE_report_print_level_set(ReportList *reports, ReportType level);
eReportType BKE_report_print_level(ReportList *reports);
void BKE_report_print_level_set(ReportList *reports, eReportType level);
ReportType BKE_report_store_level(ReportList *reports);
void BKE_report_store_level_set(ReportList *reports, ReportType level);
eReportType BKE_report_store_level(ReportList *reports);
void BKE_report_store_level_set(ReportList *reports, eReportType level);
char *BKE_reports_string(ReportList *reports, ReportType level);
void BKE_reports_print(ReportList *reports, ReportType level);
char *BKE_reports_string(ReportList *reports, eReportType level);
void BKE_reports_print(ReportList *reports, eReportType level);
Report *BKE_reports_last_displayable(ReportList *reports);
bool BKE_reports_contain(ReportList *reports, ReportType level);
bool BKE_reports_contain(ReportList *reports, eReportType level);
const char *BKE_report_type_str(ReportType type);
const char *BKE_report_type_str(eReportType type);
bool BKE_report_write_file_fp(FILE *fp, ReportList *reports, const char *header);
bool BKE_report_write_file(const char *filepath, ReportList *reports, const char *header);

View File

@ -102,11 +102,11 @@ typedef enum eUndoStepDir {
STEP_INVALID = 0,
} eUndoStepDir;
typedef enum UndoPushReturn {
typedef enum eUndoPushReturn {
UNDO_PUSH_RET_FAILURE = 0,
UNDO_PUSH_RET_SUCCESS = (1 << 0),
UNDO_PUSH_RET_OVERRIDE_CHANGED = (1 << 1),
} UndoPushReturn;
} eUndoPushReturn;
typedef void (*UndoTypeForEachIDRefFn)(void *user_data, struct UndoRefID *id_ref);
@ -156,7 +156,7 @@ typedef struct UndoType {
} UndoType;
/** #UndoType.flag bitflags. */
typedef enum UndoTypeFlags {
typedef enum eUndoTypeFlags {
/**
* This undo type `encode` callback needs a valid context, it will fail otherwise.
* \note Callback is still supposed to properly deal with a NULL context pointer.
@ -169,7 +169,7 @@ typedef enum UndoTypeFlags {
* This is typically used for undo systems that store both before/after states.
*/
UNDOTYPE_FLAG_DECODE_ACTIVE_STEP = 1 << 1,
} UndoTypeFlags;
} eUndoTypeFlags;
/* Expose since we need to perform operations on specific undo types (rarely). */
extern const UndoType *BKE_UNDOSYS_TYPE_IMAGE;
@ -204,11 +204,11 @@ UndoStep *BKE_undosys_step_push_init_with_type(UndoStack *ustack,
const UndoType *ut);
UndoStep *BKE_undosys_step_push_init(UndoStack *ustack, struct bContext *C, const char *name);
UndoPushReturn BKE_undosys_step_push_with_type(UndoStack *ustack,
struct bContext *C,
const char *name,
const UndoType *ut);
UndoPushReturn BKE_undosys_step_push(UndoStack *ustack, struct bContext *C, const char *name);
eUndoPushReturn BKE_undosys_step_push_with_type(UndoStack *ustack,
struct bContext *C,
const char *name,
const UndoType *ut);
eUndoPushReturn BKE_undosys_step_push(UndoStack *ustack, struct bContext *C, const char *name);
UndoStep *BKE_undosys_step_find_by_name_with_type(UndoStack *ustack,
const char *name,

View File

@ -328,7 +328,7 @@ void BKE_main_relations_free(Main *bmain)
/** Set or clear given `tag` in all relation entries of given `bmain`. */
void BKE_main_relations_tag_set(struct Main *bmain,
const MainIDRelationsEntryTags tag,
const eMainIDRelationsEntryTags tag,
const bool value)
{
if (bmain->relations == NULL) {

View File

@ -37,7 +37,7 @@
#include "BKE_global.h" /* G.background only */
#include "BKE_report.h"
const char *BKE_report_type_str(ReportType type)
const char *BKE_report_type_str(eReportType type)
{
switch (type) {
case RPT_DEBUG:
@ -101,7 +101,7 @@ void BKE_reports_clear(ReportList *reports)
BLI_listbase_clear(&reports->list);
}
void BKE_report(ReportList *reports, ReportType type, const char *_message)
void BKE_report(ReportList *reports, eReportType type, const char *_message)
{
Report *report;
int len;
@ -129,7 +129,7 @@ void BKE_report(ReportList *reports, ReportType type, const char *_message)
}
}
void BKE_reportf(ReportList *reports, ReportType type, const char *_format, ...)
void BKE_reportf(ReportList *reports, eReportType type, const char *_format, ...)
{
DynStr *ds;
Report *report;
@ -215,7 +215,7 @@ void BKE_reports_prependf(ReportList *reports, const char *_prepend, ...)
}
}
ReportType BKE_report_print_level(ReportList *reports)
eReportType BKE_report_print_level(ReportList *reports)
{
if (!reports) {
return RPT_ERROR;
@ -224,7 +224,7 @@ ReportType BKE_report_print_level(ReportList *reports)
return reports->printlevel;
}
void BKE_report_print_level_set(ReportList *reports, ReportType level)
void BKE_report_print_level_set(ReportList *reports, eReportType level)
{
if (!reports) {
return;
@ -233,7 +233,7 @@ void BKE_report_print_level_set(ReportList *reports, ReportType level)
reports->printlevel = level;
}
ReportType BKE_report_store_level(ReportList *reports)
eReportType BKE_report_store_level(ReportList *reports)
{
if (!reports) {
return RPT_ERROR;
@ -242,7 +242,7 @@ ReportType BKE_report_store_level(ReportList *reports)
return reports->storelevel;
}
void BKE_report_store_level_set(ReportList *reports, ReportType level)
void BKE_report_store_level_set(ReportList *reports, eReportType level)
{
if (!reports) {
return;
@ -251,7 +251,7 @@ void BKE_report_store_level_set(ReportList *reports, ReportType level)
reports->storelevel = level;
}
char *BKE_reports_string(ReportList *reports, ReportType level)
char *BKE_reports_string(ReportList *reports, eReportType level)
{
Report *report;
DynStr *ds;
@ -279,7 +279,7 @@ char *BKE_reports_string(ReportList *reports, ReportType level)
return cstring;
}
void BKE_reports_print(ReportList *reports, ReportType level)
void BKE_reports_print(ReportList *reports, eReportType level)
{
char *cstring = BKE_reports_string(reports, level);
@ -305,7 +305,7 @@ Report *BKE_reports_last_displayable(ReportList *reports)
return NULL;
}
bool BKE_reports_contain(ReportList *reports, ReportType level)
bool BKE_reports_contain(ReportList *reports, eReportType level)
{
Report *report;
if (reports != NULL) {

View File

@ -346,7 +346,7 @@ static bool undosys_stack_push_main(UndoStack *ustack, const char *name, struct
CLOG_INFO(&LOG, 1, "'%s'", name);
bContext *C_temp = CTX_create();
CTX_data_main_set(C_temp, bmain);
UndoPushReturn ret = BKE_undosys_step_push_with_type(
eUndoPushReturn ret = BKE_undosys_step_push_with_type(
ustack, C_temp, name, BKE_UNDOSYS_TYPE_MEMFILE);
CTX_free(C_temp);
return (ret & UNDO_PUSH_RET_SUCCESS);
@ -500,17 +500,17 @@ UndoStep *BKE_undosys_step_push_init(UndoStack *ustack, bContext *C, const char
/**
* \param C: Can be NULL from some callers if their encoding function doesn't need it
*/
UndoPushReturn BKE_undosys_step_push_with_type(UndoStack *ustack,
bContext *C,
const char *name,
const UndoType *ut)
eUndoPushReturn BKE_undosys_step_push_with_type(UndoStack *ustack,
bContext *C,
const char *name,
const UndoType *ut)
{
BLI_assert((ut->flags & UNDOTYPE_FLAG_NEED_CONTEXT_FOR_ENCODE) == 0 || C != NULL);
UNDO_NESTED_ASSERT(false);
undosys_stack_validate(ustack, false);
bool is_not_empty = ustack->step_active != NULL;
UndoPushReturn retval = UNDO_PUSH_RET_FAILURE;
eUndoPushReturn retval = UNDO_PUSH_RET_FAILURE;
/* Might not be final place for this to be called - probably only want to call it from some
* undo handlers, not all of them? */
@ -602,7 +602,7 @@ UndoPushReturn BKE_undosys_step_push_with_type(UndoStack *ustack,
return (retval | UNDO_PUSH_RET_SUCCESS);
}
UndoPushReturn BKE_undosys_step_push(UndoStack *ustack, bContext *C, const char *name)
eUndoPushReturn BKE_undosys_step_push(UndoStack *ustack, bContext *C, const char *name)
{
UNDO_NESTED_ASSERT(false);
const UndoType *ut = ustack->step_init ? ustack->step_init->type :

View File

@ -62,10 +62,10 @@ int BLI_task_scheduler_num_threads(void);
* be launched.
*/
typedef enum TaskPriority {
typedef enum eTaskPriority {
TASK_PRIORITY_LOW,
TASK_PRIORITY_HIGH,
} TaskPriority;
} eTaskPriority;
typedef struct TaskPool TaskPool;
typedef void (*TaskRunFunction)(TaskPool *__restrict pool, void *taskdata);
@ -73,21 +73,21 @@ typedef void (*TaskFreeFunction)(TaskPool *__restrict pool, void *taskdata);
/* Regular task pool that immediately starts executing tasks as soon as they
* are pushed, either on the current or another thread. */
TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority);
TaskPool *BLI_task_pool_create(void *userdata, eTaskPriority priority);
/* Background: always run tasks in a background thread, never immediately
* execute them. For running background jobs. */
TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority);
TaskPool *BLI_task_pool_create_background(void *userdata, eTaskPriority priority);
/* Background Serial: run tasks one after the other in the background,
* without parallelization between the tasks. */
TaskPool *BLI_task_pool_create_background_serial(void *userdata, TaskPriority priority);
TaskPool *BLI_task_pool_create_background_serial(void *userdata, eTaskPriority priority);
/* Suspended: don't execute tasks until work_and_wait is called. This is slower
* as threads can't immediately start working. But it can be used if the data
* structures the threads operate on are not fully initialized until all tasks
* are created. */
TaskPool *BLI_task_pool_create_suspended(void *userdata, TaskPriority priority);
TaskPool *BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority);
/* No threads: immediately executes tasks on the same thread. For debugging. */
TaskPool *BLI_task_pool_create_no_threads(void *userdata);

View File

@ -121,7 +121,7 @@ class Task {
#ifdef WITH_TBB
class TBBTaskGroup : public tbb::task_group {
public:
TBBTaskGroup(TaskPriority priority)
TBBTaskGroup(eTaskPriority priority)
{
# if TBB_INTERFACE_VERSION_MAJOR >= 12
/* TODO: support priorities in TBB 2021, where they are only available as
@ -186,7 +186,7 @@ void Task::operator()() const
* Tasks may be suspended until in all are created, to make it possible to
* initialize data structures and create tasks in a single pass. */
static void tbb_task_pool_create(TaskPool *pool, TaskPriority priority)
static void tbb_task_pool_create(TaskPool *pool, eTaskPriority priority)
{
if (pool->type == TASK_POOL_TBB_SUSPENDED) {
pool->is_suspended = true;
@ -363,7 +363,7 @@ static void background_task_pool_free(TaskPool *pool)
/* Task Pool */
static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, TaskPriority priority)
static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, eTaskPriority priority)
{
const bool use_threads = BLI_task_scheduler_num_threads() > 1 && type != TASK_POOL_NO_THREADS;
@ -401,7 +401,7 @@ static TaskPool *task_pool_create_ex(void *userdata, TaskPoolType type, TaskPrio
/**
* Create a normal task pool. Tasks will be executed as soon as they are added.
*/
TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority)
TaskPool *BLI_task_pool_create(void *userdata, eTaskPriority priority)
{
return task_pool_create_ex(userdata, TASK_POOL_TBB, priority);
}
@ -418,7 +418,7 @@ TaskPool *BLI_task_pool_create(void *userdata, TaskPriority priority)
* they could end never being executed, since the 'fallback' background thread is already
* busy with parent task in single-threaded context).
*/
TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority)
TaskPool *BLI_task_pool_create_background(void *userdata, eTaskPriority priority)
{
return task_pool_create_ex(userdata, TASK_POOL_BACKGROUND, priority);
}
@ -428,7 +428,7 @@ TaskPool *BLI_task_pool_create_background(void *userdata, TaskPriority priority)
* for until BLI_task_pool_work_and_wait() is called. This helps reducing threading
* overhead when pushing huge amount of small initial tasks from the main thread.
*/
TaskPool *BLI_task_pool_create_suspended(void *userdata, TaskPriority priority)
TaskPool *BLI_task_pool_create_suspended(void *userdata, eTaskPriority priority)
{
return task_pool_create_ex(userdata, TASK_POOL_TBB_SUSPENDED, priority);
}
@ -446,7 +446,7 @@ TaskPool *BLI_task_pool_create_no_threads(void *userdata)
* Task pool that executes one task after the other, possibly on different threads
* but never in parallel.
*/
TaskPool *BLI_task_pool_create_background_serial(void *userdata, TaskPriority priority)
TaskPool *BLI_task_pool_create_background_serial(void *userdata, eTaskPriority priority)
{
return task_pool_create_ex(userdata, TASK_POOL_BACKGROUND_SERIAL, priority);
}

View File

@ -43,7 +43,7 @@
/* for SDNA_TYPE_FROM_STRUCT() macro */
#include "dna_type_offsets.h"
#include "DNA_windowmanager_types.h" /* for ReportType */
#include "DNA_windowmanager_types.h" /* for eReportType */
#ifdef __cplusplus
extern "C" {
@ -252,7 +252,7 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id);
*/
void BLO_reportf_wrap(struct BlendFileReadReport *reports,
ReportType type,
eReportType type,
const char *format,
...) ATTR_PRINTF_FORMAT(3, 4);

View File

@ -222,7 +222,7 @@ typedef struct BHeadN {
* bit kludge but better than doubling up on prints,
* we could alternatively have a versions of a report function which forces printing - campbell
*/
void BLO_reportf_wrap(BlendFileReadReport *reports, ReportType type, const char *format, ...)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format, ...)
{
char fixed_buf[1024]; /* should be long enough */

View File

@ -31,7 +31,7 @@
#include "BLI_filereader.h"
#include "DNA_sdna_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h" /* for ReportType */
#include "DNA_windowmanager_types.h" /* for eReportType */
struct BLI_mmap_file;
struct BLOCacheStorage;

View File

@ -166,7 +166,7 @@ bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool
eBMOpErrorLevel level;
while (BMO_error_pop(em->bm, &errmsg, NULL, &level)) {
ReportType type = RPT_INFO;
eReportType type = RPT_INFO;
switch (level) {
case BMO_ERROR_CANCEL: {
changed_was_set = true;

View File

@ -146,7 +146,7 @@ void ED_undo_push(bContext *C, const char *str)
}
}
UndoPushReturn push_retval;
eUndoPushReturn push_retval;
/* Only apply limit if this is the last undo step. */
if (wm->undo_stack->step_active && (wm->undo_stack->step_active->next == NULL)) {

View File

@ -59,7 +59,7 @@ struct wmTimer;
#define KMAP_MAX_NAME 64
/* keep in sync with 'rna_enum_wm_report_items' in wm_rna.c */
typedef enum ReportType {
typedef enum eReportType {
RPT_DEBUG = (1 << 0),
RPT_INFO = (1 << 1),
RPT_OPERATOR = (1 << 2),
@ -69,7 +69,7 @@ typedef enum ReportType {
RPT_ERROR_INVALID_INPUT = (1 << 6),
RPT_ERROR_INVALID_CONTEXT = (1 << 7),
RPT_ERROR_OUT_OF_MEMORY = (1 << 8),
} ReportType;
} eReportType;
#define RPT_DEBUG_ALL (RPT_DEBUG)
#define RPT_INFO_ALL (RPT_INFO)
@ -91,7 +91,7 @@ enum ReportListFlags {
#
typedef struct Report {
struct Report *next, *prev;
/** ReportType. */
/** eReportType. */
short type;
short flag;
/** `strlen(message)`, saves some time calculating the word wrap. */
@ -103,9 +103,9 @@ typedef struct Report {
/* saved in the wm, don't remove */
typedef struct ReportList {
ListBase list;
/** ReportType. */
/** eReportType. */
int printlevel;
/** ReportType. */
/** eReportType. */
int storelevel;
int flag;
char _pad[4];

View File

@ -178,12 +178,12 @@ void WM_opengl_context_dispose(void *context);
void WM_opengl_context_activate(void *context);
void WM_opengl_context_release(void *context);
/* WM_window_open alignment */
typedef enum WindowAlignment {
/* #WM_window_open alignment */
typedef enum eWindowAlignment {
WIN_ALIGN_ABSOLUTE = 0,
WIN_ALIGN_LOCATION_CENTER,
WIN_ALIGN_PARENT_CENTER,
} WindowAlignment;
} eWindowAlignment;
struct wmWindow *WM_window_open(struct bContext *C,
const char *title,
@ -195,7 +195,7 @@ struct wmWindow *WM_window_open(struct bContext *C,
bool toplevel,
bool dialog,
bool temp,
WindowAlignment alignment);
eWindowAlignment alignment);
void WM_window_set_dpi(const wmWindow *win);
@ -372,8 +372,8 @@ void WM_main_remap_editor_id_reference(struct ID *old_id, struct ID *new_id);
/* reports */
void WM_report_banner_show(void);
void WM_report_banners_cancel(struct Main *bmain);
void WM_report(ReportType type, const char *message);
void WM_reportf(ReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(2, 3);
void WM_report(eReportType type, const char *message);
void WM_reportf(eReportType type, const char *format, ...) ATTR_PRINTF_FORMAT(2, 3);
struct wmEvent *wm_event_add_ex(struct wmWindow *win,
const struct wmEvent *event_to_add,

View File

@ -804,7 +804,7 @@ static void wm_add_reports(ReportList *reports)
}
}
void WM_report(ReportType type, const char *message)
void WM_report(eReportType type, const char *message)
{
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
@ -815,7 +815,7 @@ void WM_report(ReportType type, const char *message)
BKE_reports_clear(&reports);
}
void WM_reportf(ReportType type, const char *format, ...)
void WM_reportf(eReportType type, const char *format, ...)
{
va_list args;

View File

@ -772,7 +772,7 @@ wmWindow *WM_window_open(bContext *C,
bool toplevel,
bool dialog,
bool temp,
WindowAlignment alignment)
eWindowAlignment alignment)
{
Main *bmain = CTX_data_main(C);
wmWindowManager *wm = CTX_wm_manager(C);