Remove cs_dbg.h from amalgamated headers

PUBLISHED_FROM=993c4b1bec363e3f7975b83710e694792bedf5b3
This commit is contained in:
Alexander Alashkin 2016-08-18 15:50:06 +02:00 committed by Cesanta Bot
parent af6fc64ab9
commit f149f4aab1
10 changed files with 145 additions and 136 deletions

View File

@ -6,6 +6,7 @@
#include "bm222.h"
#include "mongoose.h"
#include "cs_dbg.h"
#include "i2c_if.h"

1
examples/CC3200/cs_dbg.h Symbolic link
View File

@ -0,0 +1 @@
./../../../common/cs_dbg.h

View File

@ -12,6 +12,7 @@
#include "bm222.h"
#include "tmp006.h"
#include "cs_dbg.h"
struct temp_data {
double ts;

View File

@ -26,7 +26,7 @@
/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
#include <mongoose.h>
#include "cs_dbg.h"
#include <simplelink/include/device.h>
#include "data.h"

View File

@ -11,6 +11,7 @@
#include <driverlib/utils.h>
#include <example/common/gpio_if.h>
#include "cs_dbg.h"
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
switch (e->Event) {

View File

@ -0,0 +1 @@
./../../../../common/cs_dbg.h

View File

@ -6,6 +6,7 @@
#include "esp_common.h"
#include "mongoose.h"
#include "cs_dbg.h"
#define AP_SSID "Mongoose"
#define AP_PASS "Mongoose"

View File

@ -33,7 +33,7 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
char rname[256];
rr = &msg->questions[i];
mg_dns_uncompress_name(msg, &rr->name, rname, sizeof(rname) - 1);
LOG(LL_INFO, ("Q type %d name %s", rr->rtype, rname));
fprintf(stdout, "Q type %d name %s\n", rr->rtype, rname);
if (rr->rtype == MG_DNS_A_RECORD) {
mg_dns_reply_record(&reply, rr, NULL, rr->rtype, 10, &s_our_ip_addr,
4);
@ -62,7 +62,6 @@ int main(int argc, char *argv[]) {
mg_mgr_init(&mgr, NULL);
s_our_ip_addr = inet_addr("127.0.0.1");
cs_log_set_level(LL_INFO);
/* Parse command line arguments */
for (i = 1; i < argc; i++) {

View File

@ -55,6 +55,7 @@
/* Amalgamated: #include "mongoose/src/net.h" */
/* Amalgamated: #include "mongoose/src/http.h" */
/* Amalgamated: #include "common/cs_dbg.h" */
#define MG_CTL_MSG_MESSAGE_SIZE 8192
@ -120,6 +121,142 @@ extern void *(*test_calloc)(size_t count, size_t size);
#endif /* CS_MONGOOSE_SRC_INTERNAL_H_ */
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/cs_dbg.h"
#endif
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
#ifndef CS_COMMON_CS_DBG_H_
#define CS_COMMON_CS_DBG_H_
#ifndef CS_DISABLE_STDIO
#include <stdio.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
enum cs_log_level {
LL_NONE = -1,
LL_ERROR = 0,
LL_WARN = 1,
LL_INFO = 2,
LL_DEBUG = 3,
LL_VERBOSE_DEBUG = 4,
_LL_MIN = -2,
_LL_MAX = 5,
};
void cs_log_set_level(enum cs_log_level level);
#ifndef CS_DISABLE_STDIO
void cs_log_set_file(FILE *file);
extern enum cs_log_level cs_log_level;
void cs_log_print_prefix(const char *func);
void cs_log_printf(const char *fmt, ...);
#define LOG(l, x) \
if (cs_log_level >= l) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#ifndef CS_NDEBUG
#define DBG(x) \
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#else /* NDEBUG */
#define DBG(x)
#endif
#else /* CS_DISABLE_STDIO */
#define LOG(l, x)
#define DBG(x)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CS_COMMON_CS_DBG_H_ */
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/cs_dbg.c"
#endif
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
/* Amalgamated: #include "common/cs_dbg.h" */
#include <stdarg.h>
#include <stdio.h>
/* Amalgamated: #include "common/cs_time.h" */
enum cs_log_level cs_log_level =
#ifdef CS_ENABLE_DEBUG
LL_VERBOSE_DEBUG;
#else
LL_ERROR;
#endif
#ifndef CS_DISABLE_STDIO
FILE *cs_log_file = NULL;
#ifdef CS_LOG_TS_DIFF
double cs_log_ts;
#endif
void cs_log_print_prefix(const char *func) {
if (cs_log_file == NULL) cs_log_file = stderr;
fprintf(cs_log_file, "%-20s ", func);
#ifdef CS_LOG_TS_DIFF
{
double now = cs_time();
fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
cs_log_ts = now;
}
#endif
}
void cs_log_printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(cs_log_file, fmt, ap);
va_end(ap);
fputc('\n', cs_log_file);
fflush(cs_log_file);
}
void cs_log_set_file(FILE *file) {
cs_log_file = file;
}
#endif /* !CS_DISABLE_STDIO */
void cs_log_set_level(enum cs_log_level level) {
cs_log_level = level;
#if defined(CS_LOG_TS_DIFF) && !defined(CS_DISABLE_STDIO)
cs_log_ts = cs_time();
#endif
}
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/base64.c"
#endif
/*
@ -323,69 +460,6 @@ int cs_base64_decode(const unsigned char *s, int len, char *dst) {
#endif /* EXCLUDE_COMMON */
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/cs_dbg.c"
#endif
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
/* Amalgamated: #include "common/cs_dbg.h" */
#include <stdarg.h>
#include <stdio.h>
/* Amalgamated: #include "common/cs_time.h" */
enum cs_log_level cs_log_level =
#ifdef CS_ENABLE_DEBUG
LL_VERBOSE_DEBUG;
#else
LL_ERROR;
#endif
#ifndef CS_DISABLE_STDIO
FILE *cs_log_file = NULL;
#ifdef CS_LOG_TS_DIFF
double cs_log_ts;
#endif
void cs_log_print_prefix(const char *func) {
if (cs_log_file == NULL) cs_log_file = stderr;
fprintf(cs_log_file, "%-20s ", func);
#ifdef CS_LOG_TS_DIFF
{
double now = cs_time();
fprintf(cs_log_file, "%7u ", (unsigned int) ((now - cs_log_ts) * 1000000));
cs_log_ts = now;
}
#endif
}
void cs_log_printf(const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(cs_log_file, fmt, ap);
va_end(ap);
fputc('\n', cs_log_file);
fflush(cs_log_file);
}
void cs_log_set_file(FILE *file) {
cs_log_file = file;
}
#endif /* !CS_DISABLE_STDIO */
void cs_log_set_level(enum cs_log_level level) {
cs_log_level = level;
#if defined(CS_LOG_TS_DIFF) && !defined(CS_DISABLE_STDIO)
cs_log_ts = cs_time();
#endif
}
#ifdef MG_MODULE_LINES
#line 1 "./src/../../common/cs_dirent.h"
#endif
/*

View File

@ -750,76 +750,6 @@ int sl_set_ssl_opts(struct mg_connection *nc);
* All rights reserved
*/
#ifndef CS_COMMON_CS_DBG_H_
#define CS_COMMON_CS_DBG_H_
#ifndef CS_DISABLE_STDIO
#include <stdio.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
enum cs_log_level {
LL_NONE = -1,
LL_ERROR = 0,
LL_WARN = 1,
LL_INFO = 2,
LL_DEBUG = 3,
LL_VERBOSE_DEBUG = 4,
_LL_MIN = -2,
_LL_MAX = 5,
};
void cs_log_set_level(enum cs_log_level level);
#ifndef CS_DISABLE_STDIO
void cs_log_set_file(FILE *file);
extern enum cs_log_level cs_log_level;
void cs_log_print_prefix(const char *func);
void cs_log_printf(const char *fmt, ...);
#define LOG(l, x) \
if (cs_log_level >= l) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#ifndef CS_NDEBUG
#define DBG(x) \
if (cs_log_level >= LL_VERBOSE_DEBUG) { \
cs_log_print_prefix(__func__); \
cs_log_printf x; \
}
#else /* NDEBUG */
#define DBG(x)
#endif
#else /* CS_DISABLE_STDIO */
#define LOG(l, x)
#define DBG(x)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CS_COMMON_CS_DBG_H_ */
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
#ifndef CS_COMMON_CS_TIME_H_
#define CS_COMMON_CS_TIME_H_