Skip to content
Snippets Groups Projects
Commit 8108da4c authored by Dmitry Gerasimov's avatar Dmitry Gerasimov
Browse files

[-] Removed some depricated files

[*] Updated Qt pri
parent adc533d3
No related branches found
No related tags found
1 merge request!897hotfix-6925
Pipeline #19174 passed with stage
in 5 minutes and 30 seconds
/* Authors:
* Dmitriy A. Gearasimov <gerasimov.dmitriy@demlabs.net>
* Demlabs Ltd https://demlabs.net
* DAP SDK https://gitlab.demlabs.net/dap/dap-sdk
* Copyright (c) 2021
* All rights reserved.
This file is part of DAP SDK the open source project
DAP SDK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP SDK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "dap_common.h"
typedef struct dap_meta{
uint32_t value_length;
byte_t name_n_value[]; // Name and value are splitted with terminated 0
} dap_meta_t;
dap_meta_t * dap_meta_create(const char * a_name, const void * a_data, size_t a_data_size);
dap_meta_t* dap_meta_find(byte_t * a_data, size_t a_data_size, const char * a_name);
int dap_meta_check(dap_meta_t * a_meta);
#define dap_meta_create_scalar(name,value) dap_meta_create (name, &value, sizeof(value) )
#define dap_meta_get_scalar(a,typeconv) *((typeconv*) a->name_n_value + strlen(a->name_n_value)+1)
// NULL-terminated string
#define dap_meta_create_string(name,str) dap_meta_create (name,str, dap_strlen(str)+1)
#define dap_meta_get_string(a) ( ((char*) a->name_n_value+ strlen((char*) a->name_n_value)+1)[a->value_length-1] == '\0'? (char*) a->name_n_value : "<CORRUPTED STRING>" )
#define dap_meta_get_string_const(a) ( ((const char*) a->name_n_value + strlen((char*) a->name_n_value)+1 )[a->value_length-1] == '\0'? (const char*) a->name_n_value : "<CORRUPTED STRING>" )
#define dap_meta_name(a) ( ((char*) a->name_n_value+ strlen((char*) a->name_n_value)+1)[a->value_length-1] == '\0'? (char*) a->name_n_value : "<CORRUPTED STRING>" )
#define dap_meta_size(a) (sizeof(*a)+a->value_length+ strlen((char*) a->name_n_value)+1)
......@@ -2,7 +2,7 @@
#QMAKE_CFLAGS_DEBUG = -std=gnu11 -DDAP_DEBUG
#QMAKE_CFLAGS_RELEASE += -std=gnu1
QMAKE_CFLAGS_DEBUG += -DDAP_DEBUG
QMAKE_CXXFLAGS += -std=c++11
QMAKE_CXXFLAGS += -std=c++1
QMAKE_CFLAGS += -std=gnu11
unix {
......@@ -63,24 +63,34 @@ HEADERS += $$PWD/include/dap_common.h \
$$PWD/include/dap_config.h \
$$PWD/include/dap_math_ops.h \
$$PWD/include/dap_file_utils.h \
$$PWD/src/circular_buffer.h \
$$PWD/include/dap_circular_buffer.h \
$$PWD/include/dap_cbuf.h \
$$PWD/include/dap_list.h \
$$PWD/include/dap_module.h \
$$PWD/include/dap_strfuncs.h \
$$PWD/include/dap_string.h \
$$PWD/include/dap_time.h
$$PWD/include/dap_time.h \
$$PWD/include/dap_tsd.h \
$$PWD/dap_fnmatch.h \
$$PWD/dap_fnmatch_loop.h \
$$PWD/portable_endian.h
SOURCES += $$PWD/src/dap_common.c \
$$PWD/src/dap_binary_tree.c \
$$PWD/src/dap_config.c \
$$PWD/src/dap_file_utils.c \
$$PWD/src/dap_circular_buffer.c \
$$PWD/src/dap_cbuf.c \
$$PWD/src/dap_list.c \
$$PWD/src/dap_module.c \
$$PWD/src/dap_strfuncs.c \
$$PWD/src/dap_string.c \
$$PWD/src/dap_time.c
$$PWD/src/dap_time.c \
$$PWD/src/dap_tsd.c \
$$PWD/src/dap_fnmatch.c \
$$PWD/src/dap_meta.c
INCLUDEPATH += $$PWD/include \
$$PWD/../../3rdparty/uthash/src/
unix {
include(unix/unix.pri)
LIBS += -lrt
}
darwin {
include(darwin/darwin.pri)
}
HEADERS += $$PWD/dap_common.h \
$$PWD/dap_config.h \
$$PWD/dap_math_ops.h \
$$PWD/uthash.h \
$$PWD/utlist.h \
$$PWD/dap_math_ops.h \
$$PWD/dap_file_utils.h \
$$PWD/dap_cbuf.h \
$$PWD/dap_list.h \
$$PWD/dap_module.h \
$$PWD/dap_strfuncs.h \
$$PWD/dap_string.h \
$$PWD/dap_time.h
SOURCES += $$PWD/dap_common.c \
$$PWD/dap_config.c \
$$PWD/dap_file_utils.c \
$$PWD/dap_cbuf.c \
$$PWD/dap_list.c \
$$PWD/dap_module.c \
$$PWD/dap_strfuncs.c \
$$PWD/dap_string.c \
$$PWD/dap_time.c
INCLUDEPATH += $$PWD
/* Authors:
* Dmitriy A. Gearasimov <gerasimov.dmitriy@demlabs.net>
* Demlabs Ltd https://demlabs.net
* DAP SDK https://gitlab.demlabs.net/dap/dap-sdk
* Copyright (c) 2021
* All rights reserved.
This file is part of DAP SDK the open source project
DAP SDK is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
DAP SDK is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with any DAP based project. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dap_meta.h"
#define LOG_TAG "dap_meta"
/**
* @brief dap_meta_create
* @param a_name
* @param a_data
* @param a_data_size
* @return
*/
dap_meta_t * dap_meta_create(const char * a_name, const void * a_data, size_t a_data_size)
{
if ( !a_name)
return NULL;
size_t a_name_len = strlen(a_name);
if( ! a_name_len )
return NULL;
dap_meta_t * l_ret = DAP_NEW_Z_SIZE(dap_meta_t, sizeof (dap_meta_t)+a_name_len+1+a_data_size );
if (l_ret){
memcpy(l_ret->name_n_value,a_name,a_name_len);
if(a_data_size)
memcpy(l_ret->name_n_value+a_name_len+1,a_data,a_data_size);
}
return l_ret;
}
/**
* @brief dap_meta_find
* @param a_data
* @param a_data_size
* @param a_name
* @return
*/
dap_meta_t* dap_meta_find(byte_t * a_data, size_t a_data_size, const char * a_name)
{
dap_meta_t * l_ret = NULL;
for(size_t l_offset=0; l_offset<a_data_size; ){
dap_meta_t * l_meta =(dap_meta_t*) (a_data + l_offset);
size_t l_meta_size = dap_meta_size(l_meta);
if( !l_meta_size || l_meta_size +l_offset > a_data_size){
break;
}
if (strcmp( dap_meta_name(l_meta), a_name) == 0 ){
l_ret = l_meta;
break;
}
l_offset+=l_meta_size;
}
return l_ret;
}
/**
* @brief dap_meta_check
* @param a_meta
* @return
*/
int dap_meta_check(dap_meta_t * a_meta)
{
return -1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment