main.c
is the sample usage code, spall_auto.h
is the single-header library.
You'll need spall.h, get it from here: https://github.com/colrdavidson/spall/blob/master/spall.h
build with:
cl main.c /O2 /GH /Gh
(also supports /Oy
)
or
#include "parsing.h" | |
#include "buffer.h" | |
#include <ch_stl/time.h> | |
namespace parsing { | |
// This is a column-reduction table to map 128 ASCII values to a 11-input space. | |
// The values in this table are premultiplied with the number of DFA states | |
// to save one multiply when indexing the state transition table. | |
#define P (DFA_NUM_STATES) | |
static const u8 char_type[] = { |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <ctype.h> | |
#include <stdarg.h> | |
//template <class F> struct deferrer { F f; ~deferrer() { f(); } }; | |
//struct defer_dummy {}; |
// SPDX-FileCopyrightText: © 2022 Phillip Trudeau-Tavara <pmttavara@protonmail.com> | |
// SPDX-License-Identifier: 0BSD | |
// https://hero.handmade.network/forums/code-discussion/t/7485-queryperformancefrequency_returning_10mhz_bug/2 | |
// https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/timers#partition-reference-tsc-mechanism | |
#include <stdbool.h> | |
#include <stdint.h> | |
#define WIN32_LEAN_AND_MEAN |
main.c
is the sample usage code, spall_auto.h
is the single-header library.
You'll need spall.h, get it from here: https://github.com/colrdavidson/spall/blob/master/spall.h
build with:
cl main.c /O2 /GH /Gh
(also supports /Oy
)
or
static bool terminal_belongs_to_self(void) { | |
DWORD pid = 0; GetWindowThreadProcessId(GetConsoleWindow(), &pid); | |
return pid == GetCurrentProcessId(); | |
} |