Skip to content
Myr

test_cpp_compilation.cpp

This file

Path

tests/test_cpp_compilation.cpp

186 lines · 5.8 KiB · C++

Last changed by

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

History of this file

Take it

The walk stopped after 200 commits: lines older than 08759eb point at it.

stb_hexwave added, stretchy_buffer.h deprecatedSean Barrettbefore adoption559d759

lines 1–7why, one step back
1#define STB_IMAGE_WRITE_STATIC
2#define STBIWDEF static inline34#include "stb_image.h"5#include "stb_rect_pack.h"6#include "stb_truetype.h"7#include "stb_image_write.h"

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

line 8why, one step back
8#include "stb_c_lexer.h"

stb_hexwave added, stretchy_buffer.h deprecatedSean Barrettbefore adoption559d759

lines 9–15why, one step back
9#include "stb_perlin.h"
10#include "stb_dxt.h"11#include "stb_divide.h"12#include "stb_herringbone_wang_tile.h"13#include "stb_ds.h"14#include "stb_hexwave.h"15

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 16–31why, one step back
16#include "stb_sprintf.h"
17#define STB_SPRINTF_IMPLEMENTATION18#include "stb_sprintf.h"192021#define STB_IMAGE_WRITE_IMPLEMENTATION22#define STB_TRUETYPE_IMPLEMENTATION23#define STB_PERLIN_IMPLEMENTATION24#define STB_DXT_IMPLEMENATION25#define STB_C_LEXER_IMPLEMENTATIOn26#define STB_DIVIDE_IMPLEMENTATION27#define STB_IMAGE_IMPLEMENTATION28#define STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION29#define STB_RECT_PACK_IMPLEMENTATION30#define STB_VOXEL_RENDER_IMPLEMENTATION31#define STB_CONNECTED_COMPONENTS_IMPLEMENTATION

stb_hexwave added, stretchy_buffer.h deprecatedSean Barrettbefore adoption559d759

line 32why, one step back
32#define STB_HEXWAVE_IMPLEMENTATION

update tests and project files for stb_dsSean Barrettbefore adoptione704ed0

line 33why, one step back
33#define STB_DS_IMPLEMENTATION

test updates for test_ds unit testingSean Barrettbefore adoption72990ef

line 34why, one step back
34#define STBDS_UNIT_TESTS

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 35–51why, one step back
35
36#define STBI_MALLOC my_malloc37#define STBI_FREE my_free38#define STBI_REALLOC my_realloc3940void *my_malloc(size_t) { return 0; }41void *my_realloc(void *, size_t) { return 0; }42void my_free(void *) { }4344#include "stb_image.h"45#include "stb_rect_pack.h"46#include "stb_truetype.h"47#include "stb_image_write.h"48#include "stb_perlin.h"49#include "stb_dxt.h"50#include "stb_divide.h"51#include "stb_herringbone_wang_tile.h"

update tests and project files for stb_dsSean Barrettbefore adoptione704ed0

line 52why, one step back
52#include "stb_ds.h"

stb_hexwave added, stretchy_buffer.h deprecatedSean Barrettbefore adoption559d759

line 53why, one step back
53#include "stb_hexwave.h"

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 54–72why, one step back
54
55#define STBCC_GRID_COUNT_X_LOG2 1056#define STBCC_GRID_COUNT_Y_LOG2 1057#include "stb_connected_components.h"5859#define STBVOX_CONFIG_MODE 160#include "stb_voxel_render.h"6162#define STBTE_DRAW_RECT(x0,y0,x1,y1,color) do ; while(0)63#define STBTE_DRAW_TILE(x,y,id,highlight,data) do ; while(0)64#define STB_TILEMAP_EDITOR_IMPLEMENTATION65#include "stb_tilemap_editor.h"6667#include "stb_easy_font.h"6869#define STB_LEAKCHECK_IMPLEMENTATION70#include "stb_leakcheck.h"7172#define STB_IMAGE_RESIZE_IMPLEMENTATION

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

line 73why, one step back
73#include "stb_image_resize2.h"

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

line 74why, one step back
74

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 75why, one step back
75//#include "stretchy_buffer.h" // deprecating

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 76–77why, one step back
76
77

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

lines 78–85why, one step back
78// avoid unused-function complaints
79void dummy2(void)80{81 stb_easy_font_spacing(1.0);82 stb_easy_font_print(0,0,NULL,NULL,NULL,0);83 stb_easy_font_width(NULL);84 stb_easy_font_height(NULL);85}

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

