Removed precompiled header pch.h and framework.h

This commit is contained in:
Kai S. K. Engelbart 2020-01-30 08:57:03 +01:00
parent ce09ea09e6
commit 0138aa5e5f
7 changed files with 15 additions and 61 deletions

View File

@ -98,7 +98,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -130,7 +130,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
@ -147,18 +147,10 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="framework.h" />
<ClInclude Include="menu.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="menu.c" />
<ClCompile Include="pch.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -15,12 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="pch.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="menu.h">
<Filter>Headerdateien</Filter>
</ClInclude>
@ -29,8 +23,5 @@
<ClCompile Include="menu.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="pch.c">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -1,3 +0,0 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // Selten verwendete Komponenten aus Windows-Headern ausschließen

20
menu.c
View File

@ -1,8 +1,8 @@
#include "pch.h"
#include "framework.h"
#include "menu.h"
#include <stdio.h>
#include <Windows.h>
const struct MenuBorder DEFAULT = {
'*', '*', '*', '*', '*', '*', '[', ']'
};
@ -21,10 +21,10 @@ const struct MenuBorder SOLID = {
void print_content(const int itemc, const struct MenuItem itemv[], const char title[], const struct MenuBorder* border);
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop)
void show_menu(const struct MenuPage* pages, const size_t page_count, const int infinite_loop)
{
unsigned int page_index = 0;
bool action_performed, loop, page_changed = true;
int action_performed, loop, page_changed = 1;
char page_key, itemKey;
int i;
@ -50,10 +50,10 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool
if (page_key == 'n' || page_key == 'm')
break;
page_changed = false;
page_changed = 0;
itemKey = page_key;
do {
action_performed = false;
action_performed = 0;
itemKey != page_key ? itemKey = _getch() : page_key;
page_key = 0;
@ -64,7 +64,7 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool
// Perform action
system("cls");
pages[page_index].items[i].action(pages[page_index].items[i].param);
action_performed = true;
action_performed = 1;
// Pause if requested
if (pages[page_index].pause)
@ -83,7 +83,7 @@ void show_menu(const struct MenuPage* pages, const size_t page_count, const bool
}
// Checks if a line index should display a menu item
bool is_item_line(const int line, const int itemc, int* item_index)
int is_item_line(const int line, const int itemc, int* item_index)
{
if (line >= 2 && line % 2 == 0)
{
@ -91,7 +91,7 @@ bool is_item_line(const int line, const int itemc, int* item_index)
*item_index = (line - 2) / 2;
return *item_index < itemc;
}
return false;
return 0;
}
// Acquires the dimensions (width and height) of the console window

6
menu.h
View File

@ -1,6 +1,6 @@
#pragma once
#include "pch.h"
#include <stdlib.h>
/// <summary>Represents one menu item in a menu.</summary>
struct MenuItem {
@ -30,7 +30,7 @@ struct MenuPage {
const struct MenuItem* items;
const size_t item_count;
char* title;
bool loopback, pause;
int loopback, pause;
const struct MenuBorder* border;
};
@ -38,4 +38,4 @@ struct MenuPage {
/// <param name="pages">An array of all pages to display.</param>
/// <param name="page_count">The length of the array <c>pages</c>.</param>
/// <param name="infinite_loop">Always display the first page after a loopback=false item finished executing.</param>
void show_menu(const struct MenuPage* pages, const size_t page_count, const bool infinite_loop);
void show_menu(const struct MenuPage* pages, const size_t page_count, const int infinite_loop);

5
pch.c
View File

@ -1,5 +0,0 @@
// pch.cpp: Quelldatei, die dem vorkompilierten Header entspricht
#include "pch.h"
// Bei der Verwendung vorkompilierter Header ist diese Quelldatei für eine erfolgreiche Kompilierung erforderlich.

21
pch.h
View File

@ -1,21 +0,0 @@
// pch.h: Dies ist eine vorkompilierte Headerdatei.
// Die unten aufgeführten Dateien werden nur einmal kompiliert, um die Buildleistung für zukünftige Builds zu verbessern.
// Dies wirkt sich auch auf die IntelliSense-Leistung aus, Codevervollständigung und viele Features zum Durchsuchen von Code eingeschlossen.
// Die hier aufgeführten Dateien werden jedoch ALLE neu kompiliert, wenn mindestens eine davon zwischen den Builds aktualisiert wird.
// Fügen Sie hier keine Dateien hinzu, die häufig aktualisiert werden sollen, da sich so der Leistungsvorteil ins Gegenteil verkehrt.
#ifndef PCH_H
#define PCH_H
// Fügen Sie hier Header hinzu, die vorkompiliert werden sollen.
#include "framework.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <conio.h>
#include <Windows.h>
#endif //PCH_H