From 6986f3c8546f915c8e37be8ebe3eeb5506b6af10 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Wed, 31 Aug 2016 11:10:22 -0400 Subject: [PATCH] fixed indent bug with end of line comment, removed token merging --- 4coder_API.html | 6 +-- 4coder_config.h | 80 -------------------------------------- 4coder_string.h | 2 +- 4coder_version.h | 5 ++- 4cpp_lexer.h | 36 ++++++----------- 4cpp_lexer_types.h | 6 ++- 4ed_api_implementation.cpp | 4 +- 4ed_app_target.cpp | 1 - 4ed_metagen.cpp | 2 +- TODO.txt | 41 ++++++++++++++----- internal_4coder_string.cpp | 2 +- 11 files changed, 58 insertions(+), 127 deletions(-) delete mode 100644 4coder_config.h diff --git a/4coder_API.html b/4coder_API.html index 63f3c983..2ff08350 100644 --- a/4coder_API.html +++ b/4coder_API.html @@ -22,7 +22,7 @@ ul { list-style: none; padding: 0; margin: 0; }

§1 Introduction

-This is the documentation for alpha 4.0.10 The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections.

+This is the documentation for alpha 4.0.11 The documentation is still under construction so some of the links are linking to sections that have not been written yet. What is here should be correct and I suspect useful even without some of the other sections.

If you have questions or discover errors please contact editor@4coder.net or to get help from community members you can post on the 4coder forums hosted on handmade.network at 4coder.handmade.network

@@ -718,8 +718,8 @@ cursor in the same column or x position.
Return
This call returns non-zero on success.
Description
The highlight is mutually exclusive to the cursor. When the turn_on parameter is set to true the highlight will be shown and the cursor will be hidden. After -that either setting the with view_set_cursor or calling view_set_highlight and -the turn_on set to false, will switch back to showing the cursor.

+that either setting the cursor with view_set_cursor or calling view_set_highlight +and the turn_on set to false, will switch back to showing the cursor.

§3.3.35: view_set_buffer

bool32 app->view_set_buffer( diff --git a/4coder_config.h b/4coder_config.h deleted file mode 100644 index 81df0bc0..00000000 --- a/4coder_config.h +++ /dev/null @@ -1,80 +0,0 @@ -/* "4cpp" Open C++ Parser v0.1: Config - no warranty implied; use at your own risk - -NOTES ON USE: - This file is used to configure 4cpp options at the begining of 4cpp files. - It is not meant to be used directly. -*/ - -#ifdef FCPP_NO_CRT -# ifndef FCPP_NO_MALLOC -# define FCPP_NO_MALLOC -# endif -# ifndef FCPP_NO_ASSERT -# define FCPP_NO_ASSERT -# endif -# ifndef FCPP_NO_STRING -# define FCPP_NO_STRING -# endif -#endif - -#ifdef FCPP_FORBID_MALLOC -# define FCPP_NO_MALLOC -#endif - -#ifndef FCPP_NO_MALLOC -# include -#endif - -#ifndef FCPP_NO_ASSERT -# include -#endif - -#ifndef FCPP_NO_STRING -# include -#endif - -#ifndef FCPP_NO_MALLOC -# ifndef FCPP_GET_MEMORY -# define FCPP_GET_MEMORY malloc -# endif -# ifndef FCPP_FREE_MEMORY -# define FCPP_FREE_MEMORY free -# endif -#else -# ifndef FCPP_FORBID_MALLOC -# ifndef FCPP_GET_MEMORY -# error Missing definition for FCPP_GET_MEMORY -# endif -# ifndef FCPP_FREE_MEMORY -# error Missing definition for FCPP_FREE_MEMORY -# endif -# endif -#endif - -#ifndef FCPP_NO_ASSERT -# ifndef FCPP_ASSERT -# define FCPP_ASSERT assert -# endif -#else -# ifndef FCPP_ASSERT -# define FCPP_ASSERT(x) -# endif -#endif - -#ifndef FCPP_NO_STRING -# ifndef FCPP_MEM_COPY -# define FCPP_MEM_COPY memcpy -# endif -# ifndef FCPP_MEM_MOVE -# define FCPP_MEM_MOVE memmove -# endif -#endif - -#ifndef FCPP_LINK -# ifdef FCPP_EXTERN -# define FCPP_LINK extern -# else -# define FCPP_LINK static -# endif -#endif diff --git a/4coder_string.h b/4coder_string.h index 71f61791..fd955d66 100644 --- a/4coder_string.h +++ b/4coder_string.h @@ -1618,7 +1618,7 @@ FSTRING_LINK int32_t str_to_int_c(char *str){ int32_t x = 0; for (; *str; ++str){ - if (*str >= '0' || *str <= '9'){ + if (*str >= '0' && *str <= '9'){ x *= 10; x += *str - '0'; } diff --git a/4coder_version.h b/4coder_version.h index 25a13817..11f90000 100644 --- a/4coder_version.h +++ b/4coder_version.h @@ -1,15 +1,16 @@ #define MAJOR 4 #define MINOR 0 -#define PATCH 10 +#define PATCH 11 #define VN__(a,b,c) #a"."#b"."#c #define VN_(a,b,c) VN__(a,b,c) #define VERSION_NUMBER VN_(MAJOR,MINOR,PATCH) #define VERSION_STRING "alpha " VERSION_NUMBER -#ifdef FRED_SUPER +#if defined(FRED_SUPER) #define VERSION_TYPE " super!" #else #define VERSION_TYPE #endif + #define VERSION VERSION_STRING VERSION_TYPE diff --git a/4cpp_lexer.h b/4cpp_lexer.h index 08ee5180..ec591a7a 100644 --- a/4cpp_lexer.h +++ b/4cpp_lexer.h @@ -297,6 +297,7 @@ cpp_pp_directive_to_state(Cpp_Token_Type type){ return(result); } +#if 0 FCPP_LINK Cpp_Token_Merge cpp_attempt_token_merge(Cpp_Token prev_token, Cpp_Token next_token){ Cpp_Token_Merge result = {(Cpp_Token_Type)0}; @@ -312,25 +313,32 @@ cpp_attempt_token_merge(Cpp_Token prev_token, Cpp_Token next_token){ prev_token.size = next_token.start + next_token.size - prev_token.start; result.new_token = prev_token; } - return result; + return(result); } +#endif FCPP_LINK int32_t cpp_place_token_nonalloc(Cpp_Token *out_tokens, int32_t token_i, Cpp_Token token){ - Cpp_Token_Merge merge = {(Cpp_Token_Type)0}; + //Cpp_Token_Merge merge = {(Cpp_Token_Type)0}; Cpp_Token prev_token = {(Cpp_Token_Type)0}; if (token_i > 0){ prev_token = out_tokens[token_i - 1]; +#if 0 merge = cpp_attempt_token_merge(prev_token, token); if (merge.did_merge){ out_tokens[token_i - 1] = merge.new_token; } +#endif } +#if 0 if (!merge.did_merge){ out_tokens[token_i++] = token; } +#else + out_tokens[token_i++] = token; +#endif return(token_i); } @@ -1178,28 +1186,6 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state, double_break:; if (!went_too_far){ - if (relex_stack->count > 0){ - if (state->start_token_i > 0){ - Cpp_Token_Merge merge = - cpp_attempt_token_merge(tokens[state->start_token_i - 1], - relex_stack->tokens[0]); - if (merge.did_merge){ - --state->start_token_i; - relex_stack->tokens[0] = merge.new_token; - } - } - - if (relex_end_i < state->stack->count){ - Cpp_Token_Merge merge = - cpp_attempt_token_merge(relex_stack->tokens[relex_stack->count-1], - tokens[relex_end_i]); - if (merge.did_merge){ - ++relex_end_i; - relex_stack->tokens[relex_stack->count-1] = merge.new_token; - } - } - } - *relex_end = relex_end_i; } else{ @@ -1209,7 +1195,7 @@ cpp_relex_nonalloc_main(Cpp_Relex_State *state, return(went_too_far); } -#if !defined(FCPP_FORBID_MALLOC) +#if defined(FCPP_ALLOW_MALLOC) #include #include diff --git a/4cpp_lexer_types.h b/4cpp_lexer_types.h index 2ef65fa8..8adb033a 100644 --- a/4cpp_lexer_types.h +++ b/4cpp_lexer_types.h @@ -212,10 +212,12 @@ cpp_token_stack_zero(){ return(stack); } +#if 0 struct Cpp_Token_Merge{ - Cpp_Token new_token; - int32_t did_merge; + Cpp_Token new_token; + int32_t did_merge; }; +#endif struct Seek_Result{ int32_t pos; diff --git a/4ed_api_implementation.cpp b/4ed_api_implementation.cpp index a23d5111..1e70a066 100644 --- a/4ed_api_implementation.cpp +++ b/4ed_api_implementation.cpp @@ -1674,8 +1674,8 @@ DOC ( The highlight is mutually exclusive to the cursor. When the turn_on parameter is set to true the highlight will be shown and the cursor will be hidden. After -that either setting the with view_set_cursor or calling view_set_highlight and -the turn_on set to false, will switch back to showing the cursor. +that either setting the cursor with view_set_cursor or calling view_set_highlight +and the turn_on set to false, will switch back to showing the cursor. ) */{ Command_Data *cmd = (Command_Data*)app->cmd_context; diff --git a/4ed_app_target.cpp b/4ed_app_target.cpp index 99791dd8..f6175973 100644 --- a/4ed_app_target.cpp +++ b/4ed_app_target.cpp @@ -28,7 +28,6 @@ #include "4ed.h" -#define FCPP_FORBID_MALLOC #include "4cpp_lexer.h" #include "4coder_table.cpp" diff --git a/4ed_metagen.cpp b/4ed_metagen.cpp index d2b9eb6d..9ba21eb6 100644 --- a/4ed_metagen.cpp +++ b/4ed_metagen.cpp @@ -13,7 +13,7 @@ #include "internal_4coder_string.cpp" -#define FCPP_LEXER_IMPLEMENTATION +#define FCPP_ALLOW_MALLOC #include "4cpp_lexer.h" #include diff --git a/TODO.txt b/TODO.txt index 76c062ad..16dee005 100644 --- a/TODO.txt +++ b/TODO.txt @@ -69,10 +69,32 @@ ; [X] new file is messed up for code files, it never finishes parsing! ; [X] key presses that should be consumed in the GUI are now passed to the file! ; [X] paste snaps the cursor back into view! +; [X] clean whitespace doesn't appear to be cleaning trailing whitespace anymore??? ; ; [] indication on failure to save -; [] clean whitespace doesn't appear to be cleaning trailing whitespace anymore??? +; [] history is broken, revist the entire system ; +; [] 8.0\Include\um\dsound.h +; [] paths with parens in them +; [] double check end of line comments +; [] paste external text from bug report (in email) (not repod, get more info) +; +; + +; BEFORE I SHIP +; +; [] tokens in the custom API +; [] auto indent on the custom side +; [] option to not open *messages* every startup +; [] command for resizing panels +; [] control over how mouse effects panel focus +; [] full screen option +; [] API docs as text file +; [] user file bar string +; [] mouse down/up distinction +; [] hook on exit +; [] exit command +; [] read only files ; ; TODOS @@ -87,7 +109,7 @@ ; [X] API for file views ; [X] Seek backwards option ; [X] Use range parameters in all applicable commands -; [X] generate enum for key codes +; [X] generate enum for key codes ; [X] API for direct input ; [X] Seek string instead of delimiter ; [X] hook parameters @@ -104,26 +126,27 @@ ; [X] manipulate scroll target API ; [X] generate documentation for custom API ; -; [] OS font rendering ; [] support full length unicode file names ; [] switch based word complete -; +; ; [] undo groups ; [] cursor/scroll grouping ; [] file status in custom API -; [] user file bar string -; [] simple multi-line editing ; [] allow for arbitrary wrap positions independent of view width -; [] word level wrapping ~ temporary measure really want to have totally formatted code +; [] word level wrapping ~ temporary measure really want to have totally formatted code ; [] additional hooks ; [X] new file ; [] file out of sync ; [] double binding warnings ; +; [] multi-line editing +; [] multi-cursor editing +; ; GUI related tech ; [X] consolidate all GUI code properly ; [X] rewrite GUI ; [X] arrow navigation of GUIs +; [] scroll bar position and size options ; [] GUI API ; ; search related tech @@ -192,7 +215,6 @@ ; [X] shift backspace ; [X] center view on cursor ; [X] delta time in scroll interpolation -; [] close editor command ; [] panel grow/shrink commands ; @@ -204,7 +226,8 @@ ; [] fill screen right away ; [] history breaks when heavily used? (disk swaping?) ; -; [] minimize and reopen problem (still not reproduced here) +; [] a triangle rendered for a few frames? color of the dirty markers (not reproduced by me yet) +; [] minimize and reopen problem (not reproduced by me yet) ; ; FANCY-PANTS IDEAS diff --git a/internal_4coder_string.cpp b/internal_4coder_string.cpp index 42e9beb4..9a749e9e 100644 --- a/internal_4coder_string.cpp +++ b/internal_4coder_string.cpp @@ -1342,7 +1342,7 @@ DOC(If str is a valid string representation of an integer, this call will return the integer represented by the string. Otherwise this call returns zero.) */{ int32_t x = 0; for (; *str; ++str){ - if (*str >= '0' || *str <= '9'){ + if (*str >= '0' && *str <= '9'){ x *= 10; x += *str - '0'; }