Commit 20b4c992 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

modernize c++

parent 7aeb0054
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
project(bapps)
subdirs(i_discretize_file)
subdirs(i_fread)
subdirs(i_oscillator)
......
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
# Set the name of the project as the directory basename
project(f_max)
find_package(blc_channel)
find_package(blc_program)
find_package(blc)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(f_max f_max.cpp)
target_link_libraries(f_max ${BL_LIBRARIES})
target_compile_features(f_max PRIVATE cxx_std_14)
target_link_libraries(f_max blc)
......
......@@ -2,6 +2,7 @@
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_text.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......@@ -78,7 +79,7 @@ int main(int argc, char **argv){
}
else
{
output.create_or_open(output_name, BLC_CHANNEL_WRITE, input.type, 'NDEF', 1, 1);
output.create_or_open(output_name, BLC_CHANNEL_WRITE, input.type, 'NDEF', {1});
output.publish();
blc_loop_try_add_waiting_semaphore(output.sem_ack_data);
......
......@@ -3,23 +3,21 @@
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
project(i_discretize_file)
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
find_package(blc REQUIRED)
add_definitions(${BL_DEFINTIIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(i_discretize_file i_discretize_file.cpp)
target_link_libraries(i_discretize_file ${BL_LIBRARIES})
target_compile_features(i_discretize_file PRIVATE cxx_std_14)
target_link_libraries(i_discretize_file PRIVATE blc)
......
//Read only array of dim 1
#include "blc_core.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......@@ -58,7 +57,7 @@ int main(int argc, char** argv){
SSCANF(1, offset_str, "%f", &offset);
SSCANF(1, gain_str, "%f", &gain);
channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, 'FL32', 'LPCM', 1, length);
channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, 'FL32', 'LPCM',{static_cast<size_t>(length)});
blc_loop_try_add_posting_semaphore(channel.sem_new_data);
blc_loop_try_add_waiting_semaphore(channel.sem_ack_data);
......
......@@ -3,25 +3,20 @@
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
project(i_fread)
#The name of the project is the basename of the directory
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PROJECT_NAME})
find_package(blc REQUIRED)
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
add_definitions(${BL_DEFINTIIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} i_fread.cpp)
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES})
add_executable(i_fread i_fread.cpp)
target_compile_features(i_fread PRIVATE cxx_std_14)
target_link_libraries(i_fread PRIVATE blc)
......
//Read only array of dim 1
#include "blc_core.h"
#include "blc_text.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......@@ -46,7 +45,7 @@ static void array_def_with_tsv_file_first_line(blc_array *array, char const *fil
if (time_str) length--; //The first coulmn dos not count it is the time.
array->def_array('FL32', 'NDEF', 1, length);
array->def_array('FL32', 'NDEF', {static_cast<size_t>(length)});
fclose(file);
}
......
......@@ -9,17 +9,14 @@
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
project(i_keyboard)
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
add_definitions(${BL_DEFINITIONS} -std=c++14 -W -Wall)
include_directories(${BL_INCLUDE_DIRS})
find_package(blc REQUIRED)
add_executable(i_keyboard src/i_keyboard.cpp)
target_link_libraries(i_keyboard ${BL_LIBRARIES})
target_compile_options(i_keyboard PRIVATE -W -Wall)
target_compile_features(i_keyboard PRIVATE cxx_std_14)
target_link_libraries(i_keyboard blc)
......
#include "blc_core.h"
#include "blc_text.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......@@ -304,7 +304,7 @@ int main(int argc, char** argv){
if (memchr(key_list, quitting_key, keys_nb)) EXIT_ON_ERROR("The quitting key '%c' is in your key list %.*s, you need to select an other one with --quitting_key=...", quitting_key, keys_nb, key_list);
if (memchr(key_list, neutral_key, keys_nb)) EXIT_ON_ERROR("The neutral key '%c' is in your key list %.*s, you need to select an other one with --neutral_key=...", neutral_key, keys_nb, key_list);
created=channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', 1, keys_nb);
created=channel.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', { static_cast<size_t>(keys_nb) });
if (filename){
extension = blc_get_filename_extension(filename);
......
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
# Set the name of the project as the directory basename
project(i_oscillator)
find_package(blc_channel)
find_package(blc_program)
find_package(blc REQUIRED)
add_definitions(${BL_DEFINITIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(i_oscillator i_oscillator.cpp)
target_link_libraries(i_oscillator ${BL_LIBRARIES})
target_compile_features(i_oscillator PRIVATE cxx_std_14)
target_link_libraries(i_oscillator PRIVATE blc)
......
......@@ -2,7 +2,7 @@
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_core.h"
#include "blc_text.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......@@ -75,7 +75,7 @@ int main(int argc, char **argv){
SSCANF(1, min_str, "%f", &min);
SSCANF(1, max_str, "%f", &max);
output.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', 1, buffer_length);
output.create_or_open(channel_name, BLC_CHANNEL_WRITE, type, 'NDEF', { static_cast<size_t>(buffer_length) });
output.publish();
/*
......
# Set the minimum version of cmake required to build this project
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
# Set the name of the project as the directory basename
project(o_display)
find_package(blc_channel)
find_package(blc_program)
find_package(blc)
add_definitions(${BL_DEFINITIONS} -std=c++11)
include_directories(${BL_INCLUDE_DIRS})
add_executable(o_display o_display.cpp)
target_link_libraries(o_display ${BL_LIBRARIES})
target_compile_features(o_display PRIVATE cxx_std_14)
target_link_libraries(o_display PRIVATE blc)
......
......@@ -2,7 +2,7 @@
// Created by Arnaud Blanchard on 22/12/15.
// Copyright ETIS 2015. All rights reserved.
//
#include "blc_core.h"
#include "blc_text.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......
......@@ -3,25 +3,22 @@
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
# users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.
# In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software,
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.13)
#The name of the project is the basename of the directory
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${PROJECT_NAME})
project(o_fwrite)
find_package(blc_channel REQUIRED)
find_package(blc_program REQUIRED)
find_package(blc REQUIRED)
add_definitions(${BL_DEFINTIIONS})
include_directories(${BL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} o_fwrite.cpp)
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES})
add_executable(o_fwrite o_fwrite.cpp)
target_compile_features(o_fwrite PRIVATE cxx_std_14)
target_link_libraries(o_fwrite PRIVATE blc)
......
#include "blc_core.h"
#include "blc_channel.h"
#include "blc_program.h"
#include <unistd.h>
......
#define END_LOOP 3000
int main(int argc, char **argv){
int i, sum=0;
for (i=0; i<END_LOOP; i++){
sum+=2;
}
i=0;
sum=0;
while ( i<END_LOOP){
sum+=2;
i++;
}
return 0;
}
#define END_LOOP 3000
int main(int argc, char **argv){
int i, sum=0;
for (i=0; i<END_LOOP; i++){
sum+=2;
}
i=0;
sum=0;
while ( i<END_LOOP){
sum+=2;
i++;
}
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment