Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
/* Simple Plugin API */
/* SPDX-FileCopyrightText: Copyright © 2022 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#ifndef SPA_DEBUG_FILE_H
#define SPA_DEBUG_FILE_H
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include <spa/utils/defs.h>
#include <spa/support/log.h>
#include <spa/debug/context.h>
#include <spa/debug/dict.h>
#include <spa/debug/format.h>
#include <spa/debug/mem.h>
#include <spa/debug/pod.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SPA_API_DEBUG_FILE
#ifdef SPA_API_IMPL
#define SPA_API_DEBUG_FILE SPA_API_IMPL
#else
#define SPA_API_DEBUG_FILE static inline
#endif
#endif
struct spa_debug_file_ctx {
struct spa_debug_context ctx;
FILE *f;
};
SPA_PRINTF_FUNC(2,3)
SPA_API_DEBUG_FILE void spa_debug_file_log(struct spa_debug_context *ctx, const char *fmt, ...)
{
struct spa_debug_file_ctx *c = SPA_CONTAINER_OF(ctx, struct spa_debug_file_ctx, ctx);
va_list args;
va_start(args, fmt);
vfprintf(c->f, fmt, args); fputc('\n', c->f);
va_end(args);
}
#define SPA_DEBUG_FILE_INIT(_f) \
(struct spa_debug_file_ctx){ { spa_debug_file_log }, _f, }
#define spa_debug_file_error_location(f,loc,fmt,...) \
({ \
struct spa_debug_file_ctx c = SPA_DEBUG_FILE_INIT(f); \
if (fmt) spa_debugc(&c.ctx, fmt, __VA_ARGS__); \
spa_debugc_error_location(&c.ctx, loc); \
})
/**
* \}
*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SPA_DEBUG_FILE_H */
dict.h
spa/debug/dict.h
format.h
spa/debug/format.h
pod.h
spa/debug/pod.h
defs.h
spa/utils/defs.h
args
uint32_t int int const char va_list args
Definition core.h:434
va_end
va_end(args)
va_start
va_start(args, message)
spa_debug_file_log
SPA_API_DEBUG_FILE void spa_debug_file_log(struct spa_debug_context *ctx, const char *fmt,...)
Definition file.h:50
SPA_API_DEBUG_FILE
#define SPA_API_DEBUG_FILE
Definition file.h:40
SPA_CONTAINER_OF
#define SPA_CONTAINER_OF(p, t, m)
Definition defs.h:235
SPA_PRINTF_FUNC
#define SPA_PRINTF_FUNC(fmt, arg1)
Definition defs.h:297
context.h
spa/debug/context.h
mem.h
spa/debug/mem.h
log.h
spa/support/log.h
spa_debug_context
Definition context.h:46
spa_debug_file_ctx
Definition file.h:44
spa_debug_file_ctx::f
FILE * f
Definition file.h:46
spa_debug_file_ctx::ctx
struct spa_debug_context ctx
Definition file.h:45