From 852822b1d924b94f9dfb8bd84cb08b3795b2c959 Mon Sep 17 00:00:00 2001 From: leshkov1980 <6203050@gmail.com> Date: Mon, 17 Jul 2017 14:44:43 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D0=BC=D0=B0=D1=88=D0=BD=D0=B5?= =?UTF-8?q?=D0=B5=20=D0=B7=D0=B0=D0=B4=D0=B0=D0=BD=D0=B5=D0=B5:=20=D0=9F?= =?UTF-8?q?=D0=BE=D0=B1=D0=B8=D1=82=D0=BE=D0=B2=D1=8B=D0=B5=20=D0=BE=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bitwise --- LeshkovAV/Bitwise/Bitwise.sln | 28 ++++ LeshkovAV/Bitwise/Bitwise/Bitwise.cpp | 111 ++++++++++++ LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj | 158 ++++++++++++++++++ .../Bitwise/Bitwise/Bitwise.vcxproj.filters | 36 ++++ LeshkovAV/Bitwise/Bitwise/ReadMe.txt | 40 +++++ LeshkovAV/Bitwise/Bitwise/stdafx.cpp | 8 + LeshkovAV/Bitwise/Bitwise/stdafx.h | 15 ++ LeshkovAV/Bitwise/Bitwise/targetver.h | 8 + 8 files changed, 404 insertions(+) create mode 100644 LeshkovAV/Bitwise/Bitwise.sln create mode 100644 LeshkovAV/Bitwise/Bitwise/Bitwise.cpp create mode 100644 LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj create mode 100644 LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj.filters create mode 100644 LeshkovAV/Bitwise/Bitwise/ReadMe.txt create mode 100644 LeshkovAV/Bitwise/Bitwise/stdafx.cpp create mode 100644 LeshkovAV/Bitwise/Bitwise/stdafx.h create mode 100644 LeshkovAV/Bitwise/Bitwise/targetver.h diff --git a/LeshkovAV/Bitwise/Bitwise.sln b/LeshkovAV/Bitwise/Bitwise.sln new file mode 100644 index 0000000..af4c70c --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bitwise", "Bitwise\Bitwise.vcxproj", "{C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x64.ActiveCfg = Debug|x64 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x64.Build.0 = Debug|x64 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x86.ActiveCfg = Debug|Win32 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Debug|x86.Build.0 = Debug|Win32 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x64.ActiveCfg = Release|x64 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x64.Build.0 = Release|x64 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x86.ActiveCfg = Release|Win32 + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp b/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp new file mode 100644 index 0000000..26d2825 --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp @@ -0,0 +1,111 @@ +// Bitwise.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include +#include +#include + +typedef unsigned int uint_32; +void PrintHtml(char const* string, int style); +uint_32 ParagraphParameters(char* str); +void ParagraphParameters(uint_32 flag); + + +int main() +{ + PrintHtml("Hello", 7); + PrintHtml("Hello, World", 3); + + char str1[] = "Hello, World<\font size><\horalign><\U><\I><\B>"; + printf("\n\n%s\n", str1); + printf("Flags of the string: %X\n\n", ParagraphParameters(str1)); + + ParagraphParameters(0x1207); + ParagraphParameters(0x5221); + ParagraphParameters(0x631F); + printf("\n"); + ParagraphParameters(ParagraphParameters(str1)); + + return 0; +} + + +void PrintHtml(char const* string, int style) +{ +//0001 - Underline, 0010 - Italic, 0100 - Bold + char *str = new char[128]; + strcpy(str, string); + printf("%s\n", str); + if (style & 01) + strrev(strcat(strrev(strcat(str, "")), ">U<")); + if (style & 02) + strrev(strcat(strrev(strcat(str, "")), ">I<")); + if (style & 04) + strrev(strcat(strrev(strcat(str, "")), ">B<")); + printf("%s\n", str); + delete[] str; + +} + +uint_32 ParagraphParameters(char* str) +{ +//0x0001 - Bold, 0x0002 - Italic, 0x0004 - Underline, HorAlign +//HorAlign: 0x0000 - Left, 0x0010 - Center, 0x0020 - Right, 0x0030 - Justify +//0x0100 - 0x6400 Font size + uint_32 flag = 0x00; + char str_int[4] = ""; + if (strstr(str, "")) + flag = flag | 0x01; + if (strstr(str, "")) + flag = flag | 0x02; + if (strstr(str, "")) + flag = flag | 0x04; + if (strstr(str, "horalign=\"center\"")) + flag = flag | 0x10; + else + if (strstr(str, "horalign=\"righr\"")) + flag = flag | 0x20; + else + if (strstr(str, "horalign=\"justify\"")) + flag = flag | 0x30; + str = strpbrk(strstr(str, "font size"), "0123456789"); + int fontsize = atoi(strncpy(str_int, str, strspn(str, "0123456789"))); + flag = flag | uint_32((fontsize << 8)); + //printf("%X\n", flag); + + return flag; +} + +void ParagraphParameters(uint_32 flag) +{ +//0x0001 - Bold, 0x0002 - Italic, 0x0004 - Underline, HorAlign +//HorAlign: 0x0000 - Left, 0x0010 - Center, 0x0020 - Right, 0x0030 - Justify +//0x0100 - 0x6400 Font size + + printf("\nFlags: %X\n", flag); + printf("Parameters of the Paragraph: \n"); + if (flag & 0x01) + printf("Bold\n"); + if (flag & 0x02) + printf("Italic\n"); + if (flag & 0x04) + printf("Underline\n"); + + switch (flag & 0x30) + { + case 0x00: + printf("HorAlign: Left\n"); + break; + case 0x10: + printf("HorAlign: Center\n"); + break; + case 0x20: + printf("HorAlign: Right\n"); + break; + case 0x30: + printf("HorAlign: Justify\n"); + } + + printf("Font size: %d\n", (flag >> 8) & 0xFF); +} diff --git a/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj b/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj new file mode 100644 index 0000000..dc7fa13 --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj @@ -0,0 +1,158 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {C310D1CC-A4C8-4F47-B70F-A49FF3C1F6C5} + Win32Proj + Bitwise + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + + + Level3 + Disabled + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj.filters b/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj.filters new file mode 100644 index 0000000..fb2158e --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/Bitwise.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/LeshkovAV/Bitwise/Bitwise/ReadMe.txt b/LeshkovAV/Bitwise/Bitwise/ReadMe.txt new file mode 100644 index 0000000..fab7ccf --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : Bitwise Project Overview +======================================================================== + +AppWizard has created this Bitwise application for you. + +This file contains a summary of what you will find in each of the files that +make up your Bitwise application. + + +Bitwise.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +Bitwise.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +Bitwise.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named Bitwise.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/LeshkovAV/Bitwise/Bitwise/stdafx.cpp b/LeshkovAV/Bitwise/Bitwise/stdafx.cpp new file mode 100644 index 0000000..27b9a3c --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// Bitwise.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/LeshkovAV/Bitwise/Bitwise/stdafx.h b/LeshkovAV/Bitwise/Bitwise/stdafx.h new file mode 100644 index 0000000..b005a83 --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/LeshkovAV/Bitwise/Bitwise/targetver.h b/LeshkovAV/Bitwise/Bitwise/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include From d1a07c03d1ff751fa48eb6df16f1ecf1fd34e7a1 Mon Sep 17 00:00:00 2001 From: leshkov1980 <6203050@gmail.com> Date: Wed, 19 Jul 2017 17:39:05 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9F=D0=BE=D0=B1=D0=B8=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20=D0=BE=D0=BF=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bitwise --- LeshkovAV/Bitwise/Bitwise.txt | 1 + LeshkovAV/Bitwise/Bitwise/Bitwise.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 LeshkovAV/Bitwise/Bitwise.txt diff --git a/LeshkovAV/Bitwise/Bitwise.txt b/LeshkovAV/Bitwise/Bitwise.txt new file mode 100644 index 0000000..2486872 --- /dev/null +++ b/LeshkovAV/Bitwise/Bitwise.txt @@ -0,0 +1 @@ +https://github.com/bugslayer312/StudentHomeworks/pull/17 \ No newline at end of file diff --git a/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp b/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp index 26d2825..0ea9d41 100644 --- a/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp +++ b/LeshkovAV/Bitwise/Bitwise/Bitwise.cpp @@ -8,7 +8,7 @@ typedef unsigned int uint_32; void PrintHtml(char const* string, int style); -uint_32 ParagraphParameters(char* str); +uint_32 TextParameters(char* str); void ParagraphParameters(uint_32 flag); @@ -19,13 +19,13 @@ int main() char str1[] = "Hello, World<\font size><\horalign><\U><\I><\B>"; printf("\n\n%s\n", str1); - printf("Flags of the string: %X\n\n", ParagraphParameters(str1)); + printf("Flags of the string: %X\n\n", TextParameters(str1)); ParagraphParameters(0x1207); ParagraphParameters(0x5221); ParagraphParameters(0x631F); printf("\n"); - ParagraphParameters(ParagraphParameters(str1)); + ParagraphParameters(TextParameters(str1)); return 0; } @@ -48,7 +48,7 @@ void PrintHtml(char const* string, int style) } -uint_32 ParagraphParameters(char* str) +uint_32 TextParameters(char* str) { //0x0001 - Bold, 0x0002 - Italic, 0x0004 - Underline, HorAlign //HorAlign: 0x0000 - Left, 0x0010 - Center, 0x0020 - Right, 0x0030 - Justify