line 86why, one step back
86

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 87why, one step back
87

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 88–139why, one step back
88////////////////////////////////////////////////////////////
89//90// text edit9192#include <stdlib.h>93#include <string.h> // memmove94#include <ctype.h> // isspace9596#define STB_TEXTEDIT_CHARTYPE char97#define STB_TEXTEDIT_STRING text_control9899// get the base type100#include "stb_textedit.h"101102// define our editor structure103typedef struct104{105 char *string;106 int stringlen;107 STB_TexteditState state;108} text_control;109110// define the functions we need111void layout_func(StbTexteditRow *row, STB_TEXTEDIT_STRING *str, int start_i)112{113 int remaining_chars = str->stringlen - start_i;114 row->num_chars = remaining_chars > 20 ? 20 : remaining_chars; // should do real word wrap here115 row->x0 = 0;116 row->x1 = 20; // need to account for actual size of characters117 row->baseline_y_delta = 1.25;118 row->ymin = -1;119 row->ymax = 0;120}121122int delete_chars(STB_TEXTEDIT_STRING *str, int pos, int num)123{124 memmove(&str->string[pos], &str->string[pos+num], str->stringlen - (pos+num));125 str->stringlen -= num;126 return 1; // always succeeds127}128129int insert_chars(STB_TEXTEDIT_STRING *str, int pos, STB_TEXTEDIT_CHARTYPE *newtext, int num)130{131 str->string = (char *) realloc(str->string, str->stringlen + num);132 memmove(&str->string[pos+num], &str->string[pos], str->stringlen - pos);133 memcpy(&str->string[pos], newtext, num);134 str->stringlen += num;135 return 1; // always succeeds136}137138// define all the #defines needed 139

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

line 140why, one step back
140#define KEYDOWN_BIT 0x40000000

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 141–151why, one step back
141
142#define STB_TEXTEDIT_STRINGLEN(tc) ((tc)->stringlen)143#define STB_TEXTEDIT_LAYOUTROW layout_func144#define STB_TEXTEDIT_GETWIDTH(tc,n,i) (1) // quick hack for monospaced145#define STB_TEXTEDIT_KEYTOTEXT(key) (((key) & KEYDOWN_BIT) ? 0 : (key))146#define STB_TEXTEDIT_GETCHAR(tc,i) ((tc)->string[i])147#define STB_TEXTEDIT_NEWLINE '\n'148#define STB_TEXTEDIT_IS_SPACE(ch) isspace(ch)149#define STB_TEXTEDIT_DELETECHARS delete_chars150#define STB_TEXTEDIT_INSERTCHARS insert_chars151

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

lines 152–153why, one step back
152#define STB_TEXTEDIT_K_SHIFT 0x20000000
153#define STB_TEXTEDIT_K_CONTROL 0x10000000

Merge branch 'fix-sprintf-int-size-1' of https://github.com/account-login/stb into workingSean Barrettbefore adoption08759eb

lines 154–175why, one step back
154#define STB_TEXTEDIT_K_LEFT (KEYDOWN_BIT | 1) // actually use VK_LEFT, SDLK_LEFT, etc
155#define STB_TEXTEDIT_K_RIGHT (KEYDOWN_BIT | 2) // VK_RIGHT156#define STB_TEXTEDIT_K_UP (KEYDOWN_BIT | 3) // VK_UP157#define STB_TEXTEDIT_K_DOWN (KEYDOWN_BIT | 4) // VK_DOWN158#define STB_TEXTEDIT_K_LINESTART (KEYDOWN_BIT | 5) // VK_HOME159#define STB_TEXTEDIT_K_LINEEND (KEYDOWN_BIT | 6) // VK_END160#define STB_TEXTEDIT_K_TEXTSTART (STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_CONTROL)161#define STB_TEXTEDIT_K_TEXTEND (STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_CONTROL)162#define STB_TEXTEDIT_K_DELETE (KEYDOWN_BIT | 7) // VK_DELETE163#define STB_TEXTEDIT_K_BACKSPACE (KEYDOWN_BIT | 8) // VK_BACKSPACE164#define STB_TEXTEDIT_K_UNDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'z')165#define STB_TEXTEDIT_K_REDO (KEYDOWN_BIT | STB_TEXTEDIT_K_CONTROL | 'y')166#define STB_TEXTEDIT_K_INSERT (KEYDOWN_BIT | 9) // VK_INSERT167#define STB_TEXTEDIT_K_WORDLEFT (STB_TEXTEDIT_K_LEFT | STB_TEXTEDIT_K_CONTROL)168#define STB_TEXTEDIT_K_WORDRIGHT (STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_CONTROL)169#define STB_TEXTEDIT_K_PGUP (KEYDOWN_BIT | 10) // VK_PGUP -- not implemented170#define STB_TEXTEDIT_K_PGDOWN (KEYDOWN_BIT | 11) // VK_PGDOWN -- not implemented171172#define STB_TEXTEDIT_IMPLEMENTATION173#include "stb_textedit.h"174175

Merge branch 'master' into workingSean Barrettbefore adoptiond940053

lines 176–184why, one step back
176void dummy3(void)
177{178 stb_textedit_click(0,0,0,0);179 stb_textedit_drag(0,0,0,0);180 stb_textedit_cut(0,0);181 stb_textedit_key(0,0,0);182 stb_textedit_initialize_state(0,0);183 stb_textedit_paste(0,0,0,0);184}

Merge branch 'master' into workingSean Barrettbefore adoption6e9f34d

lines 185–186why, one step back
185
186#include "stb_c_lexer.h"