From 5e706af311cdcf764497176cc4a9ea8375e72078 Mon Sep 17 00:00:00 2001 From: xolatile Date: Wed, 3 Jan 2024 06:41:52 -0500 Subject: [PATCH] Changed naming to redo standard... --- xyntax.c | 61 +++++++++++++++++++++++++------------------------------------ xyntax.h | 8 -------- 2 files changed, 25 insertions(+), 44 deletions(-) diff --git a/xyntax.c b/xyntax.c index c46c3d5..50df34c 100644 --- a/xyntax.c +++ b/xyntax.c @@ -1,11 +1,3 @@ -/* -Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic - -Xyntax is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation. -And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version. -It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3. -*/ - #ifndef XYNTAX_SOURCE #define XYNTAX_SOURCE @@ -14,19 +6,19 @@ It is distributed in the hope that it will be useful or harmful, it really depen #include static int syntax_count = 0; -static int syntax_active = FALSE; -static int * syntax_enrange = NULL; -static int * syntax_derange = NULL; -static char * * syntax_begin = NULL; -static char * * syntax_end = NULL; -static char * syntax_escape = NULL; -static int * syntax_colour = NULL; -static int * syntax_effect = NULL; +static int syntax_active = false; +static int * syntax_enrange = null; +static int * syntax_derange = null; +static char * * syntax_begin = null; +static char * * syntax_end = null; +static char * syntax_escape = null; +static int * syntax_colour = null; +static int * syntax_effect = null; static void syntax_delete (void) { int offset; - if (syntax_active == FALSE) { + if (syntax_active == false) { return; } @@ -43,19 +35,19 @@ static void syntax_delete (void) { syntax_colour = deallocate (syntax_colour); syntax_effect = deallocate (syntax_effect); - syntax_active = FALSE; + syntax_active = false; syntax_count = 0; } int syntax_define (int enrange, int derange, char * begin, char * end, char escape, int colour, int effect) { - if (syntax_active == FALSE) { - syntax_active = TRUE; + if (syntax_active == false) { + syntax_active = true; atexit (syntax_delete); } - fatal_failure (begin == NULL, "syntax_define: Begin string is null pointer."); - fatal_failure (end == NULL, "syntax_define: End string is null pointer."); + fatal_failure (begin == null, "syntax_define: Begin string is null pointer."); + fatal_failure (end == null, "syntax_define: End string is null pointer."); ++syntax_count; @@ -85,25 +77,22 @@ int syntax_define (int enrange, int derange, char * begin, char * end, char esca int syntax_select (char * string, int * length) { int offset, subset, select; - fatal_failure (syntax_active == FALSE, "syntax_select: Syntax is not active."); - fatal_failure (string == NULL, "syntax_select: String is null."); - fatal_failure (length == NULL, "syntax_select: Length is null."); + fatal_failure (syntax_active == false, "syntax_select: Syntax is not active."); + fatal_failure (string == null, "syntax_select: String is null."); + fatal_failure (length == null, "syntax_select: Length is null."); for (select = offset = 0; select != syntax_count; ++select) { - if (syntax_enrange [select] == FALSE) { - if (syntax_derange [select] == FALSE) { - if (string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE) { + if (syntax_enrange [select] == false) { + if (syntax_derange [select] == false) { + if (string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == true) { break; } } else { - if ((string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE) - && (character_compare_array (string [offset + string_length (syntax_begin [select])], syntax_end [select]) == TRUE)) { + if ((string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == true) + && (character_compare_array (string [offset + string_length (syntax_begin [select])], syntax_end [select]) == true)) { break; } } - /*if (string_compare_limit (string, syntax_begin [select], string_length (syntax_begin [select])) == TRUE) { - break; - }*/ } else { for (subset = 0; subset != string_length (syntax_begin [select]); ++subset) { if (string [offset] == syntax_begin [select] [subset]) { @@ -127,14 +116,14 @@ int syntax_select (char * string, int * length) { continue; } - if (syntax_derange [select] == FALSE) { - if (string_compare_limit (& string [offset], syntax_end [select], string_length (syntax_end [select])) == TRUE) { + if (syntax_derange [select] == false) { + if (string_compare_limit (& string [offset], syntax_end [select], string_length (syntax_end [select])) == true) { * length = offset + string_length (syntax_end [select]); return (select); } } else { subset = 0; - if (string_compare (syntax_end [select], "") == FALSE) { + if (string_compare (syntax_end [select], "") == false) { break; } do { if (string [offset] == syntax_end [select] [subset]) { diff --git a/xyntax.h b/xyntax.h index d004219..3b44bf3 100644 --- a/xyntax.h +++ b/xyntax.h @@ -1,11 +1,3 @@ -/* -Copyright (c) 2023 : Ognjen 'xolatile' Milan Robovic - -Xyntax is free software! You will redistribute it or modify it under the terms of the GNU General Public License by Free Software Foundation. -And when you do redistribute it or modify it, it will use either version 3 of the License, or (at yours truly opinion) any later version. -It is distributed in the hope that it will be useful or harmful, it really depends... But no warranty what so ever, seriously. See GNU/GPLv3. -*/ - #ifndef XYNTAX_HEADER #define XYNTAX_HEADER