Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
aiekick committed Dec 1, 2024
1 parent 374a512 commit 2ac3c83
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 40 deletions.
46 changes: 24 additions & 22 deletions 3rdparty/BuildInc/BuildInc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
MIT License
Copyright (c) 2022-2023 Stephane Cuillerdier (aka aiekick)
Copyright (c) 2022-2022 Stephane Cuillerdier (aka aiekick)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -27,16 +27,17 @@ SOFTWARE.
#include <stdlib.h>
#include <string.h>

#define MAX_LENGTH 1024
#define MAX_LENGTH 2048
#define BUILD_PREFIX "Prefix"
#define BUILD_WORD "BuildNumber"
#define MINOR_WORD "MinorNumber"
#define MAJOR_WORD "MajorNumber"
#define BUILD_ID_WORD "BuildId"

static int rule_maxBuildNumber = 1000;
static int rule_maxMinorNumber = 10;
static int rule_maxBuildNumber = 1000;
static int rule_maxMinorNumber = 10;
static char prefix_buffer[MAX_LENGTH + 1] = "";
static int rule_enabled = 0;

// return 1 if a prefix was found
int ParsePrefix(const char* vPrefix) {
Expand All @@ -60,9 +61,9 @@ int ParseRule(const char* vRule) {
if (vRule && strlen(vRule)) {
int maxBuild, maxMinor;
#ifdef _MSC_VER
int res = sscanf_s(vRule, "%i:%i", &maxBuild, &maxMinor);
int res = sscanf_s(vRule, "-rule=%i:%i", &maxBuild, &maxMinor);
#else
int res = sscanf(vRule, "%i:%i", &maxBuild, &maxMinor);
int res = sscanf(vRule, "-rule=%i:%i", &maxBuild, &maxMinor);
#endif
if (res == 2) {
rule_maxBuildNumber = maxBuild;
Expand All @@ -72,10 +73,6 @@ int ParseRule(const char* vRule) {
}
}

printf("-- The rule is missing or wrong\n");
printf("-- The rule must respect this format max_build_number:max_minor_number\n");
printf("-- The default rule of 1000:10 will be applied\n");

return 0;
}

Expand All @@ -100,8 +97,8 @@ void ParseFile(const char* vFile) {
{
// read
while (!feof(fp) && idx < 3) {
fgets(bufLine, MAX_LENGTH, fp);
if (ferror(fp)) {
char* ptr = fgets(bufLine, MAX_LENGTH, fp);
if (!ptr || ferror(fp)) {
fprintf(stderr, "-- Reading error with code %d\n", errno);
break;
}
Expand Down Expand Up @@ -153,13 +150,15 @@ void ParseFile(const char* vFile) {
fp == NULL) { // fichier non existant
// treatment
++BuildNumber;
if (BuildNumber > rule_maxBuildNumber) {
BuildNumber = 0;
++MinorNumber;
}
if (MinorNumber > rule_maxMinorNumber) {
MinorNumber = 0;
++MajorNumber;
if (rule_enabled == 1) {
if (BuildNumber > rule_maxBuildNumber) {
BuildNumber = 0;
++MinorNumber;
}
if (MinorNumber > rule_maxMinorNumber) {
MinorNumber = 0;
++MajorNumber;
}
}

// print vars :
Expand Down Expand Up @@ -233,7 +232,7 @@ int main(int argc, char* argv[]) { // Don't forget first integral argument 'arg
if (argc == 1) {
printf("-------------------- BuildInc --------------------\n");
printf("-- this func will increment in a c/c++ include file, 3 vars : MajorNumber, MinorNumber and BuildNumber, according to a rule\n");
printf("-- the syntax is : BuildInc -prefix=\"prefix\" rule include_file\n");
printf("-- the syntax is : BuildInc -prefix=<\"prefix\"> -rule=<rule> include_file\n");
printf("-- the rule is 'max_build_number:max_minor_number' \n");
printf("-- by ex with a rule of 1000:10 the corresponding pseudo code will be :\n");
printf("-- if (BuildNumber > 1000) ++MinorNumber;\n");
Expand All @@ -246,10 +245,13 @@ int main(int argc, char* argv[]) { // Don't forget first integral argument 'arg
if (argc > 1) {
ParsePrefix(argv[idx++]);
int res = ParseRule(argv[idx]);
if (res)
if (res) {
rule_enabled = 1;
++idx;
if (argc > 2 || res == 0)
}
if (argc > 2 || res == 0) {
ParseFile(argv[idx]);
}
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ add_subdirectory(3rdparty/BuildInc)

add_custom_command(
TARGET ${PROJECT} PRE_BUILD
COMMAND BuildInc -prefix=${PROJECT} 1000000:10 $<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/src/headers/${PROJECT}Build.h>
COMMAND BuildInc -prefix=${PROJECT} $<$<CONFIG:Debug>:${CMAKE_SOURCE_DIR}/src/headers/${PROJECT}Build.h>
DEPENDS ${PROJECT})

########################################################
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
LogToGraph_Windows_Debug_x64_v0.2.1026
LogToGraph_Windows_Debug_x64_v0.3.3583
2 changes: 1 addition & 1 deletion plugins/LuaScripting/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ set(LOADED_LOG_TO_GRAPH_PLUGINS ${LOADED_LOG_TO_GRAPH_PLUGINS} ${PROJECT} PARENT
## only for Debug
add_custom_command(
TARGET ${PROJECT} PRE_BUILD
COMMAND BuildInc -prefix=${PROJECT} 1000000:10 $<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/src/Headers/${PROJECT}Build.h>
COMMAND BuildInc -prefix=${PROJECT} $<$<CONFIG:Debug>:${CMAKE_CURRENT_SOURCE_DIR}/src/Headers/${PROJECT}Build.h>
DEPENDS ${PROJECT}
)

Expand Down
2 changes: 1 addition & 1 deletion plugins/LuaScripting/src/LuaScripting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PLUGIN_PREFIX void deleter(LuaScripting* ptr) {
}
}

#include <Modules/Module.h>
#include <modules/Module.h>

LuaScripting::LuaScripting() = default;

Expand Down
2 changes: 1 addition & 1 deletion plugins/LuaScripting/src/modules/LuaDatasModel.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Modules/LuaDatasModel.h>
#include <modules/LuaDatasModel.h>
#include <ezlibs/ezTools.hpp>
#include <ezlibs/ezLog.hpp>

Expand Down
4 changes: 2 additions & 2 deletions plugins/LuaScripting/src/modules/Module.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma once

#include <Modules/LuaDatasModel.h>
#include <modules/LuaDatasModel.h>
#include <apis/LtgPluginApi.h>
#include <Settings/Settings.h>
#include <settings/Settings.h>
#include <string>
#include <vector>
#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion plugins/LuaScripting/src/settings/Settings.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <Settings/Settings.h>
#include <settings/Settings.h>

#include <ImGuiPack.h>

Expand Down
6 changes: 3 additions & 3 deletions src/headers/LogToGraphBuild.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#define LogToGraph_Prefix "LogToGraph"
#define LogToGraph_BuildNumber 1063
#define LogToGraph_MinorNumber 2
#define LogToGraph_BuildNumber 3583
#define LogToGraph_MinorNumber 3
#define LogToGraph_MajorNumber 0
#define LogToGraph_BuildId "0.2.1063"
#define LogToGraph_BuildId "0.3.3583"
11 changes: 4 additions & 7 deletions src/panes/LogPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ void LogPane::DrawMenuBar() {
}

void LogPane::DrawTable() {
ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY |
ImGuiTableFlags_NoHostExtendY;
ImGuiTableFlags flags = ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_RowBg | ImGuiTableFlags_Hideable | ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoHostExtendY;

if (!ProjectFile::Instance()->m_AutoResizeLogColumns) {
flags |= ImGuiTableFlags_Resizable;
Expand All @@ -167,9 +166,8 @@ void LogPane::DrawTable() {
m_need_re_preparation = false;

auto listViewID = ImGui::GetID("##LogPane_DrawTable");
if (ImGui::BeginTableEx("##LogPane_DrawTable", listViewID, 5, flags)) //-V112
{
ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible
if (ImGui::BeginTableEx("##LogPane_DrawTable", listViewID, 5, flags)) { //-V112
ImGui::TableSetupScrollFreeze(0, 1); // Make header always visible
ImGui::TableSetupColumn("Epoch", ImGuiTableColumnFlags_WidthFixed | ImGuiTableColumnFlags_DefaultHide);
ImGui::TableSetupColumn("Date", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("Cat", ImGuiTableColumnFlags_WidthFixed);
Expand All @@ -178,8 +176,7 @@ void LogPane::DrawTable() {

ImGui::TableNextRow(ImGuiTableRowFlags_Headers);

for (int column = 0; column < 5; column++) //-V112
{
for (int column = 0; column < 5; column++) { //-V112
ImGui::TableSetColumnIndex(column);
const char* column_name = ImGui::TableGetColumnName(column); // Retrieve name passed to TableSetupColumn()
ImGui::PushID(column);
Expand Down

0 comments on commit 2ac3c83

Please sign in to comment.