Compare commits

..

No commits in common. "master" and "fix_project_gen" have entirely different histories.

102 changed files with 11670 additions and 8000 deletions

4
.gitignore vendored
View File

@ -1,7 +1,3 @@
build/
build_new/temp
current_dist*/
distributions/
build_stable/
code/generated
code/custom/generated

BIN
4ed.rdbg

Binary file not shown.

View File

@ -26,55 +26,5 @@ Welcome to the 4coder community repository.
1. `$ cd 4cc/code`
2. `$ ./bin/build-linux.sh`
## Mac
> 4coder targets x86_64. If you are using a M1+ ARM CPU you need to prefix the build scripts commands with: `arch -arch x86_64`
1. Use the `package-mac.sh` script from the code directory (this builds a distribution in the `distributions` directory with all the non-binary dependencies)
1. `$ cd 4cc/code`
2. `$ ./bin/package-mac.sh`
2. You can also use the `build-mac.sh` script if you want just build the binaries, (this produces the build artifacts in the `build` directory, this doesn't produce a functional distribution)
1. `$ cd 4cc/code`
2. `$ ./bin/build-mac.sh`
### Older Macs, 10.15.7 Catalina
If you are using an older version of mac, such as 10.15.7 Catalina you need to install the realpath command:
1. `$ sudo port install coreutils`
2. macports names the `realpath` command `grealpath`, so make a symbolic link in order to use build-mac.sh:
`$ sudo ln -s /opt/local/bin/grealpath /opt/local/bin/realpath`
## Build script parameter
The build script accepts a parameter (mutually exclusive):
- `/DDEV_BUILD` or `/DDEV_BUILD_X86` (default value) : build without optimizations.
Produces debug symbols.
Defines: `FRED_INTERNAL`, `FRED_SUPER`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.
- `/DOPT_BUILD` or `/DOPT_BUILD_X86` (similar to `build_optimized` script): build with optimizations.
Doesn't produce debug symbols.
Defines `FRED_SUPER` macro.
- `/DPACKAGE_SUPER_X64` or `/DPACKAGE_SUPER_X86` (similar to `package` script): package 4coder for distribution.
Turns on optimizations.
Produces debug symbols.
Defines `SHIP_MODE`, `FRED_SUPER`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.
- `/DPACKAGE_DEMO_X64` or `/DPACKAGE_DEMO_X86`: packages 4coder demo for distribution.
Turns on optimizations.
Produces debug symbols.
Defines `SHIP_MODE`, `DO_CRAZY_EXPENSIVE_ASSERTS` (on Windows) macros.
## API generators
4coder uses several small programs to generate some headers and source files. Those do not run automatically, you must build them and run them when needed (which shouldn't really happen).
- `code\4ed_font_api.cpp` creates, in `code\generated`, `font_api.h`, `font_api.cpp`, `font_api_constructor.cpp` (not used) and `font_api_master_list.h` (not used);
- `code\4ed_graphics_api.cpp` creates, in `code\generated`, `graphics_api.h` and `graphics_api.cpp`, `graphics_api_constructor.cpp` (not used) and `graphics_api_master_list.h` (not used);
- `code\4ed_system_api.cpp` creates, in `code\custom\generated`, `system_api.h`, `system_api.cpp`, `system_api_constructor.cpp`, `system_api_master_list.h`;
- `code\4ed_api_parser_main.cpp` is a little different, as it parses source files passed as parameters to search for functions and type preceded by `api(some_api_name)` and creates 4 files in the `code\custom\generated`. It is used to generate `custom_api.h`, `custom_api.cpp`, `custom_api_constructor.cpp` and `custom_api_master_list.h` by passing `code\4ed_api_implementation.cpp` as a parameter.
You need to compile one of those file and run it from the `code` directory.
There is also `code\4ed_api_check.cpp` to verify the generated file but it's not clear at the moment what to check against.
- `code\4ed_generate_keycodes.cpp` is also a bit appart as it generates `code\custom\generated\4coder_event_codes.h` which are keyboard key codes and some event hook ids.
## Mac (Untested)
1. The steps should be the same as linux but replace the `*-linux.sh` with their `*-mac.sh` equivalents.

26
TODO.md
View File

@ -1,26 +0,0 @@
# TODO
PRIME DIRECTIVE: SIMPLIFY
## Necessary
[] figure out why the built version has a different font size than this one.
## Nice to Have
[] 4coder projects should have a startup script - so you can do things like add cl to the path
[] Look into removing *keyboard* buffer - seems like over long sessions, that could get out of hand
- good first step: print out the memory footprint of this buffer when we exit 4coder, just so we can see what it's taking up
[] multi cursor editing
[] yeet sheet
## Investigations
[] What are fade ranges? Do we need them?
# DONE
[x] matching curly brace highlight
[x] when buffers have the same filename, a short name is appended. I'd prefer to append the path relative to the project, and if the file is outside the project, append the full path.
[x] reload dirty files if there are no local edits to them automatically
[x] remove audio (search @Remove)
[x] backspace through entire filename in navigation strip at top
[x] fix project creation - this should just work out of the box
[x] remove automatic code layout for now

View File

@ -1,224 +0,0 @@
#!/bin/bash
# build-config.sh - Essential build configuration extracted from 4ed_build.cpp
# This file contains all the platform-specific compiler flags, linker flags, and build settings
# =============================================================================
# Directory Configuration
# =============================================================================
# Get the directory containing this script
CONFIG_SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$CONFIG_SCRIPT_DIR/../.." && pwd)"
# Build directories (absolute paths)
BUILD_DIR="$PROJECT_ROOT/build"
BUILD_TEMP_DIR="$PROJECT_ROOT/build_new/temp"
PACK_DIR="$PROJECT_ROOT/distributions"
SITE_DIR="$PROJECT_ROOT/site"
# Source directories (absolute paths)
CODE_DIR="$PROJECT_ROOT/code"
GENERATED_DIR="$PROJECT_ROOT/code/generated"
CUSTOM_DIR="$PROJECT_ROOT/code/custom"
CUSTOM_GENERATED_DIR="$PROJECT_ROOT/code/custom/generated"
FOREIGN_DIR="$PROJECT_ROOT/non-source/foreign"
SCRIPTS_DIR="$PROJECT_ROOT/build_new/scripts"
HELPERS_DIR="$PROJECT_ROOT/build_new/helpers"
# Include directories
INCLUDES=(
"$CUSTOM_DIR"
"$FOREIGN_DIR/freetype2"
)
# =============================================================================
# Platform Detection
# =============================================================================
# Platform codes
PLATFORM_WINDOWS=0
PLATFORM_LINUX=1
PLATFORM_MAC=2
# Architecture codes
ARCH_X64=0
ARCH_X86=1
# =============================================================================
# Build Flags
# =============================================================================
# Build flag bits (matching 4ed_build.cpp)
FLAG_OPTS=$((0x1)) # Compiler warnings/options
FLAG_LIBS=$((0x2)) # Link libraries
FLAG_ICON=$((0x4)) # Windows icon resource
FLAG_SHARED_CODE=$((0x8)) # Build as shared library
FLAG_DEBUG_INFO=$((0x10)) # Debug symbols
FLAG_OPTIMIZATION=$((0x20)) # Optimization level
FLAG_SUPER=$((0x40)) # Super tier features
FLAG_INTERNAL=$((0x80)) # Internal build flags
FLAG_SHIP=$((0x100)) # Shipping build
# =============================================================================
# Compiler Options - Windows (CL equivalent using clang)
# =============================================================================
# Windows compiler options (translated from CL to clang)
CLANG_OPTS_WINDOWS=(
"-Wall" # Enable most warnings
"-Wno-unused-parameter" # Disable unused parameter warnings
"-Wno-unused-variable" # Disable unused variable warnings
"-Wno-missing-field-initializers" # Disable missing field initializer warnings
"-Wno-deprecated-declarations" # Disable deprecated declarations warnings
"-Wno-missing-braces" # Disable missing braces warnings
"-Wno-tautological-compare" # Disable tautological compare warnings
"-Wno-write-strings" # Disable write strings warnings
"-Werror" # Treat warnings as errors
"-fno-rtti" # Disable RTTI (equivalent to /GR-)
"-fno-exceptions" # Disable exceptions (equivalent to /EHa-)
"-std=c++11" # C++11 standard
"-target x86_64-pc-windows-msvc" # Target Windows with MSVC ABI
)
# Windows libraries
LIBS_WINDOWS=(
"-luser32"
"-lwinmm"
"-lgdi32"
"-lopengl32"
"-lcomdlg32"
"-luserenv"
)
# Windows FreeType libraries
FREETYPE_LIB_WINDOWS_X64="$FOREIGN_DIR/x64/freetype.lib"
FREETYPE_LIB_WINDOWS_X86="$FOREIGN_DIR/x86/freetype.lib"
# Windows icon resource
WINDOWS_ICON="$PROJECT_ROOT/non-source/res/icon.res"
# =============================================================================
# Compiler Options - Linux (GCC equivalent using clang)
# =============================================================================
CLANG_OPTS_LINUX=(
"-Wno-write-strings"
"-D_GNU_SOURCE"
"-fPIC"
"-fno-threadsafe-statics"
"-pthread"
"-Wno-unused-result"
"-std=c++11"
"-target x86_64-linux-gnu" # Target Linux
)
# Linux libraries
LIBS_LINUX=(
"-lX11"
"-lpthread"
"-lm"
"-lrt"
"-lGL"
"-ldl"
"-lXfixes"
"-lfreetype"
"-lfontconfig"
)
# Linux platform includes
PLATFORM_INCLUDES_LINUX=(
"platform_all"
"platform_unix"
)
# =============================================================================
# Compiler Options - macOS (Clang native)
# =============================================================================
CLANG_OPTS_MACOS=(
"-Wno-write-strings"
"-Wno-deprecated-declarations"
"-Wno-comment"
"-Wno-switch"
"-Wno-null-dereference"
"-Wno-tautological-compare"
"-Wno-unused-result"
"-Wno-missing-declarations"
"-Wno-nullability-completeness"
"-std=c++11"
# Target will be set based on architecture
)
# macOS frameworks (equivalent to libraries)
FRAMEWORKS_MACOS=(
"-lc++"
"-lobjc"
-framework Cocoa
-framework QuartzCore
-framework CoreServices
-framework OpenGL
-framework IOKit
-framework Metal
-framework MetalKit
)
# macOS FreeType libraries
FREETYPE_LIB_MACOS_X64="$FOREIGN_DIR/x64/libfreetype-mac.a"
FREETYPE_LIB_MACOS_X86="$FOREIGN_DIR/x86/libfreetype-mac.a"
# macOS platform includes
PLATFORM_INCLUDES_MACOS=(
"platform_all"
"platform_unix"
)
# =============================================================================
# Architecture-specific flags
# =============================================================================
# 64-bit architecture
ARCH_FLAGS_X64=(
"-m64"
"-DFTECH_64_BIT"
)
# 32-bit architecture
ARCH_FLAGS_X86=(
"-m32"
"-DFTECH_32_BIT"
)
# =============================================================================
# Build Mode Flags
# =============================================================================
# Debug flags
DEBUG_FLAGS=(
"-g" # Debug symbols
"-O0" # No optimization
"-DDO_CRAZY_EXPENSIVE_ASSERTS" # Enable expensive assertions
)
# Release flags
RELEASE_FLAGS=(
"-O2" # Optimization level 2 (clang equivalent to -O3 for performance)
)
# =============================================================================
# Build Outputs
# =============================================================================
# Main executable names
EXECUTABLE_WINDOWS="4ed.exe"
EXECUTABLE_LINUX="4ed"
EXECUTABLE_MACOS="4ed"
# Shared library names
SHARED_LIB_WINDOWS="4ed_app.dll"
SHARED_LIB_LINUX="4ed_app.so"
SHARED_LIB_MACOS="4ed_app.so"
# Custom layer library names
CUSTOM_LIB_WINDOWS="custom_4coder.dll"
CUSTOM_LIB_LINUX="custom_4coder.so"
CUSTOM_LIB_MACOS="custom_4coder.so"

View File

@ -1,36 +0,0 @@
#!/bin/bash
copy_resources() {
print_step "Copying resources"
local themes_source="$CODE_DIR/ship_files/themes"
local themes_dest="$BUILD_DIR/themes"
if [[ -d "$themes_source" ]]; then
print_info "Copying themes..."
rm -rf "$themes_dest"
mkdir -p "$themes_dest"
cp -r "$themes_source"/* "$themes_dest/"
print_success "Themes copied"
fi
local fonts_src="$PROJECT_ROOT/non-source/dist_files/fonts"
local fonts_dst="$BUILD_DIR/fonts"
if [[ -d "$fonts_src" ]]; then
print_info "Copying fonts..."
rm -rf "$fonts_dst"
cp -r "$fonts_src" "$fonts_dst"
print_success "Fonts copied"
fi
# Copy config files if they exist
local config_files=("$CODE_DIR/ship_files/config.4coder" "$CODE_DIR/ship_files/bindings.4coder")
for config_file in "${config_files[@]}"; do
if [[ -f "$config_file" ]]; then
local filename=$(basename "$config_file")
cp "$config_file" "$BUILD_DIR/$filename"
print_info "Copied $filename"
fi
done
}

View File

@ -1,128 +0,0 @@
#!/bin/bash
# detect-platform.sh - Platform detection utility
# Returns: win32, linux, or macos
# Exit code: 0 for success, 1 for unknown platform
set -e
# =============================================================================
# Platform Detection
# =============================================================================
detect_platform() {
local uname_output
uname_output=$(uname -s)
case "$uname_output" in
"Darwin")
echo "macos"
return 0
;;
"Linux")
echo "linux"
return 0
;;
"CYGWIN"*|"MINGW"*|"MSYS"*)
echo "win32"
return 0
;;
*)
echo "Error: Unknown platform '$uname_output'" >&2
echo "Supported platforms: Darwin (macOS), Linux, CYGWIN/MINGW/MSYS (Windows)" >&2
return 1
;;
esac
}
# =============================================================================
# Additional Platform Information
# =============================================================================
detect_architecture() {
local uname_machine
uname_machine=$(uname -m)
case "$uname_machine" in
"x86_64"|"amd64")
echo "x64"
return 0
;;
"i386"|"i686")
echo "x86"
return 0
;;
"arm64"|"aarch64")
echo "arm64"
return 0
;;
*)
echo "Error: Unknown architecture '$uname_machine'" >&2
echo "Supported architectures: x86_64, i386, i686, arm64, aarch64" >&2
return 1
;;
esac
}
get_platform_info() {
local platform arch
platform=$(detect_platform)
if [[ $? -ne 0 ]]; then
return 1
fi
arch=$(detect_architecture)
if [[ $? -ne 0 ]]; then
return 1
fi
echo "Platform: $platform"
echo "Architecture: $arch"
echo "Full info: $(uname -a)"
return 0
}
# =============================================================================
# Main execution
# =============================================================================
main() {
local command="${1:-detect}"
case "$command" in
"detect")
detect_platform
;;
"arch")
detect_architecture
;;
"info")
get_platform_info
;;
"help"|"-h"|"--help")
echo "Usage: $0 [detect|arch|info|help]"
echo ""
echo "Commands:"
echo " detect - Detect platform (macos, linux, win32)"
echo " arch - Detect architecture (x64, x86, arm64)"
echo " info - Show detailed platform information"
echo " help - Show this help message"
echo ""
echo "Examples:"
echo " $0 detect # Returns: macos"
echo " $0 arch # Returns: x64"
echo " $0 info # Returns: Platform: macos, Architecture: x64, etc."
;;
*)
echo "Error: Unknown command '$command'" >&2
echo "Run '$0 help' for usage information" >&2
return 1
;;
esac
}
# Only run main if script is executed directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi

View File

@ -1,37 +0,0 @@
#!/bin/bash
# Colors & Styles for output
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
BOLD='\033[1m'
NC='\033[0m' # No Color
print_success() {
printf "%b✓%b %s\n" "$GREEN" "$NC" "$1"
}
print_info() {
printf "%b%b%b %s\n" "$BLUE" "$BOLD" "$NC" "$1"
}
print_step() {
printf "%b===%b%b %s %b%b===%b\n" "$BLUE" "$NC" "$BOLD" "$1" "$NC" "$BLUE" "$NC"
}
print_warning() {
printf "%b⚠%b %s\n" "$YELLOW" "$NC" "$1"
}
print_error() {
printf "%b⚠%b %s\n" "$RED" "$NC" "$1"
}
pushdir() {
pushd $1 > /dev/null
}
popdir() {
popd > /dev/null
}

View File

@ -1,312 +0,0 @@
#!/bin/bash
# build-linux.sh - Linux-specific build logic using clang
# Handles X11, pthread, fontconfig, etc.
# Usage: ./build-linux.sh [debug|release] [x64|x86]
set -e # Exit on error
# =============================================================================
# Configuration
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_DIR="$SCRIPT_DIR/../config"
# Source configuration files
source "$CONFIG_DIR/build-config.sh"
source "$HELPERS_DIR/print-routines.sh"
source "$HELPERS_DIR/copy-resources.sh"
# =============================================================================
# Platform-specific settings
# =============================================================================
setup_linux_vars() {
local config=$1
local arch=$2
# Base directories (relative to project root)
BUILD_DIR="${BUILD_ROOT:-../build}"
CODE_DIR="${CODE_DIR:-../code}"
CUSTOM_DIR="${CUSTOM_DIR:-../code/custom}"
FOREIGN_DIR="${FOREIGN_DIR:-../non-source/foreign}"
# Compiler
CXX="clang++"
CC="clang"
# Base flags for Linux
COMMON_FLAGS=(
"${CLANG_OPTS_LINUX[@]}"
"-I$CODE_DIR"
"-I$FOREIGN_DIR/freetype2"
)
# Architecture-specific flags
case "$arch" in
"x64")
ARCH_FLAGS=("${ARCH_FLAGS_X64[@]}")
;;
"x86")
ARCH_FLAGS=("${ARCH_FLAGS_X86[@]}")
;;
*)
echo "Error: Unsupported architecture: $arch" >&2
return 1
;;
esac
# Configuration-specific flags
case "$config" in
"debug")
CONFIG_FLAGS=("${DEBUG_FLAGS[@]}")
;;
"release")
CONFIG_FLAGS=("${RELEASE_FLAGS[@]}")
;;
*)
echo "Error: Unsupported config: $config" >&2
return 1
;;
esac
# Combine all flags
COMPILE_FLAGS=(
"${COMMON_FLAGS[@]}"
"${ARCH_FLAGS[@]}"
"${CONFIG_FLAGS[@]}"
)
# Libraries
LINK_LIBS=("${LIBS_LINUX[@]}")
# Platform includes
PLATFORM_INCLUDES=()
for inc in "${PLATFORM_INCLUDES_LINUX[@]}"; do
PLATFORM_INCLUDES+=("-I$CODE_DIR/$inc")
done
print_info "Linux build configuration:"
print_info " Architecture: $arch"
print_info " Configuration: $config"
print_info " Compiler: $CXX"
}
# =============================================================================
# Build functions
# =============================================================================
build_core_engine() {
print_step "Building core engine (4ed_app.so)"
local app_target="$CODE_DIR/4ed_app_target.cpp"
local output_lib="$BUILD_DIR/4ed_app.so"
# Build flags for shared library
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-fPIC"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
# Include directories for custom layer
local include_flags=(
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
)
print_info "Compiling core application library..."
print_info "Input: $app_target"
print_info "Output: $output_lib"
# Compile core application shared library
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} ${include_flags[*]} -o $output_lib $app_target ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
"${include_flags[@]}" \
-o "$output_lib" \
"$app_target" \
"${LINK_LIBS[@]}"
print_success "Core engine built successfully"
}
build_platform_layer() {
print_step "Building platform layer (4ed executable)"
local platform_source="$CODE_DIR/platform_linux/linux_4ed.cpp"
local output_exe="$BUILD_DIR/4ed"
# Build flags for executable
local build_flags=(
"${COMPILE_FLAGS[@]}"
"${PLATFORM_INCLUDES[@]}"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
print_info "Compiling platform layer executable..."
print_info "Input: $platform_source"
print_info "Output: $output_exe"
# Compile platform layer executable
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} -o $output_exe $platform_source ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
-o "$output_exe" \
"$platform_source" \
"${LINK_LIBS[@]}"
print_success "Platform layer built successfully"
}
build_custom_layer() {
print_step "Building custom layer (custom_4coder.so)"
local custom_target="$CUSTOM_DIR/4coder_default_bindings.cpp"
local output_lib="$BUILD_DIR/custom_4coder.so"
local temp_dir="$BUILD_DIR/temp"
# Create temp directory
mkdir -p "$temp_dir"
# Multi-stage custom layer build process
# Stage 1: Preprocess with meta macros
print_info "Stage 1: Preprocessing with meta macros..."
local preprocessed_file="$temp_dir/4coder_default_bindings.i"
$CXX \
-I"$CODE_DIR" \
-I"$CUSTOM_DIR" \
-I"$CUSTOM_DIR/generated" \
-DMETA_PASS \
-E \
"$custom_target" \
-o "$preprocessed_file"
print_success "Preprocessing completed"
# Stage 2: Build metadata generator
print_info "Stage 2: Building metadata generator..."
local metadata_generator="$temp_dir/metadata_generator"
local metadata_source="$CUSTOM_DIR/4coder_metadata_generator.cpp"
$CXX \
"${COMPILE_FLAGS[@]}" \
-I"$CODE_DIR" \
-I"$CUSTOM_DIR" \
-I"$CUSTOM_DIR/generated" \
-o "$metadata_generator" \
"$metadata_source"
print_success "Metadata generator built"
# Stage 3: Generate metadata
print_info "Stage 3: Generating metadata files..."
# Ensure generated directory exists
mkdir -p "$CUSTOM_DIR/generated"
# Run metadata generator
"$metadata_generator" \
-R "$CUSTOM_DIR/generated/" \
"$preprocessed_file"
print_success "Metadata generated"
# Stage 4: Compile custom layer shared library
print_info "Stage 4: Compiling custom layer shared library..."
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-fPIC"
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} -o $output_lib $custom_target"
fi
$CXX \
"${build_flags[@]}" \
-o "$output_lib" \
"$custom_target"
print_success "Custom layer built successfully"
# Clean up temporary files
print_info "Cleaning up temporary files..."
rm -f "$preprocessed_file" "$metadata_generator"
}
validate_build() {
print_step "Validating build outputs"
local all_good=true
local expected_files=("4ed" "4ed_app.so" "custom_4coder.so")
for file in "${expected_files[@]}"; do
if [[ -f "$BUILD_DIR/$file" ]]; then
local file_size
file_size=$(stat -c%s "$BUILD_DIR/$file" 2>/dev/null || echo "unknown")
print_success "$file (${file_size} bytes)"
else
echo -e "${RED}${NC} Missing: $file"
all_good=false
fi
done
if [[ "$all_good" == "true" ]]; then
print_success "All build outputs validated"
return 0
else
echo -e "${RED}${NC} Build validation failed"
return 1
fi
}
# =============================================================================
# Main execution
# =============================================================================
main() {
local config="${1:-debug}"
local arch="${2:-x64}"
print_step "Linux Build Process"
print_info "Configuration: $config"
print_info "Architecture: $arch"
# Setup platform-specific variables
setup_linux_vars "$config" "$arch"
# Create build directory
mkdir -p "$BUILD_DIR"
# Execute build steps
build_custom_layer
build_core_engine
build_platform_layer
copy_resources
validate_build
print_success "Linux build completed successfully!"
}
# Only run main if script is executed directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi

View File

@ -1,319 +0,0 @@
#!/bin/bash
# build-macos.sh - macOS-specific build logic using clang
# Handles Objective-C++ files, frameworks, etc.
# Usage: ./build-macos.sh [debug|release] [x64|x86|arm64]
set -e # Exit on error
# =============================================================================
# Configuration
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_DIR="$SCRIPT_DIR/../config"
# Source configuration files
source "$CONFIG_DIR/build-config.sh"
source "$HELPERS_DIR/print-routines.sh"
source "$HELPERS_DIR/copy-resources.sh"
# =============================================================================
# Platform-specific settings
# =============================================================================
setup_macos_vars() {
local config=$1
local arch=$2
# Use directories from build-config.sh (already set to absolute paths)
# BUILD_DIR, CODE_DIR, CUSTOM_DIR, FOREIGN_DIR are already set
# Compiler
CXX="clang++"
CC="clang"
# Base flags for macOS
COMMON_FLAGS=(
"${CLANG_OPTS_MACOS[@]}"
"-I$CODE_DIR"
"-I$FOREIGN_DIR/freetype2"
)
# Architecture-specific flags
case "$arch" in
"x64")
ARCH_FLAGS=("${ARCH_FLAGS_X64[@]}")
FREETYPE_LIB="$FREETYPE_LIB_MACOS_X64"
;;
"arm64")
ARCH_FLAGS=("-arch" "arm64" "-DFTECH_64_BIT")
FREETYPE_LIB="$FREETYPE_LIB_MACOS_X64" # Use x64 lib for now
;;
"x86")
ARCH_FLAGS=("${ARCH_FLAGS_X86[@]}")
FREETYPE_LIB="$FREETYPE_LIB_MACOS_X86"
;;
*)
echo "Error: Unsupported architecture: $arch" >&2
return 1
;;
esac
# Configuration-specific flags
case "$config" in
"debug")
CONFIG_FLAGS=("${DEBUG_FLAGS[@]}")
;;
"release")
CONFIG_FLAGS=("${RELEASE_FLAGS[@]}")
;;
*)
echo "Error: Unsupported config: $config" >&2
return 1
;;
esac
# Combine all flags
COMPILE_FLAGS=(
"${COMMON_FLAGS[@]}"
"${ARCH_FLAGS[@]}"
"${CONFIG_FLAGS[@]}"
)
# Libraries and frameworks
LINK_LIBS=(
"${FRAMEWORKS_MACOS[@]}"
"$FREETYPE_LIB"
)
# Platform includes
PLATFORM_INCLUDES=()
for inc in "${PLATFORM_INCLUDES_MACOS[@]}"; do
PLATFORM_INCLUDES+=("-I$CODE_DIR/$inc")
done
print_info "macOS build configuration:"
print_info " Architecture: $arch"
print_info " Configuration: $config"
print_info " Compiler: $CXX"
print_info " FreeType: $FREETYPE_LIB"
}
# =============================================================================
# Build functions
# =============================================================================
build_core_engine() {
print_step "Building API Parser..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_api_parser_main.cpp $BUILD_DIR && cp $BUILD_DIR/one_time $BUILD_DIR/api_parser
print_step "Building System API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_system_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building API Check..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_api_check.cpp $BUILD_DIR && cp $BUILD_DIR/one_time $BUILD_DIR/api_checker
print_step "Running API Parser..."
$BUILD_DIR/api_parser $CODE_DIR/4ed_api_implementation.cpp
print_step "Building Font API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_font_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Graphics API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_graphics_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building core engine (4ed_app.so)"
local app_target="$CODE_DIR/4ed_app_target.cpp"
local output_lib="$BUILD_DIR/4ed_app.so"
# Build flags for shared library
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-fPIC"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
# Include directories for custom layer
local include_flags=(
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
)
print_info "Compiling core application library..."
print_info "Input: $app_target"
print_info "Output: $output_lib"
# Compile core application shared library
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} ${include_flags[*]} -o $output_lib $app_target ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
"${include_flags[@]}" \
-o "$output_lib" \
"$app_target" \
"${LINK_LIBS[@]}"
print_success "Core engine built successfully"
}
build_platform_layer() {
print_step "Building platform layer (4ed executable)"
local platform_source="$CODE_DIR/platform_mac/mac_4ed.mm"
local output_exe="$BUILD_DIR/4ed"
local include_flags=(
"-I$CUSTOM_DIR"
)
# Build flags for executable
local build_flags=(
"${COMPILE_FLAGS[@]}"
"${PLATFORM_INCLUDES[@]}"
"${include_flags[@]}"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
print_info "Compiling platform layer executable..."
print_info "Input: $platform_source"
print_info "Output: $output_exe"
# Compile platform layer executable
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} -o $output_exe $platform_source ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
-o "$output_exe" \
"$platform_source" \
"${LINK_LIBS[@]}"
print_success "Platform layer built successfully"
}
build_custom_layer() {
print_step "Building custom layer (custom_4coder.so)"
local custom_target="$CUSTOM_DIR/4coder_default_bindings.cpp"
local output_lib="$BUILD_DIR/custom_4coder.so"
local temp_dir="$BUILD_DIR/temp"
# Create temp directory
mkdir -p "$temp_dir"
# Multi-stage custom layer build process
# Stage 0: Build and Run Generators
mkdir -p "$CODE_DIR/generated"
print_step "Building CPP Lexer Gen..."
$CUSTOM_DIR/bin/build_one_time.sh $CUSTOM_DIR/languages/4coder_cpp_lexer_gen.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Generate Keycodes..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_generate_keycodes.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Docs..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/docs/4ed_doc_custom_api_main.cpp $BUILD_DIR && $BUILD_DIR/one_time
# Ensure generated directory exists
mkdir -p "$CUSTOM_DIR/generated"
# Stage 3: Generate metadata
$SCRIPTS_DIR/build-metadata.sh
print_success "Metadata generated"
# Stage 4: Compile custom layer shared library
print_info "Stage 4: Compiling custom layer shared library..."
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-fPIC"
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} -o $output_lib $custom_target"
fi
$CXX \
"${build_flags[@]}" \
-o "$output_lib" \
"$custom_target"
print_success "Custom layer built successfully"
# Clean up temporary files
print_info "Cleaning up temporary files..."
# rm -f "$preprocessed_file" "$metadata_generator"
}
validate_build() {
print_step "Validating build outputs"
local all_good=true
local expected_files=("4ed" "4ed_app.so" "custom_4coder.so")
for file in "${expected_files[@]}"; do
if [[ -f "$BUILD_DIR/$file" ]]; then
local file_size
file_size=$(stat -f%z "$BUILD_DIR/$file" 2>/dev/null || echo "unknown")
print_success "$file (${file_size} bytes)"
else
echo -e "${RED}${NC} Missing: $file"
all_good=false
fi
done
if [[ "$all_good" == "true" ]]; then
print_success "All build outputs validated"
return 0
else
echo -e "${RED}${NC} Build validation failed"
return 1
fi
}
# =============================================================================
# Main execution
# =============================================================================
main() {
local config="${1:-debug}"
local arch="${2:-x64}"
print_step "macOS Build Process"
print_info "Configuration: $config"
print_info "Architecture: $arch"
# Setup platform-specific variables
setup_macos_vars "$config" "$arch"
# Create build directory
mkdir -p "$BUILD_DIR"
# Execute build steps
build_custom_layer
build_core_engine
build_platform_layer
copy_resources
validate_build
print_success "macOS build completed successfully!"
}
# Only run main if script is executed directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi

View File

@ -1,33 +0,0 @@
#!/bin/sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../config/build-config.sh"
source "$HELPERS_DIR/print-routines.sh"
SOURCE="$CUSTOM_DIR/4coder_default_bindings.cpp"
METADATA_GEN_SRC="$CUSTOM_DIR/4coder_metadata_generator.cpp"
METADATA_GEN_DST="$BUILD_TEMP_DIR/metadata_generator"
PREPROC_FILE="$BUILD_TEMP_DIR/4coder_command_metadata.i"
OPTS="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-writable-strings -g -std=gnu++0x"
META_MACROS="-DMETA_PASS"
print_step "Building Metadata"
print_info "Running C Preprocessor"
g++ -I"$CUSTOM_DIR" $META_MACROS $OPTS "$SOURCE" -E -o $PREPROC_FILE
print_info "Building Metadata Generator"
g++ -I"$CUSTOM_DIR" $OPTS $METADATA_GEN_SRC -o $METADATA_GEN_DST
print_info "Running Metadata Generator"
$METADATA_GEN_DST -R $CUSTOM_DIR "$PREPROC_FILE"
if [ -nz $? ]; then
print_success "Metadata build"
fi

View File

@ -1,359 +0,0 @@
#!/bin/bash
# build-win32.sh - Windows-specific build logic using clang
# Handles Windows APIs, resource compilation, etc.
# Usage: ./build-win32.sh [debug|release] [x64|x86]
set -e # Exit on error
# =============================================================================
# Configuration
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CONFIG_DIR="$SCRIPT_DIR/../config"
# Source configuration files
source "$CONFIG_DIR/build-config.sh"
source "$HELPERS_DIR/print-routines.sh"
source "$HELPERS_DIR/copy-resources.sh"
# =============================================================================
# Platform-specific settings
# =============================================================================
setup_win32_vars() {
local config=$1
local arch=$2
# Base directories (relative to project root)
BUILD_DIR="${BUILD_ROOT:-../build}"
CODE_DIR="${CODE_DIR:-../code}"
CUSTOM_DIR="${CUSTOM_DIR:-../code/custom}"
FOREIGN_DIR="${FOREIGN_DIR:-../non-source/foreign}"
# Compiler (using clang with Windows target)
CXX="clang++"
CC="clang"
# Base flags for Windows
COMMON_FLAGS=(
"${CLANG_OPTS_WINDOWS[@]}"
"-I$CODE_DIR"
"-I$FOREIGN_DIR/freetype2"
)
# Architecture-specific flags
case "$arch" in
"x64")
ARCH_FLAGS=("${ARCH_FLAGS_X64[@]}")
FREETYPE_LIB="$FREETYPE_LIB_WINDOWS_X64"
;;
"x86")
ARCH_FLAGS=("${ARCH_FLAGS_X86[@]}")
FREETYPE_LIB="$FREETYPE_LIB_WINDOWS_X86"
;;
*)
echo "Error: Unsupported architecture: $arch" >&2
return 1
;;
esac
# Configuration-specific flags
case "$config" in
"debug")
CONFIG_FLAGS=("${DEBUG_FLAGS[@]}")
;;
"release")
CONFIG_FLAGS=("${RELEASE_FLAGS[@]}")
;;
*)
echo "Error: Unsupported config: $config" >&2
return 1
;;
esac
# Combine all flags
COMPILE_FLAGS=(
"${COMMON_FLAGS[@]}"
"${ARCH_FLAGS[@]}"
"${CONFIG_FLAGS[@]}"
)
# Libraries
LINK_LIBS=(
"${LIBS_WINDOWS[@]}"
"$FREETYPE_LIB"
)
# Platform includes
PLATFORM_INCLUDES=()
# Windows doesn't have additional platform includes in the original build
print_info "Windows build configuration:"
print_info " Architecture: $arch"
print_info " Configuration: $config"
print_info " Compiler: $CXX"
print_info " FreeType: $FREETYPE_LIB"
}
# =============================================================================
# Resource compilation (Windows-specific)
# =============================================================================
compile_resources() {
print_step "Compiling Windows resources"
local icon_rc="$CODE_DIR/../non-source/res/icon.rc"
local icon_res="$BUILD_DIR/icon.res"
if [[ -f "$icon_rc" ]]; then
print_info "Compiling icon resource..."
# Use windres if available, otherwise skip resources
if command -v windres &> /dev/null; then
windres "$icon_rc" -o "$icon_res"
print_success "Icon resource compiled"
echo "$icon_res" # Return the resource file path
else
print_warning "windres not found, skipping resource compilation"
echo "" # Return empty string
fi
else
print_warning "Icon resource file not found: $icon_rc"
echo "" # Return empty string
fi
}
# =============================================================================
# Build functions
# =============================================================================
build_core_engine() {
print_step "Building API Parser..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_api_parser_main.cpp $BUILD_DIR && cp $BUILD_DIR/one_time $BUILD_DIR/api_parser
print_step "Building System API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_system_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building API Check..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_api_check.cpp $BUILD_DIR && cp $BUILD_DIR/one_time $BUILD_DIR/api_checker
print_step "Running API Parser..."
$BUILD_DIR/api_parser $CODE_DIR/4ed_api_implementation.cpp
print_step "Building Font API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_font_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Graphics API..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_graphics_api.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building core engine (4ed_app.dll)"
local app_target="$CODE_DIR/4ed_app_target.cpp"
local output_lib="$BUILD_DIR/4ed_app.dll"
# Build flags for shared library
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
# Include directories for custom layer
local include_flags=(
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
)
print_info "Compiling core application library..."
print_info "Input: $app_target"
print_info "Output: $output_lib"
# Compile core application shared library
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} ${include_flags[*]} -o $output_lib $app_target ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
"${include_flags[@]}" \
-o "$output_lib" \
"$app_target" \
"${LINK_LIBS[@]}"
print_success "Core engine built successfully"
}
build_platform_layer() {
print_step "Building platform layer (4ed.exe)"
local platform_source="$CODE_DIR/platform_win32/win32_4ed.cpp"
local output_exe="$BUILD_DIR/4ed.exe"
# Compile resources
local resource_file
resource_file=$(compile_resources)
# Build flags for executable
local build_flags=(
"${COMPILE_FLAGS[@]}"
"${PLATFORM_INCLUDES[@]}"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
# Add resource file if it exists
local resource_args=()
if [[ -n "$resource_file" && -f "$resource_file" ]]; then
resource_args=("$resource_file")
print_info "Including resource file: $resource_file"
fi
print_info "Compiling platform layer executable..."
print_info "Input: $platform_source"
print_info "Output: $output_exe"
# Compile platform layer executable
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} -o $output_exe $platform_source ${resource_args[*]} ${LINK_LIBS[*]}"
fi
$CXX \
"${build_flags[@]}" \
-o "$output_exe" \
"$platform_source" \
"${resource_args[@]}" \
"${LINK_LIBS[@]}"
print_success "Platform layer built successfully"
}
build_custom_layer() {
print_step "Building custom layer (custom_4coder.dll)"
local custom_target="$CUSTOM_DIR/4coder_default_bindings.cpp"
local output_lib="$BUILD_DIR/custom_4coder.dll"
local temp_dir="$BUILD_DIR/temp"
# Create temp directory
mkdir -p "$temp_dir"
# Multi-stage custom layer build process
# Stage 0: Build and Run Generators
mkdir -p "$CODE_DIR/generated"
print_step "Building CPP Lexer Gen..."
$CUSTOM_DIR/bin/build_one_time.sh $CUSTOM_DIR/languages/4coder_cpp_lexer_gen.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Generate Keycodes..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/4ed_generate_keycodes.cpp $BUILD_DIR && $BUILD_DIR/one_time
print_step "Building Docs..."
$CUSTOM_DIR/bin/build_one_time.sh $CODE_DIR/docs/4ed_doc_custom_api_main.cpp $BUILD_DIR && $BUILD_DIR/one_time
# Ensure generated directory exists
mkdir -p "$CUSTOM_DIR/generated"
# Ensure generated directory exists
mkdir -p "$CUSTOM_DIR/generated"
# Stage 2: Generate metadata
$SCRIPTS_DIR/build-metadata.sh
print_success "Metadata generated"
# Stage 4: Compile custom layer shared library
print_info "Stage 4: Compiling custom layer shared library..."
local build_flags=(
"${COMPILE_FLAGS[@]}"
"-shared"
"-I$CUSTOM_DIR"
"-I$CUSTOM_DIR/generated"
"-DFRED_SUPER"
"-DFRED_INTERNAL"
)
# Add export flags for Windows DLL
local export_flags=(
"-Wl,--export-all-symbols"
"-Wl,--out-implib,$BUILD_DIR/custom_4coder.lib"
)
if [[ "${BUILD_VERBOSE:-}" == "1" ]]; then
echo "Executing: $CXX ${build_flags[*]} ${export_flags[*]} -o $output_lib $custom_target"
fi
$CXX \
"${build_flags[@]}" \
"${export_flags[@]}" \
-o "$output_lib" \
"$custom_target"
print_success "Custom layer built successfully"
# Clean up temporary files
print_info "Cleaning up temporary files..."
rm -f "$preprocessed_file" "$metadata_generator"
}
validate_build() {
print_step "Validating build outputs"
local all_good=true
local expected_files=("4ed.exe" "4ed_app.dll" "custom_4coder.dll")
for file in "${expected_files[@]}"; do
if [[ -f "$BUILD_DIR/$file" ]]; then
local file_size
file_size=$(stat -c%s "$BUILD_DIR/$file" 2>/dev/null || echo "unknown")
print_success "$file (${file_size} bytes)"
else
echo -e "${RED}${NC} Missing: $file"
all_good=false
fi
done
if [[ "$all_good" == "true" ]]; then
print_success "All build outputs validated"
return 0
else
echo -e "${RED}${NC} Build validation failed"
return 1
fi
}
# =============================================================================
# Main execution
# =============================================================================
main() {
local config="${1:-debug}"
local arch="${2:-x64}"
print_step "Windows Build Process"
print_info "Configuration: $config"
print_info "Architecture: $arch"
# Setup platform-specific variables
setup_win32_vars "$config" "$arch"
# Create build directory
mkdir -p "$BUILD_DIR"
# Execute build steps
build_custom_layer
build_core_engine
build_platform_layer
copy_resources
validate_build
print_success "Windows build completed successfully!"
}
# Only run main if script is executed directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi

View File

@ -1,307 +0,0 @@
#!/bin/bash
# build.sh - Master build script for 4coder simplified build system
# Usage: ./build.sh [platform] [config] [arch]
# Examples:
# ./build.sh macos debug x64
# ./build.sh linux release x64
# ./build.sh win32 debug x64
set -e # Exit on error
# =============================================================================
# Configuration
# =============================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BUILD_ROOT="$SCRIPT_DIR/../../build"
CONFIG_DIR="$SCRIPT_DIR/../config"
HELPERS_DIR="$SCRIPT_DIR/../helpers"
# Source configuration files
source "$CONFIG_DIR/build-config.sh"
# =============================================================================
# Utility Functions
# =============================================================================
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_success() {
echo -e "${GREEN}${NC} $1"
}
print_warning() {
echo -e "${YELLOW}${NC} $1"
}
print_error() {
echo -e "${RED}${NC} $1"
}
print_info() {
echo -e "${BLUE}${NC} $1"
}
print_step() {
echo -e "${BLUE}===${NC} $1 ${BLUE}===${NC}"
}
show_usage() {
echo "Usage: $0 [platform] [config] [arch]"
echo ""
echo "Parameters:"
echo " platform - Target platform (auto-detect if not specified)"
echo " Options: macos, linux, win32"
echo " config - Build configuration (default: debug)"
echo " Options: debug, release"
echo " arch - Target architecture (auto-detect if not specified)"
echo " Options: x64, x86, arm64"
echo ""
echo "Examples:"
echo " $0 # Auto-detect platform and arch, debug build"
echo " $0 macos debug x64 # Explicit macOS debug x64 build"
echo " $0 linux release x64 # Linux release build"
echo " $0 win32 debug x64 # Windows debug build"
echo ""
echo "Environment:"
echo " BUILD_VERBOSE=1 # Enable verbose compilation output"
echo " BUILD_CLEAN=1 # Clean before build"
}
# =============================================================================
# Parameter Processing
# =============================================================================
detect_platform_and_arch() {
local detected_platform detected_arch
if [[ -x "$HELPERS_DIR/detect-platform.sh" ]]; then
detected_platform=$("$HELPERS_DIR/detect-platform.sh" detect 2>/dev/null)
detected_arch=$("$HELPERS_DIR/detect-platform.sh" arch 2>/dev/null)
if [[ -n "$detected_platform" && -n "$detected_arch" ]]; then
# Don't print here, let the caller print after parsing
echo "$detected_platform $detected_arch"
else
print_error "Failed to detect platform or architecture" >&2
return 1
fi
else
print_error "Platform detection script not found" >&2
return 1
fi
}
validate_parameters() {
local platform=$1
local config=$2
local arch=$3
# Validate platform
case "$platform" in
"macos"|"linux"|"win32")
;;
*)
print_error "Invalid platform: $platform"
print_info "Valid platforms: macos, linux, win32"
return 1
;;
esac
# Validate config
case "$config" in
"debug"|"release")
;;
*)
print_error "Invalid config: $config"
print_info "Valid configs: debug, release"
return 1
;;
esac
# Validate arch
case "$arch" in
"x64"|"x86"|"arm64")
;;
*)
print_error "Invalid architecture: $arch"
print_info "Valid architectures: x64, x86, arm64"
return 1
;;
esac
return 0
}
# =============================================================================
# Build Environment Setup
# =============================================================================
setup_build_environment() {
local platform=$1
local config=$2
local arch=$3
print_step "Setting up build environment"
# Create build directories
mkdir -p "$BUILD_ROOT"
mkdir -p "$BUILD_ROOT/temp"
# Export build variables
export BUILD_PLATFORM="$platform"
export BUILD_CONFIG="$config"
export BUILD_ARCH="$arch"
export BUILD_ROOT="$BUILD_ROOT"
export CODE_DIR="$CODE_DIR"
export CUSTOM_DIR="$CUSTOM_DIR"
export FOREIGN_DIR="$FOREIGN_DIR"
print_success "Build environment ready"
print_info "Platform: $platform"
print_info "Config: $config"
print_info "Architecture: $arch"
print_info "Build root: $BUILD_ROOT"
}
# =============================================================================
# Build Execution
# =============================================================================
execute_platform_build() {
local platform=$1
local config=$2
local arch=$3
local platform_script="$SCRIPT_DIR/build-$platform.sh"
if [[ -x "$platform_script" ]]; then
print_step "Executing platform-specific build"
print_info "Running: $platform_script $config $arch"
# Execute platform-specific build script
"$platform_script" "$config" "$arch"
return $?
else
print_error "Platform-specific build script not found: $platform_script"
return 1
fi
}
# =============================================================================
# Clean Build Support
# =============================================================================
clean_build() {
print_step "Cleaning build directory"
if [[ -d "$BUILD_ROOT" ]]; then
print_info "Removing $BUILD_ROOT"
rm -rf "$BUILD_ROOT"
fi
print_success "Build directory cleaned"
}
# =============================================================================
# Main Build Process
# =============================================================================
main() {
local platform="${1:-}"
local config="${2:-debug}"
local arch="${3:-}"
# Handle help request
if [[ "$1" == "help" || "$1" == "-h" || "$1" == "--help" ]]; then
show_usage
return 0
fi
# Handle clean request
if [[ "$1" == "clean" ]]; then
clean_build
return 0
fi
print_step "4coder Simplified Build System"
# Auto-detect platform and arch if not provided
if [[ -z "$platform" || -z "$arch" ]]; then
local detected_info detected_platform detected_arch
detected_info=$(detect_platform_and_arch)
if [[ $? -ne 0 ]]; then
print_error "Failed to auto-detect platform and architecture"
return 1
fi
read -r detected_platform detected_arch <<< "$detected_info"
platform="${platform:-$detected_platform}"
arch="${arch:-$detected_arch}"
print_info "Auto-detected platform: $platform"
print_info "Auto-detected architecture: $arch"
fi
# Validate parameters
if ! validate_parameters "$platform" "$config" "$arch"; then
echo ""
show_usage
return 1
fi
# Clean if requested
if [[ "${BUILD_CLEAN:-}" == "1" ]]; then
clean_build
fi
# Setup build environment
if ! setup_build_environment "$platform" "$config" "$arch"; then
return 1
fi
# Record build start time
local build_start_time
build_start_time=$(date +%s)
# Execute platform-specific build
print_step "Starting build process"
if execute_platform_build "$platform" "$config" "$arch"; then
local build_end_time build_duration
build_end_time=$(date +%s)
build_duration=$((build_end_time - build_start_time))
print_step "Build completed successfully!"
print_success "Build time: ${build_duration}s"
print_info "Outputs in: $BUILD_ROOT"
# List built artifacts
print_info "Built artifacts:"
if [[ -f "$BUILD_ROOT/4ed" ]]; then
print_success " 4ed (main executable)"
fi
if [[ -f "$BUILD_ROOT/4ed_app.so" ]]; then
print_success " 4ed_app.so (core engine)"
fi
if [[ -f "$BUILD_ROOT/custom_4coder.so" ]]; then
print_success " custom_4coder.so (custom layer)"
fi
return 0
else
print_error "Build failed"
return 1
fi
}
# Only run main if script is executed directly (not sourced)
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi

View File

@ -208,10 +208,7 @@ api_get_callable_name(Arena *arena, String_Const_u8 api_name, String_Const_u8 na
////////////////////////////////
function void
generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
for (API_Call *call = api->first_call;
call != 0;
call = call->next){
@ -239,10 +236,7 @@ generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Fla
}
function void
generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
for (API_Call *call = api->first_call;
call != 0;
call = call->next){
@ -270,8 +264,6 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, ")\n");
}
fprintf(out, "\n");
for (API_Call *call = api->first_call;
call != 0;
call = call->next){
@ -297,13 +289,11 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, ");\n");
}
fprintf(out, "\n");
fprintf(out, "struct API_VTable_%.*s{\n", string_expand(api->name));
for (API_Call *call = api->first_call;
call != 0;
call = call->next){
fprintf(out, " %.*s_%.*s_type *",
fprintf(out, "%.*s_%.*s_type *",
string_expand(api->name),
string_expand(call->name));
fprintf(out, "%.*s",
@ -312,8 +302,6 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
}
fprintf(out, "};\n");
fprintf(out, "\n");
fprintf(out, "#if defined(STATIC_LINK_API)\n");
for (API_Call *call = api->first_call;
call != 0;
@ -340,7 +328,6 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, ");\n");
}
fprintf(out, "#undef STATIC_LINK_API\n");
fprintf(out, "\n");
fprintf(out, "#elif defined(DYNAMIC_LINK_API)\n");
for (API_Call *call = api->first_call;
call != 0;
@ -356,10 +343,7 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
}
function void
generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
fprintf(out, "function void\n");
fprintf(out, "%.*s_api_fill_vtable(API_VTable_%.*s *vtable){\n",
string_expand(api->name),
@ -368,12 +352,11 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
call != 0;
call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
fprintf(out, " vtable->%.*s = %.*s;\n",
fprintf(out, "vtable->%.*s = %.*s;\n",
string_expand(call->name),
string_expand(callable_name));
}
fprintf(out, "}\n");
fprintf(out, "\n");
fprintf(out, "#if defined(DYNAMIC_LINK_API)\n");
fprintf(out, "function void\n");
@ -384,7 +367,7 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
call != 0;
call = call->next){
String_Const_u8 callable_name = api_get_callable_name(scratch, api->name, call->name, flags);
fprintf(out, " %.*s = vtable->%.*s;\n",
fprintf(out, "%.*s = vtable->%.*s;\n",
string_expand(callable_name),
string_expand(call->name));
}
@ -394,21 +377,18 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
}
function void
generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out){
fprintf(out, "function API_Definition*\n");
fprintf(out, "%.*s_api_construct(Arena *arena){\n",
string_expand(api->name));
fprintf(out, " API_Definition *result = begin_api(arena, \"%.*s\");\n",
fprintf(out, "API_Definition *result = begin_api(arena, \"%.*s\");\n",
string_expand(api->name));
for (API_Call *call = api->first_call;
call != 0;
call = call->next){
fprintf(out, " {\n");
fprintf(out, " API_Call *call = api_call_with_location(arena, result, "
fprintf(out, "{\n");
fprintf(out, "API_Call *call = api_call_with_location(arena, result, "
"string_u8_litexpr(\"%.*s\"), "
"string_u8_litexpr(\"%.*s\"), "
"string_u8_litexpr(\"\"));\n",
@ -416,29 +396,29 @@ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag fl
string_expand(call->return_type));
if (call->params.count == 0){
fprintf(out, " (void)call;\n");
fprintf(out, "(void)call;\n");
}
else{
for (API_Param *param = call->params.first;
param != 0;
param = param->next){
fprintf(out, " api_param(arena, call, \"%.*s\", \"%.*s\");\n",
fprintf(out, "api_param(arena, call, \"%.*s\", \"%.*s\");\n",
string_expand(param->type_name),
string_expand(param->name));
}
}
fprintf(out, " }\n");
fprintf(out, "}\n");
}
fprintf(out, " return(result);\n");
fprintf(out, "return(result);\n");
fprintf(out, "}\n");
}
////////////////////////////////
function b32
api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generated_Group group, API_Generation_Flag flags, String_Const_u8 generated_by){
api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generated_Group group, API_Generation_Flag flags){
// NOTE(allen): Arrange output files
String_Const_u8 path_to_self = string_u8_litexpr(__FILE__);
@ -514,10 +494,10 @@ api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generate
// NOTE(allen): Generate output
generate_api_master_list(arena, api, flags, out_file_ml, generated_by);
generate_header(arena, api, flags, out_file_h, generated_by);
generate_cpp(arena, api, flags, out_file_cpp, generated_by);
generate_constructor(arena, api, flags, out_file_con, generated_by);
generate_api_master_list(arena, api, flags, out_file_ml);
generate_header(arena, api, flags, out_file_h);
generate_cpp(arena, api, flags, out_file_cpp);
generate_constructor(arena, api, flags, out_file_con);
////////////////////////////////

View File

@ -31,7 +31,7 @@ int
main(void){
Arena arena = make_arena_malloc();
API_Definition *api = define_api(&arena);
if (!api_definition_generate_api_includes(&arena, api, get_api_group(), 0, SCu8(GENERATED_BY))){
if (!api_definition_generate_api_includes(&arena, api, get_api_group(), 0)){
return(1);
}
return(0);

View File

@ -37,21 +37,9 @@ main(int argc, char **argv){
exit(1);
}
String_Const_u8 exe = SCu8("code/4ed_api_parser_main.exe");
u32 command_line_length = exe.size;
for (i32 i = 1; i < argc; i+=1){
command_line_length += 1 + cstring_length(argv[i]);
}
String_u8 command_line = string_u8_push(&arena, command_line_length );
string_append(&command_line, exe);
API_Definition_List list = {};
for (i32 i = 1; i < argc; i += 1){
char *file_name = argv[i];
string_append_character(&command_line, ' ');
string_append(&command_line, SCu8(argv[i]));
FILE *file = fopen(file_name, "rb");
if (file == 0){
printf("error: could not open input file: '%s'\n", argv[i]);
@ -69,7 +57,7 @@ main(int argc, char **argv){
for (API_Definition *node = list.first;
node != 0;
node = node->next){
api_definition_generate_api_includes(&arena, node, GeneratedGroup_Custom, APIGeneration_NoAPINameOnCallables, SCu8(command_line));
api_definition_generate_api_includes(&arena, node, GeneratedGroup_Custom, APIGeneration_NoAPINameOnCallables);
}
}

View File

@ -368,9 +368,6 @@ edit_change_current_history_state(Thread_Context *tctx, Models *models, Editing_
}
file->state.current_record_index = current;
if (file->state.saved_record_index == current){
RemFlag(file->state.dirty, DirtyState_UnsavedChanges);
}
}
}

View File

@ -19,11 +19,13 @@ string_from_file_name(Editing_File_Name *name){
internal void
file_edit_positions_set_cursor(File_Edit_Positions *edit_pos, i64 pos){
edit_pos->cursor_pos = pos;
edit_pos->last_set_type = EditPos_CursorSet;
}
internal void
file_edit_positions_set_scroll(File_Edit_Positions *edit_pos, Buffer_Scroll scroll){
edit_pos->scroll = scroll;
edit_pos->last_set_type = EditPos_ScrollSet;
}
internal void
@ -155,7 +157,6 @@ save_file_to_name(Thread_Context *tctx, Models *models, Editing_File *file, u8 *
File_Attributes new_attributes = system_save_file(scratch, (char*)file_name, saveable_string);
if (new_attributes.last_write_time > 0 &&
using_actual_file_name){
file->state.saved_record_index = file->state.current_record_index;
file->state.save_state = FileSaveState_SavedWaitingForNotification;
file_clear_dirty_flags(file);
}

View File

@ -12,7 +12,14 @@
#if !defined(FRED_FILE_H)
#define FRED_FILE_H
typedef i32 Edit_Pos_Set_Type;
enum{
EditPos_None,
EditPos_CursorSet,
EditPos_ScrollSet
};
struct File_Edit_Positions{
Edit_Pos_Set_Type last_set_type;
Buffer_Scroll scroll;
i64 cursor_pos;
};
@ -47,8 +54,6 @@ struct Editing_File_State{
History history;
i32 current_record_index;
i32 saved_record_index;
Dirty_State dirty;
File_Save_State save_state;

View File

@ -9,8 +9,6 @@
// TOP
#define GENERATED_BY "code/4ed_font_api.cpp"
#include "4ed_api_definition_main.cpp"
function API_Definition*

View File

@ -125,50 +125,27 @@ ft__bad_rect_pack_end_line(Bad_Rect_Pack *pack){
internal Vec3_i32
ft__bad_rect_pack_next(Bad_Rect_Pack *pack, Vec2_i32 dim){
Vec3_i32 result = { };
// NOTE(simon, 28/02/24): Does this character fit in the texture if it's the only character ?
if ( dim.x <= pack->max_dim.x && dim.y <= pack->max_dim.y ){
b8 end_line = false;
if ( pack->p.x + dim.x > pack->max_dim.x ) {
// NOTE(simon, 28/02/24): Can't fit the character horizontally.
end_line = true;
Vec3_i32 result = {};
if (dim.x <= pack->max_dim.x && dim.y <= pack->max_dim.y){
if (pack->current_line_h < dim.y){
pack->current_line_h = dim.y;
}
if ( pack->current_line_h < dim.y && pack->p.y + dim.y > pack->max_dim.y ) {
// NOTE(simon, 28/02/24): Character doesn't fit in the current line height, AND we
// can't grow the line height.
end_line = true;
}
if ( end_line ) {
ft__bad_rect_pack_end_line( pack );
}
if ( pack->p.y + dim.y > pack->max_dim.y ) {
Assert( end_line );
// NOTE(simon, 28/02/24): We ended a line. There isn't enough space on a new line to
// fit the character vertically. We need to go to the next texture in the array.
// In a new texture the character is guaranteed to fit, because of the outer most if.
if (pack->current_line_h > pack->max_dim.y){
ft__bad_rect_pack_end_line(pack);
pack->p.y = 0;
pack->dim.z += 1;
pack->p.z += 1;
// NOTE(simon, 28/02/24): There are no checks on the z axis range, but texture arrays
// have a limit. At the moment it's 2048 on both OpenGL and DirectX.
}
// NOTE(simon, 28/02/24): We are now sure that the character will fit.
pack->current_line_h = Max(pack->current_line_h, dim.y);
else{
if (pack->p.x + dim.x > pack->max_dim.x){
ft__bad_rect_pack_end_line(pack);
}
result = pack->p;
pack->p.x += dim.x;
pack->dim.x = Max( pack->dim.x, pack->p.x );
pack->current_line_h = Max(pack->current_line_h, dim.y);
pack->dim.x = clamp_bot(pack->dim.x, pack->p.x);
}
}
return(result);
}
@ -329,67 +306,59 @@ ft__font_make_face(Arena *arena, Face_Description *description, f32 scale_factor
Texture_Kind texture_kind = TextureKind_Mono;
u32 texture = graphics_get_texture(pack.dim, texture_kind);
face->texture_kind = texture_kind;
face->texture = texture;
/* NOTE simon (06/01/25): This assumes that every platforms don't use 0 as a valid texture id.
This is valid for OpenGL and the DX11 implementaion. Someone needs to check the MAC versions. */
if (texture != 0 ){
Vec3_f32 texture_dim = V3f32(pack.dim);
face->texture_dim = texture_dim;
face->texture_kind = texture_kind;
face->texture = texture;
{
Vec3_i32 p = V3i32((i32)face->white.uv.x0, (i32)face->white.uv.y0, (i32)face->white.w);
Vec3_i32 dim = V3i32(white.dim.x, white.dim.y, 1);
graphics_fill_texture(texture_kind, texture, p, dim, white.data);
face->white.uv.x1 = (face->white.uv.x0 + face->white.uv.x1)/texture_dim.x;
face->white.uv.y1 = (face->white.uv.y0 + face->white.uv.y1)/texture_dim.y;
face->white.uv.x0 = face->white.uv.x0/texture_dim.x;
face->white.uv.y0 = face->white.uv.y0/texture_dim.y;
face->white.w /= texture_dim.z;
}
Vec3_f32 texture_dim = V3f32(pack.dim);
face->texture_dim = texture_dim;
for (u16 i = 0; i < index_count; i += 1){
Vec3_i32 p = V3i32((i32)face->bounds[i].uv.x0, (i32)face->bounds[i].uv.y0, (i32)face->bounds[i].w);
Vec3_i32 dim = V3i32(glyph_bitmaps[i].dim.x, glyph_bitmaps[i].dim.y, 1);
graphics_fill_texture(texture_kind, texture, p, dim, glyph_bitmaps[i].data);
face->bounds[i].uv.x1 = (face->bounds[i].uv.x0 + face->bounds[i].uv.x1)/texture_dim.x;
face->bounds[i].uv.y1 = (face->bounds[i].uv.y0 + face->bounds[i].uv.y1)/texture_dim.y;
face->bounds[i].uv.x0 = face->bounds[i].uv.x0/texture_dim.x;
face->bounds[i].uv.y0 = face->bounds[i].uv.y0/texture_dim.y;
face->bounds[i].w /= texture_dim.z;
}
{
Vec3_i32 p = V3i32((i32)face->white.uv.x0, (i32)face->white.uv.y0, (i32)face->white.w);
Vec3_i32 dim = V3i32(white.dim.x, white.dim.y, 1);
graphics_fill_texture(texture_kind, texture, p, dim, white.data);
face->white.uv.x1 = (face->white.uv.x0 + face->white.uv.x1)/texture_dim.x;
face->white.uv.y1 = (face->white.uv.y0 + face->white.uv.y1)/texture_dim.y;
face->white.uv.x0 = face->white.uv.x0/texture_dim.x;
face->white.uv.y0 = face->white.uv.y0/texture_dim.y;
}
{
Face_Advance_Map *advance_map = &face->advance_map;
for (u16 i = 0; i < index_count; i += 1){
Vec3_i32 p = V3i32((i32)face->bounds[i].uv.x0, (i32)face->bounds[i].uv.y0, (i32)face->bounds[i].w);
Vec3_i32 dim = V3i32(glyph_bitmaps[i].dim.x, glyph_bitmaps[i].dim.y, 1);
graphics_fill_texture(texture_kind, texture, p, dim, glyph_bitmaps[i].data);
face->bounds[i].uv.x1 = (face->bounds[i].uv.x0 + face->bounds[i].uv.x1)/texture_dim.x;
face->bounds[i].uv.y1 = (face->bounds[i].uv.y0 + face->bounds[i].uv.y1)/texture_dim.y;
face->bounds[i].uv.x0 = face->bounds[i].uv.x0/texture_dim.x;
face->bounds[i].uv.y0 = face->bounds[i].uv.y0/texture_dim.y;
}
{
Face_Advance_Map *advance_map = &face->advance_map;
met->space_advance = font_get_glyph_advance(advance_map, met, ' ', 0);
met->decimal_digit_advance =
font_get_max_glyph_advance_range(advance_map, met, '0', '9', 0);
met->hex_digit_advance =
font_get_max_glyph_advance_range(advance_map, met, 'A', 'F', 0);
met->hex_digit_advance =
Max(met->hex_digit_advance, met->decimal_digit_advance);
met->byte_sub_advances[0] =
font_get_glyph_advance(advance_map, met, '\\', 0);
met->byte_sub_advances[1] = met->hex_digit_advance;
met->byte_sub_advances[2] = met->hex_digit_advance;
met->byte_advance =
met->byte_sub_advances[0] +
met->byte_sub_advances[1] +
met->byte_sub_advances[2];
met->normal_lowercase_advance =
font_get_average_glyph_advance_range(advance_map, met, 'a', 'z', 0);
met->normal_uppercase_advance =
font_get_average_glyph_advance_range(advance_map, met, 'A', 'Z', 0);
met->normal_advance = (26*met->normal_lowercase_advance +
26*met->normal_uppercase_advance +
10*met->decimal_digit_advance)/62.f;
}
} else {
pop_array(arena, Face, 1);
face = 0;
met->space_advance = font_get_glyph_advance(advance_map, met, ' ', 0);
met->decimal_digit_advance =
font_get_max_glyph_advance_range(advance_map, met, '0', '9', 0);
met->hex_digit_advance =
font_get_max_glyph_advance_range(advance_map, met, 'A', 'F', 0);
met->hex_digit_advance =
Max(met->hex_digit_advance, met->decimal_digit_advance);
met->byte_sub_advances[0] =
font_get_glyph_advance(advance_map, met, '\\', 0);
met->byte_sub_advances[1] = met->hex_digit_advance;
met->byte_sub_advances[2] = met->hex_digit_advance;
met->byte_advance =
met->byte_sub_advances[0] +
met->byte_sub_advances[1] +
met->byte_sub_advances[2];
met->normal_lowercase_advance =
font_get_average_glyph_advance_range(advance_map, met, 'a', 'z', 0);
met->normal_uppercase_advance =
font_get_average_glyph_advance_range(advance_map, met, 'A', 'Z', 0);
met->normal_advance = (26*met->normal_lowercase_advance +
26*met->normal_uppercase_advance +
10*met->decimal_digit_advance)/62.f;
}
}
@ -399,3 +368,4 @@ ft__font_make_face(Arena *arena, Face_Description *description, f32 scale_factor
}
// BOTTOM

View File

@ -153,9 +153,6 @@ font_set_modify_face(Font_Set *set, Face_ID id, Face_Description *description){
Arena arena = make_arena_system();
Face *face = font_make_face(&arena, description, set->scale_factor);
if (face != 0){
if (slot->face->texture != 0){
graphics_free_texture(slot->face->texture);
}
linalloc_clear(&slot->arena);
slot->arena = arena;
slot->face = face;

View File

@ -45,20 +45,20 @@ generate_codes(Arena *scratch, Event_Code_List *list, FILE *out){
for (Event_Code *code = list->first;
code != 0;
code = code->next){
fprintf(out, " %.*s_%.*s = %d,\n",
fprintf(out, "%.*s_%.*s = %d,\n",
string_expand(code_prefix), string_expand(code->name), counter);
counter += 1;
}
fprintf(out, " %.*s_COUNT = %d,\n", string_expand(code_prefix), counter);
fprintf(out, "%.*s_COUNT = %d,\n", string_expand(code_prefix), counter);
fprintf(out, "};\n");
fprintf(out, "global char* %.*s[%.*s_COUNT] = {\n",
string_expand(name_table), string_expand(code_prefix));
fprintf(out, " \"None\",\n");
fprintf(out, "\"None\",\n");
for (Event_Code *code = list->first;
code != 0;
code = code->next){
fprintf(out, " \"%.*s\",\n", string_expand(code->name));
fprintf(out, "\"%.*s\",\n", string_expand(code->name));
counter += 1;
}
fprintf(out, "};\n");
@ -188,9 +188,6 @@ main(void){
exit(1);
}
fprintf(out, "/* Generated by: " __FILE__ );
fprintf(out, " */\n" );
generate_codes(&arena, &key_list, out);
generate_codes(&arena, &mouse_list, out);
generate_codes(&arena, &core_list, out);

View File

@ -9,8 +9,6 @@
// TOP
#define GENERATED_BY "code/4ed_graphics_api.cpp"
#include "4ed_api_definition_main.cpp"
function API_Definition*
@ -32,11 +30,6 @@ define_api(Arena *arena){
api_param(arena, call, "void*", "data");
}
{
API_Call *call = api_call(arena, api, "free_texture", "void");
api_param(arena, call, "u32", "texid");
}
return(api);
}

View File

@ -132,32 +132,27 @@ end_render_section(Render_Target *target){
internal void
draw_rectangle_outline(Render_Target *target, Rect_f32 rect, f32 roundness, f32 thickness, u32 color){
if ( rect_overlap(rect, target->current_clip_box) ) {
if (roundness < epsilon_f32){
roundness = 0.f;
}
thickness = clamp_bot(1.f, thickness);
f32 half_thickness = thickness*0.5f;
Render_Vertex vertices[6] = {};
vertices[0].xy = V2f32(rect.x0, rect.y0);
vertices[1].xy = V2f32(rect.x1, rect.y0);
vertices[2].xy = V2f32(rect.x0, rect.y1);
vertices[3].xy = V2f32(rect.x1, rect.y0);
vertices[4].xy = V2f32(rect.x0, rect.y1);
vertices[5].xy = V2f32(rect.x1, rect.y1);
Vec2_f32 center = rect_center(rect);
for (i32 i = 0; i < ArrayCount(vertices); i += 1){
vertices[i].uvw = V3f32(center.x, center.y, roundness);
vertices[i].color = color;
vertices[i].half_thickness = half_thickness;
}
draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices));
if (roundness < epsilon_f32){
roundness = 0.f;
}
thickness = clamp_bot(1.f, thickness);
f32 half_thickness = thickness*0.5f;
Render_Vertex vertices[6] = {};
vertices[0].xy = V2f32(rect.x0, rect.y0);
vertices[1].xy = V2f32(rect.x1, rect.y0);
vertices[2].xy = V2f32(rect.x0, rect.y1);
vertices[3].xy = V2f32(rect.x1, rect.y0);
vertices[4].xy = V2f32(rect.x0, rect.y1);
vertices[5].xy = V2f32(rect.x1, rect.y1);
Vec2_f32 center = rect_center(rect);
for (i32 i = 0; i < ArrayCount(vertices); i += 1){
vertices[i].uvw = V3f32(center.x, center.y, roundness);
vertices[i].color = color;
vertices[i].half_thickness = half_thickness;
}
draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices));
}
internal void
@ -199,62 +194,53 @@ draw_font_glyph(Render_Target *target, Face *face, u32 codepoint, Vec2_f32 p,
vertices[2].xy = p_x_min + y_max;
vertices[5].xy = p_x_max + y_max;
/* NOTE simon (26/09/24): We don't use rect_overlap here because the text rect is not guaranteed to be axis aligned. */
b32 draw = rect_contains_point( target->current_clip_box, vertices[ 0 ].xy );
draw = draw || rect_contains_point( target->current_clip_box, vertices[ 1 ].xy );
draw = draw || rect_contains_point( target->current_clip_box, vertices[ 2 ].xy );
draw = draw || rect_contains_point( target->current_clip_box, vertices[ 5 ].xy );
if ( draw ) {
#if 0
Vec2_f32 xy_min = p + bounds.xy_off.x0*x_axis + bounds.xy_off.y0*y_axis;
Vec2_f32 xy_max = p + bounds.xy_off.x1*x_axis + bounds.xy_off.y1*y_axis;
Vec2_f32 xy_min = p + bounds.xy_off.x0*x_axis + bounds.xy_off.y0*y_axis;
Vec2_f32 xy_max = p + bounds.xy_off.x1*x_axis + bounds.xy_off.y1*y_axis;
vertices[0].xy = V2f32(xy_min.x, xy_min.y);
vertices[1].xy = V2f32(xy_max.x, xy_min.y);
vertices[2].xy = V2f32(xy_min.x, xy_max.y);
vertices[5].xy = V2f32(xy_max.x, xy_max.y);
vertices[0].xy = V2f32(xy_min.x, xy_min.y);
vertices[1].xy = V2f32(xy_max.x, xy_min.y);
vertices[2].xy = V2f32(xy_min.x, xy_max.y);
vertices[5].xy = V2f32(xy_max.x, xy_max.y);
#endif
#if 0
if (!HasFlag(flags, GlyphFlag_Rotate90)){
Rect_f32 xy = Rf32(p + bounds.xy_off.p0, p + bounds.xy_off.p1);
if (!HasFlag(flags, GlyphFlag_Rotate90)){
Rect_f32 xy = Rf32(p + bounds.xy_off.p0, p + bounds.xy_off.p1);
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y0, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x1, uv.y0, bounds.w);
}
else{
Rect_f32 xy = Rf32(p.x - bounds.xy_off.y1, p.y + bounds.xy_off.x0,
p.x - bounds.xy_off.y0, p.y + bounds.xy_off.x1);
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y0, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x0, uv.y0, bounds.w);
}
#endif
vertices[3] = vertices[1];
vertices[4] = vertices[2];
for (i32 i = 0; i < ArrayCount(vertices); i += 1){
vertices[i].color = color;
vertices[i].half_thickness = 0.f;
}
draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices));
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y0, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x1, uv.y0, bounds.w);
}
else{
Rect_f32 xy = Rf32(p.x - bounds.xy_off.y1, p.y + bounds.xy_off.x0,
p.x - bounds.xy_off.y0, p.y + bounds.xy_off.x1);
vertices[0].xy = V2f32(xy.x0, xy.y1);
vertices[0].uvw = V3f32(uv.x1, uv.y1, bounds.w);
vertices[1].xy = V2f32(xy.x1, xy.y1);
vertices[1].uvw = V3f32(uv.x1, uv.y0, bounds.w);
vertices[2].xy = V2f32(xy.x0, xy.y0);
vertices[2].uvw = V3f32(uv.x0, uv.y1, bounds.w);
vertices[5].xy = V2f32(xy.x1, xy.y0);
vertices[5].uvw = V3f32(uv.x0, uv.y0, bounds.w);
}
#endif
vertices[3] = vertices[1];
vertices[4] = vertices[2];
for (i32 i = 0; i < ArrayCount(vertices); i += 1){
vertices[i].color = color;
vertices[i].half_thickness = 0.f;
}
draw__write_vertices_in_current_group(target, vertices, ArrayCount(vertices));
}
////////////////////////////////

View File

@ -9,8 +9,6 @@
// TOP
#define GENERATED_BY "code/4ed_system_api.cpp"
#include "4ed_api_definition_main.cpp"
function API_Definition*

View File

@ -450,6 +450,7 @@ view_set_cursor_and_scroll(Thread_Context *tctx, Models *models, View *view, i64
Vec2_f32 p = view_relative_xy_of_pos(tctx, models, view, cursor.line, pos);
view->preferred_x = p.x;
file_edit_positions_set_scroll(&edit_pos, scroll);
edit_pos.last_set_type = EditPos_None;
view_set_edit_pos(view, edit_pos);
}

View File

@ -395,7 +395,7 @@ buffer_bind_name(Thread_Context *tctx, Models *models, Arena *scratch, Working_S
node != used_nodes;
node = node->next){
Editing_File *file_ptr = CastFromMember(Editing_File, main_chain_node, node);
if (file_ptr != 0 && string_match(base_name, string_from_file_name(&file_ptr->unique_name))){
if (file_ptr != 0 && string_match(base_name, string_from_file_name(&file_ptr->base_name))){
Node_Ptr *new_node = push_array(scratch, Node_Ptr, 1);
sll_queue_push(conflict_first, conflict_last, new_node);
new_node->file_ptr = file_ptr;

View File

@ -185,7 +185,7 @@ get_defines_from_flags(Arena *arena, u32 flags){
"-wd4611 -wd4189 -WX -GR- -EHa- -nologo -FC"
#define CL_LIBS_COMMON \
"user32.lib winmm.lib gdi32.lib comdlg32.lib userenv.lib "
"user32.lib winmm.lib gdi32.lib opengl32.lib comdlg32.lib userenv.lib "
#define CL_LIBS_X64 CL_LIBS_COMMON FOREIGN_WIN "\\x64\\freetype.lib"
#define CL_LIBS_X86 CL_LIBS_COMMON FOREIGN_WIN "\\x86\\freetype.lib"

View File

@ -1,31 +0,0 @@
#!/bin/bash
# If any command errors, stop the script
set -e
# Set up directories
# NOTE(yuval): Replaced readlink with realpath which works for both macOS and Linux
ME="$(realpath "$0")"
LOCATION="$(dirname "$ME")"
SRC_ROOT="$(dirname "$LOCATION")"
PROJECT_ROOT="$(dirname "$SRC_ROOT")"
if [ ! -d "$PROJECT_ROOT/build" ]; then
mkdir "$PROJECT_ROOT/build"
fi
BUILD_ROOT="$PROJECT_ROOT/build"
BIN_ROOT="$SRC_ROOT/bin"
CUSTOM_ROOT="$SRC_ROOT/custom"
CUSTOM_BIN="$CUSTOM_ROOT/bin"
BUILD_MODE="-DOPT_BUILD"
WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch"
FLAGS="-D_GNU_SOURCE -fPIC -fpermissive $BUILD_MODE"
INCLUDES="-I$SRC_ROOT -I$CUSTOM_ROOT"
# Execute
clang++ $WARNINGS $FLAGS $INCLUDES "$BIN_ROOT/4ed_build.cpp" -g -o "$BUILD_ROOT/build"
pushd "$SRC_ROOT"
"$BUILD_ROOT/build"
popd

View File

@ -17,7 +17,11 @@ BIN_ROOT="$SRC_ROOT/bin"
CUSTOM_ROOT="$SRC_ROOT/custom"
CUSTOM_BIN="$CUSTOM_ROOT/bin"
BUILD_MODE="-DDEV_BUILD"
# Get the build mode
BUILD_MODE="$1"
if [ -z "$BUILD_MODE" ]; then
BUILD_MODE="-DDEV_BUILD"
fi
WARNINGS="-Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch"

View File

@ -1,11 +1,10 @@
@echo off
set location=%cd%
set me=%~dp0
set me="%~dp0"
:: REM 4cc\code\bin
REM 4cc\code\bin
cd %me%
REM ..\code\bin
REM 4cc
cd ..\..
@ -35,7 +34,6 @@ if %ERRORLEVEL% neq 0 (set FirstError=1)
if %ERRORLEVEL% neq 0 (goto END)
popd
cd %me%\..
%build_root%\build
:END
if %ERRORLEVEL% neq 0 (set FirstError=1)

View File

@ -1,6 +1,4 @@
#!/bin/bash
pushd $(dirname "${BASH_SOURCE[0]}")/.. > /dev/null > /dev/null
chmod +x bin/build-mac-dev.sh
bin/build-mac-dev.sh "-DPACKAGE_SUPER_X64"
popd > /dev/null
chmod +x bin/build-mac.sh
bin/build-mac.sh "-DPACKAGE_SUPER_X64"

View File

@ -1,4 +1,3 @@
@echo off
SET mypath=%~dp0
call %mypath:~0,-1%\build.bat /DPACKAGE_SUPER_X64
call bin\build.bat /DPACKAGE_SUPER_X64

View File

@ -0,0 +1,276 @@
////////////////////////////////
// NOTE(allen): Default Mixer Helpers
// TODO(allen): intrinsics wrappers
#if OS_LINUX
#include <immintrin.h>
#define _InterlockedExchangeAdd __sync_fetch_and_add
#elif OS_MAC
#include <immintrin.h>
#define _InterlockedExchangeAdd __sync_fetch_and_add
#else
#include <intrin.h>
#endif
function u32
AtomicAddU32AndReturnOriginal(u32 volatile *Value, u32 Addend)
{
// NOTE(casey): Returns the original value _prior_ to adding
u32 Result = _InterlockedExchangeAdd((long volatile*)Value, (long)Addend);
return(Result);
}
function void
def_audio_begin_ticket_mutex(Audio_System *Crunky)
{
u32 Ticket = AtomicAddU32AndReturnOriginal(&Crunky->ticket, 1);
while(Ticket != Crunky->serving) {_mm_pause();}
}
function void
def_audio_end_ticket_mutex(Audio_System *Crunky)
{
AtomicAddU32AndReturnOriginal(&Crunky->serving, 1);
}
////////////////////////////////
// NOTE(allen): Default Mixer
global Audio_System def_audio_system = {};
function void
def_audio_init(void){
block_zero_struct(&def_audio_system);
system_set_source_mixer(&def_audio_system, def_audio_mix_sources);
system_set_destination_mixer(def_audio_mix_destination);
}
function void
def_audio_play_clip(Audio_Clip clip, Audio_Control *control){
clip.control = control;
Audio_System *Crunky = &def_audio_system;
def_audio_begin_ticket_mutex(Crunky);
if (Crunky->pending_clip_count < ArrayCount(Crunky->pending_clips))
{
Crunky->pending_clips[Crunky->pending_clip_count++] = clip;
}
def_audio_end_ticket_mutex(Crunky);
}
internal b32
def_audio_is_playing(Audio_Control *control){
Audio_System *Crunky = &def_audio_system;
b32 result = (Crunky->generation - control->generation < 2);
return(result);
}
internal void
def_audio_stop(Audio_Control *control){
Audio_System *Crunky = &def_audio_system;
def_audio_begin_ticket_mutex(Crunky);
Audio_Clip *clip = Crunky->playing_clips;
for(u32 i = 0;
i < ArrayCount(Crunky->playing_clips);
i += 1, clip += 1){
if (clip->control == control){
clip->at_sample_index = clip->sample_count;
clip->control = 0;
}
}
control->loop = false;
def_audio_end_ticket_mutex(Crunky);
}
function void
def_audio_mix_sources(void *ctx, f32 *mix_buffer, u32 sample_count){
Audio_System *Crunky = (Audio_System*)ctx;
def_audio_begin_ticket_mutex(Crunky);
// NOTE(casey): Move pending sounds into the playing list
{
Crunky->generation += 1;
u32 PendIndex = 0;
Audio_Clip *clip = Crunky->playing_clips;
for(u32 DestIndex = 0;
(DestIndex < ArrayCount(Crunky->playing_clips)) && (PendIndex < Crunky->pending_clip_count);
DestIndex += 1, clip += 1)
{
if (clip->at_sample_index == clip->sample_count)
{
Audio_Control *control = clip->control;
if (control == 0 || !control->loop){
*clip = Crunky->pending_clips[PendIndex++];
}
}
}
Crunky->pending_clip_count = 0;
}
def_audio_end_ticket_mutex(Crunky);
// NOTE(casey): Mix all sounds into the output buffer
{
Audio_Clip *clip = Crunky->playing_clips;
for(u32 SoundIndex = 0;
SoundIndex < ArrayCount(Crunky->playing_clips);
SoundIndex += 1, clip += 1)
{
// NOTE(allen): Determine starting point
Audio_Control *control = clip->control;
if (control != 0 && control->loop && clip->at_sample_index == clip->sample_count){
clip->at_sample_index = 0;
}
u32 base_sample_index = clip->at_sample_index;
// NOTE(casey): Determine how many samples are left to play in this
// sound (possible none)
u32 SamplesToMix = clamp_top((clip->sample_count - clip->at_sample_index), sample_count);
clip->at_sample_index += SamplesToMix;
// NOTE(casey): Load the volume out of the control if there is one,
// and if there is, update the generation and sample index so
// external controllers can take action
f32 LeftVol = clip->channel_volume[0];
f32 RightVol = clip->channel_volume[1];
if(SamplesToMix && control != 0)
{
LeftVol *= control->channel_volume[0];
RightVol *= control->channel_volume[1];
control->generation = Crunky->generation;
control->last_played_sample_index = clip->at_sample_index;
}
// NOTE(casey): Mix samples
for(u32 SampleIndex = 0;
SampleIndex < SamplesToMix;
++SampleIndex)
{
u32 src_index = 2*(base_sample_index + SampleIndex);
f32 Left = LeftVol *(f32)clip->samples[src_index + 0];
f32 Right = RightVol*(f32)clip->samples[src_index + 1];
u32 dst_index = 2*SampleIndex;
mix_buffer[dst_index + 0] += Left;
mix_buffer[dst_index + 1] += Right;
}
}
}
}
function void
def_audio_mix_destination(i16 *dst, f32 *src, u32 sample_count){
u32 opl = sample_count*2;
for(u32 i = 0; i < opl; i += 1){
f32 sample = src[i];
f32 sat_sample = clamp(-32768.f, sample, 32767.f);
dst[i] = (i16)sat_sample;
}
}
////////////////////////////////
// NOTE(allen): Loading Clip
#if !defined(FCODER_SKIP_WAV)
#define FCODER_SKIP_WAV
#pragma pack(push, 1)
struct wave_fmt_data
{
u16 wFormatTag;
u16 wChannels;
u32 dwSamplesPerSec;
u32 dwAvgBytesPerSec;
u16 wBlockAlign;
u16 wBitsPerSample;
};
struct riff_header
{
u32 ID;
u32 DataSize;
};
#pragma pack(pop)
#endif
function Audio_Clip
audio_clip_from_wav_data(String_Const_u8 data){
Audio_Clip Result = {};
if (data.size >= 4 && *(u32 *)data.str == *(u32 *)"RIFF"){
// NOTE(casey): This ROM is in WAV format
riff_header *RootHeader = (riff_header *)data.str;
wave_fmt_data *Format = 0;
u32 SampleDataSize = 0;
i16 *Samples = 0;
u32 At = sizeof(riff_header);
u32 LastAt = At + ((RootHeader->DataSize + 1) & ~1);
if ((*(u32 *)(data.str + At) == *(u32 *)"WAVE") &&
(LastAt <= data.size)){
At += sizeof(u32);
while (At < LastAt){
riff_header *Header = (riff_header *)(data.str + At);
u32 DataAt = At + sizeof(riff_header);
u32 EndAt = DataAt + ((Header->DataSize + 1) & ~1);
if(EndAt <= data.size)
{
void *Data = (data.str + DataAt);
if(Header->ID == *(u32 *)"fmt ")
{
Format = (wave_fmt_data *)Data;
}
else if(Header->ID == *(u32 *)"data")
{
SampleDataSize = Header->DataSize;
Samples = (i16 *)Data;
}
}
At = EndAt;
}
}
if (Format &&
Samples &&
(Format->wFormatTag == 1) &&
(Format->wChannels == 2) &&
(Format->wBitsPerSample == 16) &&
(Format->dwSamplesPerSec == 48000)){
for (u32 i = 0; i < 2; i += 1){
Result.channel_volume[i] = 1.f;
}
Result.sample_count = SampleDataSize / (Format->wChannels*Format->wBitsPerSample/8);
Result.samples = (i16 *)Samples;
}
else{
// TODO(casey): This is where you would output an error - to 4coder somehow?
}
}
else{
// TODO(casey): This is where you would output an error - to 4coder somehow?
}
return(Result);
}
function Audio_Clip
audio_clip_from_wav_FILE(Arena *arena, FILE *file){
String_Const_u8 data = data_from_file(arena, file);
Audio_Clip result = audio_clip_from_wav_data(data);
return(result);
}
function Audio_Clip
audio_clip_from_wav_file_name(Arena *arena, char *file_name){
Audio_Clip result = {};
String_Const_u8 data = {};
FILE *file = fopen(file_name, "rb");
if (file != 0){
result = audio_clip_from_wav_FILE(arena, file);
fclose(file);
}
return(result);
}

View File

@ -0,0 +1,56 @@
/* date = November 23rd 2020 1:18 pm */
#ifndef FCODER_AUDIO_H
#define FCODER_AUDIO_H
////////////////////////////////
// NOTE(allen): Default Mixer Types
struct Audio_Control{
volatile f32 channel_volume[2];
volatile u32 generation;
volatile u32 last_played_sample_index;
volatile b32 loop;
};
struct Audio_Clip{
i16 *samples;
Audio_Control *control;
f32 channel_volume[2];
u32 sample_count;
u32 at_sample_index;
};
struct Audio_System{
volatile u32 quit;
volatile u32 ticket;
volatile u32 serving;
volatile u32 generation;
Audio_Clip playing_clips[64];
// NOTE(casey): Requests to play sounds are written to a pending array to avoid long locking
volatile u32 pending_clip_count;
Audio_Clip pending_clips[64];
};
////////////////////////////////
// NOTE(allen): Default Mixer
function void def_audio_init(void);
function void def_audio_play_clip(Audio_Clip clip, Audio_Control *control);
function b32 def_audio_is_playing(Audio_Control *control);
function void def_audio_stop(Audio_Control *control);
function void def_audio_mix_sources(void *ctx, f32 *mix_buffer, u32 sample_count);
function void def_audio_mix_destination(i16 *dst, f32 *src, u32 sample_count);
////////////////////////////////
// NOTE(allen): Loading Clip
function Audio_Clip audio_clip_from_wav_data(String_Const_u8 data);
function Audio_Clip audio_clip_from_wav_FILE(Arena *arena, FILE *file);
function Audio_Clip audio_clip_from_wav_file_name(Arena *arena, char *file_name);
#endif //4CODER_AUDIO_H

View File

@ -437,84 +437,14 @@ CUSTOM_DOC("Auto-indents the range between the cursor and the mark.")
move_past_lead_whitespace(app, view, buffer);
}
function i64
get_line_indent_level(Application_Links *app, View_ID view, Buffer_ID buffer, i64 line)
{
Scratch_Block scratch(app);
String_Const_u8 line_string = push_buffer_line(app, scratch, buffer, line);
i64 line_start_pos = get_line_start_pos(app, buffer, line);
Range_i64 line_indent_range = Ii64(0, 0);
i64 tabs_at_beginning = 0;
i64 spaces_at_beginning = 0;
for(u64 i = 0; i < line_string.size; i += 1)
{
if(line_string.str[i] == '\t')
{
tabs_at_beginning += 1;
}
else if(character_is_whitespace(line_string.str[i]))
{
spaces_at_beginning += 1;
}
else if(!character_is_whitespace(line_string.str[i]))
{
line_indent_range.max = (i64)i;
break;
}
}
// NOTE(PS): This is in the event that we are unindenting a line that
// is JUST tabs or spaces - rather than unindenting nothing
// and then reindenting the proper amount, this should cause
// the removal of all leading tabs and spaces on an otherwise
// empty line
bool place_cursor_at_end = false;
if (line_indent_range.max == 0 && line_string.size > 0)
{
line_indent_range.max = line_string.size;
place_cursor_at_end = true;
}
Range_i64 indent_range =
{
line_indent_range.min + line_start_pos,
line_indent_range.max + line_start_pos,
};
i64 indent_width = (i64)def_get_config_u64(app, vars_save_string_lit("indent_width"));
i64 spaces_per_indent_level = indent_width;
i64 indent_level = spaces_at_beginning / spaces_per_indent_level + tabs_at_beginning;
return indent_level;
}
function String_Const_u8
get_indent_string(Application_Links* app, Arena* scratch)
{
i64 indent_width = (i64)def_get_config_u64(app, vars_save_string_lit("indent_width"));
b32 indent_with_tabs = def_get_config_b32(vars_save_string_lit("indent_with_tabs"));
String_Const_u8 result;
if (indent_with_tabs) {
result = string_u8_litexpr("\t");
} else {
result = push_stringf(scratch, "%.*s", Min(indent_width, 16), " ");
}
return result;
}
CUSTOM_COMMAND_SIG(write_text_and_auto_indent)
CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.")
{
ProfileScope(app, "write and auto indent");
Scratch_Block scratch(app);
User_Input in = get_current_input(app);
String_Const_u8 insert = to_writable(&in);
if (insert.str != 0 && insert.size > 0){
b32 do_auto_indent = false;
b32 only_indent_next_line = true;
b32 is_newline = false;
for (u64 i = 0; !do_auto_indent && i < insert.size; i += 1){
switch (insert.str[i]){
case ';': case ':':
@ -522,30 +452,16 @@ CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if a
case '(': case ')':
case '[': case ']':
case '#':
{
do_auto_indent = true;
}break;
case '\n': case '\t':
{
do_auto_indent = true;
is_newline = true;
}break;
}
}
View_ID view = get_active_view(app, Access_ReadWriteVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
String_Const_u8 file_name = push_buffer_file_name(app, scratch, buffer);
String_Const_u8 ext = string_file_extension(file_name);
if (string_match(ext, string_u8_litexpr("js")) ||
string_match(ext, string_u8_litexpr("css")))
{
only_indent_next_line = do_auto_indent;
}
if (do_auto_indent){
History_Group group = history_group_begin(app, buffer);
View_ID view = get_active_view(app, Access_ReadWriteVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
Range_i64 pos = {};
if (view_has_highlighted_range(app, view)){
pos = get_view_range(app, view);
@ -557,29 +473,11 @@ CUSTOM_DOC("Inserts text and auto-indents the line on which the cursor sits if a
write_text_input(app);
i64 end_pos = view_get_cursor_pos(app, view);
if (!only_indent_next_line) {
pos.min = Min(pos.min, end_pos);
pos.max = Max(pos.max, end_pos);
auto_indent_buffer(app, buffer, pos, 0);
move_past_lead_whitespace(app, view, buffer);
} else if (only_indent_next_line && is_newline) {
String_Const_u8 indent_string = get_indent_string(app, scratch);
pos.min = Min(pos.min, end_pos);
pos.max = Max(pos.max, end_pos);
// getting the indent from the PREVIOUS line, not the line
// the cursor is about to be on - since that line is new,
// and therefore, empty
i64 line = get_line_number_from_pos(app, buffer, pos.min);
i64 indent_level = get_line_indent_level(app, view, buffer, line);
pos.min = pos.max = end_pos;
for(i64 i = 0; i < indent_level; i += 1)
{
buffer_replace_range(app, buffer, Ii64(pos.max), indent_string);
}
move_past_lead_whitespace(app, view, buffer);
}
history_group_end(group);
auto_indent_buffer(app, buffer, pos, 0);
move_past_lead_whitespace(app, view, buffer);
}
else{
write_text_input(app);

View File

@ -159,139 +159,6 @@ CUSTOM_DOC("Delete characters between the cursor position and the first alphanum
push_boundary_list(scratch, boundary_alpha_numeric_unicode));
}
function i64
get_boundary_token_or_whitespace(Application_Links *app, Buffer_ID buffer,
Side side, Scan_Direction direction, i64 pos)
{
// NOTE(PS): originally this was F4_Boundary_TokenAndWhitespace
i64 result = boundary_non_whitespace(app, buffer, side, direction, pos);
Token_Array tokens = get_token_array_from_buffer(app, buffer);
if (tokens.tokens != 0){
switch (direction){
case Scan_Forward:
{
i64 buffer_size = buffer_get_size(app, buffer);
result = buffer_size;
if(tokens.count > 0)
{
Token_Iterator_Array it = token_iterator_pos(0, &tokens, pos);
Token *token = token_it_read(&it);
if(token == 0)
{
break;
}
// NOTE(rjf): Comments/Strings
if(token->kind == TokenBaseKind_Comment ||
token->kind == TokenBaseKind_LiteralString)
{
result = boundary_non_whitespace(app, buffer, side, direction, pos);
break;
}
// NOTE(rjf): All other cases.
else
{
if (token->kind == TokenBaseKind_Whitespace)
{
// token_it_inc_non_whitespace(&it);
// token = token_it_read(&it);
}
if (side == Side_Max){
result = token->pos + token->size;
token_it_inc_all(&it);
Token *ws = token_it_read(&it);
if(ws != 0 && ws->kind == TokenBaseKind_Whitespace &&
get_line_number_from_pos(app, buffer, ws->pos + ws->size) ==
get_line_number_from_pos(app, buffer, token->pos))
{
result = ws->pos + ws->size;
}
}
else{
if (token->pos <= pos){
token_it_inc_non_whitespace(&it);
token = token_it_read(&it);
}
if (token != 0){
result = token->pos;
}
}
}
}
}break;
case Scan_Backward:
{
result = 0;
if (tokens.count > 0){
Token_Iterator_Array it = token_iterator_pos(0, &tokens, pos);
Token *token = token_it_read(&it);
Token_Iterator_Array it2 = it;
token_it_dec_non_whitespace(&it2);
Token *token2 = token_it_read(&it2);
// NOTE(rjf): Comments/Strings
if(token->kind == TokenBaseKind_Comment ||
token->kind == TokenBaseKind_LiteralString ||
(token2 &&
token2->kind == TokenBaseKind_Comment ||
token2->kind == TokenBaseKind_LiteralString))
{
result = boundary_non_whitespace(app, buffer, side, direction, pos);
break;
}
if (token->kind == TokenBaseKind_Whitespace){
token_it_dec_non_whitespace(&it);
token = token_it_read(&it);
}
if (token != 0){
if (side == Side_Min){
if (token->pos >= pos){
token_it_dec_non_whitespace(&it);
token = token_it_read(&it);
}
result = token->pos;
}
else{
if (token->pos + token->size >= pos){
token_it_dec_non_whitespace(&it);
token = token_it_read(&it);
}
result = token->pos + token->size;
}
}
}
}break;
}
}
return(result);
}
CUSTOM_COMMAND_SIG(backspace_alpha_numeric_or_camel_boundary)
CUSTOM_DOC("Deletes left to a alphanumeric or camel boundary.")
{
Scratch_Block scratch(app);
current_view_boundary_delete(app, Scan_Backward, push_boundary_list(scratch,
boundary_line,
boundary_alpha_numeric,
boundary_alpha_numeric_camel));
}
CUSTOM_COMMAND_SIG(backspace_token_boundary)
CUSTOM_DOC("Deletes left to a token boundary.")
{
Scratch_Block scratch(app);
Boundary_Function_List boundary_list = push_boundary_list(scratch, get_boundary_token_or_whitespace);
current_view_boundary_delete(app, Scan_Backward, boundary_list);
}
CUSTOM_COMMAND_SIG(delete_alpha_numeric_boundary)
CUSTOM_DOC("Delete characters between the cursor position and the first alphanumeric boundary to the right.")
{
@ -1706,31 +1573,6 @@ CUSTOM_DOC("Delete the line the on which the cursor sits.")
buffer_replace_range(app, buffer, range, string_u8_litexpr(""));
}
CUSTOM_COMMAND_SIG(delete_to_end_of_line)
CUSTOM_DOC("Deletes all text from the cursor to the end of the line")
{
View_ID view = get_active_view(app, Access_ReadWriteVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
i64 pos = view_get_cursor_pos(app, view);
i64 line_number = get_line_number_from_pos(app, buffer, pos);
Range_Cursor line_range = get_line_range(app, buffer, line_number);
Range_i64 delete_range = {};
if (line_range.start.line != 0 && line_range.end.line != 0)
{
delete_range = Ii64(pos, line_range.end.pos);
}
if (range_size(delete_range) == 0)
{
delete_range.end += 1;
i32 buffer_size = (i32)buffer_get_size(app, buffer);
delete_range.end = clamp_top(delete_range.end, buffer_size);
}
buffer_replace_range(app, buffer, delete_range, string_u8_litexpr(""));
}
////////////////////////////////
CUSTOM_COMMAND_SIG(open_file_in_quotes)
@ -2053,7 +1895,7 @@ CUSTOM_DOC("Advances forwards through the undo history of the current buffer.")
History_Record_Index current = buffer_history_get_current_state_index(app, buffer);
History_Record_Index max_index = buffer_history_get_max_record_index(app, buffer);
if (current < max_index){
Record_Info record = buffer_history_get_record_info(app, buffer, current+1);
Record_Info record = buffer_history_get_record_info(app, buffer, current);
i64 new_position = record_get_new_cursor_position_redo(app, buffer, current + 1, record);
buffer_history_set_current_state_index(app, buffer, current + 1);
@ -2235,284 +2077,5 @@ CUSTOM_DOC("Notes the external modification of attached files by printing a mess
}
}
CUSTOM_COMMAND_SIG(toggle_compilation_view)
{
Buffer_ID buffer = view_get_buffer(app, global_compilation_view, Access_Always);
Face_ID face_id = get_face_id(app, buffer);
Face_Metrics metrics = get_face_metrics(app, face_id);
if(global_compilation_view_expanded ^= 1)
{
view_set_split_pixel_size(app, global_compilation_view, (i32)(metrics.line_height*32.f));
}
else
{
view_set_split_pixel_size(app, global_compilation_view, (i32)(metrics.line_height*4.f));
}
}
////////////////////////////////////////
// Indentation
function void
reindent_line(Application_Links *app, Buffer_ID buffer, i64 line, i64 indent_delta)
{
Scratch_Block scratch(app);
View_ID view = get_active_view(app, Access_ReadWriteVisible);
String_Const_u8 line_string = push_buffer_line(app, scratch, buffer, line);
i64 line_start_pos = get_line_start_pos(app, buffer, line);
Range_i64 line_indent_range = Ii64(0, 0);
i64 tabs_at_beginning = 0;
i64 spaces_at_beginning = 0;
for(u64 i = 0; i < line_string.size; i += 1)
{
if(line_string.str[i] == '\t')
{
tabs_at_beginning += 1;
}
else if(character_is_whitespace(line_string.str[i]))
{
spaces_at_beginning += 1;
}
else if(!character_is_whitespace(line_string.str[i]))
{
line_indent_range.max = (i64)i;
break;
}
}
// NOTE(PS): This is in the event that we are unindenting a line that
// is JUST tabs or spaces - rather than unindenting nothing
// and then reindenting the proper amount, this should cause
// the removal of all leading tabs and spaces on an otherwise
// empty line
bool place_cursor_at_end = false;
if (line_indent_range.max == 0 && line_string.size == (u64)(spaces_at_beginning + tabs_at_beginning))
{
line_indent_range.max = line_string.size;
place_cursor_at_end = true;
}
// NOTE(rjf): Indent lines.
{
Range_i64 indent_range =
{
line_indent_range.min + line_start_pos,
line_indent_range.max + line_start_pos,
};
i64 indent_width = (i64)def_get_config_u64(app, vars_save_string_lit("indent_width"));
b32 indent_with_tabs = def_get_config_b32(vars_save_string_lit("indent_with_tabs"));
i64 spaces_per_indent_level = indent_width;
i64 indent_level = spaces_at_beginning / spaces_per_indent_level + tabs_at_beginning;
i64 new_indent_level = indent_level + indent_delta;
String_Const_u8 indent_string;
if (indent_with_tabs) {
indent_string = str8_lit("\t");
} else {
indent_string = push_stringf(scratch, "%.*s", Min(indent_width, 16), " ");
}
buffer_replace_range(app, buffer, indent_range, str8_lit(""));
for(i64 i = 0; i < new_indent_level; i += 1)
{
buffer_replace_range(app, buffer, Ii64(line_start_pos), indent_string);
}
if (place_cursor_at_end)
{
// update line_string now that we've edited the line
line_string = push_buffer_line(app, scratch, buffer, line);
line_start_pos = get_line_start_pos(app, buffer, line);
i64 line_end_pos = line_start_pos + line_string.size;
view_set_cursor(app, view, seek_pos(line_end_pos));
}
}
}
internal void
reindent_line_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, i64 indent_delta)
{
for(i64 i = range.min; i <= range.max; i += 1)
{
reindent_line(app, buffer, i, indent_delta);
}
}
// TODO(PS): @F4Layer - it's unclear why we need these, when there's existing, similarly named functions
// already in the codebase. (Just remove the f4_ and the compiler will show you where).
internal Range_i64
f4_get_line_range_from_pos_range(Application_Links *app, Buffer_ID buffer, Range_i64 pos_range)
{
Range_i64 lines_range =
Ii64(get_line_number_from_pos(app, buffer, pos_range.min),
get_line_number_from_pos(app, buffer, pos_range.max));
return lines_range;
}
// TODO(PS): @F4Layer
internal Range_i64
f4_get_pos_range_from_line_range(Application_Links *app, Buffer_ID buffer, Range_i64 line_range)
{
if(line_range.min > line_range.max)
{
i64 swap = line_range.max;
line_range.max = line_range.min;
line_range.min = swap;
}
Range_i64 pos_range =
Ii64(get_line_start_pos(app, buffer, line_range.min),
get_line_end_pos(app, buffer, line_range.max));
return pos_range;
}
internal void
reindent_pos_range(Application_Links *app, Buffer_ID buffer, Range_i64 range, i64 indent_delta)
{
reindent_line_range(app, buffer,
f4_get_line_range_from_pos_range(app, buffer, range),
indent_delta);
}
CUSTOM_COMMAND_SIG(unindent_line)
{
View_ID view = get_active_view(app, Access_ReadWrite);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
i64 pos = view_get_cursor_pos(app, view);
i64 line = get_line_number_from_pos(app, buffer, pos);
reindent_line(app, buffer, line, -1);
}
internal void
adjust_cursor_and_mark_for_indentation(Application_Links *app, View_ID view, i64 original_cursor, i64 original_mark, Range_i64 original_line_range)
{
Buffer_ID buffer = view_get_buffer(app, view, Access_Read);
Scratch_Block scratch(app);
if(original_cursor == original_mark)
{
i64 start_pos = get_line_start_pos(app, buffer, original_line_range.min);
i64 new_pos = start_pos;
String_Const_u8 line = push_buffer_line(app, scratch, buffer, original_line_range.min);
for(u64 i = 0; i < line.size; i += 1)
{
if(!character_is_whitespace(line.str[i]))
{
new_pos = start_pos + (i64)i;
break;
}
}
view_set_cursor(app, view, seek_pos(new_pos));
view_set_mark(app, view, seek_pos(new_pos));
}
else
{
Range_i64 range = f4_get_pos_range_from_line_range(app, buffer, original_line_range);
view_set_cursor(app, view, seek_pos(original_cursor > original_mark ? range.max : range.min));
view_set_mark(app, view, seek_pos(original_cursor > original_mark ? range.min : range.max));
}
}
function void
update_range_indentation(Application_Links* app, i32 indent_offset)
{
Scratch_Block scratch(app);
View_ID view = get_active_view(app, Access_ReadWrite);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWrite);
i64 pos = view_get_cursor_pos(app, view);
i64 mark = view_get_mark_pos(app, view);
Range_i64 pos_range = Ii64(pos, mark);
Range_i64 line_range = get_line_range_from_pos_range(app, buffer, pos_range);
History_Group group = history_group_begin(app, buffer);
reindent_pos_range(app, buffer, Ii64(pos, mark), indent_offset);
adjust_cursor_and_mark_for_indentation(app, view, pos, mark, line_range);
history_group_end(group);
no_mark_snap_to_cursor(app, view);
}
CUSTOM_COMMAND_SIG(indent_range)
{
update_range_indentation(app, 1);
}
CUSTOM_COMMAND_SIG(unindent_range)
{
update_range_indentation(app, -1);
}
CUSTOM_COMMAND_SIG(indent_or_autocomplete)
{
Scratch_Block scratch(app);
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer != 0)
{
i64 pos = view_get_cursor_pos(app, view);
Buffer_Cursor buffer_cursor = buffer_compute_cursor(app, buffer, seek_pos(pos));
Buffer_Cursor line_start_cursor = get_line_start(app, buffer, buffer_cursor.line);
u8 char_before = buffer_get_char(app, buffer, pos - 1);
if ((buffer_cursor.pos == line_start_cursor.pos) || character_is_whitespace(char_before))
{
i64 indent_width = (i64)def_get_config_u64(app, vars_save_string_lit("indent_width"));
b32 indent_with_tabs = def_get_config_b32(vars_save_string_lit("indent_with_tabs"));
String_Const_u8 indent_string;
if (indent_with_tabs) {
indent_string = str8_lit("\t");
} else {
indent_string = push_stringf(scratch, "%.*s", Min(indent_width, 16), " ");
}
write_text(app, indent_string);
}
else
{
word_complete(app);
}
}
}
///////////////////////////////////////////
CUSTOM_COMMAND_SIG(input_enter_behavior)
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer == 0)
{
buffer = view_get_buffer(app, view, Access_ReadVisible);
if (buffer != 0)
{
goto_jump_at_cursor(app);
lock_jump_buffer(app, buffer);
}
}
else
{
leave_current_input_unhandled(app);
}
}
CUSTOM_COMMAND_SIG(input_alt_enter_behavior)
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer == 0){
buffer = view_get_buffer(app, view, Access_ReadVisible);
if (buffer != 0){
goto_jump_at_cursor_same_panel(app);
lock_jump_buffer(app, buffer);
}
}
else
{
leave_current_input_unhandled(app);
}
}
// BOTTOM

View File

@ -4990,27 +4990,6 @@ string_find_first_insensitive(String_Const_u32 str, String_Const_u32 needle){
return(string_find_first(str, needle, StringMatch_CaseInsensitive));
}
function u64
string_find_first_of_set(String_Const_u8 str, String_Const_u8 needle)
{
u64 i = 0;
if (needle.size > 0){
i = 0;
for (;i < str.size; i += 1){
bool found = false;
for (u64 j = 0; j < needle.size; j++)
{
if (str.str[i] == needle.str[j]) {
found = true;
break;
}
}
if (found) break;
}
}
return(i);
}
function b32
string_has_substr(String_Const_u8 str, String_Const_u8 needle, String_Match_Rule rule){
return(string_find_first(str, needle, rule) < str.size);

View File

@ -96,7 +96,7 @@ struct Code_Index{
Code_Index_File_Storage *storage_last;
i32 storage_count;
Code_Index_Note_List name_hash[10000];
Code_Index_Note_List name_hash[4099];
};
////////////////////////////////

View File

@ -95,95 +95,5 @@ CUSTOM_DOC("Jump to the first definition in the code index matching an identifie
}
}
global String_Const_u8 code_index_note_strs[] = {
str8_lit("Type"),
str8_lit("Function"),
str8_lit("Macro"),
str8_lit("None"),
};
function bool
note_is_of_kind(Code_Index_Note_Kind* kinds, i32 kinds_count, Code_Index_Note* note)
{
bool result = false;
for (i32 i = 0; i < kinds_count; i++)
{
if (kinds[i] == note->note_kind)
{
result = true;
break;
}
}
return result;
}
function void
lister_add_from_buffer_code_index_filtered(Lister* lister, Buffer_ID buffer, Arena* scratch, Code_Index_Note_Kind* kinds, i32 kinds_count, bool filter_all_but_last)
{
Code_Index_File* file_notes = code_index_get_file(buffer);
if (!file_notes) return;
for (Code_Index_Note* note = file_notes->note_list.first;
note != 0;
note = note->next)
{
if (!note_is_of_kind(kinds, kinds_count, note)) continue;
if (filter_all_but_last && note->next_in_hash) continue;
String_Const_u8 sort = code_index_note_strs[note->note_kind];
Tiny_Jump *jump = push_array(scratch, Tiny_Jump, 1);
jump->buffer = buffer;
jump->pos = note->pos.start;
lister_add_item(lister, note->text, sort, jump, 0);
}
}
function void
run_jump_lister(Application_Links* app, Lister* lister)
{
Lister_Result l_result = run_lister(app, lister);
Tiny_Jump result = {};
if (!l_result.canceled && l_result.user_data != 0){
block_copy_struct(&result, (Tiny_Jump*)l_result.user_data);
}
if (result.buffer != 0)
{
View_ID view = get_this_ctx_view(app, Access_Always);
point_stack_push_view_cursor(app, view);
jump_to_location(app, view, result.buffer, result.pos);
}
}
function void
lister_search_filtered(Application_Links* app, char* query, Code_Index_Note_Kind* allowed, i32 allowed_count, bool filter_all_but_last)
{
Scratch_Block scratch(app);
Lister_Block lister(app, scratch);
lister_set_query(lister, query);
lister_set_default_handlers(lister);
for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always);
buffer != 0; buffer = get_buffer_next(app, buffer, Access_Always))
{
lister_add_from_buffer_code_index_filtered(lister, buffer, scratch, allowed, allowed_count, filter_all_but_last);
}
run_jump_lister(app, lister);
}
CUSTOM_UI_COMMAND_SIG(lister_search_all)
CUSTOM_DOC("Runs a search lister on all code indices of the project")
{
char *query = "Search:";
Code_Index_Note_Kind allowed[] = {
CodeIndexNote_Macro,
CodeIndexNote_Function,
CodeIndexNote_Type,
};
lister_search_filtered(app, query, allowed, 3, false);
}
// BOTTOM

View File

@ -296,6 +296,7 @@ map_get_binding_non_recursive(Command_Map *map, Input_Event *event, Binding_Matc
}
}
}break;
case BindingMatchRule_Loose:
{
for (SNode *node = list->first;
@ -309,7 +310,7 @@ map_get_binding_non_recursive(Command_Map *map, Input_Event *event, Binding_Matc
}
}
}break;
}
}
done:;
}
else{

View File

@ -39,7 +39,8 @@ def_search_normal_fopen(Arena *arena, char *file_name, char *opt){
// NOTE(allen): Extension List
function String_Const_u8_Array
parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){
parse_extension_line_to_extension_list(Application_Links *app, Arena *arena, String_Const_u8 str){
ProfileScope(app, "parse extension line to extension list");
i32 count = 0;
for (u64 i = 0; i < str.size; i += 1){
if (str.str[i] == '.'){
@ -64,13 +65,6 @@ parse_extension_line_to_extension_list(Arena *arena, String_Const_u8 str){
return(array);
}
function String_Const_u8_Array
parse_extension_line_to_extension_list(Application_Links *app, Arena *arena, String_Const_u8 str){
ProfileScope(app, "parse extension line to extension list");
return parse_extension_line_to_extension_list(arena, str);
}
////////////////////////////////
// NOTE(allen): Token Array

View File

@ -15,521 +15,15 @@
#include "generated/managed_id_metadata.cpp"
#endif
#define EXTERNAL_KEYBOARD 0
#if OS_MAC && !EXTERNAL_KEYBOARD
global u32 key_alt = KeyCode_Command;
#else
global u32 key_alt = KeyCode_Alt;
#endif
function String_Const_u8
get_lexeme_under_cursor(Application_Links* app, View_ID view, Buffer_ID buffer, Arena* arena)
{
String_Const_u8 lexeme = {0};
i64 pos = view_get_cursor_pos(app, view);
Token* token = get_token_from_pos(app, buffer, pos);
if (token != 0) {
lexeme = push_token_lexeme(app, arena, buffer, token);
}
return lexeme;
}
function void
go_to_definition(Application_Links* app, String_Const_u8 lexeme, View_ID view)
{
Code_Index_Note* note = 0;
// if we're trying to go to the definition of the same lexeme as last time
// then there are probably a typedef + declaration in different locations so
// we want to advance to the next code index note that matches this lexeme
// and then loop
if (string_match(go_to_definition_last_lexeme, lexeme))
{
Code_Index_Note_List* list = code_index__list_from_string(lexeme);
u64 i = 0;
for (Code_Index_Note *it = list->first;
it != 0;
it = it->next_in_hash, i++){
if (string_match(lexeme, it->text) && i > go_to_definition_last_lexeme_index){
note = it;
go_to_definition_last_lexeme_index = i;
break;
}
}
}
if (!note)
{
note = code_index_note_from_string(lexeme);
go_to_definition_last_lexeme = lexeme;
go_to_definition_last_lexeme_index = 0;
}
if (note == 0) return;
Buffer_ID buffer = note->file->buffer;
view_set_buffer(app, view, buffer, 0);
switch (note->note_kind)
{
case CodeIndexNote_Type:
case CodeIndexNote_Function:
case CodeIndexNote_Macro:
{
jump_to_location(app, view, note->file->buffer, note->pos.start);
} break;
default: {} break;
}
}
CUSTOM_COMMAND_SIG(cmd_enter_behavior)
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer == 0){
buffer = view_get_buffer(app, view, Access_ReadVisible);
if (buffer != 0){
goto_jump_at_cursor(app);
lock_jump_buffer(app, buffer);
}
}
else{
Scratch_Block scratch(app);
String_Const_u8 lexeme = get_lexeme_under_cursor(app, view, buffer, scratch);
if (lexeme.size > 0) {
go_to_definition(app, lexeme, view);
}
}
}
CUSTOM_COMMAND_SIG(cmd_alt_enter_behavior)
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadWriteVisible);
if (buffer == 0){
buffer = view_get_buffer(app, view, Access_ReadVisible);
if (buffer != 0){
goto_jump_at_cursor_same_panel(app);
lock_jump_buffer(app, buffer);
}
}
else{
Scratch_Block scratch(app);
String_Const_u8 lexeme = get_lexeme_under_cursor(app, view, buffer, scratch);
if (lexeme.size > 0) {
view = get_next_view_looped_primary_panels(app, view, Access_Always);
go_to_definition(app, lexeme, view);
}
}
}
//////////////////////////////////////////////////////////////////
// Column Alignment
function i64
qol_seek_char(Application_Links *app, Buffer_ID buffer, Scan_Direction direction, i64 start_pos, u8 target_char){
Scratch_Block scratch(app);
i64 line = get_line_number_from_pos(app, buffer, start_pos);
Range_i64 range = get_line_pos_range(app, buffer, line);
range.max += 1;
String_Const_u8 string = push_buffer_range(app, scratch, buffer, range);
i64 pos = start_pos;
while(range_contains(range, pos)){
pos += direction;
u8 current_char = string.str[pos - range.min];
if (current_char == target_char){ return pos; }
}
return start_pos;
}
CUSTOM_COMMAND_SIG(qol_char_forward)
CUSTOM_DOC("[QOL] Seeks forward in current line to the selected char")
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible);
i64 cursor_pos = view_get_cursor_pos(app, view);
i64 pos = qol_seek_char(app, buffer, Scan_Forward, cursor_pos, qol_target_char);
view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
}
CUSTOM_COMMAND_SIG(qol_char_backward)
CUSTOM_DOC("[QOL] Seeks back in current line to the selected char")
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible);
i64 cursor_pos = view_get_cursor_pos(app, view);
i64 pos = qol_seek_char(app, buffer, Scan_Backward, cursor_pos, qol_target_char);
view_set_cursor_and_preferred_x(app, view, seek_pos(pos));
}
CUSTOM_COMMAND_SIG(qol_column_toggle)
CUSTOM_DOC("[QOL] Toggles the column for bumping and selects hovered char")
{
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible);
if (qol_col_cursor.pos < 0){
i64 pos = view_get_cursor_pos(app, view);
qol_target_char = buffer_get_char(app, buffer, pos);
qol_col_cursor = buffer_compute_cursor(app, buffer, seek_pos(pos));
}
else{
qol_col_cursor.pos = -1;
}
}
CUSTOM_COMMAND_SIG(qol_write_space)
CUSTOM_DOC("[QOL] Writes as many spaces needed for bumping to column")
{
Scratch_Block scratch(app);
if (qol_col_cursor.pos > 0){
View_ID view = get_active_view(app, Access_ReadVisible);
Buffer_ID buffer = view_get_buffer(app, view, Access_ReadVisible);
qol_col_cursor = buffer_compute_cursor(app, buffer, seek_line_col(qol_col_cursor.line, qol_col_cursor.col));
i64 pos = view_get_cursor_pos(app, view);
i64 line = get_line_number_from_pos(app, buffer, pos);
f32 col_x = view_relative_xy_of_pos(app, view, line, qol_col_cursor.pos).x;
f32 cur_x = view_relative_xy_of_pos(app, view, line, pos).x;
Face_ID face = get_face_id(app, buffer);
f32 space_advance = get_face_metrics(app, face).space_advance;
i64 N = i64((col_x - cur_x) / space_advance);
if (N < 0){ N = 1; }
String_Const_u8 spaces = string_const_u8_push(scratch, N);
block_fill_u8(spaces.str, N, ' ');
write_text(app, spaces);
}
else{
write_space(app);
}
}
//////////////////////////////////////////////////////////////////
// Jumping
struct QOL_Point
{
Buffer_ID buffer;
i64 pos;
};
struct QOL_View_Jumps
{
b32 check;
QOL_Point point;
i64 bot, pos, top;
Point_Stack_Slot ring[128];
};
function QOL_View_Jumps*
qol_jumps(Application_Links *app, View_ID view)
{
Managed_Scope scope = view_get_managed_scope(app, view);
return scope_attachment(app, scope, qol_view_jumps, QOL_View_Jumps);
}
function QOL_Point
qol_current_point(Application_Links *app)
{
QOL_Point point = {};
View_ID view = get_active_view(app, Access_ReadVisible);
point.buffer = view_get_buffer(app, view, Access_ReadVisible);
point.pos = view_get_cursor_pos(app, view);
return point;
}
function QOL_Point
qol_point_from_slot(Application_Links *app, Point_Stack_Slot slot)
{
Marker *marker = (Marker*)managed_object_get_pointer(app, slot.object);
return marker == 0 ? QOL_Point{-1,-1} : QOL_Point{slot.buffer, marker->pos};
}
function Point_Stack_Slot
qol_alloc_slot_from_point(Application_Links *app, QOL_Point point)
{
Point_Stack_Slot slot = {};
Managed_Object object = alloc_buffer_markers_on_buffer(app, point.buffer, 1, 0);
Marker *marker = (Marker*)managed_object_get_pointer(app, object);
marker->pos = point.pos;
marker->lean_right = false;
slot.buffer = point.buffer;
slot.object = object;
return slot;
}
function void
qol_free_slot(Application_Links *app, Point_Stack_Slot slot)
{
managed_object_free(app, slot.object);
}
function b32
qol_is_jump(Application_Links *app, QOL_Point a, QOL_Point b)
{
if (!buffer_exists(app, a.buffer)){ return false; }
return a.buffer != b.buffer || 1 < range_size(get_line_range_from_pos_range(app, a.buffer, Ii64(a.pos, b.pos)));
}
function void
qol_pre_command_inner(Application_Links *app, Managed_Scope scope)
{
QOL_View_Jumps *jumps = scope_attachment(app, scope, qol_view_jumps, QOL_View_Jumps);
jumps->check = true;
jumps->point = qol_current_point(app);
}
function void
qol_post_command_inner(Application_Links *app, Managed_Scope scope)
{
QOL_View_Jumps *jumps = scope_attachment(app, scope, qol_view_jumps, QOL_View_Jumps);
QOL_Point point = qol_current_point(app);
if (jumps != 0 && jumps->check && qol_is_jump(app, jumps->point, point))
{
i64 cap = ArrayCount(jumps->ring);
if (jumps->pos - jumps->bot == cap-1)
{
qol_free_slot(app, jumps->ring[jumps->bot++ % cap]);
}
if (2*cap <= jumps->pos)
{
jumps->top -= cap;
jumps->bot -= cap;
}
jumps->ring[jumps->pos++ % cap] = qol_alloc_slot_from_point(app, jumps->point);
jumps->top = jumps->pos;
}
}
function void
qol_jump_to_point(Application_Links *app, View_ID view, QOL_Point point)
{
if (point.buffer != view_get_buffer(app, view, Access_Always))
{
view_set_buffer(app, view, point.buffer, 0);
view_set_cursor(app, view, seek_pos(point.pos));
center_view(app);
}
else
{
Range_i64 range = Ii64(view_get_cursor_pos(app, view), point.pos);
Range_i64 lines = get_line_range_from_pos_range(app, point.buffer, range);
f32 y_diff = view_line_y_difference(app, view, lines.max, lines.min);
view_set_cursor(app, view, seek_pos(point.pos));
if (rect_height(view_get_buffer_region(app, view)) < y_diff)
{
center_view(app);
}
}
}
CUSTOM_COMMAND_SIG(qol_jump_down)
CUSTOM_DOC("[QOL] Jump down the view's jump stack")
{
View_ID view = get_active_view(app, Access_ReadVisible);
QOL_View_Jumps *jumps = qol_jumps(app, view);
jumps->check = false;
if (jumps->pos == jumps->bot){ return; }
QOL_Point point = qol_point_from_slot(app, ArraySafe(jumps->ring, --jumps->pos));
if (!buffer_exists(app, point.buffer)){ return; }
if (jumps->pos+1 == jumps->top){
ArraySafe(jumps->ring, jumps->top++) = qol_alloc_slot_from_point(app, qol_current_point(app));
}
qol_jump_to_point(app, view, point);
}
CUSTOM_COMMAND_SIG(qol_jump_up)
CUSTOM_DOC("[QOL] Jump back up the view's jump stack")
{
View_ID view = get_active_view(app, Access_ReadVisible);
QOL_View_Jumps *jumps = qol_jumps(app, view);
jumps->check = false;
if (jumps->top <= jumps->pos+1){ return; }
QOL_Point point = qol_point_from_slot(app, ArraySafe(jumps->ring, ++jumps->pos));
if (!buffer_exists(app, point.buffer)){ return; }
qol_jump_to_point(app, view, point);
}
//////////////////////////////////////////////////////////////////
// Bindings
function void
bindings_cmd_misc(Mapping* m, Command_Map* map)
{
Bind(command_lister, KeyCode_W);
Bind(change_active_panel, KeyCode_E);
Bind(toggle_compilation_view, KeyCode_Minus);
}
function void
bindings_cmd_file_ops(Mapping* m, Command_Map* map)
{
Bind(set_mark, KeyCode_Space);
Bind(interactive_open_or_new, KeyCode_Comma);
Bind(interactive_switch_buffer, KeyCode_Period);
Bind(save, KeyCode_Semicolon);
}
function void
bindings_cmd_search(Mapping* m, Command_Map* map)
{
Bind(query_replace, KeyCode_S);
Bind(query_replace_identifier, KeyCode_S, key_alt);
Bind(query_replace_selection, KeyCode_S, key_alt, KeyCode_Shift);
Bind(search, KeyCode_F);
Bind(list_all_locations_of_identifier, KeyCode_D);
Bind(list_all_substring_locations_case_insensitive, KeyCode_D, key_alt);
Bind(goto_next_jump, KeyCode_T);
Bind(goto_prev_jump, KeyCode_R);
// Listers
Bind(lister_search_all, KeyCode_1);
}
function void
bindings_cmd_nav(Mapping* m, Command_Map* map)
{
Bind(seek_beginning_of_line, KeyCode_Y);
Bind(seek_end_of_line, KeyCode_P);
Bind(move_left_token_boundary, KeyCode_U);
Bind(move_right_token_boundary, KeyCode_O);
Bind(move_up, KeyCode_I);
Bind(move_left, KeyCode_J);
Bind(move_down, KeyCode_K);
Bind(move_right, KeyCode_L);
Bind(move_up_to_blank_line_end, KeyCode_H);
Bind(move_down_to_blank_line_end, KeyCode_N);
Bind(cmd_enter_behavior, KeyCode_Return);
Bind(cmd_alt_enter_behavior, KeyCode_Return, key_alt);
Bind(jump_to_last_point, KeyCode_Semicolon, KeyCode_Control);
}
function void
custom_keyboard_bindings()
{
modal_set_cursor_color_u32(modal_mode_input, 0xFF00FF00);
modal_set_cursor_color_u32(modal_mode_cmd, 0xFFFF0000);
modal_set_cursor_color_u32(modal_mode_debug, 0xFF00F0FF);
MappingScope();
// Global commands
modal_bind_all(modal_map_id_global, modal_set_mode_toggle, KeyCode_F, key_alt, 0);
modal_bind_all(modal_map_id_global, modal_set_mode_next, KeyCode_F, KeyCode_Control, 0);
modal_bind_all(modal_map_id_global, exit_4coder, KeyCode_F4, key_alt, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F1, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F2, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F3, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F4, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F5, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F6, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F7, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F8, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F9, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F10, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F11, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F12, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F13, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F14, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F15, 0, 0);
modal_bind_all(modal_map_id_global, project_fkey_command, KeyCode_F16, 0, 0);
SelectMapping(&modal_get_mode(modal_mode_cmd)->map);
SelectMap(modal_map_id_global);
{
bindings_cmd_file_ops(m, map);
bindings_cmd_misc(m, map);
bindings_cmd_search(m, map);
bindings_cmd_nav(m, map);
// Text Editing
Bind(delete_to_end_of_line, KeyCode_A);
Bind(undo, KeyCode_Z);
Bind(redo, KeyCode_B);
Bind(copy, KeyCode_C);
Bind(paste, KeyCode_V);
Bind(cut, KeyCode_X);
Bind(backspace_char, KeyCode_Backspace);
Bind(backspace_alpha_numeric_or_camel_boundary, KeyCode_Backspace, key_alt);
Bind(backspace_token_boundary, KeyCode_Backspace, KeyCode_Control);
Bind(unindent_range, KeyCode_Tab, KeyCode_Shift);
Bind(indent_range, KeyCode_Tab);
// Column Alignment
Bind(qol_column_toggle, KeyCode_BackwardSlash, key_alt);
Bind(qol_write_space, KeyCode_Space, key_alt, KeyCode_Shift);
Bind(qol_char_forward, KeyCode_L, key_alt);
Bind(qol_char_backward, KeyCode_J, key_alt);
// Jumping
Bind(qol_jump_down, KeyCode_LeftBracket);
Bind(qol_jump_up, KeyCode_RightBracket);
// Macros
Bind(keyboard_macro_start_recording, KeyCode_1, key_alt);
Bind(keyboard_macro_finish_recording, KeyCode_2, key_alt);
Bind(keyboard_macro_replay, KeyCode_3, key_alt);
// Yeet Sheet
Bind(loco_yeet_selected_range_or_jump, KeyCode_G);
}
SelectMapping(&modal_get_mode(modal_mode_input)->map);
SelectMap(modal_map_id_global);
{
BindMouse(click_set_cursor_and_mark, MouseCode_Left);
BindMouseRelease(click_set_cursor, MouseCode_Left);
BindCore(click_set_cursor_and_mark, CoreCode_ClickActivateView);
BindMouseMove(click_set_cursor_if_lbutton);
Bind(delete_char, KeyCode_Delete);
Bind(backspace_char, KeyCode_Backspace);
Bind(backspace_alpha_numeric_or_camel_boundary, KeyCode_Backspace, key_alt);
Bind(backspace_token_boundary, KeyCode_Backspace, KeyCode_Control);
Bind(move_up, KeyCode_I, key_alt);
Bind(move_down, KeyCode_K, key_alt);
BindTextInput(write_text_and_auto_indent);
Bind(indent_or_autocomplete, KeyCode_Tab);
Bind(unindent_line, KeyCode_Tab, KeyCode_Shift);
Bind(write_todo, KeyCode_T, key_alt);
Bind(write_note, KeyCode_G, key_alt);
Bind(input_enter_behavior, KeyCode_Return);
Bind(input_alt_enter_behavior, KeyCode_Return, key_alt);
}
SelectMapping(&modal_get_mode(modal_mode_debug)->map);
SelectMap(modal_map_id_global);
{
bindings_cmd_file_ops(m, map);
bindings_cmd_misc(m, map);
bindings_cmd_search(m, map);
bindings_cmd_nav(m, map);
}
}
void
custom_layer_init(Application_Links *app){
Thread_Context *tctx = get_thread_context(app);
// NOTE(allen): setup for default framework
default_framework_init(app);
// NOTE(allen): default hooks and command maps
set_all_default_hooks(app);
modal_init(3, tctx);
custom_keyboard_bindings();
#if 0
mapping_init(tctx, &framework_mapping);
String_ID global_map_id = vars_save_string_lit("keys_global");
String_ID file_map_id = vars_save_string_lit("keys_file");
@ -540,8 +34,6 @@ custom_layer_init(Application_Links *app){
setup_default_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#endif
setup_essential_mapping(&framework_mapping, global_map_id, file_map_id, code_map_id);
#endif
}
#endif //FCODER_DEFAULT_BINDINGS

View File

@ -45,10 +45,6 @@ CUSTOM_ID(colors, defcolor_back_cycle);
CUSTOM_ID(colors, defcolor_text_cycle);
CUSTOM_ID(colors, defcolor_line_numbers_back);
CUSTOM_ID(colors, defcolor_line_numbers_text);
CUSTOM_ID(colors, defcolor_function);
CUSTOM_ID(colors, defcolor_operator);
CUSTOM_ID(colors, defcolor_type);
CUSTOM_ID(colors, defcolor_macro);
struct Color_Table_Node{
Color_Table_Node *next;

View File

@ -58,8 +58,7 @@ global b32 auto_center_after_jumps = AUTO_CENTER_AFTER_JUMPS;
global u8 locked_buffer_space[256];
global String_Const_u8 locked_buffer = {};
global View_ID global_compilation_view = 0;
global b32 global_compilation_view_expanded = 0;
global View_ID build_footer_panel_view_id = 0;
global u8 out_buffer_space[1024];
@ -112,31 +111,5 @@ global Point_Stack point_stack = {};
global Clipboard clipboard0 = {};
////////////////////////////////
// Modal System Maps
global String_ID modal_map_id_global;
global String_ID modal_map_id_file;
global String_ID modal_map_id_code;
// Modal system modes
global Modal_Mode* modal_modes;
global u32 modal_modes_cap;
// State Tracking
global u32 modal_last_mode;
global u32 modal_curr_mode;
// Mode Ids
global u32 modal_mode_input = 0;
global u32 modal_mode_cmd = 1;
global u32 modal_mode_debug = 2;
////////////////////////////////
static String_Const_u8 go_to_definition_last_lexeme = {};
static u64 go_to_definition_last_lexeme_index = 0;
// BOTTOM

View File

@ -9,56 +9,25 @@ CUSTOM_DOC("Default command for responding to a startup event")
{
ProfileScope(app, "default startup");
User_Input input = get_current_input(app);
if (match_core_code(&input, CoreCode_Startup))
{
if (match_core_code(&input, CoreCode_Startup)){
String_Const_u8_Array file_names = input.event.core.file_names;
load_themes_default_folder(app);
default_4coder_initialize(app, file_names);
default_4coder_side_by_side_panels(app, file_names);
b32 auto_load = def_get_config_b32(vars_save_string_lit("automatically_load_project"));
if (auto_load){
load_project(app);
}
}
// Setup Default Layout
Buffer_ID comp_buffer = create_buffer(app, str8_lit("*compilation*"), BufferCreate_NeverAttachToFile | BufferCreate_AlwaysNew);
buffer_set_setting(app, comp_buffer, BufferSetting_Unimportant, true);
buffer_set_setting(app, comp_buffer, BufferSetting_ReadOnly, true);
Buffer_Identifier comp_name = buffer_identifier(str8_lit("*compilation*"));
Buffer_Identifier code_left_name = buffer_identifier(str8_lit("*scratch*"));
Buffer_Identifier code_right_name = buffer_identifier(str8_lit("*messages*"));
Buffer_ID comp_id = buffer_identifier_to_id(app, comp_name);
Buffer_ID code_left_id = buffer_identifier_to_id(app, code_left_name);
Buffer_ID code_right_id = buffer_identifier_to_id(app, code_right_name);
// Left Panel
View_ID left_view = get_active_view(app, Access_Always);
new_view_settings(app, left_view);
view_set_buffer(app, left_view, code_left_id, 0);
// Bottom panel
View_ID compilation_view = 0;
compilation_view = open_view(app, left_view, ViewSplit_Bottom);
new_view_settings(app, compilation_view);
Buffer_ID buffer = view_get_buffer(app, compilation_view, Access_Always);
Face_ID face_id = get_face_id(app, buffer);
Face_Metrics metrics = get_face_metrics(app, face_id);
view_set_split_pixel_size(app, compilation_view, (i32)(metrics.line_height*4.f));
view_set_passive(app, compilation_view, true);
global_compilation_view = compilation_view;
view_set_buffer(app, compilation_view, comp_id, 0);
// Right Panel
view_set_active(app, left_view);
open_panel_vsplit(app);
View_ID right_view = get_active_view(app, Access_Always);
view_set_buffer(app, right_view, code_right_id, 0);
view_set_active(app, left_view);
{
def_audio_init();
}
{
def_enable_virtual_whitespace = def_get_config_b32(vars_save_string_lit("enable_virtual_whitespace"));
clear_all_layouts(app);
}
system_set_fullscreen(false);
}
CUSTOM_COMMAND_SIG(default_try_exit)
@ -96,9 +65,7 @@ default_implicit_map(Application_Links *app, String_ID lang, String_ID mode, Inp
View_ID view = get_this_ctx_view(app, Access_Always);
Command_Map_ID map_id = default_get_map_id(app, view);
Modal_Mode* mode_curr = modal_get_mode_curr();
Mapping* mode_map = &mode_curr->map;
Command_Binding binding = map_get_binding_recursive(mode_map, map_id, event);
Command_Binding binding = map_get_binding_recursive(&framework_mapping, map_id, event);
// TODO(allen): map_id <-> map name?
result.map = 0;
@ -117,6 +84,7 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
Managed_Scope scope = view_get_managed_scope(app, view);
for (;;){
// NOTE(allen): Get input
User_Input input = get_next_input(app, EventPropertyGroup_Any, 0);
if (input.abort){
break;
@ -141,13 +109,11 @@ CUSTOM_DOC("Input consumption loop for default view behavior")
}
// NOTE(allen): Run the command and pre/post command stuff
qol_pre_command_inner(app, scope);
default_pre_command(app, scope);
ProfileCloseNow(view_input_profile);
map_result.command(app);
ProfileScope(app, "after view input");
default_post_command(app, scope);
qol_post_command_inner(app, scope);
}
}
@ -187,42 +153,30 @@ code_index_update_tick(Application_Links *app){
buffer_modified_set_clear();
}
f32 time_since_last_dirty_buffers_check = 0;
function void
reload_clean_buffers_on_filesystem_change(Application_Links *app, Frame_Info frame_info)
{
time_since_last_dirty_buffers_check += frame_info.literal_dt;
if (time_since_last_dirty_buffers_check > 1)
{
time_since_last_dirty_buffers_check = 0;
for (Buffer_ID buffer = get_buffer_next(app, 0, Access_Always);
buffer != 0;
buffer = get_buffer_next(app, buffer, Access_Always)) {
Dirty_State dirty = buffer_get_dirty_state(app, buffer);
if (dirty == DirtyState_UnloadedChanges) {
buffer_reopen(app, buffer, 0);
}
}
}
}
function void
default_tick(Application_Links *app, Frame_Info frame_info){
////////////////////////////////
// NOTE(allen): Update code index
code_index_update_tick(app);
////////////////////////////////
// NOTE(allen): Update fade ranges
if (tick_all_fade_ranges(app, frame_info.animation_dt)){
animate_in_n_milliseconds(app, 0);
}
{ // Clear layouts if virtual whitespace setting changed
////////////////////////////////
// NOTE(allen): Clear layouts if virtual whitespace setting changed.
{
b32 enable_virtual_whitespace = def_get_config_b32(vars_save_string_lit("enable_virtual_whitespace"));
if (enable_virtual_whitespace != def_enable_virtual_whitespace){
def_enable_virtual_whitespace = enable_virtual_whitespace;
clear_all_layouts(app);
}
}
reload_clean_buffers_on_filesystem_change(app, frame_info);
}
function Rect_f32
@ -309,16 +263,11 @@ recursive_nest_highlight(Application_Links *app, Text_Layout_ID layout_id, Range
recursive_nest_highlight(app, layout_id, range, &file->nest_array, 0);
}
function void default_render_buffer(
Application_Links *app,
View_ID view_id,
Face_ID face_id,
Buffer_ID buffer,
Text_Layout_ID text_layout_id,
Rect_f32 rect
){
function void
default_render_buffer(Application_Links *app, View_ID view_id, Face_ID face_id,
Buffer_ID buffer, Text_Layout_ID text_layout_id,
Rect_f32 rect){
ProfileScope(app, "render buffer");
Scratch_Block scratch(app);
View_ID active_view = get_active_view(app, Access_Always);
b32 is_active_view = (active_view == view_id);
@ -333,104 +282,43 @@ function void default_render_buffer(
f32 mark_thickness = (f32)def_get_config_u64(app, vars_save_string_lit("mark_thickness"));
// NOTE(allen): Token colorizing
ARGB_Color color_default = fcolor_resolve(fcolor_id(defcolor_text_default));
ARGB_Color color_function = fcolor_resolve(fcolor_id(defcolor_function));
ARGB_Color color_operator = fcolor_resolve(fcolor_id(defcolor_operator));
ARGB_Color color_type = fcolor_resolve(fcolor_id(defcolor_type));
ARGB_Color color_macro = fcolor_resolve(fcolor_id(defcolor_macro));
ARGB_Color color_back = fcolor_resolve(fcolor_id(defcolor_back));
ARGB_Color color_cur_token = color_default;
Token_Array token_array = get_token_array_from_buffer(app, buffer);
if (token_array.tokens != 0)
{
Token* cursor_token = token_from_pos(&token_array, view_get_cursor_pos(app, active_view));
String_Const_u8 cursor_token_string = push_token_lexeme(app, scratch, buffer, cursor_token);
if (cursor_token->kind == TokenBaseKind_Identifier)
{
Code_Index_Note* note = code_index_note_from_string(cursor_token_string);
if (token_array.tokens != 0){
draw_cpp_token_colors(app, text_layout_id, &token_array);
if (note != 0)
{
switch (note->note_kind)
{
case CodeIndexNote_Function: color_cur_token = color_function; break;
case CodeIndexNote_Type: color_cur_token = color_type; break;
case CodeIndexNote_Macro: color_cur_token = color_macro; break;
//case CodeIndexNote_Global: color_cur_token = color_global; break;
//case CodeIndexNote_Enum: color_cur_token = color_enum; break;
}
}
}
Rect_f32 cursor_tok_rect = text_layout_character_on_screen(app, text_layout_id, cursor_token->pos);
Vec2_f32 tok_rect_dim = V2f32(cursor_token->size*rect_width(cursor_tok_rect), 2.f);
cursor_tok_rect = Rf32_xy_wh(V2f32(cursor_tok_rect.x0, cursor_tok_rect.y1 - 2.f), tok_rect_dim);
draw_cpp_token_colors(app, text_layout_id, &token_array);
// NOTE(allen): Scan for TODOs and NOTEs
b32 use_comment_keyword = def_get_config_b32(vars_save_string_lit("use_comment_keyword"));
if (use_comment_keyword){
Comment_Highlight_Pair pairs[] = {
{string_u8_litexpr("NOTE"), finalize_color(defcolor_comment_pop, 0)},
{string_u8_litexpr("TODO"), finalize_color(defcolor_comment_pop, 1)},
};
draw_comment_highlights(app, buffer, text_layout_id, &token_array, pairs, ArrayCount(pairs));
}
// NOTE(allen): Color functions
Token_Iterator_Array it = token_iterator_pos(0, &token_array, visible_range.first);
it.count = Min(it.count, visible_range.one_past_last);
for (;;){
if (!token_it_inc_non_whitespace(&it)){
break;
// NOTE(allen): Scan for TODOs and NOTEs
b32 use_comment_keyword = def_get_config_b32(vars_save_string_lit("use_comment_keyword"));
if (use_comment_keyword){
Comment_Highlight_Pair pairs[] = {
{string_u8_litexpr("NOTE"), finalize_color(defcolor_comment_pop, 0)},
{string_u8_litexpr("TODO"), finalize_color(defcolor_comment_pop, 1)},
};
draw_comment_highlights(app, buffer, text_layout_id, &token_array, pairs, ArrayCount(pairs));
}
Token *token = token_it_read(&it);
if (token->kind == TokenBaseKind_Operator ||
token->kind == TokenBaseKind_ScopeOpen ||
token->kind == TokenBaseKind_ScopeClose ||
token->kind == TokenBaseKind_ParentheticalOpen ||
token->kind == TokenBaseKind_ParentheticalClose ||
token->kind == TokenBaseKind_StatementClose)
{
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), color_operator);
}
else
{
String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, token);
Code_Index_Note *note = code_index_note_from_string(lexeme);
#if 0
// TODO(allen): Put in 4coder_draw.cpp
// NOTE(allen): Color functions
// Underline tokens that match the identifier the cursor is on
if (string_match(lexeme, cursor_token_string))
{
Rect_f32 cur_tok_rect = text_layout_character_on_screen(app, text_layout_id, token->pos);
cur_tok_rect = Rf32_xy_wh(V2f32(cur_tok_rect.x0, cur_tok_rect.y1 - 2.f), tok_rect_dim);
draw_rectangle(app, cur_tok_rect, 5.f, argb_color_blend(color_cur_token, 0.7f, color_back));
}
Scratch_Block scratch(app);
ARGB_Color argb = 0xFFFF00FF;
if (note != 0)
{
ARGB_Color token_color = color_default;
switch (note->note_kind)
{
case CodeIndexNote_Type: token_color = color_type; break;
case CodeIndexNote_Function: token_color = color_function; break;
case CodeIndexNote_Macro: token_color = color_macro; break;
default: {} break;
Token_Iterator_Array it = token_iterator_pos(0, &token_array, visible_range.first);
for (;;){
if (!token_it_inc_non_whitespace(&it)){
break;
}
Token *token = token_it_read(&it);
String_Const_u8 lexeme = push_token_lexeme(app, scratch, buffer, token);
Code_Index_Note *note = code_index_note_from_string(lexeme);
if (note != 0 && note->note_kind == CodeIndexNote_Function){
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), argb);
}
paint_text_color(app, text_layout_id, Ii64_size(token->pos, token->size), token_color);
}
}
}
#endif
}
else
{
paint_text_color(app, text_layout_id, visible_range, color_default);
else{
paint_text_color_fcolor(app, text_layout_id, visible_range, fcolor_id(defcolor_text_default));
}
i64 cursor_pos = view_correct_cursor(app, view_id);
@ -443,18 +331,6 @@ function void default_render_buffer(
draw_scope_highlight(app, buffer, text_layout_id, cursor_pos, colors.vals, colors.count);
}
// NOTE(PS): QOL Column
if (qol_col_cursor.pos >= 0){
Buffer_Seek seek = seek_line_col(qol_col_cursor.line, qol_col_cursor.col);
Buffer_Cursor cursor = buffer_compute_cursor(app, buffer, seek);
Rect_f32 col_rect = text_layout_character_on_screen(app, text_layout_id, cursor.pos);
if (col_rect.x1 > 0.f){
col_rect.y0 = rect.y0;
col_rect.y1 = rect.y1;
draw_rectangle_fcolor(app, col_rect, 0.f, fcolor_id(defcolor_highlight_cursor_line));
}
}
b32 use_error_highlight = def_get_config_b32(vars_save_string_lit("use_error_highlight"));
b32 use_jump_highlight = def_get_config_b32(vars_save_string_lit("use_jump_highlight"));
if (use_error_highlight || use_jump_highlight){
@ -607,14 +483,33 @@ default_render_caller(Application_Links *app, Frame_Info frame_info, View_ID vie
// NOTE(allen): draw the buffer
default_render_buffer(app, view_id, face_id, buffer, text_layout_id, region);
loco_render_buffer(app, view_id, face_id, buffer, text_layout_id, region, frame_info);
text_layout_free(app, text_layout_id);
draw_set_clip(app, prev_clip);
}
function void
default_whole_screen_render_caller(Application_Links *app, Frame_Info frame_info){}
default_whole_screen_render_caller(Application_Links *app, Frame_Info frame_info){
#if 0
Rect_f32 region = global_get_screen_rectangle(app);
Vec2_f32 center = rect_center(region);
Face_ID face_id = get_face_id(app, 0);
Scratch_Block scratch(app);
draw_string_oriented(app, face_id, finalize_color(defcolor_text_default, 0),
SCu8("Hello, World!"), center - V2f32(200.f, 300.f),
0, V2f32(0.f, -1.f));
draw_string_oriented(app, face_id, finalize_color(defcolor_text_default, 0),
SCu8("Hello, World!"), center - V2f32(240.f, 300.f),
0, V2f32(0.f, 1.f));
draw_string_oriented(app, face_id, finalize_color(defcolor_text_default, 0),
SCu8("Hello, World!"), center - V2f32(400.f, 400.f),
0, V2f32(-1.f, 0.f));
draw_string_oriented(app, face_id, finalize_color(defcolor_text_default, 0),
SCu8("Hello, World!"), center - V2f32(400.f, -100.f),
0, V2f32(cos_f32(pi_f32*.333f), sin_f32(pi_f32*.333f)));
#endif
}
HOOK_SIG(default_view_adjust){
// NOTE(allen): Called whenever the view layout/sizes have been modified,
@ -734,70 +629,6 @@ BUFFER_NAME_RESOLVER_SIG(default_buffer_name_resolution){
}
}
BUFFER_NAME_RESOLVER_SIG(gs_buffer_name_resolution)
{
if (conflict_count <= 1) return;
Scratch_Block scratch(app);
Variable_Handle prj_var = vars_read_key(vars_get_root(), vars_save_string_lit("prj_config"));
String8 prj_dir = prj_path_from_project(scratch, prj_var);
u8 path_divider = '\\';
u64 prj_dir_slash_index = string_find_first_slash(prj_dir);
if (prj_dir_slash_index < prj_dir.size) path_divider = prj_dir.str[prj_dir_slash_index];
for (int i = 0; i < conflict_count; i++)
{
Buffer_Name_Conflict_Entry *conflict = &conflicts[i];
String_Const_u8 file_name = conflict->file_name;
String_Const_u8 uniqueifier;
// Convert the file_name_prefix to have the same path divider as prj_dir
String_Const_u8 file_name_prefix = push_string_copy(scratch, string_prefix(file_name, prj_dir.size));
for (int j = 0; j < file_name_prefix.size; j++)
{
if (character_is_slash(file_name_prefix.str[j])) file_name_prefix.str[j] = path_divider;
}
// If the full path to the file matches the project path,
// append a project local unique identifier to the filename
// otherwise, simply add on the full path to the file
if (string_match(file_name_prefix, prj_dir))
{
String_Const_u8 file_name_minus_prj_dir = string_skip(file_name, prj_dir.size);
uniqueifier = file_name_minus_prj_dir;
}
else
{
uniqueifier = file_name;
}
String_u8 builder = Su8(conflict->unique_name_in_out,
conflict->unique_name_len_in_out,
conflict->unique_name_capacity);
string_append(&builder, string_u8_litexpr(" <"));
string_append(&builder, uniqueifier);
string_append(&builder, string_u8_litexpr(">"));
conflict->unique_name_len_in_out = builder.size;
}
// double check that each previously conflicting filename is unique
// on a conflict, fall back to the full system path
for (int i = 0; i < conflict_count - 1; i++)
{
String_Const_u8 unique_name_i = SCu8(conflicts[i].unique_name_in_out, conflicts[i].unique_name_len_in_out);
for (int j = i + 1; j < conflict_count; j++)
{
String_Const_u8 unique_name_j = SCu8(conflicts[j].unique_name_in_out, conflicts[j].unique_name_len_in_out);
if (string_match(unique_name_i, unique_name_j))
{
print_message(app, string_u8_litexpr("Unable to provide a unique name for a file. Falling back to its full system path"));
Assert(conflicts[j].file_name.size <= conflicts[j].unique_name_capacity);
block_copy(conflicts[j].unique_name_in_out, conflicts[j].file_name.str, conflicts[j].file_name.size);
}
}
}
}
function void
parse_async__inner(Async_Context *actx, Buffer_ID buffer_id,
String_Const_u8 contents, Token_Array *tokens, i32 limit_factor){
@ -911,8 +742,68 @@ BUFFER_HOOK_SIG(default_begin_buffer){
String_Const_u8 ext = string_file_extension(file_name);
for (i32 i = 0; i < extensions.count; ++i){
if (string_match(ext, extensions.strings[i])){
treat_as_code = true;
break;
if (string_match(ext, string_u8_litexpr("cpp")) ||
string_match(ext, string_u8_litexpr("h")) ||
string_match(ext, string_u8_litexpr("c")) ||
string_match(ext, string_u8_litexpr("hpp")) ||
string_match(ext, string_u8_litexpr("cc"))){
treat_as_code = true;
}
#if 0
treat_as_code = true;
if (string_match(ext, string_u8_litexpr("cs"))){
if (parse_context_language_cs == 0){
init_language_cs(app);
}
parse_context_id = parse_context_language_cs;
}
if (string_match(ext, string_u8_litexpr("java"))){
if (parse_context_language_java == 0){
init_language_java(app);
}
parse_context_id = parse_context_language_java;
}
if (string_match(ext, string_u8_litexpr("rs"))){
if (parse_context_language_rust == 0){
init_language_rust(app);
}
parse_context_id = parse_context_language_rust;
}
if (string_match(ext, string_u8_litexpr("cpp")) ||
string_match(ext, string_u8_litexpr("h")) ||
string_match(ext, string_u8_litexpr("c")) ||
string_match(ext, string_u8_litexpr("hpp")) ||
string_match(ext, string_u8_litexpr("cc"))){
if (parse_context_language_cpp == 0){
init_language_cpp(app);
}
parse_context_id = parse_context_language_cpp;
}
// TODO(NAME): Real GLSL highlighting
if (string_match(ext, string_u8_litexpr("glsl"))){
if (parse_context_language_cpp == 0){
init_language_cpp(app);
}
parse_context_id = parse_context_language_cpp;
}
// TODO(NAME): Real Objective-C highlighting
if (string_match(ext, string_u8_litexpr("m"))){
if (parse_context_language_cpp == 0){
init_language_cpp(app);
}
parse_context_id = parse_context_language_cpp;
}
#endif
break;
}
}
}
@ -934,7 +825,6 @@ BUFFER_HOOK_SIG(default_begin_buffer){
b32 use_lexer = false;
if (treat_as_code){
wrap_lines = def_get_config_b32(vars_save_string_lit("enable_code_wrapping"));
// TODO(PS): @Remove - consider removing the lexer for now? later, replace in favor of tree-sitter
use_lexer = true;
}
@ -1036,8 +926,6 @@ BUFFER_HOOK_SIG(default_file_save){
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
Line_Ending_Kind *eol = scope_attachment(app, scope, buffer_eol_setting,
Line_Ending_Kind);
clean_all_lines_buffer(app, buffer_id, CleanAllLinesMode_RemoveBlankLines);
switch (*eol){
case LineEndingKind_LF:
{
@ -1160,17 +1048,12 @@ BUFFER_EDIT_RANGE_SIG(default_buffer_edit_range){
make_data_struct(&buffer_id));
}
loco_on_buffer_edit(app, buffer_id, old_range, new_range);
// no meaning for return
return(0);
}
BUFFER_HOOK_SIG(default_end_buffer){
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
loco_on_buffer_end(app, buffer_id);
Async_Task *lex_task_ptr = scope_attachment(app, scope, buffer_lex_task, Async_Task);
if (lex_task_ptr != 0){
async_task_cancel(app, &global_async_system, *lex_task_ptr);
@ -1206,7 +1089,7 @@ set_all_default_hooks(Application_Links *app){
set_custom_hook_memory_size(app, HookID_DeltaRule,
delta_ctx_size(fixed_time_cubic_delta_memory_size));
set_custom_hook(app, HookID_BufferNameResolver, gs_buffer_name_resolution);
set_custom_hook(app, HookID_BufferNameResolver, default_buffer_name_resolution);
set_custom_hook(app, HookID_BeginBuffer, default_begin_buffer);
set_custom_hook(app, HookID_EndBuffer, end_buffer_close_jump_list);

View File

@ -34,6 +34,7 @@
#include "generated/lexer_cpp.h"
#include "4coder_variables.h"
#include "4coder_audio.h"
#include "4coder_profile.h"
#include "4coder_async_tasks.h"
#include "4coder_string_match.h"
@ -63,8 +64,6 @@
#include "4coder_profile_inspect.h"
#include "4coder_tutorial.h"
#include "4coder_search_list.h"
#include "4coder_modal.h"
#include "4coder_qol.h"
////////////////////////////////
@ -140,16 +139,13 @@
#include "4coder_doc_commands.cpp"
#include "4coder_docs.cpp"
#include "4coder_variables.cpp"
#include "4coder_audio.cpp"
#include "4coder_search_list.cpp"
#include "4coder_modal.cpp"
#include "4coder_yeet.cpp"
#include "4coder_examples.cpp"
#include "4coder_default_hooks.cpp"
#include "4coder_qol.cpp"
#endif
// BOTTOM

View File

@ -850,15 +850,21 @@ draw_original_4coder_style_cursor_mark_highlight(Application_Links *app, View_ID
i64 cursor_pos = view_get_cursor_pos(app, view_id);
i64 mark_pos = view_get_mark_pos(app, view_id);
if (is_active_view){
Modal_Mode* mode_curr = modal_get_mode_curr();
FColor c0 = mode_curr->cursor_color;
FColor c1 = fcolor_id(defcolor_at_cursor);
draw_character_block(app, text_layout_id, cursor_pos, roundness, c0);
paint_text_color_pos(app, text_layout_id, cursor_pos, c1);
draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, c0);
} else {
draw_character_wire_frame(app, text_layout_id, mark_pos, roundness, outline_thickness, fcolor_id(defcolor_mark));
draw_character_wire_frame(app, text_layout_id, cursor_pos, roundness, outline_thickness, fcolor_id(defcolor_cursor, cursor_sub_id));
draw_character_block(app, text_layout_id, cursor_pos, roundness,
fcolor_id(defcolor_cursor, cursor_sub_id));
paint_text_color_pos(app, text_layout_id, cursor_pos,
fcolor_id(defcolor_at_cursor));
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(defcolor_mark));
}
else{
draw_character_wire_frame(app, text_layout_id, mark_pos,
roundness, outline_thickness,
fcolor_id(defcolor_mark));
draw_character_wire_frame(app, text_layout_id, cursor_pos,
roundness, outline_thickness,
fcolor_id(defcolor_cursor, cursor_sub_id));
}
}
}

View File

@ -208,6 +208,61 @@ CUSTOM_DOC("Example of query_user_string and query_user_number")
}
}
global Audio_Control the_music_control = {};
CUSTOM_COMMAND_SIG(music_start)
CUSTOM_DOC("Starts the music.")
{
local_persist Audio_Clip the_music_clip = {};
if (the_music_clip.sample_count == 0){
Scratch_Block scratch(app);
FILE *file = def_search_normal_fopen(scratch, "audio_test/chtulthu.wav", "rb");
if (file != 0){
the_music_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
}
}
if (!def_audio_is_playing(&the_music_control)){
the_music_control.loop = true;
the_music_control.channel_volume[0] = 1.f;
the_music_control.channel_volume[1] = 1.f;
def_audio_play_clip(the_music_clip, &the_music_control);
}
}
CUSTOM_COMMAND_SIG(music_stop)
CUSTOM_DOC("Stops the music.")
{
def_audio_stop(&the_music_control);
}
CUSTOM_COMMAND_SIG(hit_sfx)
CUSTOM_DOC("Play the hit sound effect")
{
local_persist Audio_Clip the_hit_clip = {};
if (the_hit_clip.sample_count == 0){
Scratch_Block scratch(app);
FILE *file = def_search_normal_fopen(scratch, "audio_test/hit.wav", "rb");
if (file != 0){
the_hit_clip = audio_clip_from_wav_FILE(&global_permanent_arena, file);
fclose(file);
}
}
local_persist u32 index = 0;
local_persist Audio_Control controls[8] = {};
Audio_Control *control = &controls[index%8];
if (!def_audio_is_playing(control)){
control->loop = false;
control->channel_volume[0] = 1.f;
control->channel_volume[1] = 1.f;
def_audio_play_clip(the_hit_clip, control);
index += 1;
}
}
// BOTTOM

View File

@ -55,7 +55,7 @@ parse_buffer_to_jump_array(Application_Links *app, Arena *arena, Buffer_ID buffe
Temp_Memory_Block line_auto_closer(arena);
if (is_valid_line(app, buffer, line)){
String_Const_u8 line_str = push_buffer_line(app, arena, buffer, line);
Parsed_Jump parsed_jump = gs_parse_jump_location(line_str);
Parsed_Jump parsed_jump = parse_jump_location(line_str);
if (parsed_jump.success){
Buffer_ID jump_buffer = {};
if (open_file(app, &jump_buffer, parsed_jump.location.file, false, true)){
@ -454,8 +454,7 @@ get_locked_jump_state(Application_Links *app, Heap *heap){
Buffer_ID buffer = view_get_buffer(app, result.view, Access_Always);
result.list = get_or_make_list_for_buffer(app, heap, buffer);
i64 size = buffer_get_size(app, buffer);
i64 cursor_position = size == 0 ? 0 : view_get_cursor_pos(app, result.view) % size;
i64 cursor_position = view_get_cursor_pos(app, result.view);
Buffer_Cursor cursor = buffer_compute_cursor(app, buffer, seek_pos(cursor_position));
result.list_index = get_index_nearest_from_list(app, result.list, cursor.line);
}
@ -469,8 +468,7 @@ CUSTOM_DOC("If a buffer containing jump locations has been locked in, goes to th
Locked_Jump_State jump_state = get_locked_jump_state(app, heap);
if (jump_state.view != 0){
i64 size = buffer_get_size(app, view_get_buffer(app, jump_state.view, Access_Always));
i64 cursor_position = size == 0 ? 0 : view_get_cursor_pos(app, jump_state.view) % size;
i64 cursor_position = view_get_cursor_pos(app, jump_state.view);
Buffer_Cursor cursor = view_compute_cursor(app, jump_state.view, seek_pos(cursor_position));
i64 line = get_line_from_list(app, jump_state.list, jump_state.list_index);
if (line <= cursor.line){

View File

@ -59,119 +59,6 @@ check_is_note(String_Const_u8 line, u64 colon_pos){
return(is_note);
}
/* ERROR EXAMPLES
These are the cases that gs_parse_jump_location is designed to parse.
############################# JAVASCRIPT / NODE ERROR ##########################
C:\psjr\blackbird\test.js:2
console.error("Foo);
^^^^^^
SyntaxError: Invalid or unexpected token
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
############################# MSVC ERROR #######################################
test.c(4): error C2632: 'int' followed by 'int' is illegal
############################# CLANG ERROR ######################################
test.c:4:1: error: cannot combine with previous 'int' declaration specifier
int main(int argc, char** args) {
############################# JAI ERROR ########################################
C:/projects/games/atof//src/cards.jai:106,48: Error: Semicolon expected after expression.
}
return card_index, (<< collection)[card_index]
*/
function Parsed_Jump
gs_parse_jump_location(String_Const_u8 line)
{
Parsed_Jump jump = {};
jump.sub_jump_indented = (string_get_character(line, 0) == ' ');
String_Const_u8 reduced_line = string_skip_chop_whitespace(line);
u64 whitespace_length = (u64)(reduced_line.str - line.str);
line = reduced_line;
String_Const_u8 separators = str8_lit(":(),"); // characters used to separate paths, indices, and notes
u64 sep1 = string_find_first_of_set(line, separators);
// on windows, paths might have a colon in them. ie. C:\some\path\file.cpp
// we want to skip this first colon - so check if there's a slash after it
// and skip in that case.
if (sep1 + 1 < line.size)
{
if (character_is_slash(string_get_character(line, sep1 + 1))){
u64 next_sep = string_find_first_of_set(
string_skip(line, sep1 + 1),
separators
);
sep1 = next_sep + sep1 + 1;
}
}
u64 sep2 = string_find_first_of_set(
string_skip(line, sep1 + 1),
separators
) + sep1 + 1;
u64 sep3 = string_find_first_of_set(
string_skip(line, sep2 + 1),
separators
) + sep2 + 1;
// TODO(PS): check_is_note? - seems to be checking for test.c(4): note
// ^^^^
// and setting jump.sub_jump_note = true. Not sure what this is for yet
if (sep1 < line.size) {
String_Const_u8 file_name = string_prefix(line, sep1);
if (file_name.size > 0) {
jump.location.file = file_name;
if (sep2 < line.size) {
String_Const_u8 line_number = string_skip(string_prefix(line, sep2), sep1 + 1);
if (string_is_integer(line_number, 10)) {
jump.location.line = (i32)string_to_integer(line_number, 10);
// NOTE(PS): we must at least get a line number to consider the line
// to contain a valid jump location
jump.success = true;
}
}
// NOTE(PS): columns are optional since MSVC doesn't output them
if (sep3 < line.size) {
String_Const_u8 column_number = string_skip(string_prefix(line, sep3), sep2 + 1);
if (string_is_integer(column_number, 10)) {
jump.location.column = (i32)string_to_integer(column_number, 10);
}
jump.colon_position = (i32)(sep3 + whitespace_length);
}
}
}
if (!jump.success){
block_zero_struct(&jump);
}
else{
jump.is_sub_jump = (jump.sub_jump_indented || jump.sub_jump_note);
}
return(jump);
}
function Parsed_Jump
parse_jump_location(String_Const_u8 line){
Parsed_Jump jump = {};
@ -246,10 +133,6 @@ parse_jump_location(String_Const_u8 line){
}
u64 colon_pos2 = string_find_first(string_skip(line, colon_pos1 + 1), ':') + colon_pos1 + 1;
u64 comma_pos2 = string_find_first(string_skip(line, colon_pos1 + 1), ',') + colon_pos1 + 1;
if (comma_pos2 < colon_pos2) {
colon_pos2 = comma_pos2;
}
u64 colon_pos3 = string_find_first(string_skip(line, colon_pos2 + 1), ':') + colon_pos2 + 1;
if (colon_pos3 < line.size){

View File

@ -298,7 +298,6 @@ lister_render(Application_Links *app, Frame_Info frame_info, View_ID view){
for (i32 i = first_index; i < count; i += 1){
Lister_Node *node = lister->filtered.node_ptrs[i];
if (y_pos >= region.y1) break;
Range_f32 y = If32(y_pos, y_pos + block_height);
y_pos = y.max;

View File

@ -274,7 +274,12 @@ lister__backspace_text_field__file_path(Application_Links *app){
User_Input input = get_current_input(app);
String_Const_u8 text_field = lister->text_field.string;
String_Const_u8 new_hot = string_remove_last_folder(text_field);
lister->text_field.size = new_hot.size;
b32 is_modified = has_modifier(&input, KeyCode_Control);
b32 whole_word_when_mod = def_get_config_b32(vars_save_string_lit("lister_whole_word_backspace_when_modified"));
b32 whole_word_backspace = (is_modified == whole_word_when_mod);
if (whole_word_backspace){
lister->text_field.size = new_hot.size;
}
set_hot_directory(app, new_hot);
// TODO(allen): We have to protect against lister_call_refresh_handler
// changing the text_field here. Clean this up.

View File

@ -1,105 +0,0 @@
function void
modal_init(u32 mode_cap, Thread_Context* tctx){
Assert(mode_cap > 0);
modal_modes_cap = mode_cap;
modal_modes = base_array(tctx->allocator, Modal_Mode, mode_cap);
modal_map_id_global = vars_save_string_lit("keys_global");
modal_map_id_file = vars_save_string_lit("keys_file");
modal_map_id_code = vars_save_string_lit("keys_code");
for (u32 i = 0; i < modal_modes_cap; i++){
Modal_Mode* mode = modal_modes + i;
mapping_init(tctx, &mode->map);
setup_essential_mapping(&mode->map, modal_map_id_global, modal_map_id_file, modal_map_id_code);
}
}
function Modal_Mode*
modal_get_mode(u32 mode_id)
{
if (mode_id >= modal_modes_cap) return 0;
return modal_modes + mode_id;
}
function void
modal_bind(Mapping* mode, Command_Map* map, custom_cmd* proc, u32 key_code, u32 mod_key_code0, u32 mod_key_code1)
{
map_set_binding_l(mode, map, BindFWrap_(proc), InputEventKind_KeyStroke, key_code, mod_key_code0, mod_key_code1, 0);
}
function void
modal_bind(u32 mode_id, String_ID map_id, custom_cmd* proc, u32 key_code, u32 mod_key_code0, u32 mod_key_code1)
{
Assert(mode_id < modal_modes_cap);
Modal_Mode* mode = modal_get_mode(mode_id);
Mapping* m = &mode->map;
Command_Map* map = mapping_get_or_make_map(m, map_id);
modal_bind(m, map, proc, key_code, mod_key_code0, mod_key_code1);
}
function void
modal_bind_all(String_ID map_id, custom_cmd* proc, u32 key_code, u32 mod_key_code0, u32 mod_key_code1)
{
for (u32 i = 0; i < modal_modes_cap; i++)
{
Mapping* m = &modal_modes[i].map;
Command_Map* map = mapping_get_or_make_map(m, map_id);
modal_bind(m, map, proc, key_code, mod_key_code0, mod_key_code1);
}
}
function Modal_Mode*
modal_get_mode_curr()
{
return modal_get_mode(modal_curr_mode);
}
function void
modal_set_mode(u32 mode_id)
{
modal_last_mode = modal_curr_mode;
modal_curr_mode = mode_id;
}
function u32
modal_get_next_mode(u32 base)
{
u32 result = (base + 1) % modal_modes_cap;
return result;
}
function void
modal_set_cursor_color(u32 mode_id, FColor color)
{
Modal_Mode* mode = modal_get_mode(mode_id);
mode->cursor_color = color;
}
function void
modal_set_cursor_color_u32(u32 mode_id, u32 color)
{
FColor fc = {};
fc.argb = color;
modal_set_cursor_color(mode_id, fc);
}
CUSTOM_COMMAND_SIG(modal_set_mode_toggle)
{
u32 next_mode = modal_last_mode;
if (next_mode == modal_curr_mode)
{
next_mode = modal_get_next_mode(next_mode);
}
modal_set_mode(next_mode);
}
CUSTOM_COMMAND_SIG(modal_set_mode_next)
{
u32 next_mode = modal_get_next_mode(modal_curr_mode);
modal_set_mode(next_mode);
}

View File

@ -1,17 +0,0 @@
/* date = February 10th 2024 3:00 pm */
#ifndef FRED_MODAL_H
#define FRED_MODAL_H
struct Modal_Mode
{
Mapping map;
FColor cursor_color;
String_Const_u8 name;
};
typedef CUSTOM_COMMAND_SIG(custom_cmd);
function Modal_Mode* modal_get_mode_curr();
#endif //FRED_MODAL_H

View File

@ -459,23 +459,17 @@ prj_generate_project(Arena *scratch, String8 script_path, String8 script_file, S
String8 file_name = push_u8_stringf(scratch, "%.*s/project.4coder", string_expand(script_path));
String8 treat_as_code = def_get_config_string(scratch, vars_save_string_lit("treat_as_code"));
String8Array extensions = parse_extension_line_to_extension_list(scratch, treat_as_code);
FILE *out = fopen((char*)file_name.str, "wb");
if (out != 0){
fprintf(out, "version(2);\n");
fprintf(out, "project_name = \"%.*s\";\n", string_expand(binary_file));
fprintf(out, "patterns = {\n");
for (i32 i = 0; i < extensions.count; i++) {
fprintf(out, "\"*.%.*s\",\n", string_expand(extensions.strings[i]));
}
// fprintf(out, "\"*.c\",\n");
// fprintf(out, "\"*.cpp\",\n");
// fprintf(out, "\"*.h\",\n");
// fprintf(out, "\"*.m\",\n");
// fprintf(out, "\"*.bat\",\n");
// fprintf(out, "\"*.sh\",\n");
fprintf(out, "\"*.c\",\n");
fprintf(out, "\"*.cpp\",\n");
fprintf(out, "\"*.h\",\n");
fprintf(out, "\"*.m\",\n");
fprintf(out, "\"*.bat\",\n");
fprintf(out, "\"*.sh\",\n");
fprintf(out, "\"*.4coder\",\n");
fprintf(out, "};\n");
fprintf(out, "blacklist_patterns = {\n");

View File

@ -1,14 +0,0 @@
/* date = July 7th 2025 2:22 pm */
#ifndef FCODER_QOL_H
#define FCODER_QOL_H
global u8 qol_target_char;
global Buffer_Cursor qol_col_cursor = {-1};
CUSTOM_ID(attachment, qol_view_jumps);
function void qol_pre_command_inner(Application_Links *app, Managed_Scope scope);
function void qol_post_command_inner(Application_Links *app, Managed_Scope scope);
#endif //FCODER_QOL_H

View File

@ -52,7 +52,6 @@ print_string_match_list_to_buffer(Application_Links *app, Buffer_ID out_buffer_i
}
end_buffer_insertion(&out);
lock_jump_buffer(app, out_buffer_id);
}
internal void

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ fi
debug=-g
opts="-Wno-macro-redefined -Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=0"
opts="-Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=0"
pushd $dst
g++ -I"$CUSTOM_ROOT" $opts $full_target -o one_time

Binary file not shown.

View File

@ -0,0 +1,318 @@
enum{
KeyCode_A = 1,
KeyCode_B = 2,
KeyCode_C = 3,
KeyCode_D = 4,
KeyCode_E = 5,
KeyCode_F = 6,
KeyCode_G = 7,
KeyCode_H = 8,
KeyCode_I = 9,
KeyCode_J = 10,
KeyCode_K = 11,
KeyCode_L = 12,
KeyCode_M = 13,
KeyCode_N = 14,
KeyCode_O = 15,
KeyCode_P = 16,
KeyCode_Q = 17,
KeyCode_R = 18,
KeyCode_S = 19,
KeyCode_T = 20,
KeyCode_U = 21,
KeyCode_V = 22,
KeyCode_W = 23,
KeyCode_X = 24,
KeyCode_Y = 25,
KeyCode_Z = 26,
KeyCode_0 = 27,
KeyCode_1 = 28,
KeyCode_2 = 29,
KeyCode_3 = 30,
KeyCode_4 = 31,
KeyCode_5 = 32,
KeyCode_6 = 33,
KeyCode_7 = 34,
KeyCode_8 = 35,
KeyCode_9 = 36,
KeyCode_Space = 37,
KeyCode_Tick = 38,
KeyCode_Minus = 39,
KeyCode_Equal = 40,
KeyCode_LeftBracket = 41,
KeyCode_RightBracket = 42,
KeyCode_Semicolon = 43,
KeyCode_Quote = 44,
KeyCode_Comma = 45,
KeyCode_Period = 46,
KeyCode_ForwardSlash = 47,
KeyCode_BackwardSlash = 48,
KeyCode_Tab = 49,
KeyCode_Escape = 50,
KeyCode_Pause = 51,
KeyCode_Up = 52,
KeyCode_Down = 53,
KeyCode_Left = 54,
KeyCode_Right = 55,
KeyCode_Backspace = 56,
KeyCode_Return = 57,
KeyCode_Delete = 58,
KeyCode_Insert = 59,
KeyCode_Home = 60,
KeyCode_End = 61,
KeyCode_PageUp = 62,
KeyCode_PageDown = 63,
KeyCode_CapsLock = 64,
KeyCode_NumLock = 65,
KeyCode_ScrollLock = 66,
KeyCode_Menu = 67,
KeyCode_Shift = 68,
KeyCode_Control = 69,
KeyCode_Alt = 70,
KeyCode_Command = 71,
KeyCode_F1 = 72,
KeyCode_F2 = 73,
KeyCode_F3 = 74,
KeyCode_F4 = 75,
KeyCode_F5 = 76,
KeyCode_F6 = 77,
KeyCode_F7 = 78,
KeyCode_F8 = 79,
KeyCode_F9 = 80,
KeyCode_F10 = 81,
KeyCode_F11 = 82,
KeyCode_F12 = 83,
KeyCode_F13 = 84,
KeyCode_F14 = 85,
KeyCode_F15 = 86,
KeyCode_F16 = 87,
KeyCode_F17 = 88,
KeyCode_F18 = 89,
KeyCode_F19 = 90,
KeyCode_F20 = 91,
KeyCode_F21 = 92,
KeyCode_F22 = 93,
KeyCode_F23 = 94,
KeyCode_F24 = 95,
KeyCode_NumPad0 = 96,
KeyCode_NumPad1 = 97,
KeyCode_NumPad2 = 98,
KeyCode_NumPad3 = 99,
KeyCode_NumPad4 = 100,
KeyCode_NumPad5 = 101,
KeyCode_NumPad6 = 102,
KeyCode_NumPad7 = 103,
KeyCode_NumPad8 = 104,
KeyCode_NumPad9 = 105,
KeyCode_NumPadStar = 106,
KeyCode_NumPadPlus = 107,
KeyCode_NumPadMinus = 108,
KeyCode_NumPadDot = 109,
KeyCode_NumPadSlash = 110,
KeyCode_Ex0 = 111,
KeyCode_Ex1 = 112,
KeyCode_Ex2 = 113,
KeyCode_Ex3 = 114,
KeyCode_Ex4 = 115,
KeyCode_Ex5 = 116,
KeyCode_Ex6 = 117,
KeyCode_Ex7 = 118,
KeyCode_Ex8 = 119,
KeyCode_Ex9 = 120,
KeyCode_Ex10 = 121,
KeyCode_Ex11 = 122,
KeyCode_Ex12 = 123,
KeyCode_Ex13 = 124,
KeyCode_Ex14 = 125,
KeyCode_Ex15 = 126,
KeyCode_Ex16 = 127,
KeyCode_Ex17 = 128,
KeyCode_Ex18 = 129,
KeyCode_Ex19 = 130,
KeyCode_Ex20 = 131,
KeyCode_Ex21 = 132,
KeyCode_Ex22 = 133,
KeyCode_Ex23 = 134,
KeyCode_Ex24 = 135,
KeyCode_Ex25 = 136,
KeyCode_Ex26 = 137,
KeyCode_Ex27 = 138,
KeyCode_Ex28 = 139,
KeyCode_Ex29 = 140,
KeyCode_COUNT = 141,
};
global char* key_code_name[KeyCode_COUNT] = {
"None",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"Space",
"Tick",
"Minus",
"Equal",
"LeftBracket",
"RightBracket",
"Semicolon",
"Quote",
"Comma",
"Period",
"ForwardSlash",
"BackwardSlash",
"Tab",
"Escape",
"Pause",
"Up",
"Down",
"Left",
"Right",
"Backspace",
"Return",
"Delete",
"Insert",
"Home",
"End",
"PageUp",
"PageDown",
"CapsLock",
"NumLock",
"ScrollLock",
"Menu",
"Shift",
"Control",
"Alt",
"Command",
"F1",
"F2",
"F3",
"F4",
"F5",
"F6",
"F7",
"F8",
"F9",
"F10",
"F11",
"F12",
"F13",
"F14",
"F15",
"F16",
"F17",
"F18",
"F19",
"F20",
"F21",
"F22",
"F23",
"F24",
"NumPad0",
"NumPad1",
"NumPad2",
"NumPad3",
"NumPad4",
"NumPad5",
"NumPad6",
"NumPad7",
"NumPad8",
"NumPad9",
"NumPadStar",
"NumPadPlus",
"NumPadMinus",
"NumPadDot",
"NumPadSlash",
"Ex0",
"Ex1",
"Ex2",
"Ex3",
"Ex4",
"Ex5",
"Ex6",
"Ex7",
"Ex8",
"Ex9",
"Ex10",
"Ex11",
"Ex12",
"Ex13",
"Ex14",
"Ex15",
"Ex16",
"Ex17",
"Ex18",
"Ex19",
"Ex20",
"Ex21",
"Ex22",
"Ex23",
"Ex24",
"Ex25",
"Ex26",
"Ex27",
"Ex28",
"Ex29",
};
enum{
MouseCode_Left = 1,
MouseCode_Middle = 2,
MouseCode_Right = 3,
MouseCode_COUNT = 4,
};
global char* mouse_code_name[MouseCode_COUNT] = {
"None",
"Left",
"Middle",
"Right",
};
enum{
CoreCode_Startup = 1,
CoreCode_Animate = 2,
CoreCode_ClickActivateView = 3,
CoreCode_ClickDeactivateView = 4,
CoreCode_TryExit = 5,
CoreCode_FileExternallyModified = 6,
CoreCode_NewClipboardContents = 7,
CoreCode_COUNT = 8,
};
global char* core_code_name[CoreCode_COUNT] = {
"None",
"Startup",
"Animate",
"ClickActivateView",
"ClickDeactivateView",
"TryExit",
"FileExternallyModified",
"NewClipboardContents",
};

View File

@ -0,0 +1,830 @@
#if !defined(META_PASS)
#define command_id(c) (fcoder_metacmd_ID_##c)
#define command_metadata(c) (&fcoder_metacmd_table[command_id(c)])
#define command_metadata_by_id(id) (&fcoder_metacmd_table[id])
#define command_one_past_last_id 268
#if defined(CUSTOM_COMMAND_SIG)
#define PROC_LINKS(x,y) x
#else
#define PROC_LINKS(x,y) y
#endif
#if defined(CUSTOM_COMMAND_SIG)
CUSTOM_COMMAND_SIG(allow_mouse);
CUSTOM_COMMAND_SIG(auto_indent_line_at_cursor);
CUSTOM_COMMAND_SIG(auto_indent_range);
CUSTOM_COMMAND_SIG(auto_indent_whole_file);
CUSTOM_COMMAND_SIG(backspace_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(backspace_char);
CUSTOM_COMMAND_SIG(basic_change_active_panel);
CUSTOM_COMMAND_SIG(begin_clipboard_collection_mode);
CUSTOM_COMMAND_SIG(build_in_build_panel);
CUSTOM_COMMAND_SIG(build_search);
CUSTOM_COMMAND_SIG(center_view);
CUSTOM_COMMAND_SIG(change_active_panel);
CUSTOM_COMMAND_SIG(change_active_panel_backwards);
CUSTOM_COMMAND_SIG(change_to_build_panel);
CUSTOM_COMMAND_SIG(clean_all_lines);
CUSTOM_COMMAND_SIG(clean_trailing_whitespace);
CUSTOM_COMMAND_SIG(clear_all_themes);
CUSTOM_COMMAND_SIG(clear_clipboard);
CUSTOM_COMMAND_SIG(click_set_cursor);
CUSTOM_COMMAND_SIG(click_set_cursor_and_mark);
CUSTOM_COMMAND_SIG(click_set_cursor_if_lbutton);
CUSTOM_COMMAND_SIG(click_set_mark);
CUSTOM_COMMAND_SIG(clipboard_record_clip);
CUSTOM_COMMAND_SIG(close_all_code);
CUSTOM_COMMAND_SIG(close_build_panel);
CUSTOM_COMMAND_SIG(close_panel);
CUSTOM_COMMAND_SIG(command_documentation);
CUSTOM_COMMAND_SIG(command_lister);
CUSTOM_COMMAND_SIG(comment_line);
CUSTOM_COMMAND_SIG(comment_line_toggle);
CUSTOM_COMMAND_SIG(copy);
CUSTOM_COMMAND_SIG(cursor_mark_swap);
CUSTOM_COMMAND_SIG(custom_api_documentation);
CUSTOM_COMMAND_SIG(cut);
CUSTOM_COMMAND_SIG(decrease_face_size);
CUSTOM_COMMAND_SIG(default_file_externally_modified);
CUSTOM_COMMAND_SIG(default_startup);
CUSTOM_COMMAND_SIG(default_try_exit);
CUSTOM_COMMAND_SIG(default_view_input_handler);
CUSTOM_COMMAND_SIG(delete_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(delete_char);
CUSTOM_COMMAND_SIG(delete_current_scope);
CUSTOM_COMMAND_SIG(delete_file_query);
CUSTOM_COMMAND_SIG(delete_line);
CUSTOM_COMMAND_SIG(delete_range);
CUSTOM_COMMAND_SIG(display_key_codes);
CUSTOM_COMMAND_SIG(display_text_input);
CUSTOM_COMMAND_SIG(double_backspace);
CUSTOM_COMMAND_SIG(duplicate_line);
CUSTOM_COMMAND_SIG(execute_any_cli);
CUSTOM_COMMAND_SIG(execute_previous_cli);
CUSTOM_COMMAND_SIG(exit_4coder);
CUSTOM_COMMAND_SIG(go_to_user_directory);
CUSTOM_COMMAND_SIG(goto_beginning_of_file);
CUSTOM_COMMAND_SIG(goto_end_of_file);
CUSTOM_COMMAND_SIG(goto_first_jump);
CUSTOM_COMMAND_SIG(goto_first_jump_same_panel_sticky);
CUSTOM_COMMAND_SIG(goto_jump_at_cursor);
CUSTOM_COMMAND_SIG(goto_jump_at_cursor_same_panel);
CUSTOM_COMMAND_SIG(goto_line);
CUSTOM_COMMAND_SIG(goto_next_jump);
CUSTOM_COMMAND_SIG(goto_next_jump_no_skips);
CUSTOM_COMMAND_SIG(goto_prev_jump);
CUSTOM_COMMAND_SIG(goto_prev_jump_no_skips);
CUSTOM_COMMAND_SIG(hide_filebar);
CUSTOM_COMMAND_SIG(hide_scrollbar);
CUSTOM_COMMAND_SIG(hit_sfx);
CUSTOM_COMMAND_SIG(hms_demo_tutorial);
CUSTOM_COMMAND_SIG(if0_off);
CUSTOM_COMMAND_SIG(if_read_only_goto_position);
CUSTOM_COMMAND_SIG(if_read_only_goto_position_same_panel);
CUSTOM_COMMAND_SIG(increase_face_size);
CUSTOM_COMMAND_SIG(interactive_kill_buffer);
CUSTOM_COMMAND_SIG(interactive_new);
CUSTOM_COMMAND_SIG(interactive_open);
CUSTOM_COMMAND_SIG(interactive_open_or_new);
CUSTOM_COMMAND_SIG(interactive_switch_buffer);
CUSTOM_COMMAND_SIG(jump_to_definition);
CUSTOM_COMMAND_SIG(jump_to_definition_at_cursor);
CUSTOM_COMMAND_SIG(jump_to_last_point);
CUSTOM_COMMAND_SIG(keyboard_macro_finish_recording);
CUSTOM_COMMAND_SIG(keyboard_macro_replay);
CUSTOM_COMMAND_SIG(keyboard_macro_start_recording);
CUSTOM_COMMAND_SIG(kill_buffer);
CUSTOM_COMMAND_SIG(kill_tutorial);
CUSTOM_COMMAND_SIG(left_adjust_view);
CUSTOM_COMMAND_SIG(list_all_functions_all_buffers);
CUSTOM_COMMAND_SIG(list_all_functions_all_buffers_lister);
CUSTOM_COMMAND_SIG(list_all_functions_current_buffer);
CUSTOM_COMMAND_SIG(list_all_functions_current_buffer_lister);
CUSTOM_COMMAND_SIG(list_all_locations);
CUSTOM_COMMAND_SIG(list_all_locations_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_identifier);
CUSTOM_COMMAND_SIG(list_all_locations_of_identifier_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_selection);
CUSTOM_COMMAND_SIG(list_all_locations_of_selection_case_insensitive);
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition);
CUSTOM_COMMAND_SIG(list_all_locations_of_type_definition_of_identifier);
CUSTOM_COMMAND_SIG(list_all_substring_locations);
CUSTOM_COMMAND_SIG(list_all_substring_locations_case_insensitive);
CUSTOM_COMMAND_SIG(load_project);
CUSTOM_COMMAND_SIG(load_theme_current_buffer);
CUSTOM_COMMAND_SIG(load_themes_default_folder);
CUSTOM_COMMAND_SIG(load_themes_hot_directory);
CUSTOM_COMMAND_SIG(make_directory_query);
CUSTOM_COMMAND_SIG(miblo_decrement_basic);
CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp);
CUSTOM_COMMAND_SIG(miblo_decrement_time_stamp_minute);
CUSTOM_COMMAND_SIG(miblo_increment_basic);
CUSTOM_COMMAND_SIG(miblo_increment_time_stamp);
CUSTOM_COMMAND_SIG(miblo_increment_time_stamp_minute);
CUSTOM_COMMAND_SIG(mouse_wheel_change_face_size);
CUSTOM_COMMAND_SIG(mouse_wheel_scroll);
CUSTOM_COMMAND_SIG(move_down);
CUSTOM_COMMAND_SIG(move_down_10);
CUSTOM_COMMAND_SIG(move_down_textual);
CUSTOM_COMMAND_SIG(move_down_to_blank_line);
CUSTOM_COMMAND_SIG(move_down_to_blank_line_end);
CUSTOM_COMMAND_SIG(move_down_to_blank_line_skip_whitespace);
CUSTOM_COMMAND_SIG(move_left);
CUSTOM_COMMAND_SIG(move_left_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(move_left_alpha_numeric_or_camel_boundary);
CUSTOM_COMMAND_SIG(move_left_token_boundary);
CUSTOM_COMMAND_SIG(move_left_whitespace_boundary);
CUSTOM_COMMAND_SIG(move_left_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(move_line_down);
CUSTOM_COMMAND_SIG(move_line_up);
CUSTOM_COMMAND_SIG(move_right);
CUSTOM_COMMAND_SIG(move_right_alpha_numeric_boundary);
CUSTOM_COMMAND_SIG(move_right_alpha_numeric_or_camel_boundary);
CUSTOM_COMMAND_SIG(move_right_token_boundary);
CUSTOM_COMMAND_SIG(move_right_whitespace_boundary);
CUSTOM_COMMAND_SIG(move_right_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(move_up);
CUSTOM_COMMAND_SIG(move_up_10);
CUSTOM_COMMAND_SIG(move_up_to_blank_line);
CUSTOM_COMMAND_SIG(move_up_to_blank_line_end);
CUSTOM_COMMAND_SIG(move_up_to_blank_line_skip_whitespace);
CUSTOM_COMMAND_SIG(multi_paste);
CUSTOM_COMMAND_SIG(multi_paste_interactive);
CUSTOM_COMMAND_SIG(multi_paste_interactive_quick);
CUSTOM_COMMAND_SIG(music_start);
CUSTOM_COMMAND_SIG(music_stop);
CUSTOM_COMMAND_SIG(open_all_code);
CUSTOM_COMMAND_SIG(open_all_code_recursive);
CUSTOM_COMMAND_SIG(open_file_in_quotes);
CUSTOM_COMMAND_SIG(open_in_other);
CUSTOM_COMMAND_SIG(open_long_braces);
CUSTOM_COMMAND_SIG(open_long_braces_break);
CUSTOM_COMMAND_SIG(open_long_braces_semicolon);
CUSTOM_COMMAND_SIG(open_matching_file_cpp);
CUSTOM_COMMAND_SIG(open_panel_hsplit);
CUSTOM_COMMAND_SIG(open_panel_vsplit);
CUSTOM_COMMAND_SIG(page_down);
CUSTOM_COMMAND_SIG(page_up);
CUSTOM_COMMAND_SIG(paste);
CUSTOM_COMMAND_SIG(paste_and_indent);
CUSTOM_COMMAND_SIG(paste_next);
CUSTOM_COMMAND_SIG(paste_next_and_indent);
CUSTOM_COMMAND_SIG(place_in_scope);
CUSTOM_COMMAND_SIG(play_with_a_counter);
CUSTOM_COMMAND_SIG(profile_clear);
CUSTOM_COMMAND_SIG(profile_disable);
CUSTOM_COMMAND_SIG(profile_enable);
CUSTOM_COMMAND_SIG(profile_inspect);
CUSTOM_COMMAND_SIG(project_command_F1);
CUSTOM_COMMAND_SIG(project_command_F10);
CUSTOM_COMMAND_SIG(project_command_F11);
CUSTOM_COMMAND_SIG(project_command_F12);
CUSTOM_COMMAND_SIG(project_command_F13);
CUSTOM_COMMAND_SIG(project_command_F14);
CUSTOM_COMMAND_SIG(project_command_F15);
CUSTOM_COMMAND_SIG(project_command_F16);
CUSTOM_COMMAND_SIG(project_command_F2);
CUSTOM_COMMAND_SIG(project_command_F3);
CUSTOM_COMMAND_SIG(project_command_F4);
CUSTOM_COMMAND_SIG(project_command_F5);
CUSTOM_COMMAND_SIG(project_command_F6);
CUSTOM_COMMAND_SIG(project_command_F7);
CUSTOM_COMMAND_SIG(project_command_F8);
CUSTOM_COMMAND_SIG(project_command_F9);
CUSTOM_COMMAND_SIG(project_command_lister);
CUSTOM_COMMAND_SIG(project_fkey_command);
CUSTOM_COMMAND_SIG(project_go_to_root_directory);
CUSTOM_COMMAND_SIG(project_reprint);
CUSTOM_COMMAND_SIG(query_replace);
CUSTOM_COMMAND_SIG(query_replace_identifier);
CUSTOM_COMMAND_SIG(query_replace_selection);
CUSTOM_COMMAND_SIG(quick_swap_buffer);
CUSTOM_COMMAND_SIG(redo);
CUSTOM_COMMAND_SIG(redo_all_buffers);
CUSTOM_COMMAND_SIG(rename_file_query);
CUSTOM_COMMAND_SIG(reopen);
CUSTOM_COMMAND_SIG(replace_in_all_buffers);
CUSTOM_COMMAND_SIG(replace_in_buffer);
CUSTOM_COMMAND_SIG(replace_in_range);
CUSTOM_COMMAND_SIG(reverse_search);
CUSTOM_COMMAND_SIG(reverse_search_identifier);
CUSTOM_COMMAND_SIG(save);
CUSTOM_COMMAND_SIG(save_all_dirty_buffers);
CUSTOM_COMMAND_SIG(save_to_query);
CUSTOM_COMMAND_SIG(search);
CUSTOM_COMMAND_SIG(search_identifier);
CUSTOM_COMMAND_SIG(seek_beginning_of_line);
CUSTOM_COMMAND_SIG(seek_beginning_of_textual_line);
CUSTOM_COMMAND_SIG(seek_end_of_line);
CUSTOM_COMMAND_SIG(seek_end_of_textual_line);
CUSTOM_COMMAND_SIG(select_all);
CUSTOM_COMMAND_SIG(select_next_scope_absolute);
CUSTOM_COMMAND_SIG(select_next_scope_after_current);
CUSTOM_COMMAND_SIG(select_prev_scope_absolute);
CUSTOM_COMMAND_SIG(select_prev_top_most_scope);
CUSTOM_COMMAND_SIG(select_surrounding_scope);
CUSTOM_COMMAND_SIG(select_surrounding_scope_maximal);
CUSTOM_COMMAND_SIG(set_eol_mode_from_contents);
CUSTOM_COMMAND_SIG(set_eol_mode_to_binary);
CUSTOM_COMMAND_SIG(set_eol_mode_to_crlf);
CUSTOM_COMMAND_SIG(set_eol_mode_to_lf);
CUSTOM_COMMAND_SIG(set_face_size);
CUSTOM_COMMAND_SIG(set_face_size_this_buffer);
CUSTOM_COMMAND_SIG(set_mark);
CUSTOM_COMMAND_SIG(set_mode_to_notepad_like);
CUSTOM_COMMAND_SIG(set_mode_to_original);
CUSTOM_COMMAND_SIG(setup_build_bat);
CUSTOM_COMMAND_SIG(setup_build_bat_and_sh);
CUSTOM_COMMAND_SIG(setup_build_sh);
CUSTOM_COMMAND_SIG(setup_new_project);
CUSTOM_COMMAND_SIG(show_filebar);
CUSTOM_COMMAND_SIG(show_scrollbar);
CUSTOM_COMMAND_SIG(show_the_log_graph);
CUSTOM_COMMAND_SIG(snipe_backward_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(snipe_forward_whitespace_or_token_boundary);
CUSTOM_COMMAND_SIG(snippet_lister);
CUSTOM_COMMAND_SIG(string_repeat);
CUSTOM_COMMAND_SIG(suppress_mouse);
CUSTOM_COMMAND_SIG(swap_panels);
CUSTOM_COMMAND_SIG(theme_lister);
CUSTOM_COMMAND_SIG(to_lowercase);
CUSTOM_COMMAND_SIG(to_uppercase);
CUSTOM_COMMAND_SIG(toggle_filebar);
CUSTOM_COMMAND_SIG(toggle_fps_meter);
CUSTOM_COMMAND_SIG(toggle_fullscreen);
CUSTOM_COMMAND_SIG(toggle_highlight_enclosing_scopes);
CUSTOM_COMMAND_SIG(toggle_highlight_line_at_cursor);
CUSTOM_COMMAND_SIG(toggle_line_numbers);
CUSTOM_COMMAND_SIG(toggle_line_wrap);
CUSTOM_COMMAND_SIG(toggle_mouse);
CUSTOM_COMMAND_SIG(toggle_paren_matching_helper);
CUSTOM_COMMAND_SIG(toggle_show_whitespace);
CUSTOM_COMMAND_SIG(toggle_virtual_whitespace);
CUSTOM_COMMAND_SIG(tutorial_maximize);
CUSTOM_COMMAND_SIG(tutorial_minimize);
CUSTOM_COMMAND_SIG(uncomment_line);
CUSTOM_COMMAND_SIG(undo);
CUSTOM_COMMAND_SIG(undo_all_buffers);
CUSTOM_COMMAND_SIG(view_buffer_other_panel);
CUSTOM_COMMAND_SIG(view_jump_list_with_lister);
CUSTOM_COMMAND_SIG(word_complete);
CUSTOM_COMMAND_SIG(word_complete_drop_down);
CUSTOM_COMMAND_SIG(write_block);
CUSTOM_COMMAND_SIG(write_hack);
CUSTOM_COMMAND_SIG(write_note);
CUSTOM_COMMAND_SIG(write_space);
CUSTOM_COMMAND_SIG(write_text_and_auto_indent);
CUSTOM_COMMAND_SIG(write_text_input);
CUSTOM_COMMAND_SIG(write_todo);
CUSTOM_COMMAND_SIG(write_underscore);
CUSTOM_COMMAND_SIG(write_zero_struct);
#endif
struct Command_Metadata{
PROC_LINKS(Custom_Command_Function, void) *proc;
b32 is_ui;
char *name;
i32 name_len;
char *description;
i32 description_len;
char *source_name;
i32 source_name_len;
i32 line_number;
};
static Command_Metadata fcoder_metacmd_table[268] = {
{ PROC_LINKS(allow_mouse, 0), false, "allow_mouse", 11, "Shows the mouse and causes all mouse input to be processed normally.", 68, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 481 },
{ PROC_LINKS(auto_indent_line_at_cursor, 0), false, "auto_indent_line_at_cursor", 26, "Auto-indents the line on which the cursor sits.", 47, "C:\\Dev\\4cc\\code\\custom\\4coder_auto_indent.cpp", 45, 420 },
{ PROC_LINKS(auto_indent_range, 0), false, "auto_indent_range", 17, "Auto-indents the range between the cursor and the mark.", 55, "C:\\Dev\\4cc\\code\\custom\\4coder_auto_indent.cpp", 45, 430 },
{ PROC_LINKS(auto_indent_whole_file, 0), false, "auto_indent_whole_file", 22, "Audo-indents the entire current buffer.", 39, "C:\\Dev\\4cc\\code\\custom\\4coder_auto_indent.cpp", 45, 411 },
{ PROC_LINKS(backspace_alpha_numeric_boundary, 0), false, "backspace_alpha_numeric_boundary", 32, "Delete characters between the cursor position and the first alphanumeric boundary to the left.", 94, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 154 },
{ PROC_LINKS(backspace_char, 0), false, "backspace_char", 14, "Deletes the character to the left of the cursor.", 48, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 96 },
{ PROC_LINKS(basic_change_active_panel, 0), false, "basic_change_active_panel", 25, "Change the currently active panel, moving to the panel with the next highest view_id. Will not skipe the build panel if it is open.", 132, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 668 },
{ PROC_LINKS(begin_clipboard_collection_mode, 0), true, "begin_clipboard_collection_mode", 31, "Allows the user to copy multiple strings from other applications before switching to 4coder and pasting them all.", 113, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 71 },
{ PROC_LINKS(build_in_build_panel, 0), false, "build_in_build_panel", 20, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*. Puts the *compilation* buffer in a panel at the footer of the current view.", 230, "C:\\Dev\\4cc\\code\\custom\\4coder_build_commands.cpp", 48, 160 },
{ PROC_LINKS(build_search, 0), false, "build_search", 12, "Looks for a build.bat, build.sh, or makefile in the current and parent directories. Runs the first that it finds and prints the output to *compilation*.", 153, "C:\\Dev\\4cc\\code\\custom\\4coder_build_commands.cpp", 48, 123 },
{ PROC_LINKS(center_view, 0), false, "center_view", 11, "Centers the view vertically on the line on which the cursor sits.", 65, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 197 },
{ PROC_LINKS(change_active_panel, 0), false, "change_active_panel", 19, "Change the currently active panel, moving to the panel with the next highest view_id.", 85, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 356 },
{ PROC_LINKS(change_active_panel_backwards, 0), false, "change_active_panel_backwards", 29, "Change the currently active panel, moving to the panel with the next lowest view_id.", 84, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 362 },
{ PROC_LINKS(change_to_build_panel, 0), false, "change_to_build_panel", 21, "If the special build panel is open, makes the build panel the active panel.", 75, "C:\\Dev\\4cc\\code\\custom\\4coder_build_commands.cpp", 48, 181 },
{ PROC_LINKS(clean_all_lines, 0), false, "clean_all_lines", 15, "Removes trailing whitespace from all lines and removes all blank lines in the current buffer.", 93, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 648 },
{ PROC_LINKS(clean_trailing_whitespace, 0), false, "clean_trailing_whitespace", 25, "Removes trailing whitespace from all lines in the current buffer.", 65, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 657 },
{ PROC_LINKS(clear_all_themes, 0), false, "clear_all_themes", 16, "Clear the theme list", 20, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 565 },
{ PROC_LINKS(clear_clipboard, 0), false, "clear_clipboard", 15, "Clears the history of the clipboard", 35, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 221 },
{ PROC_LINKS(click_set_cursor, 0), false, "click_set_cursor", 16, "Sets the cursor position to the mouse position.", 47, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 235 },
{ PROC_LINKS(click_set_cursor_and_mark, 0), false, "click_set_cursor_and_mark", 25, "Sets the cursor position and mark to the mouse position.", 56, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 225 },
{ PROC_LINKS(click_set_cursor_if_lbutton, 0), false, "click_set_cursor_if_lbutton", 27, "If the mouse left button is pressed, sets the cursor position to the mouse position.", 84, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 245 },
{ PROC_LINKS(click_set_mark, 0), false, "click_set_mark", 14, "Sets the mark position to the mouse position.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 258 },
{ PROC_LINKS(clipboard_record_clip, 0), false, "clipboard_record_clip", 21, "In response to a new clipboard contents events, saves the new clip onto the clipboard history", 93, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 7 },
{ PROC_LINKS(close_all_code, 0), false, "close_all_code", 14, "Closes any buffer with a filename ending with an extension configured to be recognized as a code file type.", 107, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 829 },
{ PROC_LINKS(close_build_panel, 0), false, "close_build_panel", 17, "If the special build panel is open, closes it.", 46, "C:\\Dev\\4cc\\code\\custom\\4coder_build_commands.cpp", 48, 175 },
{ PROC_LINKS(close_panel, 0), false, "close_panel", 11, "Closes the currently active panel if it is not the only panel open.", 67, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 676 },
{ PROC_LINKS(command_documentation, 0), true, "command_documentation", 21, "Prompts the user to select a command then loads a doc buffer for that item", 74, "C:\\Dev\\4cc\\code\\custom\\4coder_docs.cpp", 38, 190 },
{ PROC_LINKS(command_lister, 0), true, "command_lister", 14, "Opens an interactive list of all registered commands.", 53, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 761 },
{ PROC_LINKS(comment_line, 0), false, "comment_line", 12, "Insert '//' at the beginning of the line after leading whitespace.", 66, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 125 },
{ PROC_LINKS(comment_line_toggle, 0), false, "comment_line_toggle", 19, "Turns uncommented lines into commented lines and vice versa for comments starting with '//'.", 92, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 149 },
{ PROC_LINKS(copy, 0), false, "copy", 4, "Copy the text in the range from the cursor to the mark onto the clipboard.", 74, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 110 },
{ PROC_LINKS(cursor_mark_swap, 0), false, "cursor_mark_swap", 16, "Swaps the position of the cursor and the mark.", 46, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 124 },
{ PROC_LINKS(custom_api_documentation, 0), true, "custom_api_documentation", 24, "Prompts the user to select a Custom API item then loads a doc buffer for that item", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_docs.cpp", 38, 175 },
{ PROC_LINKS(cut, 0), false, "cut", 3, "Cut the text in the range from the cursor to the mark onto the clipboard.", 73, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 119 },
{ PROC_LINKS(decrease_face_size, 0), false, "decrease_face_size", 18, "Decrease the size of the face used by the current buffer.", 57, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 759 },
{ PROC_LINKS(default_file_externally_modified, 0), false, "default_file_externally_modified", 32, "Notes the external modification of attached files by printing a message.", 72, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 2067 },
{ PROC_LINKS(default_startup, 0), false, "default_startup", 15, "Default command for responding to a startup event", 49, "C:\\Dev\\4cc\\code\\custom\\4coder_default_hooks.cpp", 47, 7 },
{ PROC_LINKS(default_try_exit, 0), false, "default_try_exit", 16, "Default command for responding to a try-exit event", 50, "C:\\Dev\\4cc\\code\\custom\\4coder_default_hooks.cpp", 47, 33 },
{ PROC_LINKS(default_view_input_handler, 0), false, "default_view_input_handler", 26, "Input consumption loop for default view behavior", 48, "C:\\Dev\\4cc\\code\\custom\\4coder_default_hooks.cpp", 47, 77 },
{ PROC_LINKS(delete_alpha_numeric_boundary, 0), false, "delete_alpha_numeric_boundary", 29, "Delete characters between the cursor position and the first alphanumeric boundary to the right.", 95, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 162 },
{ PROC_LINKS(delete_char, 0), false, "delete_char", 11, "Deletes the character to the right of the cursor.", 49, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 79 },
{ PROC_LINKS(delete_current_scope, 0), false, "delete_current_scope", 20, "Deletes the braces surrounding the currently selected scope. Leaves the contents within the scope.", 99, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 112 },
{ PROC_LINKS(delete_file_query, 0), false, "delete_file_query", 17, "Deletes the file of the current buffer if 4coder has the appropriate access rights. Will ask the user for confirmation first.", 125, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1385 },
{ PROC_LINKS(delete_line, 0), false, "delete_line", 11, "Delete the line the on which the cursor sits.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1557 },
{ PROC_LINKS(delete_range, 0), false, "delete_range", 12, "Deletes the text in the range between the cursor and the mark.", 62, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 134 },
{ PROC_LINKS(display_key_codes, 0), false, "display_key_codes", 17, "Example of input handling loop", 30, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 90 },
{ PROC_LINKS(display_text_input, 0), false, "display_text_input", 18, "Example of to_writable and leave_current_input_unhandled", 56, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 137 },
{ PROC_LINKS(double_backspace, 0), false, "double_backspace", 16, "Example of history group helpers", 32, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 10 },
{ PROC_LINKS(duplicate_line, 0), false, "duplicate_line", 14, "Create a copy of the line on which the cursor sits.", 51, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1543 },
{ PROC_LINKS(execute_any_cli, 0), false, "execute_any_cli", 15, "Queries for an output buffer name and system command, runs the system command as a CLI and prints the output to the specified buffer.", 133, "C:\\Dev\\4cc\\code\\custom\\4coder_cli_command.cpp", 45, 22 },
{ PROC_LINKS(execute_previous_cli, 0), false, "execute_previous_cli", 20, "If the command execute_any_cli has already been used, this will execute a CLI reusing the most recent buffer name and command.", 126, "C:\\Dev\\4cc\\code\\custom\\4coder_cli_command.cpp", 45, 7 },
{ PROC_LINKS(exit_4coder, 0), false, "exit_4coder", 11, "Attempts to close 4coder.", 25, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 848 },
{ PROC_LINKS(go_to_user_directory, 0), false, "go_to_user_directory", 20, "Go to the 4coder user directory", 31, "C:\\Dev\\4cc\\code\\custom\\4coder_config.cpp", 40, 1655 },
{ PROC_LINKS(goto_beginning_of_file, 0), false, "goto_beginning_of_file", 22, "Sets the cursor to the beginning of the file.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2258 },
{ PROC_LINKS(goto_end_of_file, 0), false, "goto_end_of_file", 16, "Sets the cursor to the end of the file.", 39, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2266 },
{ PROC_LINKS(goto_first_jump, 0), false, "goto_first_jump", 15, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer.", 95, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 525 },
{ PROC_LINKS(goto_first_jump_same_panel_sticky, 0), false, "goto_first_jump_same_panel_sticky", 33, "If a buffer containing jump locations has been locked in, goes to the first jump in the buffer and views the buffer in the panel where the jump list was.", 153, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 542 },
{ PROC_LINKS(goto_jump_at_cursor, 0), false, "goto_jump_at_cursor", 19, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in another view and changes the active panel to the view containing the jump.", 187, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 348 },
{ PROC_LINKS(goto_jump_at_cursor_same_panel, 0), false, "goto_jump_at_cursor_same_panel", 30, "If the cursor is found to be on a jump location, parses the jump location and brings up the file and position in this view, losing the compilation output or jump list.", 167, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 375 },
{ PROC_LINKS(goto_line, 0), false, "goto_line", 9, "Queries the user for a number, and jumps the cursor to the corresponding line.", 78, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 856 },
{ PROC_LINKS(goto_next_jump, 0), false, "goto_next_jump", 14, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, skipping sub jump locations.", 123, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 464 },
{ PROC_LINKS(goto_next_jump_no_skips, 0), false, "goto_next_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the next jump in the buffer, and does not skip sub jump locations.", 132, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 494 },
{ PROC_LINKS(goto_prev_jump, 0), false, "goto_prev_jump", 14, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, skipping sub jump locations.", 127, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 481 },
{ PROC_LINKS(goto_prev_jump_no_skips, 0), false, "goto_prev_jump_no_skips", 23, "If a buffer containing jump locations has been locked in, goes to the previous jump in the buffer, and does not skip sub jump locations.", 136, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 511 },
{ PROC_LINKS(hide_filebar, 0), false, "hide_filebar", 12, "Sets the current view to hide it's filebar.", 43, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 706 },
{ PROC_LINKS(hide_scrollbar, 0), false, "hide_scrollbar", 14, "Sets the current view to hide it's scrollbar.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 692 },
{ PROC_LINKS(hit_sfx, 0), false, "hit_sfx", 7, "Play the hit sound effect", 25, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 240 },
{ PROC_LINKS(hms_demo_tutorial, 0), false, "hms_demo_tutorial", 17, "Tutorial for built in 4coder bindings and features.", 51, "C:\\Dev\\4cc\\code\\custom\\4coder_tutorial.cpp", 42, 869 },
{ PROC_LINKS(if0_off, 0), false, "if0_off", 7, "Surround the range between the cursor and mark with an '#if 0' and an '#endif'", 78, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 70 },
{ PROC_LINKS(if_read_only_goto_position, 0), false, "if_read_only_goto_position", 26, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor.", 106, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 564 },
{ PROC_LINKS(if_read_only_goto_position_same_panel, 0), false, "if_read_only_goto_position_same_panel", 37, "If the buffer in the active view is writable, inserts a character, otherwise performs goto_jump_at_cursor_same_panel.", 117, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_sticky.cpp", 45, 581 },
{ PROC_LINKS(increase_face_size, 0), false, "increase_face_size", 18, "Increase the size of the face used by the current buffer.", 57, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 748 },
{ PROC_LINKS(interactive_kill_buffer, 0), true, "interactive_kill_buffer", 23, "Interactively kill an open buffer.", 34, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 521 },
{ PROC_LINKS(interactive_new, 0), true, "interactive_new", 15, "Interactively creates a new file.", 33, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 661 },
{ PROC_LINKS(interactive_open, 0), true, "interactive_open", 16, "Interactively opens a file.", 27, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 715 },
{ PROC_LINKS(interactive_open_or_new, 0), true, "interactive_open_or_new", 23, "Interactively open a file out of the file system.", 49, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 612 },
{ PROC_LINKS(interactive_switch_buffer, 0), true, "interactive_switch_buffer", 25, "Interactively switch to an open buffer.", 39, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 511 },
{ PROC_LINKS(jump_to_definition, 0), true, "jump_to_definition", 18, "List all definitions in the code index and jump to one chosen by the user.", 74, "C:\\Dev\\4cc\\code\\custom\\4coder_code_index_listers.cpp", 52, 12 },
{ PROC_LINKS(jump_to_definition_at_cursor, 0), true, "jump_to_definition_at_cursor", 28, "Jump to the first definition in the code index matching an identifier at the cursor", 83, "C:\\Dev\\4cc\\code\\custom\\4coder_code_index_listers.cpp", 52, 68 },
{ PROC_LINKS(jump_to_last_point, 0), false, "jump_to_last_point", 18, "Read from the top of the point stack and jump there; if already there pop the top and go to the next option", 107, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1338 },
{ PROC_LINKS(keyboard_macro_finish_recording, 0), false, "keyboard_macro_finish_recording", 31, "Stop macro recording, do nothing if macro recording is not already started", 74, "C:\\Dev\\4cc\\code\\custom\\4coder_keyboard_macro.cpp", 48, 54 },
{ PROC_LINKS(keyboard_macro_replay, 0), false, "keyboard_macro_replay", 21, "Replay the most recently recorded keyboard macro", 48, "C:\\Dev\\4cc\\code\\custom\\4coder_keyboard_macro.cpp", 48, 77 },
{ PROC_LINKS(keyboard_macro_start_recording, 0), false, "keyboard_macro_start_recording", 30, "Start macro recording, do nothing if macro recording is already started", 71, "C:\\Dev\\4cc\\code\\custom\\4coder_keyboard_macro.cpp", 48, 41 },
{ PROC_LINKS(kill_buffer, 0), false, "kill_buffer", 11, "Kills the current buffer.", 25, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1728 },
{ PROC_LINKS(kill_tutorial, 0), false, "kill_tutorial", 13, "If there is an active tutorial, kill it.", 40, "C:\\Dev\\4cc\\code\\custom\\4coder_tutorial.cpp", 42, 9 },
{ PROC_LINKS(left_adjust_view, 0), false, "left_adjust_view", 16, "Sets the left size of the view near the x position of the cursor.", 65, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 212 },
{ PROC_LINKS(list_all_functions_all_buffers, 0), false, "list_all_functions_all_buffers", 30, "Creates a jump list of lines from all buffers that appear to define or declare functions.", 89, "C:\\Dev\\4cc\\code\\custom\\4coder_function_list.cpp", 47, 296 },
{ PROC_LINKS(list_all_functions_all_buffers_lister, 0), true, "list_all_functions_all_buffers_lister", 37, "Creates a lister of locations that look like function definitions and declarations all buffers.", 95, "C:\\Dev\\4cc\\code\\custom\\4coder_function_list.cpp", 47, 302 },
{ PROC_LINKS(list_all_functions_current_buffer, 0), false, "list_all_functions_current_buffer", 33, "Creates a jump list of lines of the current buffer that appear to define or declare functions.", 94, "C:\\Dev\\4cc\\code\\custom\\4coder_function_list.cpp", 47, 268 },
{ PROC_LINKS(list_all_functions_current_buffer_lister, 0), true, "list_all_functions_current_buffer_lister", 40, "Creates a lister of locations that look like function definitions and declarations in the buffer.", 97, "C:\\Dev\\4cc\\code\\custom\\4coder_function_list.cpp", 47, 278 },
{ PROC_LINKS(list_all_locations, 0), false, "list_all_locations", 18, "Queries the user for a string and lists all exact case-sensitive matches found in all open buffers.", 99, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 168 },
{ PROC_LINKS(list_all_locations_case_insensitive, 0), false, "list_all_locations_case_insensitive", 35, "Queries the user for a string and lists all exact case-insensitive matches found in all open buffers.", 101, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 180 },
{ PROC_LINKS(list_all_locations_of_identifier, 0), false, "list_all_locations_of_identifier", 32, "Reads a token or word under the cursor and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 192 },
{ PROC_LINKS(list_all_locations_of_identifier_case_insensitive, 0), false, "list_all_locations_of_identifier_case_insensitive", 49, "Reads a token or word under the cursor and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 198 },
{ PROC_LINKS(list_all_locations_of_selection, 0), false, "list_all_locations_of_selection", 31, "Reads the string in the selected range and lists all exact case-sensitive mathces in all open buffers.", 102, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 204 },
{ PROC_LINKS(list_all_locations_of_selection_case_insensitive, 0), false, "list_all_locations_of_selection_case_insensitive", 48, "Reads the string in the selected range and lists all exact case-insensitive mathces in all open buffers.", 104, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 210 },
{ PROC_LINKS(list_all_locations_of_type_definition, 0), false, "list_all_locations_of_type_definition", 37, "Queries user for string, lists all locations of strings that appear to define a type whose name matches the input string.", 121, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 216 },
{ PROC_LINKS(list_all_locations_of_type_definition_of_identifier, 0), false, "list_all_locations_of_type_definition_of_identifier", 51, "Reads a token or word under the cursor and lists all locations of strings that appear to define a type whose name matches it.", 125, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 224 },
{ PROC_LINKS(list_all_substring_locations, 0), false, "list_all_substring_locations", 28, "Queries the user for a string and lists all case-sensitive substring matches found in all open buffers.", 103, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 174 },
{ PROC_LINKS(list_all_substring_locations_case_insensitive, 0), false, "list_all_substring_locations_case_insensitive", 45, "Queries the user for a string and lists all case-insensitive substring matches found in all open buffers.", 105, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 186 },
{ PROC_LINKS(load_project, 0), false, "load_project", 12, "Looks for a project.4coder file in the current directory and tries to load it. Looks in parent directories until a project file is found or there are no more parents.", 167, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 856 },
{ PROC_LINKS(load_theme_current_buffer, 0), false, "load_theme_current_buffer", 25, "Parse the current buffer as a theme file and add the theme to the theme list. If the buffer has a .4coder postfix in it's name, it is removed when the name is saved.", 165, "C:\\Dev\\4cc\\code\\custom\\4coder_config.cpp", 40, 1611 },
{ PROC_LINKS(load_themes_default_folder, 0), false, "load_themes_default_folder", 26, "Loads all the theme files in the default theme folder.", 54, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 535 },
{ PROC_LINKS(load_themes_hot_directory, 0), false, "load_themes_hot_directory", 25, "Loads all the theme files in the current hot directory.", 55, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 554 },
{ PROC_LINKS(make_directory_query, 0), false, "make_directory_query", 20, "Queries the user for a name and creates a new directory with the given name.", 76, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1497 },
{ PROC_LINKS(miblo_decrement_basic, 0), false, "miblo_decrement_basic", 21, "Decrement an integer under the cursor by one.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 44 },
{ PROC_LINKS(miblo_decrement_time_stamp, 0), false, "miblo_decrement_time_stamp", 26, "Decrement a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 237 },
{ PROC_LINKS(miblo_decrement_time_stamp_minute, 0), false, "miblo_decrement_time_stamp_minute", 33, "Decrement a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 249 },
{ PROC_LINKS(miblo_increment_basic, 0), false, "miblo_increment_basic", 21, "Increment an integer under the cursor by one.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 29 },
{ PROC_LINKS(miblo_increment_time_stamp, 0), false, "miblo_increment_time_stamp", 26, "Increment a time stamp under the cursor by one second. (format [m]m:ss or h:mm:ss", 81, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 231 },
{ PROC_LINKS(miblo_increment_time_stamp_minute, 0), false, "miblo_increment_time_stamp_minute", 33, "Increment a time stamp under the cursor by one minute. (format [m]m:ss or h:mm:ss", 81, "C:\\Dev\\4cc\\code\\custom\\4coder_miblo_numbers.cpp", 47, 243 },
{ PROC_LINKS(mouse_wheel_change_face_size, 0), false, "mouse_wheel_change_face_size", 28, "Reads the state of the mouse wheel and uses it to either increase or decrease the face size.", 92, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 801 },
{ PROC_LINKS(mouse_wheel_scroll, 0), false, "mouse_wheel_scroll", 18, "Reads the scroll wheel value from the mouse state and scrolls accordingly.", 74, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 268 },
{ PROC_LINKS(move_down, 0), false, "move_down", 9, "Moves the cursor down one line.", 31, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 342 },
{ PROC_LINKS(move_down_10, 0), false, "move_down_10", 12, "Moves the cursor down ten lines.", 32, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 354 },
{ PROC_LINKS(move_down_textual, 0), false, "move_down_textual", 17, "Moves down to the next line of actual text, regardless of line wrapping.", 72, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 360 },
{ PROC_LINKS(move_down_to_blank_line, 0), false, "move_down_to_blank_line", 23, "Seeks the cursor down to the next blank line.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 413 },
{ PROC_LINKS(move_down_to_blank_line_end, 0), false, "move_down_to_blank_line_end", 27, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 437 },
{ PROC_LINKS(move_down_to_blank_line_skip_whitespace, 0), false, "move_down_to_blank_line_skip_whitespace", 39, "Seeks the cursor down to the next blank line and places it at the end of the line.", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 425 },
{ PROC_LINKS(move_left, 0), false, "move_left", 9, "Moves the cursor one character to the left.", 43, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 443 },
{ PROC_LINKS(move_left_alpha_numeric_boundary, 0), false, "move_left_alpha_numeric_boundary", 32, "Seek left for boundary between alphanumeric characters and non-alphanumeric characters.", 87, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 520 },
{ PROC_LINKS(move_left_alpha_numeric_or_camel_boundary, 0), false, "move_left_alpha_numeric_or_camel_boundary", 41, "Seek left for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 106, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 534 },
{ PROC_LINKS(move_left_token_boundary, 0), false, "move_left_token_boundary", 24, "Seek left for the next beginning of a token.", 44, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 492 },
{ PROC_LINKS(move_left_whitespace_boundary, 0), false, "move_left_whitespace_boundary", 29, "Seek left for the next boundary between whitespace and non-whitespace.", 70, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 477 },
{ PROC_LINKS(move_left_whitespace_or_token_boundary, 0), false, "move_left_whitespace_or_token_boundary", 38, "Seek left for the next end of a token or boundary between whitespace and non-whitespace.", 88, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 506 },
{ PROC_LINKS(move_line_down, 0), false, "move_line_down", 14, "Swaps the line under the cursor with the line below it, and moves the cursor down with it.", 90, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1537 },
{ PROC_LINKS(move_line_up, 0), false, "move_line_up", 12, "Swaps the line under the cursor with the line above it, and moves the cursor up with it.", 88, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1531 },
{ PROC_LINKS(move_right, 0), false, "move_right", 10, "Moves the cursor one character to the right.", 44, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 451 },
{ PROC_LINKS(move_right_alpha_numeric_boundary, 0), false, "move_right_alpha_numeric_boundary", 33, "Seek right for boundary between alphanumeric characters and non-alphanumeric characters.", 88, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 513 },
{ PROC_LINKS(move_right_alpha_numeric_or_camel_boundary, 0), false, "move_right_alpha_numeric_or_camel_boundary", 42, "Seek right for boundary between alphanumeric characters or camel case word and non-alphanumeric characters.", 107, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 527 },
{ PROC_LINKS(move_right_token_boundary, 0), false, "move_right_token_boundary", 25, "Seek right for the next end of a token.", 39, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 485 },
{ PROC_LINKS(move_right_whitespace_boundary, 0), false, "move_right_whitespace_boundary", 30, "Seek right for the next boundary between whitespace and non-whitespace.", 71, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 469 },
{ PROC_LINKS(move_right_whitespace_or_token_boundary, 0), false, "move_right_whitespace_or_token_boundary", 39, "Seek right for the next end of a token or boundary between whitespace and non-whitespace.", 89, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 499 },
{ PROC_LINKS(move_up, 0), false, "move_up", 7, "Moves the cursor up one line.", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 336 },
{ PROC_LINKS(move_up_10, 0), false, "move_up_10", 10, "Moves the cursor up ten lines.", 30, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 348 },
{ PROC_LINKS(move_up_to_blank_line, 0), false, "move_up_to_blank_line", 21, "Seeks the cursor up to the next blank line.", 43, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 407 },
{ PROC_LINKS(move_up_to_blank_line_end, 0), false, "move_up_to_blank_line_end", 25, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 431 },
{ PROC_LINKS(move_up_to_blank_line_skip_whitespace, 0), false, "move_up_to_blank_line_skip_whitespace", 37, "Seeks the cursor up to the next blank line and places it at the end of the line.", 80, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 419 },
{ PROC_LINKS(multi_paste, 0), false, "multi_paste", 11, "Paste multiple entries from the clipboard at once", 49, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 229 },
{ PROC_LINKS(multi_paste_interactive, 0), false, "multi_paste_interactive", 23, "Paste multiple lines from the clipboard history, controlled with arrow keys", 75, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 371 },
{ PROC_LINKS(multi_paste_interactive_quick, 0), false, "multi_paste_interactive_quick", 29, "Paste multiple lines from the clipboard history, controlled by inputing the number of lines to paste", 100, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 380 },
{ PROC_LINKS(music_start, 0), false, "music_start", 11, "Starts the music.", 17, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 213 },
{ PROC_LINKS(music_stop, 0), false, "music_stop", 10, "Stops the music.", 16, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 234 },
{ PROC_LINKS(open_all_code, 0), false, "open_all_code", 13, "Open all code in the current directory. File types are determined by extensions. An extension is considered code based on the extensions specified in 4coder.config.", 164, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 838 },
{ PROC_LINKS(open_all_code_recursive, 0), false, "open_all_code_recursive", 23, "Works as open_all_code but also runs in all subdirectories.", 59, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 847 },
{ PROC_LINKS(open_file_in_quotes, 0), false, "open_file_in_quotes", 19, "Reads a filename from surrounding '\"' characters and attempts to open the corresponding file.", 94, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1578 },
{ PROC_LINKS(open_in_other, 0), false, "open_in_other", 13, "Interactively opens a file in the other panel.", 46, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 2061 },
{ PROC_LINKS(open_long_braces, 0), false, "open_long_braces", 16, "At the cursor, insert a '{' and '}' separated by a blank line.", 62, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 46 },
{ PROC_LINKS(open_long_braces_break, 0), false, "open_long_braces_break", 22, "At the cursor, insert a '{' and '}break;' separated by a blank line.", 68, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 62 },
{ PROC_LINKS(open_long_braces_semicolon, 0), false, "open_long_braces_semicolon", 26, "At the cursor, insert a '{' and '};' separated by a blank line.", 63, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 54 },
{ PROC_LINKS(open_matching_file_cpp, 0), false, "open_matching_file_cpp", 22, "If the current file is a *.cpp or *.h, attempts to open the corresponding *.h or *.cpp file in the other view.", 110, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1661 },
{ PROC_LINKS(open_panel_hsplit, 0), false, "open_panel_hsplit", 17, "Create a new panel by horizontally splitting the active panel.", 62, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 382 },
{ PROC_LINKS(open_panel_vsplit, 0), false, "open_panel_vsplit", 17, "Create a new panel by vertically splitting the active panel.", 60, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 372 },
{ PROC_LINKS(page_down, 0), false, "page_down", 9, "Scrolls the view down one view height and moves the cursor down one view height.", 80, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 378 },
{ PROC_LINKS(page_up, 0), false, "page_up", 7, "Scrolls the view up one view height and moves the cursor up one view height.", 76, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 370 },
{ PROC_LINKS(paste, 0), false, "paste", 5, "At the cursor, insert the text at the top of the clipboard.", 59, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 130 },
{ PROC_LINKS(paste_and_indent, 0), false, "paste_and_indent", 16, "Paste from the top of clipboard and run auto-indent on the newly pasted text.", 77, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 207 },
{ PROC_LINKS(paste_next, 0), false, "paste_next", 10, "If the previous command was paste or paste_next, replaces the paste range with the next text down on the clipboard, otherwise operates as the paste command.", 156, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 164 },
{ PROC_LINKS(paste_next_and_indent, 0), false, "paste_next_and_indent", 21, "Paste the next item on the clipboard and run auto-indent on the newly pasted text.", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_clipboard.cpp", 43, 214 },
{ PROC_LINKS(place_in_scope, 0), false, "place_in_scope", 14, "Wraps the code contained in the range between cursor and mark with a new curly brace scope.", 91, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 106 },
{ PROC_LINKS(play_with_a_counter, 0), false, "play_with_a_counter", 19, "Example of query bar", 20, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 29 },
{ PROC_LINKS(profile_clear, 0), false, "profile_clear", 13, "Clear all profiling information from 4coder's self profiler.", 60, "C:\\Dev\\4cc\\code\\custom\\4coder_profile.cpp", 41, 226 },
{ PROC_LINKS(profile_disable, 0), false, "profile_disable", 15, "Prevent 4coder's self profiler from gathering new profiling information.", 72, "C:\\Dev\\4cc\\code\\custom\\4coder_profile.cpp", 41, 219 },
{ PROC_LINKS(profile_enable, 0), false, "profile_enable", 14, "Allow 4coder's self profiler to gather new profiling information.", 65, "C:\\Dev\\4cc\\code\\custom\\4coder_profile.cpp", 41, 212 },
{ PROC_LINKS(profile_inspect, 0), true, "profile_inspect", 15, "Inspect all currently collected profiling information in 4coder's self profiler.", 80, "C:\\Dev\\4cc\\code\\custom\\4coder_profile_inspect.cpp", 49, 886 },
{ PROC_LINKS(project_command_F1, 0), false, "project_command_F1", 18, "Run the command with index 1", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1084 },
{ PROC_LINKS(project_command_F10, 0), false, "project_command_F10", 19, "Run the command with index 10", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1138 },
{ PROC_LINKS(project_command_F11, 0), false, "project_command_F11", 19, "Run the command with index 11", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1144 },
{ PROC_LINKS(project_command_F12, 0), false, "project_command_F12", 19, "Run the command with index 12", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1150 },
{ PROC_LINKS(project_command_F13, 0), false, "project_command_F13", 19, "Run the command with index 13", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1156 },
{ PROC_LINKS(project_command_F14, 0), false, "project_command_F14", 19, "Run the command with index 14", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1162 },
{ PROC_LINKS(project_command_F15, 0), false, "project_command_F15", 19, "Run the command with index 15", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1168 },
{ PROC_LINKS(project_command_F16, 0), false, "project_command_F16", 19, "Run the command with index 16", 29, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1174 },
{ PROC_LINKS(project_command_F2, 0), false, "project_command_F2", 18, "Run the command with index 2", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1090 },
{ PROC_LINKS(project_command_F3, 0), false, "project_command_F3", 18, "Run the command with index 3", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1096 },
{ PROC_LINKS(project_command_F4, 0), false, "project_command_F4", 18, "Run the command with index 4", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1102 },
{ PROC_LINKS(project_command_F5, 0), false, "project_command_F5", 18, "Run the command with index 5", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1108 },
{ PROC_LINKS(project_command_F6, 0), false, "project_command_F6", 18, "Run the command with index 6", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1114 },
{ PROC_LINKS(project_command_F7, 0), false, "project_command_F7", 18, "Run the command with index 7", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1120 },
{ PROC_LINKS(project_command_F8, 0), false, "project_command_F8", 18, "Run the command with index 8", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1126 },
{ PROC_LINKS(project_command_F9, 0), false, "project_command_F9", 18, "Run the command with index 9", 28, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1132 },
{ PROC_LINKS(project_command_lister, 0), false, "project_command_lister", 22, "Open a lister of all commands in the currently loaded project.", 62, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1036 },
{ PROC_LINKS(project_fkey_command, 0), false, "project_fkey_command", 20, "Run an 'fkey command' configured in a project.4coder file. Determines the index of the 'fkey command' by which function key or numeric key was pressed to trigger the command.", 175, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 974 },
{ PROC_LINKS(project_go_to_root_directory, 0), false, "project_go_to_root_directory", 28, "Changes 4coder's hot directory to the root directory of the currently loaded project. With no loaded project nothing hapepns.", 125, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1000 },
{ PROC_LINKS(project_reprint, 0), false, "project_reprint", 15, "Prints the current project to the file it was loaded from; prints in the most recent project file version", 105, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1046 },
{ PROC_LINKS(query_replace, 0), false, "query_replace", 13, "Queries the user for two strings, and incrementally replaces every occurence of the first string with the second string.", 120, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1284 },
{ PROC_LINKS(query_replace_identifier, 0), false, "query_replace_identifier", 24, "Queries the user for a string, and incrementally replace every occurence of the word or token found at the cursor with the specified string.", 140, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1305 },
{ PROC_LINKS(query_replace_selection, 0), false, "query_replace_selection", 23, "Queries the user for a string, and incrementally replace every occurence of the string found in the selected range with the specified string.", 141, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1321 },
{ PROC_LINKS(quick_swap_buffer, 0), false, "quick_swap_buffer", 17, "Change to the most recently used buffer in this view - or to the top of the buffer stack if the most recent doesn't exist anymore", 129, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1708 },
{ PROC_LINKS(redo, 0), false, "redo", 4, "Advances forwards through the undo history of the current buffer.", 65, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1888 },
{ PROC_LINKS(redo_all_buffers, 0), false, "redo_all_buffers", 16, "Advances forward through the undo history in the buffer containing the most recent regular edit.", 96, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1985 },
{ PROC_LINKS(rename_file_query, 0), false, "rename_file_query", 17, "Queries the user for a new name and renames the file of the current buffer, altering the buffer's name too.", 107, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1462 },
{ PROC_LINKS(reopen, 0), false, "reopen", 6, "Reopen the current buffer from the hard drive.", 46, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1746 },
{ PROC_LINKS(replace_in_all_buffers, 0), false, "replace_in_all_buffers", 22, "Queries the user for a needle and string. Replaces all occurences of needle with string in all editable buffers.", 112, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1194 },
{ PROC_LINKS(replace_in_buffer, 0), false, "replace_in_buffer", 17, "Queries the user for a needle and string. Replaces all occurences of needle with string in the active buffer.", 109, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1185 },
{ PROC_LINKS(replace_in_range, 0), false, "replace_in_range", 16, "Queries the user for a needle and string. Replaces all occurences of needle with string in the range between cursor and the mark in the active buffer.", 150, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1176 },
{ PROC_LINKS(reverse_search, 0), false, "reverse_search", 14, "Begins an incremental search up through the current buffer for a user specified string.", 87, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1117 },
{ PROC_LINKS(reverse_search_identifier, 0), false, "reverse_search_identifier", 25, "Begins an incremental search up through the current buffer for the word or token under the cursor.", 98, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1129 },
{ PROC_LINKS(save, 0), false, "save", 4, "Saves the current buffer.", 25, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1736 },
{ PROC_LINKS(save_all_dirty_buffers, 0), false, "save_all_dirty_buffers", 22, "Saves all buffers marked dirty (showing the '*' indicator).", 59, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 454 },
{ PROC_LINKS(save_to_query, 0), false, "save_to_query", 13, "Queries the user for a file name and saves the contents of the current buffer, altering the buffer's name too.", 110, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1429 },
{ PROC_LINKS(search, 0), false, "search", 6, "Begins an incremental search down through the current buffer for a user specified string.", 89, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1111 },
{ PROC_LINKS(search_identifier, 0), false, "search_identifier", 17, "Begins an incremental search down through the current buffer for the word or token under the cursor.", 100, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1123 },
{ PROC_LINKS(seek_beginning_of_line, 0), false, "seek_beginning_of_line", 22, "Seeks the cursor to the beginning of the visual line.", 53, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2246 },
{ PROC_LINKS(seek_beginning_of_textual_line, 0), false, "seek_beginning_of_textual_line", 30, "Seeks the cursor to the beginning of the line across all text.", 62, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2234 },
{ PROC_LINKS(seek_end_of_line, 0), false, "seek_end_of_line", 16, "Seeks the cursor to the end of the visual line.", 47, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2252 },
{ PROC_LINKS(seek_end_of_textual_line, 0), false, "seek_end_of_textual_line", 24, "Seeks the cursor to the end of the line across all text.", 56, "C:\\Dev\\4cc\\code\\custom\\4coder_helper.cpp", 40, 2240 },
{ PROC_LINKS(select_all, 0), false, "select_all", 10, "Puts the cursor at the top of the file, and the mark at the bottom of the file.", 79, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 543 },
{ PROC_LINKS(select_next_scope_absolute, 0), false, "select_next_scope_absolute", 26, "Finds the first scope started by '{' after the cursor and puts the cursor and mark on the '{' and '}'.", 102, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 57 },
{ PROC_LINKS(select_next_scope_after_current, 0), false, "select_next_scope_after_current", 31, "If a scope is selected, find first scope that starts after the selected scope. Otherwise find the first scope that starts after the cursor.", 139, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 66 },
{ PROC_LINKS(select_prev_scope_absolute, 0), false, "select_prev_scope_absolute", 26, "Finds the first scope started by '{' before the cursor and puts the cursor and mark on the '{' and '}'.", 103, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 82 },
{ PROC_LINKS(select_prev_top_most_scope, 0), false, "select_prev_top_most_scope", 26, "Finds the first scope that starts before the cursor, then finds the top most scope that contains that scope.", 108, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 99 },
{ PROC_LINKS(select_surrounding_scope, 0), false, "select_surrounding_scope", 24, "Finds the scope enclosed by '{' '}' surrounding the cursor and puts the cursor and mark on the '{' and '}'.", 107, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 27 },
{ PROC_LINKS(select_surrounding_scope_maximal, 0), false, "select_surrounding_scope_maximal", 32, "Selects the top-most scope that surrounds the cursor.", 53, "C:\\Dev\\4cc\\code\\custom\\4coder_scope_commands.cpp", 48, 39 },
{ PROC_LINKS(set_eol_mode_from_contents, 0), false, "set_eol_mode_from_contents", 26, "Sets the buffer's line ending mode to match the contents of the buffer.", 71, "C:\\Dev\\4cc\\code\\custom\\4coder_eol.cpp", 37, 125 },
{ PROC_LINKS(set_eol_mode_to_binary, 0), false, "set_eol_mode_to_binary", 22, "Puts the buffer in bin line ending mode.", 40, "C:\\Dev\\4cc\\code\\custom\\4coder_eol.cpp", 37, 112 },
{ PROC_LINKS(set_eol_mode_to_crlf, 0), false, "set_eol_mode_to_crlf", 20, "Puts the buffer in crlf line ending mode.", 41, "C:\\Dev\\4cc\\code\\custom\\4coder_eol.cpp", 37, 86 },
{ PROC_LINKS(set_eol_mode_to_lf, 0), false, "set_eol_mode_to_lf", 18, "Puts the buffer in lf line ending mode.", 39, "C:\\Dev\\4cc\\code\\custom\\4coder_eol.cpp", 37, 99 },
{ PROC_LINKS(set_face_size, 0), false, "set_face_size", 13, "Set face size of the face used by the current buffer.", 53, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 728 },
{ PROC_LINKS(set_face_size_this_buffer, 0), false, "set_face_size_this_buffer", 25, "Set face size of the face used by the current buffer; if any other buffers are using the same face a new face is created so that only this buffer is effected", 157, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 770 },
{ PROC_LINKS(set_mark, 0), false, "set_mark", 8, "Sets the mark to the current position of the cursor.", 52, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 115 },
{ PROC_LINKS(set_mode_to_notepad_like, 0), false, "set_mode_to_notepad_like", 24, "Sets the edit mode to Notepad like.", 35, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 499 },
{ PROC_LINKS(set_mode_to_original, 0), false, "set_mode_to_original", 20, "Sets the edit mode to 4coder original.", 38, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 493 },
{ PROC_LINKS(setup_build_bat, 0), false, "setup_build_bat", 15, "Queries the user for several configuration options and initializes a new build batch script.", 92, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1018 },
{ PROC_LINKS(setup_build_bat_and_sh, 0), false, "setup_build_bat_and_sh", 22, "Queries the user for several configuration options and initializes a new build batch script.", 92, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1030 },
{ PROC_LINKS(setup_build_sh, 0), false, "setup_build_sh", 14, "Queries the user for several configuration options and initializes a new build shell script.", 92, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1024 },
{ PROC_LINKS(setup_new_project, 0), false, "setup_new_project", 17, "Queries the user for several configuration options and initializes a new 4coder project with build scripts for every OS.", 120, "C:\\Dev\\4cc\\code\\custom\\4coder_project_commands.cpp", 50, 1011 },
{ PROC_LINKS(show_filebar, 0), false, "show_filebar", 12, "Sets the current view to show it's filebar.", 43, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 699 },
{ PROC_LINKS(show_scrollbar, 0), false, "show_scrollbar", 14, "Sets the current view to show it's scrollbar.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 685 },
{ PROC_LINKS(show_the_log_graph, 0), true, "show_the_log_graph", 18, "Parses *log* and displays the 'log graph' UI", 44, "C:\\Dev\\4cc\\code\\custom\\4coder_log_parser.cpp", 44, 991 },
{ PROC_LINKS(snipe_backward_whitespace_or_token_boundary, 0), false, "snipe_backward_whitespace_or_token_boundary", 43, "Delete a single, whole token on or to the left of the cursor and post it to the clipboard.", 90, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 179 },
{ PROC_LINKS(snipe_forward_whitespace_or_token_boundary, 0), false, "snipe_forward_whitespace_or_token_boundary", 42, "Delete a single, whole token on or to the right of the cursor and post it to the clipboard.", 91, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 187 },
{ PROC_LINKS(snippet_lister, 0), true, "snippet_lister", 14, "Opens a snippet lister for inserting whole pre-written snippets of text.", 72, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 237 },
{ PROC_LINKS(string_repeat, 0), false, "string_repeat", 13, "Example of query_user_string and query_user_number", 50, "C:\\Dev\\4cc\\code\\custom\\4coder_examples.cpp", 42, 179 },
{ PROC_LINKS(suppress_mouse, 0), false, "suppress_mouse", 14, "Hides the mouse and causes all mosue input (clicks, position, wheel) to be ignored.", 83, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 475 },
{ PROC_LINKS(swap_panels, 0), false, "swap_panels", 11, "Swaps the active panel with it's sibling.", 41, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1686 },
{ PROC_LINKS(theme_lister, 0), true, "theme_lister", 12, "Opens an interactive list of all registered themes.", 51, "C:\\Dev\\4cc\\code\\custom\\4coder_lists.cpp", 39, 785 },
{ PROC_LINKS(to_lowercase, 0), false, "to_lowercase", 12, "Converts all ascii text in the range between the cursor and the mark to lowercase.", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 569 },
{ PROC_LINKS(to_uppercase, 0), false, "to_uppercase", 12, "Converts all ascii text in the range between the cursor and the mark to uppercase.", 82, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 556 },
{ PROC_LINKS(toggle_filebar, 0), false, "toggle_filebar", 14, "Toggles the visibility status of the current view's filebar.", 60, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 713 },
{ PROC_LINKS(toggle_fps_meter, 0), false, "toggle_fps_meter", 16, "Toggles the visibility of the FPS performance meter", 51, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 722 },
{ PROC_LINKS(toggle_fullscreen, 0), false, "toggle_fullscreen", 17, "Toggle fullscreen mode on or off. The change(s) do not take effect until the next frame.", 89, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 529 },
{ PROC_LINKS(toggle_highlight_enclosing_scopes, 0), false, "toggle_highlight_enclosing_scopes", 33, "In code files scopes surrounding the cursor are highlighted with distinguishing colors.", 87, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 513 },
{ PROC_LINKS(toggle_highlight_line_at_cursor, 0), false, "toggle_highlight_line_at_cursor", 31, "Toggles the line highlight at the cursor.", 41, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 505 },
{ PROC_LINKS(toggle_line_numbers, 0), false, "toggle_line_numbers", 19, "Toggles the left margin line numbers.", 37, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 827 },
{ PROC_LINKS(toggle_line_wrap, 0), false, "toggle_line_wrap", 16, "Toggles the line wrap setting on this buffer.", 45, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 835 },
{ PROC_LINKS(toggle_mouse, 0), false, "toggle_mouse", 12, "Toggles the mouse suppression mode, see suppress_mouse and allow_mouse.", 71, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 487 },
{ PROC_LINKS(toggle_paren_matching_helper, 0), false, "toggle_paren_matching_helper", 28, "In code files matching parentheses pairs are colored with distinguishing colors.", 80, "C:\\Dev\\4cc\\code\\custom\\4coder_default_framework.cpp", 51, 521 },
{ PROC_LINKS(toggle_show_whitespace, 0), false, "toggle_show_whitespace", 22, "Toggles the current buffer's whitespace visibility status.", 58, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 818 },
{ PROC_LINKS(toggle_virtual_whitespace, 0), false, "toggle_virtual_whitespace", 25, "Toggles virtual whitespace for all files.", 41, "C:\\Dev\\4cc\\code\\custom\\4coder_code_index.cpp", 44, 1238 },
{ PROC_LINKS(tutorial_maximize, 0), false, "tutorial_maximize", 17, "Expand the tutorial window", 26, "C:\\Dev\\4cc\\code\\custom\\4coder_tutorial.cpp", 42, 20 },
{ PROC_LINKS(tutorial_minimize, 0), false, "tutorial_minimize", 17, "Shrink the tutorial window", 26, "C:\\Dev\\4cc\\code\\custom\\4coder_tutorial.cpp", 42, 34 },
{ PROC_LINKS(uncomment_line, 0), false, "uncomment_line", 14, "If present, delete '//' at the beginning of the line after leading whitespace.", 78, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 137 },
{ PROC_LINKS(undo, 0), false, "undo", 4, "Advances backwards through the undo history of the current buffer.", 66, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1836 },
{ PROC_LINKS(undo_all_buffers, 0), false, "undo_all_buffers", 16, "Advances backward through the undo history in the buffer containing the most recent regular edit.", 97, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1914 },
{ PROC_LINKS(view_buffer_other_panel, 0), false, "view_buffer_other_panel", 23, "Set the other non-active panel to view the buffer that the active panel views, and switch to that panel.", 104, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 1674 },
{ PROC_LINKS(view_jump_list_with_lister, 0), false, "view_jump_list_with_lister", 26, "When executed on a buffer with jumps, creates a persistent lister for all the jumps", 83, "C:\\Dev\\4cc\\code\\custom\\4coder_jump_lister.cpp", 45, 59 },
{ PROC_LINKS(word_complete, 0), false, "word_complete", 13, "Iteratively tries completing the word to the left of the cursor with other words in open buffers that have the same prefix string.", 130, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 433 },
{ PROC_LINKS(word_complete_drop_down, 0), false, "word_complete_drop_down", 23, "Word complete with drop down menu.", 34, "C:\\Dev\\4cc\\code\\custom\\4coder_search.cpp", 40, 679 },
{ PROC_LINKS(write_block, 0), false, "write_block", 11, "At the cursor, insert a block comment.", 38, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 94 },
{ PROC_LINKS(write_hack, 0), false, "write_hack", 10, "At the cursor, insert a '// HACK' comment, includes user name if it was specified in config.4coder.", 99, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 82 },
{ PROC_LINKS(write_note, 0), false, "write_note", 10, "At the cursor, insert a '// NOTE' comment, includes user name if it was specified in config.4coder.", 99, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 88 },
{ PROC_LINKS(write_space, 0), false, "write_space", 11, "Inserts a space.", 16, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 67 },
{ PROC_LINKS(write_text_and_auto_indent, 0), false, "write_text_and_auto_indent", 26, "Inserts text and auto-indents the line on which the cursor sits if any of the text contains 'layout punctuation' such as ;:{}()[]# and new lines.", 145, "C:\\Dev\\4cc\\code\\custom\\4coder_auto_indent.cpp", 45, 440 },
{ PROC_LINKS(write_text_input, 0), false, "write_text_input", 16, "Inserts whatever text was used to trigger this command.", 55, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 59 },
{ PROC_LINKS(write_todo, 0), false, "write_todo", 10, "At the cursor, insert a '// TODO' comment, includes user name if it was specified in config.4coder.", 99, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 76 },
{ PROC_LINKS(write_underscore, 0), false, "write_underscore", 16, "Inserts an underscore.", 22, "C:\\Dev\\4cc\\code\\custom\\4coder_base_commands.cpp", 47, 73 },
{ PROC_LINKS(write_zero_struct, 0), false, "write_zero_struct", 17, "At the cursor, insert a ' = {};'.", 33, "C:\\Dev\\4cc\\code\\custom\\4coder_combined_write_commands.cpp", 57, 100 },
};
static i32 fcoder_metacmd_ID_allow_mouse = 0;
static i32 fcoder_metacmd_ID_auto_indent_line_at_cursor = 1;
static i32 fcoder_metacmd_ID_auto_indent_range = 2;
static i32 fcoder_metacmd_ID_auto_indent_whole_file = 3;
static i32 fcoder_metacmd_ID_backspace_alpha_numeric_boundary = 4;
static i32 fcoder_metacmd_ID_backspace_char = 5;
static i32 fcoder_metacmd_ID_basic_change_active_panel = 6;
static i32 fcoder_metacmd_ID_begin_clipboard_collection_mode = 7;
static i32 fcoder_metacmd_ID_build_in_build_panel = 8;
static i32 fcoder_metacmd_ID_build_search = 9;
static i32 fcoder_metacmd_ID_center_view = 10;
static i32 fcoder_metacmd_ID_change_active_panel = 11;
static i32 fcoder_metacmd_ID_change_active_panel_backwards = 12;
static i32 fcoder_metacmd_ID_change_to_build_panel = 13;
static i32 fcoder_metacmd_ID_clean_all_lines = 14;
static i32 fcoder_metacmd_ID_clean_trailing_whitespace = 15;
static i32 fcoder_metacmd_ID_clear_all_themes = 16;
static i32 fcoder_metacmd_ID_clear_clipboard = 17;
static i32 fcoder_metacmd_ID_click_set_cursor = 18;
static i32 fcoder_metacmd_ID_click_set_cursor_and_mark = 19;
static i32 fcoder_metacmd_ID_click_set_cursor_if_lbutton = 20;
static i32 fcoder_metacmd_ID_click_set_mark = 21;
static i32 fcoder_metacmd_ID_clipboard_record_clip = 22;
static i32 fcoder_metacmd_ID_close_all_code = 23;
static i32 fcoder_metacmd_ID_close_build_panel = 24;
static i32 fcoder_metacmd_ID_close_panel = 25;
static i32 fcoder_metacmd_ID_command_documentation = 26;
static i32 fcoder_metacmd_ID_command_lister = 27;
static i32 fcoder_metacmd_ID_comment_line = 28;
static i32 fcoder_metacmd_ID_comment_line_toggle = 29;
static i32 fcoder_metacmd_ID_copy = 30;
static i32 fcoder_metacmd_ID_cursor_mark_swap = 31;
static i32 fcoder_metacmd_ID_custom_api_documentation = 32;
static i32 fcoder_metacmd_ID_cut = 33;
static i32 fcoder_metacmd_ID_decrease_face_size = 34;
static i32 fcoder_metacmd_ID_default_file_externally_modified = 35;
static i32 fcoder_metacmd_ID_default_startup = 36;
static i32 fcoder_metacmd_ID_default_try_exit = 37;
static i32 fcoder_metacmd_ID_default_view_input_handler = 38;
static i32 fcoder_metacmd_ID_delete_alpha_numeric_boundary = 39;
static i32 fcoder_metacmd_ID_delete_char = 40;
static i32 fcoder_metacmd_ID_delete_current_scope = 41;
static i32 fcoder_metacmd_ID_delete_file_query = 42;
static i32 fcoder_metacmd_ID_delete_line = 43;
static i32 fcoder_metacmd_ID_delete_range = 44;
static i32 fcoder_metacmd_ID_display_key_codes = 45;
static i32 fcoder_metacmd_ID_display_text_input = 46;
static i32 fcoder_metacmd_ID_double_backspace = 47;
static i32 fcoder_metacmd_ID_duplicate_line = 48;
static i32 fcoder_metacmd_ID_execute_any_cli = 49;
static i32 fcoder_metacmd_ID_execute_previous_cli = 50;
static i32 fcoder_metacmd_ID_exit_4coder = 51;
static i32 fcoder_metacmd_ID_go_to_user_directory = 52;
static i32 fcoder_metacmd_ID_goto_beginning_of_file = 53;
static i32 fcoder_metacmd_ID_goto_end_of_file = 54;
static i32 fcoder_metacmd_ID_goto_first_jump = 55;
static i32 fcoder_metacmd_ID_goto_first_jump_same_panel_sticky = 56;
static i32 fcoder_metacmd_ID_goto_jump_at_cursor = 57;
static i32 fcoder_metacmd_ID_goto_jump_at_cursor_same_panel = 58;
static i32 fcoder_metacmd_ID_goto_line = 59;
static i32 fcoder_metacmd_ID_goto_next_jump = 60;
static i32 fcoder_metacmd_ID_goto_next_jump_no_skips = 61;
static i32 fcoder_metacmd_ID_goto_prev_jump = 62;
static i32 fcoder_metacmd_ID_goto_prev_jump_no_skips = 63;
static i32 fcoder_metacmd_ID_hide_filebar = 64;
static i32 fcoder_metacmd_ID_hide_scrollbar = 65;
static i32 fcoder_metacmd_ID_hit_sfx = 66;
static i32 fcoder_metacmd_ID_hms_demo_tutorial = 67;
static i32 fcoder_metacmd_ID_if0_off = 68;
static i32 fcoder_metacmd_ID_if_read_only_goto_position = 69;
static i32 fcoder_metacmd_ID_if_read_only_goto_position_same_panel = 70;
static i32 fcoder_metacmd_ID_increase_face_size = 71;
static i32 fcoder_metacmd_ID_interactive_kill_buffer = 72;
static i32 fcoder_metacmd_ID_interactive_new = 73;
static i32 fcoder_metacmd_ID_interactive_open = 74;
static i32 fcoder_metacmd_ID_interactive_open_or_new = 75;
static i32 fcoder_metacmd_ID_interactive_switch_buffer = 76;
static i32 fcoder_metacmd_ID_jump_to_definition = 77;
static i32 fcoder_metacmd_ID_jump_to_definition_at_cursor = 78;
static i32 fcoder_metacmd_ID_jump_to_last_point = 79;
static i32 fcoder_metacmd_ID_keyboard_macro_finish_recording = 80;
static i32 fcoder_metacmd_ID_keyboard_macro_replay = 81;
static i32 fcoder_metacmd_ID_keyboard_macro_start_recording = 82;
static i32 fcoder_metacmd_ID_kill_buffer = 83;
static i32 fcoder_metacmd_ID_kill_tutorial = 84;
static i32 fcoder_metacmd_ID_left_adjust_view = 85;
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers = 86;
static i32 fcoder_metacmd_ID_list_all_functions_all_buffers_lister = 87;
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer = 88;
static i32 fcoder_metacmd_ID_list_all_functions_current_buffer_lister = 89;
static i32 fcoder_metacmd_ID_list_all_locations = 90;
static i32 fcoder_metacmd_ID_list_all_locations_case_insensitive = 91;
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier = 92;
static i32 fcoder_metacmd_ID_list_all_locations_of_identifier_case_insensitive = 93;
static i32 fcoder_metacmd_ID_list_all_locations_of_selection = 94;
static i32 fcoder_metacmd_ID_list_all_locations_of_selection_case_insensitive = 95;
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition = 96;
static i32 fcoder_metacmd_ID_list_all_locations_of_type_definition_of_identifier = 97;
static i32 fcoder_metacmd_ID_list_all_substring_locations = 98;
static i32 fcoder_metacmd_ID_list_all_substring_locations_case_insensitive = 99;
static i32 fcoder_metacmd_ID_load_project = 100;
static i32 fcoder_metacmd_ID_load_theme_current_buffer = 101;
static i32 fcoder_metacmd_ID_load_themes_default_folder = 102;
static i32 fcoder_metacmd_ID_load_themes_hot_directory = 103;
static i32 fcoder_metacmd_ID_make_directory_query = 104;
static i32 fcoder_metacmd_ID_miblo_decrement_basic = 105;
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp = 106;
static i32 fcoder_metacmd_ID_miblo_decrement_time_stamp_minute = 107;
static i32 fcoder_metacmd_ID_miblo_increment_basic = 108;
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp = 109;
static i32 fcoder_metacmd_ID_miblo_increment_time_stamp_minute = 110;
static i32 fcoder_metacmd_ID_mouse_wheel_change_face_size = 111;
static i32 fcoder_metacmd_ID_mouse_wheel_scroll = 112;
static i32 fcoder_metacmd_ID_move_down = 113;
static i32 fcoder_metacmd_ID_move_down_10 = 114;
static i32 fcoder_metacmd_ID_move_down_textual = 115;
static i32 fcoder_metacmd_ID_move_down_to_blank_line = 116;
static i32 fcoder_metacmd_ID_move_down_to_blank_line_end = 117;
static i32 fcoder_metacmd_ID_move_down_to_blank_line_skip_whitespace = 118;
static i32 fcoder_metacmd_ID_move_left = 119;
static i32 fcoder_metacmd_ID_move_left_alpha_numeric_boundary = 120;
static i32 fcoder_metacmd_ID_move_left_alpha_numeric_or_camel_boundary = 121;
static i32 fcoder_metacmd_ID_move_left_token_boundary = 122;
static i32 fcoder_metacmd_ID_move_left_whitespace_boundary = 123;
static i32 fcoder_metacmd_ID_move_left_whitespace_or_token_boundary = 124;
static i32 fcoder_metacmd_ID_move_line_down = 125;
static i32 fcoder_metacmd_ID_move_line_up = 126;
static i32 fcoder_metacmd_ID_move_right = 127;
static i32 fcoder_metacmd_ID_move_right_alpha_numeric_boundary = 128;
static i32 fcoder_metacmd_ID_move_right_alpha_numeric_or_camel_boundary = 129;
static i32 fcoder_metacmd_ID_move_right_token_boundary = 130;
static i32 fcoder_metacmd_ID_move_right_whitespace_boundary = 131;
static i32 fcoder_metacmd_ID_move_right_whitespace_or_token_boundary = 132;
static i32 fcoder_metacmd_ID_move_up = 133;
static i32 fcoder_metacmd_ID_move_up_10 = 134;
static i32 fcoder_metacmd_ID_move_up_to_blank_line = 135;
static i32 fcoder_metacmd_ID_move_up_to_blank_line_end = 136;
static i32 fcoder_metacmd_ID_move_up_to_blank_line_skip_whitespace = 137;
static i32 fcoder_metacmd_ID_multi_paste = 138;
static i32 fcoder_metacmd_ID_multi_paste_interactive = 139;
static i32 fcoder_metacmd_ID_multi_paste_interactive_quick = 140;
static i32 fcoder_metacmd_ID_music_start = 141;
static i32 fcoder_metacmd_ID_music_stop = 142;
static i32 fcoder_metacmd_ID_open_all_code = 143;
static i32 fcoder_metacmd_ID_open_all_code_recursive = 144;
static i32 fcoder_metacmd_ID_open_file_in_quotes = 145;
static i32 fcoder_metacmd_ID_open_in_other = 146;
static i32 fcoder_metacmd_ID_open_long_braces = 147;
static i32 fcoder_metacmd_ID_open_long_braces_break = 148;
static i32 fcoder_metacmd_ID_open_long_braces_semicolon = 149;
static i32 fcoder_metacmd_ID_open_matching_file_cpp = 150;
static i32 fcoder_metacmd_ID_open_panel_hsplit = 151;
static i32 fcoder_metacmd_ID_open_panel_vsplit = 152;
static i32 fcoder_metacmd_ID_page_down = 153;
static i32 fcoder_metacmd_ID_page_up = 154;
static i32 fcoder_metacmd_ID_paste = 155;
static i32 fcoder_metacmd_ID_paste_and_indent = 156;
static i32 fcoder_metacmd_ID_paste_next = 157;
static i32 fcoder_metacmd_ID_paste_next_and_indent = 158;
static i32 fcoder_metacmd_ID_place_in_scope = 159;
static i32 fcoder_metacmd_ID_play_with_a_counter = 160;
static i32 fcoder_metacmd_ID_profile_clear = 161;
static i32 fcoder_metacmd_ID_profile_disable = 162;
static i32 fcoder_metacmd_ID_profile_enable = 163;
static i32 fcoder_metacmd_ID_profile_inspect = 164;
static i32 fcoder_metacmd_ID_project_command_F1 = 165;
static i32 fcoder_metacmd_ID_project_command_F10 = 166;
static i32 fcoder_metacmd_ID_project_command_F11 = 167;
static i32 fcoder_metacmd_ID_project_command_F12 = 168;
static i32 fcoder_metacmd_ID_project_command_F13 = 169;
static i32 fcoder_metacmd_ID_project_command_F14 = 170;
static i32 fcoder_metacmd_ID_project_command_F15 = 171;
static i32 fcoder_metacmd_ID_project_command_F16 = 172;
static i32 fcoder_metacmd_ID_project_command_F2 = 173;
static i32 fcoder_metacmd_ID_project_command_F3 = 174;
static i32 fcoder_metacmd_ID_project_command_F4 = 175;
static i32 fcoder_metacmd_ID_project_command_F5 = 176;
static i32 fcoder_metacmd_ID_project_command_F6 = 177;
static i32 fcoder_metacmd_ID_project_command_F7 = 178;
static i32 fcoder_metacmd_ID_project_command_F8 = 179;
static i32 fcoder_metacmd_ID_project_command_F9 = 180;
static i32 fcoder_metacmd_ID_project_command_lister = 181;
static i32 fcoder_metacmd_ID_project_fkey_command = 182;
static i32 fcoder_metacmd_ID_project_go_to_root_directory = 183;
static i32 fcoder_metacmd_ID_project_reprint = 184;
static i32 fcoder_metacmd_ID_query_replace = 185;
static i32 fcoder_metacmd_ID_query_replace_identifier = 186;
static i32 fcoder_metacmd_ID_query_replace_selection = 187;
static i32 fcoder_metacmd_ID_quick_swap_buffer = 188;
static i32 fcoder_metacmd_ID_redo = 189;
static i32 fcoder_metacmd_ID_redo_all_buffers = 190;
static i32 fcoder_metacmd_ID_rename_file_query = 191;
static i32 fcoder_metacmd_ID_reopen = 192;
static i32 fcoder_metacmd_ID_replace_in_all_buffers = 193;
static i32 fcoder_metacmd_ID_replace_in_buffer = 194;
static i32 fcoder_metacmd_ID_replace_in_range = 195;
static i32 fcoder_metacmd_ID_reverse_search = 196;
static i32 fcoder_metacmd_ID_reverse_search_identifier = 197;
static i32 fcoder_metacmd_ID_save = 198;
static i32 fcoder_metacmd_ID_save_all_dirty_buffers = 199;
static i32 fcoder_metacmd_ID_save_to_query = 200;
static i32 fcoder_metacmd_ID_search = 201;
static i32 fcoder_metacmd_ID_search_identifier = 202;
static i32 fcoder_metacmd_ID_seek_beginning_of_line = 203;
static i32 fcoder_metacmd_ID_seek_beginning_of_textual_line = 204;
static i32 fcoder_metacmd_ID_seek_end_of_line = 205;
static i32 fcoder_metacmd_ID_seek_end_of_textual_line = 206;
static i32 fcoder_metacmd_ID_select_all = 207;
static i32 fcoder_metacmd_ID_select_next_scope_absolute = 208;
static i32 fcoder_metacmd_ID_select_next_scope_after_current = 209;
static i32 fcoder_metacmd_ID_select_prev_scope_absolute = 210;
static i32 fcoder_metacmd_ID_select_prev_top_most_scope = 211;
static i32 fcoder_metacmd_ID_select_surrounding_scope = 212;
static i32 fcoder_metacmd_ID_select_surrounding_scope_maximal = 213;
static i32 fcoder_metacmd_ID_set_eol_mode_from_contents = 214;
static i32 fcoder_metacmd_ID_set_eol_mode_to_binary = 215;
static i32 fcoder_metacmd_ID_set_eol_mode_to_crlf = 216;
static i32 fcoder_metacmd_ID_set_eol_mode_to_lf = 217;
static i32 fcoder_metacmd_ID_set_face_size = 218;
static i32 fcoder_metacmd_ID_set_face_size_this_buffer = 219;
static i32 fcoder_metacmd_ID_set_mark = 220;
static i32 fcoder_metacmd_ID_set_mode_to_notepad_like = 221;
static i32 fcoder_metacmd_ID_set_mode_to_original = 222;
static i32 fcoder_metacmd_ID_setup_build_bat = 223;
static i32 fcoder_metacmd_ID_setup_build_bat_and_sh = 224;
static i32 fcoder_metacmd_ID_setup_build_sh = 225;
static i32 fcoder_metacmd_ID_setup_new_project = 226;
static i32 fcoder_metacmd_ID_show_filebar = 227;
static i32 fcoder_metacmd_ID_show_scrollbar = 228;
static i32 fcoder_metacmd_ID_show_the_log_graph = 229;
static i32 fcoder_metacmd_ID_snipe_backward_whitespace_or_token_boundary = 230;
static i32 fcoder_metacmd_ID_snipe_forward_whitespace_or_token_boundary = 231;
static i32 fcoder_metacmd_ID_snippet_lister = 232;
static i32 fcoder_metacmd_ID_string_repeat = 233;
static i32 fcoder_metacmd_ID_suppress_mouse = 234;
static i32 fcoder_metacmd_ID_swap_panels = 235;
static i32 fcoder_metacmd_ID_theme_lister = 236;
static i32 fcoder_metacmd_ID_to_lowercase = 237;
static i32 fcoder_metacmd_ID_to_uppercase = 238;
static i32 fcoder_metacmd_ID_toggle_filebar = 239;
static i32 fcoder_metacmd_ID_toggle_fps_meter = 240;
static i32 fcoder_metacmd_ID_toggle_fullscreen = 241;
static i32 fcoder_metacmd_ID_toggle_highlight_enclosing_scopes = 242;
static i32 fcoder_metacmd_ID_toggle_highlight_line_at_cursor = 243;
static i32 fcoder_metacmd_ID_toggle_line_numbers = 244;
static i32 fcoder_metacmd_ID_toggle_line_wrap = 245;
static i32 fcoder_metacmd_ID_toggle_mouse = 246;
static i32 fcoder_metacmd_ID_toggle_paren_matching_helper = 247;
static i32 fcoder_metacmd_ID_toggle_show_whitespace = 248;
static i32 fcoder_metacmd_ID_toggle_virtual_whitespace = 249;
static i32 fcoder_metacmd_ID_tutorial_maximize = 250;
static i32 fcoder_metacmd_ID_tutorial_minimize = 251;
static i32 fcoder_metacmd_ID_uncomment_line = 252;
static i32 fcoder_metacmd_ID_undo = 253;
static i32 fcoder_metacmd_ID_undo_all_buffers = 254;
static i32 fcoder_metacmd_ID_view_buffer_other_panel = 255;
static i32 fcoder_metacmd_ID_view_jump_list_with_lister = 256;
static i32 fcoder_metacmd_ID_word_complete = 257;
static i32 fcoder_metacmd_ID_word_complete_drop_down = 258;
static i32 fcoder_metacmd_ID_write_block = 259;
static i32 fcoder_metacmd_ID_write_hack = 260;
static i32 fcoder_metacmd_ID_write_note = 261;
static i32 fcoder_metacmd_ID_write_space = 262;
static i32 fcoder_metacmd_ID_write_text_and_auto_indent = 263;
static i32 fcoder_metacmd_ID_write_text_input = 264;
static i32 fcoder_metacmd_ID_write_todo = 265;
static i32 fcoder_metacmd_ID_write_underscore = 266;
static i32 fcoder_metacmd_ID_write_zero_struct = 267;
#endif

View File

@ -0,0 +1,367 @@
function void
custom_api_fill_vtable(API_VTable_custom *vtable){
vtable->global_set_setting = global_set_setting;
vtable->global_get_screen_rectangle = global_get_screen_rectangle;
vtable->get_thread_context = get_thread_context;
vtable->create_child_process = create_child_process;
vtable->child_process_set_target_buffer = child_process_set_target_buffer;
vtable->buffer_get_attached_child_process = buffer_get_attached_child_process;
vtable->child_process_get_attached_buffer = child_process_get_attached_buffer;
vtable->child_process_get_state = child_process_get_state;
vtable->enqueue_virtual_event = enqueue_virtual_event;
vtable->get_buffer_count = get_buffer_count;
vtable->get_buffer_next = get_buffer_next;
vtable->get_buffer_by_name = get_buffer_by_name;
vtable->get_buffer_by_file_name = get_buffer_by_file_name;
vtable->buffer_read_range = buffer_read_range;
vtable->buffer_replace_range = buffer_replace_range;
vtable->buffer_batch_edit = buffer_batch_edit;
vtable->buffer_seek_string = buffer_seek_string;
vtable->buffer_seek_character_class = buffer_seek_character_class;
vtable->buffer_line_y_difference = buffer_line_y_difference;
vtable->buffer_line_shift_y = buffer_line_shift_y;
vtable->buffer_pos_at_relative_xy = buffer_pos_at_relative_xy;
vtable->buffer_relative_box_of_pos = buffer_relative_box_of_pos;
vtable->buffer_padded_box_of_pos = buffer_padded_box_of_pos;
vtable->buffer_relative_character_from_pos = buffer_relative_character_from_pos;
vtable->buffer_pos_from_relative_character = buffer_pos_from_relative_character;
vtable->view_line_y_difference = view_line_y_difference;
vtable->view_line_shift_y = view_line_shift_y;
vtable->view_pos_at_relative_xy = view_pos_at_relative_xy;
vtable->view_relative_box_of_pos = view_relative_box_of_pos;
vtable->view_padded_box_of_pos = view_padded_box_of_pos;
vtable->view_relative_character_from_pos = view_relative_character_from_pos;
vtable->view_pos_from_relative_character = view_pos_from_relative_character;
vtable->buffer_exists = buffer_exists;
vtable->buffer_get_access_flags = buffer_get_access_flags;
vtable->buffer_get_size = buffer_get_size;
vtable->buffer_get_line_count = buffer_get_line_count;
vtable->push_buffer_base_name = push_buffer_base_name;
vtable->push_buffer_unique_name = push_buffer_unique_name;
vtable->push_buffer_file_name = push_buffer_file_name;
vtable->buffer_get_dirty_state = buffer_get_dirty_state;
vtable->buffer_set_dirty_state = buffer_set_dirty_state;
vtable->buffer_set_layout = buffer_set_layout;
vtable->buffer_clear_layout_cache = buffer_clear_layout_cache;
vtable->buffer_get_layout = buffer_get_layout;
vtable->buffer_get_setting = buffer_get_setting;
vtable->buffer_set_setting = buffer_set_setting;
vtable->buffer_get_managed_scope = buffer_get_managed_scope;
vtable->buffer_send_end_signal = buffer_send_end_signal;
vtable->create_buffer = create_buffer;
vtable->buffer_save = buffer_save;
vtable->buffer_kill = buffer_kill;
vtable->buffer_reopen = buffer_reopen;
vtable->buffer_get_file_attributes = buffer_get_file_attributes;
vtable->get_view_next = get_view_next;
vtable->get_view_prev = get_view_prev;
vtable->get_this_ctx_view = get_this_ctx_view;
vtable->get_active_view = get_active_view;
vtable->view_exists = view_exists;
vtable->view_get_buffer = view_get_buffer;
vtable->view_get_cursor_pos = view_get_cursor_pos;
vtable->view_get_mark_pos = view_get_mark_pos;
vtable->view_get_preferred_x = view_get_preferred_x;
vtable->view_set_preferred_x = view_set_preferred_x;
vtable->view_get_screen_rect = view_get_screen_rect;
vtable->view_get_panel = view_get_panel;
vtable->panel_get_view = panel_get_view;
vtable->panel_is_split = panel_is_split;
vtable->panel_is_leaf = panel_is_leaf;
vtable->panel_split = panel_split;
vtable->panel_set_split = panel_set_split;
vtable->panel_swap_children = panel_swap_children;
vtable->panel_get_root = panel_get_root;
vtable->panel_get_parent = panel_get_parent;
vtable->panel_get_child = panel_get_child;
vtable->view_close = view_close;
vtable->view_get_buffer_region = view_get_buffer_region;
vtable->view_get_buffer_scroll = view_get_buffer_scroll;
vtable->view_set_active = view_set_active;
vtable->view_enqueue_command_function = view_enqueue_command_function;
vtable->view_get_setting = view_get_setting;
vtable->view_set_setting = view_set_setting;
vtable->view_get_managed_scope = view_get_managed_scope;
vtable->buffer_compute_cursor = buffer_compute_cursor;
vtable->view_compute_cursor = view_compute_cursor;
vtable->view_set_camera_bounds = view_set_camera_bounds;
vtable->view_get_camera_bounds = view_get_camera_bounds;
vtable->view_set_cursor = view_set_cursor;
vtable->view_set_buffer_scroll = view_set_buffer_scroll;
vtable->view_set_mark = view_set_mark;
vtable->view_quit_ui = view_quit_ui;
vtable->view_set_buffer = view_set_buffer;
vtable->view_push_context = view_push_context;
vtable->view_pop_context = view_pop_context;
vtable->view_alter_context = view_alter_context;
vtable->view_current_context = view_current_context;
vtable->view_current_context_hook_memory = view_current_context_hook_memory;
vtable->create_user_managed_scope = create_user_managed_scope;
vtable->destroy_user_managed_scope = destroy_user_managed_scope;
vtable->get_global_managed_scope = get_global_managed_scope;
vtable->get_managed_scope_with_multiple_dependencies = get_managed_scope_with_multiple_dependencies;
vtable->managed_scope_clear_contents = managed_scope_clear_contents;
vtable->managed_scope_clear_self_all_dependent_scopes = managed_scope_clear_self_all_dependent_scopes;
vtable->managed_scope_allocator = managed_scope_allocator;
vtable->managed_id_group_highest_id = managed_id_group_highest_id;
vtable->managed_id_declare = managed_id_declare;
vtable->managed_id_get = managed_id_get;
vtable->managed_scope_get_attachment = managed_scope_get_attachment;
vtable->managed_scope_attachment_erase = managed_scope_attachment_erase;
vtable->alloc_managed_memory_in_scope = alloc_managed_memory_in_scope;
vtable->alloc_buffer_markers_on_buffer = alloc_buffer_markers_on_buffer;
vtable->managed_object_get_item_size = managed_object_get_item_size;
vtable->managed_object_get_item_count = managed_object_get_item_count;
vtable->managed_object_get_pointer = managed_object_get_pointer;
vtable->managed_object_get_type = managed_object_get_type;
vtable->managed_object_get_containing_scope = managed_object_get_containing_scope;
vtable->managed_object_free = managed_object_free;
vtable->managed_object_store_data = managed_object_store_data;
vtable->managed_object_load_data = managed_object_load_data;
vtable->get_next_input_raw = get_next_input_raw;
vtable->get_current_input_sequence_number = get_current_input_sequence_number;
vtable->get_current_input = get_current_input;
vtable->set_current_input = set_current_input;
vtable->leave_current_input_unhandled = leave_current_input_unhandled;
vtable->set_custom_hook = set_custom_hook;
vtable->get_custom_hook = get_custom_hook;
vtable->set_custom_hook_memory_size = set_custom_hook_memory_size;
vtable->get_mouse_state = get_mouse_state;
vtable->get_active_query_bars = get_active_query_bars;
vtable->start_query_bar = start_query_bar;
vtable->end_query_bar = end_query_bar;
vtable->clear_all_query_bars = clear_all_query_bars;
vtable->print_message = print_message;
vtable->log_string = log_string;
vtable->get_largest_face_id = get_largest_face_id;
vtable->set_global_face = set_global_face;
vtable->buffer_history_get_max_record_index = buffer_history_get_max_record_index;
vtable->buffer_history_get_record_info = buffer_history_get_record_info;
vtable->buffer_history_get_group_sub_record = buffer_history_get_group_sub_record;
vtable->buffer_history_get_current_state_index = buffer_history_get_current_state_index;
vtable->buffer_history_set_current_state_index = buffer_history_set_current_state_index;
vtable->buffer_history_merge_record_range = buffer_history_merge_record_range;
vtable->buffer_history_clear_after_current_state = buffer_history_clear_after_current_state;
vtable->global_history_edit_group_begin = global_history_edit_group_begin;
vtable->global_history_edit_group_end = global_history_edit_group_end;
vtable->buffer_set_face = buffer_set_face;
vtable->get_face_description = get_face_description;
vtable->get_face_metrics = get_face_metrics;
vtable->get_face_advance_map = get_face_advance_map;
vtable->get_face_id = get_face_id;
vtable->try_create_new_face = try_create_new_face;
vtable->try_modify_face = try_modify_face;
vtable->try_release_face = try_release_face;
vtable->push_hot_directory = push_hot_directory;
vtable->set_hot_directory = set_hot_directory;
vtable->send_exit_signal = send_exit_signal;
vtable->hard_exit = hard_exit;
vtable->set_window_title = set_window_title;
vtable->acquire_global_frame_mutex = acquire_global_frame_mutex;
vtable->release_global_frame_mutex = release_global_frame_mutex;
vtable->draw_string_oriented = draw_string_oriented;
vtable->get_string_advance = get_string_advance;
vtable->draw_rectangle = draw_rectangle;
vtable->draw_rectangle_outline = draw_rectangle_outline;
vtable->draw_set_clip = draw_set_clip;
vtable->text_layout_create = text_layout_create;
vtable->text_layout_region = text_layout_region;
vtable->text_layout_get_buffer = text_layout_get_buffer;
vtable->text_layout_get_visible_range = text_layout_get_visible_range;
vtable->text_layout_line_on_screen = text_layout_line_on_screen;
vtable->text_layout_character_on_screen = text_layout_character_on_screen;
vtable->paint_text_color = paint_text_color;
vtable->paint_text_color_blend = paint_text_color_blend;
vtable->text_layout_free = text_layout_free;
vtable->draw_text_layout = draw_text_layout;
vtable->open_color_picker = open_color_picker;
vtable->animate_in_n_milliseconds = animate_in_n_milliseconds;
vtable->buffer_find_all_matches = buffer_find_all_matches;
vtable->get_core_profile_list = get_core_profile_list;
vtable->get_custom_layer_boundary_docs = get_custom_layer_boundary_docs;
}
#if defined(DYNAMIC_LINK_API)
function void
custom_api_read_vtable(API_VTable_custom *vtable){
global_set_setting = vtable->global_set_setting;
global_get_screen_rectangle = vtable->global_get_screen_rectangle;
get_thread_context = vtable->get_thread_context;
create_child_process = vtable->create_child_process;
child_process_set_target_buffer = vtable->child_process_set_target_buffer;
buffer_get_attached_child_process = vtable->buffer_get_attached_child_process;
child_process_get_attached_buffer = vtable->child_process_get_attached_buffer;
child_process_get_state = vtable->child_process_get_state;
enqueue_virtual_event = vtable->enqueue_virtual_event;
get_buffer_count = vtable->get_buffer_count;
get_buffer_next = vtable->get_buffer_next;
get_buffer_by_name = vtable->get_buffer_by_name;
get_buffer_by_file_name = vtable->get_buffer_by_file_name;
buffer_read_range = vtable->buffer_read_range;
buffer_replace_range = vtable->buffer_replace_range;
buffer_batch_edit = vtable->buffer_batch_edit;
buffer_seek_string = vtable->buffer_seek_string;
buffer_seek_character_class = vtable->buffer_seek_character_class;
buffer_line_y_difference = vtable->buffer_line_y_difference;
buffer_line_shift_y = vtable->buffer_line_shift_y;
buffer_pos_at_relative_xy = vtable->buffer_pos_at_relative_xy;
buffer_relative_box_of_pos = vtable->buffer_relative_box_of_pos;
buffer_padded_box_of_pos = vtable->buffer_padded_box_of_pos;
buffer_relative_character_from_pos = vtable->buffer_relative_character_from_pos;
buffer_pos_from_relative_character = vtable->buffer_pos_from_relative_character;
view_line_y_difference = vtable->view_line_y_difference;
view_line_shift_y = vtable->view_line_shift_y;
view_pos_at_relative_xy = vtable->view_pos_at_relative_xy;
view_relative_box_of_pos = vtable->view_relative_box_of_pos;
view_padded_box_of_pos = vtable->view_padded_box_of_pos;
view_relative_character_from_pos = vtable->view_relative_character_from_pos;
view_pos_from_relative_character = vtable->view_pos_from_relative_character;
buffer_exists = vtable->buffer_exists;
buffer_get_access_flags = vtable->buffer_get_access_flags;
buffer_get_size = vtable->buffer_get_size;
buffer_get_line_count = vtable->buffer_get_line_count;
push_buffer_base_name = vtable->push_buffer_base_name;
push_buffer_unique_name = vtable->push_buffer_unique_name;
push_buffer_file_name = vtable->push_buffer_file_name;
buffer_get_dirty_state = vtable->buffer_get_dirty_state;
buffer_set_dirty_state = vtable->buffer_set_dirty_state;
buffer_set_layout = vtable->buffer_set_layout;
buffer_clear_layout_cache = vtable->buffer_clear_layout_cache;
buffer_get_layout = vtable->buffer_get_layout;
buffer_get_setting = vtable->buffer_get_setting;
buffer_set_setting = vtable->buffer_set_setting;
buffer_get_managed_scope = vtable->buffer_get_managed_scope;
buffer_send_end_signal = vtable->buffer_send_end_signal;
create_buffer = vtable->create_buffer;
buffer_save = vtable->buffer_save;
buffer_kill = vtable->buffer_kill;
buffer_reopen = vtable->buffer_reopen;
buffer_get_file_attributes = vtable->buffer_get_file_attributes;
get_view_next = vtable->get_view_next;
get_view_prev = vtable->get_view_prev;
get_this_ctx_view = vtable->get_this_ctx_view;
get_active_view = vtable->get_active_view;
view_exists = vtable->view_exists;
view_get_buffer = vtable->view_get_buffer;
view_get_cursor_pos = vtable->view_get_cursor_pos;
view_get_mark_pos = vtable->view_get_mark_pos;
view_get_preferred_x = vtable->view_get_preferred_x;
view_set_preferred_x = vtable->view_set_preferred_x;
view_get_screen_rect = vtable->view_get_screen_rect;
view_get_panel = vtable->view_get_panel;
panel_get_view = vtable->panel_get_view;
panel_is_split = vtable->panel_is_split;
panel_is_leaf = vtable->panel_is_leaf;
panel_split = vtable->panel_split;
panel_set_split = vtable->panel_set_split;
panel_swap_children = vtable->panel_swap_children;
panel_get_root = vtable->panel_get_root;
panel_get_parent = vtable->panel_get_parent;
panel_get_child = vtable->panel_get_child;
view_close = vtable->view_close;
view_get_buffer_region = vtable->view_get_buffer_region;
view_get_buffer_scroll = vtable->view_get_buffer_scroll;
view_set_active = vtable->view_set_active;
view_enqueue_command_function = vtable->view_enqueue_command_function;
view_get_setting = vtable->view_get_setting;
view_set_setting = vtable->view_set_setting;
view_get_managed_scope = vtable->view_get_managed_scope;
buffer_compute_cursor = vtable->buffer_compute_cursor;
view_compute_cursor = vtable->view_compute_cursor;
view_set_camera_bounds = vtable->view_set_camera_bounds;
view_get_camera_bounds = vtable->view_get_camera_bounds;
view_set_cursor = vtable->view_set_cursor;
view_set_buffer_scroll = vtable->view_set_buffer_scroll;
view_set_mark = vtable->view_set_mark;
view_quit_ui = vtable->view_quit_ui;
view_set_buffer = vtable->view_set_buffer;
view_push_context = vtable->view_push_context;
view_pop_context = vtable->view_pop_context;
view_alter_context = vtable->view_alter_context;
view_current_context = vtable->view_current_context;
view_current_context_hook_memory = vtable->view_current_context_hook_memory;
create_user_managed_scope = vtable->create_user_managed_scope;
destroy_user_managed_scope = vtable->destroy_user_managed_scope;
get_global_managed_scope = vtable->get_global_managed_scope;
get_managed_scope_with_multiple_dependencies = vtable->get_managed_scope_with_multiple_dependencies;
managed_scope_clear_contents = vtable->managed_scope_clear_contents;
managed_scope_clear_self_all_dependent_scopes = vtable->managed_scope_clear_self_all_dependent_scopes;
managed_scope_allocator = vtable->managed_scope_allocator;
managed_id_group_highest_id = vtable->managed_id_group_highest_id;
managed_id_declare = vtable->managed_id_declare;
managed_id_get = vtable->managed_id_get;
managed_scope_get_attachment = vtable->managed_scope_get_attachment;
managed_scope_attachment_erase = vtable->managed_scope_attachment_erase;
alloc_managed_memory_in_scope = vtable->alloc_managed_memory_in_scope;
alloc_buffer_markers_on_buffer = vtable->alloc_buffer_markers_on_buffer;
managed_object_get_item_size = vtable->managed_object_get_item_size;
managed_object_get_item_count = vtable->managed_object_get_item_count;
managed_object_get_pointer = vtable->managed_object_get_pointer;
managed_object_get_type = vtable->managed_object_get_type;
managed_object_get_containing_scope = vtable->managed_object_get_containing_scope;
managed_object_free = vtable->managed_object_free;
managed_object_store_data = vtable->managed_object_store_data;
managed_object_load_data = vtable->managed_object_load_data;
get_next_input_raw = vtable->get_next_input_raw;
get_current_input_sequence_number = vtable->get_current_input_sequence_number;
get_current_input = vtable->get_current_input;
set_current_input = vtable->set_current_input;
leave_current_input_unhandled = vtable->leave_current_input_unhandled;
set_custom_hook = vtable->set_custom_hook;
get_custom_hook = vtable->get_custom_hook;
set_custom_hook_memory_size = vtable->set_custom_hook_memory_size;
get_mouse_state = vtable->get_mouse_state;
get_active_query_bars = vtable->get_active_query_bars;
start_query_bar = vtable->start_query_bar;
end_query_bar = vtable->end_query_bar;
clear_all_query_bars = vtable->clear_all_query_bars;
print_message = vtable->print_message;
log_string = vtable->log_string;
get_largest_face_id = vtable->get_largest_face_id;
set_global_face = vtable->set_global_face;
buffer_history_get_max_record_index = vtable->buffer_history_get_max_record_index;
buffer_history_get_record_info = vtable->buffer_history_get_record_info;
buffer_history_get_group_sub_record = vtable->buffer_history_get_group_sub_record;
buffer_history_get_current_state_index = vtable->buffer_history_get_current_state_index;
buffer_history_set_current_state_index = vtable->buffer_history_set_current_state_index;
buffer_history_merge_record_range = vtable->buffer_history_merge_record_range;
buffer_history_clear_after_current_state = vtable->buffer_history_clear_after_current_state;
global_history_edit_group_begin = vtable->global_history_edit_group_begin;
global_history_edit_group_end = vtable->global_history_edit_group_end;
buffer_set_face = vtable->buffer_set_face;
get_face_description = vtable->get_face_description;
get_face_metrics = vtable->get_face_metrics;
get_face_advance_map = vtable->get_face_advance_map;
get_face_id = vtable->get_face_id;
try_create_new_face = vtable->try_create_new_face;
try_modify_face = vtable->try_modify_face;
try_release_face = vtable->try_release_face;
push_hot_directory = vtable->push_hot_directory;
set_hot_directory = vtable->set_hot_directory;
send_exit_signal = vtable->send_exit_signal;
hard_exit = vtable->hard_exit;
set_window_title = vtable->set_window_title;
acquire_global_frame_mutex = vtable->acquire_global_frame_mutex;
release_global_frame_mutex = vtable->release_global_frame_mutex;
draw_string_oriented = vtable->draw_string_oriented;
get_string_advance = vtable->get_string_advance;
draw_rectangle = vtable->draw_rectangle;
draw_rectangle_outline = vtable->draw_rectangle_outline;
draw_set_clip = vtable->draw_set_clip;
text_layout_create = vtable->text_layout_create;
text_layout_region = vtable->text_layout_region;
text_layout_get_buffer = vtable->text_layout_get_buffer;
text_layout_get_visible_range = vtable->text_layout_get_visible_range;
text_layout_line_on_screen = vtable->text_layout_line_on_screen;
text_layout_character_on_screen = vtable->text_layout_character_on_screen;
paint_text_color = vtable->paint_text_color;
paint_text_color_blend = vtable->paint_text_color_blend;
text_layout_free = vtable->text_layout_free;
draw_text_layout = vtable->draw_text_layout;
open_color_picker = vtable->open_color_picker;
animate_in_n_milliseconds = vtable->animate_in_n_milliseconds;
buffer_find_all_matches = vtable->buffer_find_all_matches;
get_core_profile_list = vtable->get_core_profile_list;
get_custom_layer_boundary_docs = vtable->get_custom_layer_boundary_docs;
}
#undef DYNAMIC_LINK_API
#endif

View File

@ -0,0 +1,902 @@
#define custom_global_set_setting_sig() b32 custom_global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value)
#define custom_global_get_screen_rectangle_sig() Rect_f32 custom_global_get_screen_rectangle(Application_Links* app)
#define custom_get_thread_context_sig() Thread_Context* custom_get_thread_context(Application_Links* app)
#define custom_create_child_process_sig() Child_Process_ID custom_create_child_process(Application_Links* app, String_Const_u8 path, String_Const_u8 command)
#define custom_child_process_set_target_buffer_sig() b32 custom_child_process_set_target_buffer(Application_Links* app, Child_Process_ID child_process_id, Buffer_ID buffer_id, Child_Process_Set_Target_Flags flags)
#define custom_buffer_get_attached_child_process_sig() Child_Process_ID custom_buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id)
#define custom_child_process_get_attached_buffer_sig() Buffer_ID custom_child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id)
#define custom_child_process_get_state_sig() Process_State custom_child_process_get_state(Application_Links* app, Child_Process_ID child_process_id)
#define custom_enqueue_virtual_event_sig() b32 custom_enqueue_virtual_event(Application_Links* app, Input_Event* event)
#define custom_get_buffer_count_sig() i32 custom_get_buffer_count(Application_Links* app)
#define custom_get_buffer_next_sig() Buffer_ID custom_get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access)
#define custom_get_buffer_by_name_sig() Buffer_ID custom_get_buffer_by_name(Application_Links* app, String_Const_u8 name, Access_Flag access)
#define custom_get_buffer_by_file_name_sig() Buffer_ID custom_get_buffer_by_file_name(Application_Links* app, String_Const_u8 file_name, Access_Flag access)
#define custom_buffer_read_range_sig() b32 custom_buffer_read_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, u8* out)
#define custom_buffer_replace_range_sig() b32 custom_buffer_replace_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string)
#define custom_buffer_batch_edit_sig() b32 custom_buffer_batch_edit(Application_Links* app, Buffer_ID buffer_id, Batch_Edit* batch)
#define custom_buffer_seek_string_sig() String_Match custom_buffer_seek_string(Application_Links* app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos)
#define custom_buffer_seek_character_class_sig() String_Match custom_buffer_seek_character_class(Application_Links* app, Buffer_ID buffer, Character_Predicate* predicate, Scan_Direction direction, i64 start_pos)
#define custom_buffer_line_y_difference_sig() f32 custom_buffer_line_y_difference(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line_a, i64 line_b)
#define custom_buffer_line_shift_y_sig() Line_Shift_Vertical custom_buffer_line_shift_y(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line, f32 y_shift)
#define custom_buffer_pos_at_relative_xy_sig() i64 custom_buffer_pos_at_relative_xy(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy)
#define custom_buffer_relative_box_of_pos_sig() Rect_f32 custom_buffer_relative_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos)
#define custom_buffer_padded_box_of_pos_sig() Rect_f32 custom_buffer_padded_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos)
#define custom_buffer_relative_character_from_pos_sig() i64 custom_buffer_relative_character_from_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos)
#define custom_buffer_pos_from_relative_character_sig() i64 custom_buffer_pos_from_relative_character(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 relative_character)
#define custom_view_line_y_difference_sig() f32 custom_view_line_y_difference(Application_Links* app, View_ID view_id, i64 line_a, i64 line_b)
#define custom_view_line_shift_y_sig() Line_Shift_Vertical custom_view_line_shift_y(Application_Links* app, View_ID view_id, i64 line, f32 y_shift)
#define custom_view_pos_at_relative_xy_sig() i64 custom_view_pos_at_relative_xy(Application_Links* app, View_ID view_id, i64 base_line, Vec2_f32 relative_xy)
#define custom_view_relative_box_of_pos_sig() Rect_f32 custom_view_relative_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos)
#define custom_view_padded_box_of_pos_sig() Rect_f32 custom_view_padded_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos)
#define custom_view_relative_character_from_pos_sig() i64 custom_view_relative_character_from_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos)
#define custom_view_pos_from_relative_character_sig() i64 custom_view_pos_from_relative_character(Application_Links* app, View_ID view_id, i64 base_line, i64 character)
#define custom_buffer_exists_sig() b32 custom_buffer_exists(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_get_access_flags_sig() Access_Flag custom_buffer_get_access_flags(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_get_size_sig() i64 custom_buffer_get_size(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_get_line_count_sig() i64 custom_buffer_get_line_count(Application_Links* app, Buffer_ID buffer_id)
#define custom_push_buffer_base_name_sig() String_Const_u8 custom_push_buffer_base_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id)
#define custom_push_buffer_unique_name_sig() String_Const_u8 custom_push_buffer_unique_name(Application_Links* app, Arena* out, Buffer_ID buffer_id)
#define custom_push_buffer_file_name_sig() String_Const_u8 custom_push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id)
#define custom_buffer_get_dirty_state_sig() Dirty_State custom_buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_set_dirty_state_sig() b32 custom_buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state)
#define custom_buffer_set_layout_sig() b32 custom_buffer_set_layout(Application_Links* app, Buffer_ID buffer_id, Layout_Function* layout_func)
#define custom_buffer_clear_layout_cache_sig() b32 custom_buffer_clear_layout_cache(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_get_layout_sig() Layout_Function* custom_buffer_get_layout(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_get_setting_sig() b32 custom_buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out)
#define custom_buffer_set_setting_sig() b32 custom_buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value)
#define custom_buffer_get_managed_scope_sig() Managed_Scope custom_buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_send_end_signal_sig() b32 custom_buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id)
#define custom_create_buffer_sig() Buffer_ID custom_create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags)
#define custom_buffer_save_sig() b32 custom_buffer_save(Application_Links* app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags)
#define custom_buffer_kill_sig() Buffer_Kill_Result custom_buffer_kill(Application_Links* app, Buffer_ID buffer_id, Buffer_Kill_Flag flags)
#define custom_buffer_reopen_sig() Buffer_Reopen_Result custom_buffer_reopen(Application_Links* app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags)
#define custom_buffer_get_file_attributes_sig() File_Attributes custom_buffer_get_file_attributes(Application_Links* app, Buffer_ID buffer_id)
#define custom_get_view_next_sig() View_ID custom_get_view_next(Application_Links* app, View_ID view_id, Access_Flag access)
#define custom_get_view_prev_sig() View_ID custom_get_view_prev(Application_Links* app, View_ID view_id, Access_Flag access)
#define custom_get_this_ctx_view_sig() View_ID custom_get_this_ctx_view(Application_Links* app, Access_Flag access)
#define custom_get_active_view_sig() View_ID custom_get_active_view(Application_Links* app, Access_Flag access)
#define custom_view_exists_sig() b32 custom_view_exists(Application_Links* app, View_ID view_id)
#define custom_view_get_buffer_sig() Buffer_ID custom_view_get_buffer(Application_Links* app, View_ID view_id, Access_Flag access)
#define custom_view_get_cursor_pos_sig() i64 custom_view_get_cursor_pos(Application_Links* app, View_ID view_id)
#define custom_view_get_mark_pos_sig() i64 custom_view_get_mark_pos(Application_Links* app, View_ID view_id)
#define custom_view_get_preferred_x_sig() f32 custom_view_get_preferred_x(Application_Links* app, View_ID view_id)
#define custom_view_set_preferred_x_sig() b32 custom_view_set_preferred_x(Application_Links* app, View_ID view_id, f32 x)
#define custom_view_get_screen_rect_sig() Rect_f32 custom_view_get_screen_rect(Application_Links* app, View_ID view_id)
#define custom_view_get_panel_sig() Panel_ID custom_view_get_panel(Application_Links* app, View_ID view_id)
#define custom_panel_get_view_sig() View_ID custom_panel_get_view(Application_Links* app, Panel_ID panel_id, Access_Flag access)
#define custom_panel_is_split_sig() b32 custom_panel_is_split(Application_Links* app, Panel_ID panel_id)
#define custom_panel_is_leaf_sig() b32 custom_panel_is_leaf(Application_Links* app, Panel_ID panel_id)
#define custom_panel_split_sig() b32 custom_panel_split(Application_Links* app, Panel_ID panel_id, Dimension split_dim)
#define custom_panel_set_split_sig() b32 custom_panel_set_split(Application_Links* app, Panel_ID panel_id, Panel_Split_Kind kind, f32 t)
#define custom_panel_swap_children_sig() b32 custom_panel_swap_children(Application_Links* app, Panel_ID panel_id)
#define custom_panel_get_root_sig() Panel_ID custom_panel_get_root(Application_Links* app)
#define custom_panel_get_parent_sig() Panel_ID custom_panel_get_parent(Application_Links* app, Panel_ID panel_id)
#define custom_panel_get_child_sig() Panel_ID custom_panel_get_child(Application_Links* app, Panel_ID panel_id, Side which_child)
#define custom_view_close_sig() b32 custom_view_close(Application_Links* app, View_ID view_id)
#define custom_view_get_buffer_region_sig() Rect_f32 custom_view_get_buffer_region(Application_Links* app, View_ID view_id)
#define custom_view_get_buffer_scroll_sig() Buffer_Scroll custom_view_get_buffer_scroll(Application_Links* app, View_ID view_id)
#define custom_view_set_active_sig() b32 custom_view_set_active(Application_Links* app, View_ID view_id)
#define custom_view_enqueue_command_function_sig() b32 custom_view_enqueue_command_function(Application_Links* app, View_ID view_id, Custom_Command_Function* custom_func)
#define custom_view_get_setting_sig() b32 custom_view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out)
#define custom_view_set_setting_sig() b32 custom_view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value)
#define custom_view_get_managed_scope_sig() Managed_Scope custom_view_get_managed_scope(Application_Links* app, View_ID view_id)
#define custom_buffer_compute_cursor_sig() Buffer_Cursor custom_buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek)
#define custom_view_compute_cursor_sig() Buffer_Cursor custom_view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek)
#define custom_view_set_camera_bounds_sig() b32 custom_view_set_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32 margin, Vec2_f32 push_in_multiplier)
#define custom_view_get_camera_bounds_sig() b32 custom_view_get_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32* margin, Vec2_f32* push_in_multiplier)
#define custom_view_set_cursor_sig() b32 custom_view_set_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek)
#define custom_view_set_buffer_scroll_sig() b32 custom_view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule)
#define custom_view_set_mark_sig() b32 custom_view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek)
#define custom_view_quit_ui_sig() b32 custom_view_quit_ui(Application_Links* app, View_ID view_id)
#define custom_view_set_buffer_sig() b32 custom_view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags)
#define custom_view_push_context_sig() b32 custom_view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx)
#define custom_view_pop_context_sig() b32 custom_view_pop_context(Application_Links* app, View_ID view_id)
#define custom_view_alter_context_sig() b32 custom_view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx)
#define custom_view_current_context_sig() View_Context custom_view_current_context(Application_Links* app, View_ID view_id)
#define custom_view_current_context_hook_memory_sig() String_Const_u8 custom_view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id)
#define custom_create_user_managed_scope_sig() Managed_Scope custom_create_user_managed_scope(Application_Links* app)
#define custom_destroy_user_managed_scope_sig() b32 custom_destroy_user_managed_scope(Application_Links* app, Managed_Scope scope)
#define custom_get_global_managed_scope_sig() Managed_Scope custom_get_global_managed_scope(Application_Links* app)
#define custom_get_managed_scope_with_multiple_dependencies_sig() Managed_Scope custom_get_managed_scope_with_multiple_dependencies(Application_Links* app, Managed_Scope* scopes, i32 count)
#define custom_managed_scope_clear_contents_sig() b32 custom_managed_scope_clear_contents(Application_Links* app, Managed_Scope scope)
#define custom_managed_scope_clear_self_all_dependent_scopes_sig() b32 custom_managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope)
#define custom_managed_scope_allocator_sig() Base_Allocator* custom_managed_scope_allocator(Application_Links* app, Managed_Scope scope)
#define custom_managed_id_group_highest_id_sig() u64 custom_managed_id_group_highest_id(Application_Links* app, String_Const_u8 group)
#define custom_managed_id_declare_sig() Managed_ID custom_managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name)
#define custom_managed_id_get_sig() Managed_ID custom_managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name)
#define custom_managed_scope_get_attachment_sig() void* custom_managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size)
#define custom_managed_scope_attachment_erase_sig() b32 custom_managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id)
#define custom_alloc_managed_memory_in_scope_sig() Managed_Object custom_alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count)
#define custom_alloc_buffer_markers_on_buffer_sig() Managed_Object custom_alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope)
#define custom_managed_object_get_item_size_sig() u32 custom_managed_object_get_item_size(Application_Links* app, Managed_Object object)
#define custom_managed_object_get_item_count_sig() u32 custom_managed_object_get_item_count(Application_Links* app, Managed_Object object)
#define custom_managed_object_get_pointer_sig() void* custom_managed_object_get_pointer(Application_Links* app, Managed_Object object)
#define custom_managed_object_get_type_sig() Managed_Object_Type custom_managed_object_get_type(Application_Links* app, Managed_Object object)
#define custom_managed_object_get_containing_scope_sig() Managed_Scope custom_managed_object_get_containing_scope(Application_Links* app, Managed_Object object)
#define custom_managed_object_free_sig() b32 custom_managed_object_free(Application_Links* app, Managed_Object object)
#define custom_managed_object_store_data_sig() b32 custom_managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem)
#define custom_managed_object_load_data_sig() b32 custom_managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out)
#define custom_get_next_input_raw_sig() User_Input custom_get_next_input_raw(Application_Links* app)
#define custom_get_current_input_sequence_number_sig() i64 custom_get_current_input_sequence_number(Application_Links* app)
#define custom_get_current_input_sig() User_Input custom_get_current_input(Application_Links* app)
#define custom_set_current_input_sig() void custom_set_current_input(Application_Links* app, User_Input* input)
#define custom_leave_current_input_unhandled_sig() void custom_leave_current_input_unhandled(Application_Links* app)
#define custom_set_custom_hook_sig() void custom_set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr)
#define custom_get_custom_hook_sig() Void_Func* custom_get_custom_hook(Application_Links* app, Hook_ID hook_id)
#define custom_set_custom_hook_memory_size_sig() b32 custom_set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size)
#define custom_get_mouse_state_sig() Mouse_State custom_get_mouse_state(Application_Links* app)
#define custom_get_active_query_bars_sig() b32 custom_get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out)
#define custom_start_query_bar_sig() b32 custom_start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags)
#define custom_end_query_bar_sig() void custom_end_query_bar(Application_Links* app, Query_Bar* bar, u32 flags)
#define custom_clear_all_query_bars_sig() void custom_clear_all_query_bars(Application_Links* app, View_ID view_id)
#define custom_print_message_sig() void custom_print_message(Application_Links* app, String_Const_u8 message)
#define custom_log_string_sig() b32 custom_log_string(Application_Links* app, String_Const_u8 str)
#define custom_get_largest_face_id_sig() Face_ID custom_get_largest_face_id(Application_Links* app)
#define custom_set_global_face_sig() b32 custom_set_global_face(Application_Links* app, Face_ID id)
#define custom_buffer_history_get_max_record_index_sig() History_Record_Index custom_buffer_history_get_max_record_index(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_history_get_record_info_sig() Record_Info custom_buffer_history_get_record_info(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index)
#define custom_buffer_history_get_group_sub_record_sig() Record_Info custom_buffer_history_get_group_sub_record(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index, i32 sub_index)
#define custom_buffer_history_get_current_state_index_sig() History_Record_Index custom_buffer_history_get_current_state_index(Application_Links* app, Buffer_ID buffer_id)
#define custom_buffer_history_set_current_state_index_sig() b32 custom_buffer_history_set_current_state_index(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index)
#define custom_buffer_history_merge_record_range_sig() b32 custom_buffer_history_merge_record_range(Application_Links* app, Buffer_ID buffer_id, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags)
#define custom_buffer_history_clear_after_current_state_sig() b32 custom_buffer_history_clear_after_current_state(Application_Links* app, Buffer_ID buffer_id)
#define custom_global_history_edit_group_begin_sig() void custom_global_history_edit_group_begin(Application_Links* app)
#define custom_global_history_edit_group_end_sig() void custom_global_history_edit_group_end(Application_Links* app)
#define custom_buffer_set_face_sig() b32 custom_buffer_set_face(Application_Links* app, Buffer_ID buffer_id, Face_ID id)
#define custom_get_face_description_sig() Face_Description custom_get_face_description(Application_Links* app, Face_ID face_id)
#define custom_get_face_metrics_sig() Face_Metrics custom_get_face_metrics(Application_Links* app, Face_ID face_id)
#define custom_get_face_advance_map_sig() Face_Advance_Map custom_get_face_advance_map(Application_Links* app, Face_ID face_id)
#define custom_get_face_id_sig() Face_ID custom_get_face_id(Application_Links* app, Buffer_ID buffer_id)
#define custom_try_create_new_face_sig() Face_ID custom_try_create_new_face(Application_Links* app, Face_Description* description)
#define custom_try_modify_face_sig() b32 custom_try_modify_face(Application_Links* app, Face_ID id, Face_Description* description)
#define custom_try_release_face_sig() b32 custom_try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id)
#define custom_push_hot_directory_sig() String_Const_u8 custom_push_hot_directory(Application_Links* app, Arena* arena)
#define custom_set_hot_directory_sig() void custom_set_hot_directory(Application_Links* app, String_Const_u8 string)
#define custom_send_exit_signal_sig() void custom_send_exit_signal(Application_Links* app)
#define custom_hard_exit_sig() void custom_hard_exit(Application_Links* app)
#define custom_set_window_title_sig() void custom_set_window_title(Application_Links* app, String_Const_u8 title)
#define custom_acquire_global_frame_mutex_sig() void custom_acquire_global_frame_mutex(Application_Links* app)
#define custom_release_global_frame_mutex_sig() void custom_release_global_frame_mutex(Application_Links* app)
#define custom_draw_string_oriented_sig() Vec2_f32 custom_draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta)
#define custom_get_string_advance_sig() f32 custom_get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str)
#define custom_draw_rectangle_sig() void custom_draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color)
#define custom_draw_rectangle_outline_sig() void custom_draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color)
#define custom_draw_set_clip_sig() Rect_f32 custom_draw_set_clip(Application_Links* app, Rect_f32 new_clip)
#define custom_text_layout_create_sig() Text_Layout_ID custom_text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point)
#define custom_text_layout_region_sig() Rect_f32 custom_text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_text_layout_get_buffer_sig() Buffer_ID custom_text_layout_get_buffer(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_text_layout_get_visible_range_sig() Range_i64 custom_text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_text_layout_line_on_screen_sig() Range_f32 custom_text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number)
#define custom_text_layout_character_on_screen_sig() Rect_f32 custom_text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos)
#define custom_paint_text_color_sig() void custom_paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color)
#define custom_paint_text_color_blend_sig() void custom_paint_text_color_blend(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color, f32 blend)
#define custom_text_layout_free_sig() b32 custom_text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id)
#define custom_draw_text_layout_sig() void custom_draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color)
#define custom_open_color_picker_sig() void custom_open_color_picker(Application_Links* app, Color_Picker* picker)
#define custom_animate_in_n_milliseconds_sig() void custom_animate_in_n_milliseconds(Application_Links* app, u32 n)
#define custom_buffer_find_all_matches_sig() String_Match_List custom_buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction)
#define custom_get_core_profile_list_sig() Profile_Global_List* custom_get_core_profile_list(Application_Links* app)
#define custom_get_custom_layer_boundary_docs_sig() Doc_Cluster* custom_get_custom_layer_boundary_docs(Application_Links* app, Arena* arena)
typedef b32 custom_global_set_setting_type(Application_Links* app, Global_Setting_ID setting, i64 value);
typedef Rect_f32 custom_global_get_screen_rectangle_type(Application_Links* app);
typedef Thread_Context* custom_get_thread_context_type(Application_Links* app);
typedef Child_Process_ID custom_create_child_process_type(Application_Links* app, String_Const_u8 path, String_Const_u8 command);
typedef b32 custom_child_process_set_target_buffer_type(Application_Links* app, Child_Process_ID child_process_id, Buffer_ID buffer_id, Child_Process_Set_Target_Flags flags);
typedef Child_Process_ID custom_buffer_get_attached_child_process_type(Application_Links* app, Buffer_ID buffer_id);
typedef Buffer_ID custom_child_process_get_attached_buffer_type(Application_Links* app, Child_Process_ID child_process_id);
typedef Process_State custom_child_process_get_state_type(Application_Links* app, Child_Process_ID child_process_id);
typedef b32 custom_enqueue_virtual_event_type(Application_Links* app, Input_Event* event);
typedef i32 custom_get_buffer_count_type(Application_Links* app);
typedef Buffer_ID custom_get_buffer_next_type(Application_Links* app, Buffer_ID buffer_id, Access_Flag access);
typedef Buffer_ID custom_get_buffer_by_name_type(Application_Links* app, String_Const_u8 name, Access_Flag access);
typedef Buffer_ID custom_get_buffer_by_file_name_type(Application_Links* app, String_Const_u8 file_name, Access_Flag access);
typedef b32 custom_buffer_read_range_type(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, u8* out);
typedef b32 custom_buffer_replace_range_type(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string);
typedef b32 custom_buffer_batch_edit_type(Application_Links* app, Buffer_ID buffer_id, Batch_Edit* batch);
typedef String_Match custom_buffer_seek_string_type(Application_Links* app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos);
typedef String_Match custom_buffer_seek_character_class_type(Application_Links* app, Buffer_ID buffer, Character_Predicate* predicate, Scan_Direction direction, i64 start_pos);
typedef f32 custom_buffer_line_y_difference_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line_a, i64 line_b);
typedef Line_Shift_Vertical custom_buffer_line_shift_y_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line, f32 y_shift);
typedef i64 custom_buffer_pos_at_relative_xy_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy);
typedef Rect_f32 custom_buffer_relative_box_of_pos_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
typedef Rect_f32 custom_buffer_padded_box_of_pos_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
typedef i64 custom_buffer_relative_character_from_pos_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
typedef i64 custom_buffer_pos_from_relative_character_type(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 relative_character);
typedef f32 custom_view_line_y_difference_type(Application_Links* app, View_ID view_id, i64 line_a, i64 line_b);
typedef Line_Shift_Vertical custom_view_line_shift_y_type(Application_Links* app, View_ID view_id, i64 line, f32 y_shift);
typedef i64 custom_view_pos_at_relative_xy_type(Application_Links* app, View_ID view_id, i64 base_line, Vec2_f32 relative_xy);
typedef Rect_f32 custom_view_relative_box_of_pos_type(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
typedef Rect_f32 custom_view_padded_box_of_pos_type(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
typedef i64 custom_view_relative_character_from_pos_type(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
typedef i64 custom_view_pos_from_relative_character_type(Application_Links* app, View_ID view_id, i64 base_line, i64 character);
typedef b32 custom_buffer_exists_type(Application_Links* app, Buffer_ID buffer_id);
typedef Access_Flag custom_buffer_get_access_flags_type(Application_Links* app, Buffer_ID buffer_id);
typedef i64 custom_buffer_get_size_type(Application_Links* app, Buffer_ID buffer_id);
typedef i64 custom_buffer_get_line_count_type(Application_Links* app, Buffer_ID buffer_id);
typedef String_Const_u8 custom_push_buffer_base_name_type(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
typedef String_Const_u8 custom_push_buffer_unique_name_type(Application_Links* app, Arena* out, Buffer_ID buffer_id);
typedef String_Const_u8 custom_push_buffer_file_name_type(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
typedef Dirty_State custom_buffer_get_dirty_state_type(Application_Links* app, Buffer_ID buffer_id);
typedef b32 custom_buffer_set_dirty_state_type(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
typedef b32 custom_buffer_set_layout_type(Application_Links* app, Buffer_ID buffer_id, Layout_Function* layout_func);
typedef b32 custom_buffer_clear_layout_cache_type(Application_Links* app, Buffer_ID buffer_id);
typedef Layout_Function* custom_buffer_get_layout_type(Application_Links* app, Buffer_ID buffer_id);
typedef b32 custom_buffer_get_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
typedef b32 custom_buffer_set_setting_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
typedef Managed_Scope custom_buffer_get_managed_scope_type(Application_Links* app, Buffer_ID buffer_id);
typedef b32 custom_buffer_send_end_signal_type(Application_Links* app, Buffer_ID buffer_id);
typedef Buffer_ID custom_create_buffer_type(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
typedef b32 custom_buffer_save_type(Application_Links* app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags);
typedef Buffer_Kill_Result custom_buffer_kill_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Kill_Flag flags);
typedef Buffer_Reopen_Result custom_buffer_reopen_type(Application_Links* app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags);
typedef File_Attributes custom_buffer_get_file_attributes_type(Application_Links* app, Buffer_ID buffer_id);
typedef View_ID custom_get_view_next_type(Application_Links* app, View_ID view_id, Access_Flag access);
typedef View_ID custom_get_view_prev_type(Application_Links* app, View_ID view_id, Access_Flag access);
typedef View_ID custom_get_this_ctx_view_type(Application_Links* app, Access_Flag access);
typedef View_ID custom_get_active_view_type(Application_Links* app, Access_Flag access);
typedef b32 custom_view_exists_type(Application_Links* app, View_ID view_id);
typedef Buffer_ID custom_view_get_buffer_type(Application_Links* app, View_ID view_id, Access_Flag access);
typedef i64 custom_view_get_cursor_pos_type(Application_Links* app, View_ID view_id);
typedef i64 custom_view_get_mark_pos_type(Application_Links* app, View_ID view_id);
typedef f32 custom_view_get_preferred_x_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_set_preferred_x_type(Application_Links* app, View_ID view_id, f32 x);
typedef Rect_f32 custom_view_get_screen_rect_type(Application_Links* app, View_ID view_id);
typedef Panel_ID custom_view_get_panel_type(Application_Links* app, View_ID view_id);
typedef View_ID custom_panel_get_view_type(Application_Links* app, Panel_ID panel_id, Access_Flag access);
typedef b32 custom_panel_is_split_type(Application_Links* app, Panel_ID panel_id);
typedef b32 custom_panel_is_leaf_type(Application_Links* app, Panel_ID panel_id);
typedef b32 custom_panel_split_type(Application_Links* app, Panel_ID panel_id, Dimension split_dim);
typedef b32 custom_panel_set_split_type(Application_Links* app, Panel_ID panel_id, Panel_Split_Kind kind, f32 t);
typedef b32 custom_panel_swap_children_type(Application_Links* app, Panel_ID panel_id);
typedef Panel_ID custom_panel_get_root_type(Application_Links* app);
typedef Panel_ID custom_panel_get_parent_type(Application_Links* app, Panel_ID panel_id);
typedef Panel_ID custom_panel_get_child_type(Application_Links* app, Panel_ID panel_id, Side which_child);
typedef b32 custom_view_close_type(Application_Links* app, View_ID view_id);
typedef Rect_f32 custom_view_get_buffer_region_type(Application_Links* app, View_ID view_id);
typedef Buffer_Scroll custom_view_get_buffer_scroll_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_set_active_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_enqueue_command_function_type(Application_Links* app, View_ID view_id, Custom_Command_Function* custom_func);
typedef b32 custom_view_get_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
typedef b32 custom_view_set_setting_type(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
typedef Managed_Scope custom_view_get_managed_scope_type(Application_Links* app, View_ID view_id);
typedef Buffer_Cursor custom_buffer_compute_cursor_type(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
typedef Buffer_Cursor custom_view_compute_cursor_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
typedef b32 custom_view_set_camera_bounds_type(Application_Links* app, View_ID view_id, Vec2_f32 margin, Vec2_f32 push_in_multiplier);
typedef b32 custom_view_get_camera_bounds_type(Application_Links* app, View_ID view_id, Vec2_f32* margin, Vec2_f32* push_in_multiplier);
typedef b32 custom_view_set_cursor_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
typedef b32 custom_view_set_buffer_scroll_type(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
typedef b32 custom_view_set_mark_type(Application_Links* app, View_ID view_id, Buffer_Seek seek);
typedef b32 custom_view_quit_ui_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_set_buffer_type(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
typedef b32 custom_view_push_context_type(Application_Links* app, View_ID view_id, View_Context* ctx);
typedef b32 custom_view_pop_context_type(Application_Links* app, View_ID view_id);
typedef b32 custom_view_alter_context_type(Application_Links* app, View_ID view_id, View_Context* ctx);
typedef View_Context custom_view_current_context_type(Application_Links* app, View_ID view_id);
typedef String_Const_u8 custom_view_current_context_hook_memory_type(Application_Links* app, View_ID view_id, Hook_ID hook_id);
typedef Managed_Scope custom_create_user_managed_scope_type(Application_Links* app);
typedef b32 custom_destroy_user_managed_scope_type(Application_Links* app, Managed_Scope scope);
typedef Managed_Scope custom_get_global_managed_scope_type(Application_Links* app);
typedef Managed_Scope custom_get_managed_scope_with_multiple_dependencies_type(Application_Links* app, Managed_Scope* scopes, i32 count);
typedef b32 custom_managed_scope_clear_contents_type(Application_Links* app, Managed_Scope scope);
typedef b32 custom_managed_scope_clear_self_all_dependent_scopes_type(Application_Links* app, Managed_Scope scope);
typedef Base_Allocator* custom_managed_scope_allocator_type(Application_Links* app, Managed_Scope scope);
typedef u64 custom_managed_id_group_highest_id_type(Application_Links* app, String_Const_u8 group);
typedef Managed_ID custom_managed_id_declare_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
typedef Managed_ID custom_managed_id_get_type(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
typedef void* custom_managed_scope_get_attachment_type(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
typedef b32 custom_managed_scope_attachment_erase_type(Application_Links* app, Managed_Scope scope, Managed_ID id);
typedef Managed_Object custom_alloc_managed_memory_in_scope_type(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
typedef Managed_Object custom_alloc_buffer_markers_on_buffer_type(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
typedef u32 custom_managed_object_get_item_size_type(Application_Links* app, Managed_Object object);
typedef u32 custom_managed_object_get_item_count_type(Application_Links* app, Managed_Object object);
typedef void* custom_managed_object_get_pointer_type(Application_Links* app, Managed_Object object);
typedef Managed_Object_Type custom_managed_object_get_type_type(Application_Links* app, Managed_Object object);
typedef Managed_Scope custom_managed_object_get_containing_scope_type(Application_Links* app, Managed_Object object);
typedef b32 custom_managed_object_free_type(Application_Links* app, Managed_Object object);
typedef b32 custom_managed_object_store_data_type(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
typedef b32 custom_managed_object_load_data_type(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
typedef User_Input custom_get_next_input_raw_type(Application_Links* app);
typedef i64 custom_get_current_input_sequence_number_type(Application_Links* app);
typedef User_Input custom_get_current_input_type(Application_Links* app);
typedef void custom_set_current_input_type(Application_Links* app, User_Input* input);
typedef void custom_leave_current_input_unhandled_type(Application_Links* app);
typedef void custom_set_custom_hook_type(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
typedef Void_Func* custom_get_custom_hook_type(Application_Links* app, Hook_ID hook_id);
typedef b32 custom_set_custom_hook_memory_size_type(Application_Links* app, Hook_ID hook_id, u64 size);
typedef Mouse_State custom_get_mouse_state_type(Application_Links* app);
typedef b32 custom_get_active_query_bars_type(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
typedef b32 custom_start_query_bar_type(Application_Links* app, Query_Bar* bar, u32 flags);
typedef void custom_end_query_bar_type(Application_Links* app, Query_Bar* bar, u32 flags);
typedef void custom_clear_all_query_bars_type(Application_Links* app, View_ID view_id);
typedef void custom_print_message_type(Application_Links* app, String_Const_u8 message);
typedef b32 custom_log_string_type(Application_Links* app, String_Const_u8 str);
typedef Face_ID custom_get_largest_face_id_type(Application_Links* app);
typedef b32 custom_set_global_face_type(Application_Links* app, Face_ID id);
typedef History_Record_Index custom_buffer_history_get_max_record_index_type(Application_Links* app, Buffer_ID buffer_id);
typedef Record_Info custom_buffer_history_get_record_info_type(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
typedef Record_Info custom_buffer_history_get_group_sub_record_type(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index, i32 sub_index);
typedef History_Record_Index custom_buffer_history_get_current_state_index_type(Application_Links* app, Buffer_ID buffer_id);
typedef b32 custom_buffer_history_set_current_state_index_type(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
typedef b32 custom_buffer_history_merge_record_range_type(Application_Links* app, Buffer_ID buffer_id, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags);
typedef b32 custom_buffer_history_clear_after_current_state_type(Application_Links* app, Buffer_ID buffer_id);
typedef void custom_global_history_edit_group_begin_type(Application_Links* app);
typedef void custom_global_history_edit_group_end_type(Application_Links* app);
typedef b32 custom_buffer_set_face_type(Application_Links* app, Buffer_ID buffer_id, Face_ID id);
typedef Face_Description custom_get_face_description_type(Application_Links* app, Face_ID face_id);
typedef Face_Metrics custom_get_face_metrics_type(Application_Links* app, Face_ID face_id);
typedef Face_Advance_Map custom_get_face_advance_map_type(Application_Links* app, Face_ID face_id);
typedef Face_ID custom_get_face_id_type(Application_Links* app, Buffer_ID buffer_id);
typedef Face_ID custom_try_create_new_face_type(Application_Links* app, Face_Description* description);
typedef b32 custom_try_modify_face_type(Application_Links* app, Face_ID id, Face_Description* description);
typedef b32 custom_try_release_face_type(Application_Links* app, Face_ID id, Face_ID replacement_id);
typedef String_Const_u8 custom_push_hot_directory_type(Application_Links* app, Arena* arena);
typedef void custom_set_hot_directory_type(Application_Links* app, String_Const_u8 string);
typedef void custom_send_exit_signal_type(Application_Links* app);
typedef void custom_hard_exit_type(Application_Links* app);
typedef void custom_set_window_title_type(Application_Links* app, String_Const_u8 title);
typedef void custom_acquire_global_frame_mutex_type(Application_Links* app);
typedef void custom_release_global_frame_mutex_type(Application_Links* app);
typedef Vec2_f32 custom_draw_string_oriented_type(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
typedef f32 custom_get_string_advance_type(Application_Links* app, Face_ID font_id, String_Const_u8 str);
typedef void custom_draw_rectangle_type(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
typedef void custom_draw_rectangle_outline_type(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
typedef Rect_f32 custom_draw_set_clip_type(Application_Links* app, Rect_f32 new_clip);
typedef Text_Layout_ID custom_text_layout_create_type(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
typedef Rect_f32 custom_text_layout_region_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef Buffer_ID custom_text_layout_get_buffer_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef Range_i64 custom_text_layout_get_visible_range_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef Range_f32 custom_text_layout_line_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
typedef Rect_f32 custom_text_layout_character_on_screen_type(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
typedef void custom_paint_text_color_type(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
typedef void custom_paint_text_color_blend_type(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color, f32 blend);
typedef b32 custom_text_layout_free_type(Application_Links* app, Text_Layout_ID text_layout_id);
typedef void custom_draw_text_layout_type(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
typedef void custom_open_color_picker_type(Application_Links* app, Color_Picker* picker);
typedef void custom_animate_in_n_milliseconds_type(Application_Links* app, u32 n);
typedef String_Match_List custom_buffer_find_all_matches_type(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
typedef Profile_Global_List* custom_get_core_profile_list_type(Application_Links* app);
typedef Doc_Cluster* custom_get_custom_layer_boundary_docs_type(Application_Links* app, Arena* arena);
struct API_VTable_custom{
custom_global_set_setting_type *global_set_setting;
custom_global_get_screen_rectangle_type *global_get_screen_rectangle;
custom_get_thread_context_type *get_thread_context;
custom_create_child_process_type *create_child_process;
custom_child_process_set_target_buffer_type *child_process_set_target_buffer;
custom_buffer_get_attached_child_process_type *buffer_get_attached_child_process;
custom_child_process_get_attached_buffer_type *child_process_get_attached_buffer;
custom_child_process_get_state_type *child_process_get_state;
custom_enqueue_virtual_event_type *enqueue_virtual_event;
custom_get_buffer_count_type *get_buffer_count;
custom_get_buffer_next_type *get_buffer_next;
custom_get_buffer_by_name_type *get_buffer_by_name;
custom_get_buffer_by_file_name_type *get_buffer_by_file_name;
custom_buffer_read_range_type *buffer_read_range;
custom_buffer_replace_range_type *buffer_replace_range;
custom_buffer_batch_edit_type *buffer_batch_edit;
custom_buffer_seek_string_type *buffer_seek_string;
custom_buffer_seek_character_class_type *buffer_seek_character_class;
custom_buffer_line_y_difference_type *buffer_line_y_difference;
custom_buffer_line_shift_y_type *buffer_line_shift_y;
custom_buffer_pos_at_relative_xy_type *buffer_pos_at_relative_xy;
custom_buffer_relative_box_of_pos_type *buffer_relative_box_of_pos;
custom_buffer_padded_box_of_pos_type *buffer_padded_box_of_pos;
custom_buffer_relative_character_from_pos_type *buffer_relative_character_from_pos;
custom_buffer_pos_from_relative_character_type *buffer_pos_from_relative_character;
custom_view_line_y_difference_type *view_line_y_difference;
custom_view_line_shift_y_type *view_line_shift_y;
custom_view_pos_at_relative_xy_type *view_pos_at_relative_xy;
custom_view_relative_box_of_pos_type *view_relative_box_of_pos;
custom_view_padded_box_of_pos_type *view_padded_box_of_pos;
custom_view_relative_character_from_pos_type *view_relative_character_from_pos;
custom_view_pos_from_relative_character_type *view_pos_from_relative_character;
custom_buffer_exists_type *buffer_exists;
custom_buffer_get_access_flags_type *buffer_get_access_flags;
custom_buffer_get_size_type *buffer_get_size;
custom_buffer_get_line_count_type *buffer_get_line_count;
custom_push_buffer_base_name_type *push_buffer_base_name;
custom_push_buffer_unique_name_type *push_buffer_unique_name;
custom_push_buffer_file_name_type *push_buffer_file_name;
custom_buffer_get_dirty_state_type *buffer_get_dirty_state;
custom_buffer_set_dirty_state_type *buffer_set_dirty_state;
custom_buffer_set_layout_type *buffer_set_layout;
custom_buffer_clear_layout_cache_type *buffer_clear_layout_cache;
custom_buffer_get_layout_type *buffer_get_layout;
custom_buffer_get_setting_type *buffer_get_setting;
custom_buffer_set_setting_type *buffer_set_setting;
custom_buffer_get_managed_scope_type *buffer_get_managed_scope;
custom_buffer_send_end_signal_type *buffer_send_end_signal;
custom_create_buffer_type *create_buffer;
custom_buffer_save_type *buffer_save;
custom_buffer_kill_type *buffer_kill;
custom_buffer_reopen_type *buffer_reopen;
custom_buffer_get_file_attributes_type *buffer_get_file_attributes;
custom_get_view_next_type *get_view_next;
custom_get_view_prev_type *get_view_prev;
custom_get_this_ctx_view_type *get_this_ctx_view;
custom_get_active_view_type *get_active_view;
custom_view_exists_type *view_exists;
custom_view_get_buffer_type *view_get_buffer;
custom_view_get_cursor_pos_type *view_get_cursor_pos;
custom_view_get_mark_pos_type *view_get_mark_pos;
custom_view_get_preferred_x_type *view_get_preferred_x;
custom_view_set_preferred_x_type *view_set_preferred_x;
custom_view_get_screen_rect_type *view_get_screen_rect;
custom_view_get_panel_type *view_get_panel;
custom_panel_get_view_type *panel_get_view;
custom_panel_is_split_type *panel_is_split;
custom_panel_is_leaf_type *panel_is_leaf;
custom_panel_split_type *panel_split;
custom_panel_set_split_type *panel_set_split;
custom_panel_swap_children_type *panel_swap_children;
custom_panel_get_root_type *panel_get_root;
custom_panel_get_parent_type *panel_get_parent;
custom_panel_get_child_type *panel_get_child;
custom_view_close_type *view_close;
custom_view_get_buffer_region_type *view_get_buffer_region;
custom_view_get_buffer_scroll_type *view_get_buffer_scroll;
custom_view_set_active_type *view_set_active;
custom_view_enqueue_command_function_type *view_enqueue_command_function;
custom_view_get_setting_type *view_get_setting;
custom_view_set_setting_type *view_set_setting;
custom_view_get_managed_scope_type *view_get_managed_scope;
custom_buffer_compute_cursor_type *buffer_compute_cursor;
custom_view_compute_cursor_type *view_compute_cursor;
custom_view_set_camera_bounds_type *view_set_camera_bounds;
custom_view_get_camera_bounds_type *view_get_camera_bounds;
custom_view_set_cursor_type *view_set_cursor;
custom_view_set_buffer_scroll_type *view_set_buffer_scroll;
custom_view_set_mark_type *view_set_mark;
custom_view_quit_ui_type *view_quit_ui;
custom_view_set_buffer_type *view_set_buffer;
custom_view_push_context_type *view_push_context;
custom_view_pop_context_type *view_pop_context;
custom_view_alter_context_type *view_alter_context;
custom_view_current_context_type *view_current_context;
custom_view_current_context_hook_memory_type *view_current_context_hook_memory;
custom_create_user_managed_scope_type *create_user_managed_scope;
custom_destroy_user_managed_scope_type *destroy_user_managed_scope;
custom_get_global_managed_scope_type *get_global_managed_scope;
custom_get_managed_scope_with_multiple_dependencies_type *get_managed_scope_with_multiple_dependencies;
custom_managed_scope_clear_contents_type *managed_scope_clear_contents;
custom_managed_scope_clear_self_all_dependent_scopes_type *managed_scope_clear_self_all_dependent_scopes;
custom_managed_scope_allocator_type *managed_scope_allocator;
custom_managed_id_group_highest_id_type *managed_id_group_highest_id;
custom_managed_id_declare_type *managed_id_declare;
custom_managed_id_get_type *managed_id_get;
custom_managed_scope_get_attachment_type *managed_scope_get_attachment;
custom_managed_scope_attachment_erase_type *managed_scope_attachment_erase;
custom_alloc_managed_memory_in_scope_type *alloc_managed_memory_in_scope;
custom_alloc_buffer_markers_on_buffer_type *alloc_buffer_markers_on_buffer;
custom_managed_object_get_item_size_type *managed_object_get_item_size;
custom_managed_object_get_item_count_type *managed_object_get_item_count;
custom_managed_object_get_pointer_type *managed_object_get_pointer;
custom_managed_object_get_type_type *managed_object_get_type;
custom_managed_object_get_containing_scope_type *managed_object_get_containing_scope;
custom_managed_object_free_type *managed_object_free;
custom_managed_object_store_data_type *managed_object_store_data;
custom_managed_object_load_data_type *managed_object_load_data;
custom_get_next_input_raw_type *get_next_input_raw;
custom_get_current_input_sequence_number_type *get_current_input_sequence_number;
custom_get_current_input_type *get_current_input;
custom_set_current_input_type *set_current_input;
custom_leave_current_input_unhandled_type *leave_current_input_unhandled;
custom_set_custom_hook_type *set_custom_hook;
custom_get_custom_hook_type *get_custom_hook;
custom_set_custom_hook_memory_size_type *set_custom_hook_memory_size;
custom_get_mouse_state_type *get_mouse_state;
custom_get_active_query_bars_type *get_active_query_bars;
custom_start_query_bar_type *start_query_bar;
custom_end_query_bar_type *end_query_bar;
custom_clear_all_query_bars_type *clear_all_query_bars;
custom_print_message_type *print_message;
custom_log_string_type *log_string;
custom_get_largest_face_id_type *get_largest_face_id;
custom_set_global_face_type *set_global_face;
custom_buffer_history_get_max_record_index_type *buffer_history_get_max_record_index;
custom_buffer_history_get_record_info_type *buffer_history_get_record_info;
custom_buffer_history_get_group_sub_record_type *buffer_history_get_group_sub_record;
custom_buffer_history_get_current_state_index_type *buffer_history_get_current_state_index;
custom_buffer_history_set_current_state_index_type *buffer_history_set_current_state_index;
custom_buffer_history_merge_record_range_type *buffer_history_merge_record_range;
custom_buffer_history_clear_after_current_state_type *buffer_history_clear_after_current_state;
custom_global_history_edit_group_begin_type *global_history_edit_group_begin;
custom_global_history_edit_group_end_type *global_history_edit_group_end;
custom_buffer_set_face_type *buffer_set_face;
custom_get_face_description_type *get_face_description;
custom_get_face_metrics_type *get_face_metrics;
custom_get_face_advance_map_type *get_face_advance_map;
custom_get_face_id_type *get_face_id;
custom_try_create_new_face_type *try_create_new_face;
custom_try_modify_face_type *try_modify_face;
custom_try_release_face_type *try_release_face;
custom_push_hot_directory_type *push_hot_directory;
custom_set_hot_directory_type *set_hot_directory;
custom_send_exit_signal_type *send_exit_signal;
custom_hard_exit_type *hard_exit;
custom_set_window_title_type *set_window_title;
custom_acquire_global_frame_mutex_type *acquire_global_frame_mutex;
custom_release_global_frame_mutex_type *release_global_frame_mutex;
custom_draw_string_oriented_type *draw_string_oriented;
custom_get_string_advance_type *get_string_advance;
custom_draw_rectangle_type *draw_rectangle;
custom_draw_rectangle_outline_type *draw_rectangle_outline;
custom_draw_set_clip_type *draw_set_clip;
custom_text_layout_create_type *text_layout_create;
custom_text_layout_region_type *text_layout_region;
custom_text_layout_get_buffer_type *text_layout_get_buffer;
custom_text_layout_get_visible_range_type *text_layout_get_visible_range;
custom_text_layout_line_on_screen_type *text_layout_line_on_screen;
custom_text_layout_character_on_screen_type *text_layout_character_on_screen;
custom_paint_text_color_type *paint_text_color;
custom_paint_text_color_blend_type *paint_text_color_blend;
custom_text_layout_free_type *text_layout_free;
custom_draw_text_layout_type *draw_text_layout;
custom_open_color_picker_type *open_color_picker;
custom_animate_in_n_milliseconds_type *animate_in_n_milliseconds;
custom_buffer_find_all_matches_type *buffer_find_all_matches;
custom_get_core_profile_list_type *get_core_profile_list;
custom_get_custom_layer_boundary_docs_type *get_custom_layer_boundary_docs;
};
#if defined(STATIC_LINK_API)
internal b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
internal Rect_f32 global_get_screen_rectangle(Application_Links* app);
internal Thread_Context* get_thread_context(Application_Links* app);
internal Child_Process_ID create_child_process(Application_Links* app, String_Const_u8 path, String_Const_u8 command);
internal b32 child_process_set_target_buffer(Application_Links* app, Child_Process_ID child_process_id, Buffer_ID buffer_id, Child_Process_Set_Target_Flags flags);
internal Child_Process_ID buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id);
internal Buffer_ID child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id);
internal Process_State child_process_get_state(Application_Links* app, Child_Process_ID child_process_id);
internal b32 enqueue_virtual_event(Application_Links* app, Input_Event* event);
internal i32 get_buffer_count(Application_Links* app);
internal Buffer_ID get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access);
internal Buffer_ID get_buffer_by_name(Application_Links* app, String_Const_u8 name, Access_Flag access);
internal Buffer_ID get_buffer_by_file_name(Application_Links* app, String_Const_u8 file_name, Access_Flag access);
internal b32 buffer_read_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, u8* out);
internal b32 buffer_replace_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string);
internal b32 buffer_batch_edit(Application_Links* app, Buffer_ID buffer_id, Batch_Edit* batch);
internal String_Match buffer_seek_string(Application_Links* app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos);
internal String_Match buffer_seek_character_class(Application_Links* app, Buffer_ID buffer, Character_Predicate* predicate, Scan_Direction direction, i64 start_pos);
internal f32 buffer_line_y_difference(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line_a, i64 line_b);
internal Line_Shift_Vertical buffer_line_shift_y(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line, f32 y_shift);
internal i64 buffer_pos_at_relative_xy(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy);
internal Rect_f32 buffer_relative_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
internal Rect_f32 buffer_padded_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
internal i64 buffer_relative_character_from_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
internal i64 buffer_pos_from_relative_character(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 relative_character);
internal f32 view_line_y_difference(Application_Links* app, View_ID view_id, i64 line_a, i64 line_b);
internal Line_Shift_Vertical view_line_shift_y(Application_Links* app, View_ID view_id, i64 line, f32 y_shift);
internal i64 view_pos_at_relative_xy(Application_Links* app, View_ID view_id, i64 base_line, Vec2_f32 relative_xy);
internal Rect_f32 view_relative_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
internal Rect_f32 view_padded_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
internal i64 view_relative_character_from_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
internal i64 view_pos_from_relative_character(Application_Links* app, View_ID view_id, i64 base_line, i64 character);
internal b32 buffer_exists(Application_Links* app, Buffer_ID buffer_id);
internal Access_Flag buffer_get_access_flags(Application_Links* app, Buffer_ID buffer_id);
internal i64 buffer_get_size(Application_Links* app, Buffer_ID buffer_id);
internal i64 buffer_get_line_count(Application_Links* app, Buffer_ID buffer_id);
internal String_Const_u8 push_buffer_base_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
internal String_Const_u8 push_buffer_unique_name(Application_Links* app, Arena* out, Buffer_ID buffer_id);
internal String_Const_u8 push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
internal Dirty_State buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id);
internal b32 buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
internal b32 buffer_set_layout(Application_Links* app, Buffer_ID buffer_id, Layout_Function* layout_func);
internal b32 buffer_clear_layout_cache(Application_Links* app, Buffer_ID buffer_id);
internal Layout_Function* buffer_get_layout(Application_Links* app, Buffer_ID buffer_id);
internal b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
internal b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
internal Managed_Scope buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id);
internal b32 buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id);
internal Buffer_ID create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
internal b32 buffer_save(Application_Links* app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags);
internal Buffer_Kill_Result buffer_kill(Application_Links* app, Buffer_ID buffer_id, Buffer_Kill_Flag flags);
internal Buffer_Reopen_Result buffer_reopen(Application_Links* app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags);
internal File_Attributes buffer_get_file_attributes(Application_Links* app, Buffer_ID buffer_id);
internal View_ID get_view_next(Application_Links* app, View_ID view_id, Access_Flag access);
internal View_ID get_view_prev(Application_Links* app, View_ID view_id, Access_Flag access);
internal View_ID get_this_ctx_view(Application_Links* app, Access_Flag access);
internal View_ID get_active_view(Application_Links* app, Access_Flag access);
internal b32 view_exists(Application_Links* app, View_ID view_id);
internal Buffer_ID view_get_buffer(Application_Links* app, View_ID view_id, Access_Flag access);
internal i64 view_get_cursor_pos(Application_Links* app, View_ID view_id);
internal i64 view_get_mark_pos(Application_Links* app, View_ID view_id);
internal f32 view_get_preferred_x(Application_Links* app, View_ID view_id);
internal b32 view_set_preferred_x(Application_Links* app, View_ID view_id, f32 x);
internal Rect_f32 view_get_screen_rect(Application_Links* app, View_ID view_id);
internal Panel_ID view_get_panel(Application_Links* app, View_ID view_id);
internal View_ID panel_get_view(Application_Links* app, Panel_ID panel_id, Access_Flag access);
internal b32 panel_is_split(Application_Links* app, Panel_ID panel_id);
internal b32 panel_is_leaf(Application_Links* app, Panel_ID panel_id);
internal b32 panel_split(Application_Links* app, Panel_ID panel_id, Dimension split_dim);
internal b32 panel_set_split(Application_Links* app, Panel_ID panel_id, Panel_Split_Kind kind, f32 t);
internal b32 panel_swap_children(Application_Links* app, Panel_ID panel_id);
internal Panel_ID panel_get_root(Application_Links* app);
internal Panel_ID panel_get_parent(Application_Links* app, Panel_ID panel_id);
internal Panel_ID panel_get_child(Application_Links* app, Panel_ID panel_id, Side which_child);
internal b32 view_close(Application_Links* app, View_ID view_id);
internal Rect_f32 view_get_buffer_region(Application_Links* app, View_ID view_id);
internal Buffer_Scroll view_get_buffer_scroll(Application_Links* app, View_ID view_id);
internal b32 view_set_active(Application_Links* app, View_ID view_id);
internal b32 view_enqueue_command_function(Application_Links* app, View_ID view_id, Custom_Command_Function* custom_func);
internal b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
internal b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
internal Managed_Scope view_get_managed_scope(Application_Links* app, View_ID view_id);
internal Buffer_Cursor buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
internal Buffer_Cursor view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
internal b32 view_set_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32 margin, Vec2_f32 push_in_multiplier);
internal b32 view_get_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32* margin, Vec2_f32* push_in_multiplier);
internal b32 view_set_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
internal b32 view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
internal b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
internal b32 view_quit_ui(Application_Links* app, View_ID view_id);
internal b32 view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
internal b32 view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx);
internal b32 view_pop_context(Application_Links* app, View_ID view_id);
internal b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
internal View_Context view_current_context(Application_Links* app, View_ID view_id);
internal String_Const_u8 view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id);
internal Managed_Scope create_user_managed_scope(Application_Links* app);
internal b32 destroy_user_managed_scope(Application_Links* app, Managed_Scope scope);
internal Managed_Scope get_global_managed_scope(Application_Links* app);
internal Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links* app, Managed_Scope* scopes, i32 count);
internal b32 managed_scope_clear_contents(Application_Links* app, Managed_Scope scope);
internal b32 managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope);
internal Base_Allocator* managed_scope_allocator(Application_Links* app, Managed_Scope scope);
internal u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
internal Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
internal Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
internal void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
internal b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
internal Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
internal Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
internal u32 managed_object_get_item_size(Application_Links* app, Managed_Object object);
internal u32 managed_object_get_item_count(Application_Links* app, Managed_Object object);
internal void* managed_object_get_pointer(Application_Links* app, Managed_Object object);
internal Managed_Object_Type managed_object_get_type(Application_Links* app, Managed_Object object);
internal Managed_Scope managed_object_get_containing_scope(Application_Links* app, Managed_Object object);
internal b32 managed_object_free(Application_Links* app, Managed_Object object);
internal b32 managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
internal b32 managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
internal User_Input get_next_input_raw(Application_Links* app);
internal i64 get_current_input_sequence_number(Application_Links* app);
internal User_Input get_current_input(Application_Links* app);
internal void set_current_input(Application_Links* app, User_Input* input);
internal void leave_current_input_unhandled(Application_Links* app);
internal void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
internal Void_Func* get_custom_hook(Application_Links* app, Hook_ID hook_id);
internal b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size);
internal Mouse_State get_mouse_state(Application_Links* app);
internal b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
internal b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
internal void end_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
internal void clear_all_query_bars(Application_Links* app, View_ID view_id);
internal void print_message(Application_Links* app, String_Const_u8 message);
internal b32 log_string(Application_Links* app, String_Const_u8 str);
internal Face_ID get_largest_face_id(Application_Links* app);
internal b32 set_global_face(Application_Links* app, Face_ID id);
internal History_Record_Index buffer_history_get_max_record_index(Application_Links* app, Buffer_ID buffer_id);
internal Record_Info buffer_history_get_record_info(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
internal Record_Info buffer_history_get_group_sub_record(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index, i32 sub_index);
internal History_Record_Index buffer_history_get_current_state_index(Application_Links* app, Buffer_ID buffer_id);
internal b32 buffer_history_set_current_state_index(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
internal b32 buffer_history_merge_record_range(Application_Links* app, Buffer_ID buffer_id, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags);
internal b32 buffer_history_clear_after_current_state(Application_Links* app, Buffer_ID buffer_id);
internal void global_history_edit_group_begin(Application_Links* app);
internal void global_history_edit_group_end(Application_Links* app);
internal b32 buffer_set_face(Application_Links* app, Buffer_ID buffer_id, Face_ID id);
internal Face_Description get_face_description(Application_Links* app, Face_ID face_id);
internal Face_Metrics get_face_metrics(Application_Links* app, Face_ID face_id);
internal Face_Advance_Map get_face_advance_map(Application_Links* app, Face_ID face_id);
internal Face_ID get_face_id(Application_Links* app, Buffer_ID buffer_id);
internal Face_ID try_create_new_face(Application_Links* app, Face_Description* description);
internal b32 try_modify_face(Application_Links* app, Face_ID id, Face_Description* description);
internal b32 try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id);
internal String_Const_u8 push_hot_directory(Application_Links* app, Arena* arena);
internal void set_hot_directory(Application_Links* app, String_Const_u8 string);
internal void send_exit_signal(Application_Links* app);
internal void hard_exit(Application_Links* app);
internal void set_window_title(Application_Links* app, String_Const_u8 title);
internal void acquire_global_frame_mutex(Application_Links* app);
internal void release_global_frame_mutex(Application_Links* app);
internal Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
internal f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str);
internal void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
internal void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
internal Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip);
internal Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
internal Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id);
internal Buffer_ID text_layout_get_buffer(Application_Links* app, Text_Layout_ID text_layout_id);
internal Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
internal Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
internal Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
internal void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
internal void paint_text_color_blend(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color, f32 blend);
internal b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
internal void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
internal void open_color_picker(Application_Links* app, Color_Picker* picker);
internal void animate_in_n_milliseconds(Application_Links* app, u32 n);
internal String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
internal Profile_Global_List* get_core_profile_list(Application_Links* app);
internal Doc_Cluster* get_custom_layer_boundary_docs(Application_Links* app, Arena* arena);
#undef STATIC_LINK_API
#elif defined(DYNAMIC_LINK_API)
global custom_global_set_setting_type *global_set_setting = 0;
global custom_global_get_screen_rectangle_type *global_get_screen_rectangle = 0;
global custom_get_thread_context_type *get_thread_context = 0;
global custom_create_child_process_type *create_child_process = 0;
global custom_child_process_set_target_buffer_type *child_process_set_target_buffer = 0;
global custom_buffer_get_attached_child_process_type *buffer_get_attached_child_process = 0;
global custom_child_process_get_attached_buffer_type *child_process_get_attached_buffer = 0;
global custom_child_process_get_state_type *child_process_get_state = 0;
global custom_enqueue_virtual_event_type *enqueue_virtual_event = 0;
global custom_get_buffer_count_type *get_buffer_count = 0;
global custom_get_buffer_next_type *get_buffer_next = 0;
global custom_get_buffer_by_name_type *get_buffer_by_name = 0;
global custom_get_buffer_by_file_name_type *get_buffer_by_file_name = 0;
global custom_buffer_read_range_type *buffer_read_range = 0;
global custom_buffer_replace_range_type *buffer_replace_range = 0;
global custom_buffer_batch_edit_type *buffer_batch_edit = 0;
global custom_buffer_seek_string_type *buffer_seek_string = 0;
global custom_buffer_seek_character_class_type *buffer_seek_character_class = 0;
global custom_buffer_line_y_difference_type *buffer_line_y_difference = 0;
global custom_buffer_line_shift_y_type *buffer_line_shift_y = 0;
global custom_buffer_pos_at_relative_xy_type *buffer_pos_at_relative_xy = 0;
global custom_buffer_relative_box_of_pos_type *buffer_relative_box_of_pos = 0;
global custom_buffer_padded_box_of_pos_type *buffer_padded_box_of_pos = 0;
global custom_buffer_relative_character_from_pos_type *buffer_relative_character_from_pos = 0;
global custom_buffer_pos_from_relative_character_type *buffer_pos_from_relative_character = 0;
global custom_view_line_y_difference_type *view_line_y_difference = 0;
global custom_view_line_shift_y_type *view_line_shift_y = 0;
global custom_view_pos_at_relative_xy_type *view_pos_at_relative_xy = 0;
global custom_view_relative_box_of_pos_type *view_relative_box_of_pos = 0;
global custom_view_padded_box_of_pos_type *view_padded_box_of_pos = 0;
global custom_view_relative_character_from_pos_type *view_relative_character_from_pos = 0;
global custom_view_pos_from_relative_character_type *view_pos_from_relative_character = 0;
global custom_buffer_exists_type *buffer_exists = 0;
global custom_buffer_get_access_flags_type *buffer_get_access_flags = 0;
global custom_buffer_get_size_type *buffer_get_size = 0;
global custom_buffer_get_line_count_type *buffer_get_line_count = 0;
global custom_push_buffer_base_name_type *push_buffer_base_name = 0;
global custom_push_buffer_unique_name_type *push_buffer_unique_name = 0;
global custom_push_buffer_file_name_type *push_buffer_file_name = 0;
global custom_buffer_get_dirty_state_type *buffer_get_dirty_state = 0;
global custom_buffer_set_dirty_state_type *buffer_set_dirty_state = 0;
global custom_buffer_set_layout_type *buffer_set_layout = 0;
global custom_buffer_clear_layout_cache_type *buffer_clear_layout_cache = 0;
global custom_buffer_get_layout_type *buffer_get_layout = 0;
global custom_buffer_get_setting_type *buffer_get_setting = 0;
global custom_buffer_set_setting_type *buffer_set_setting = 0;
global custom_buffer_get_managed_scope_type *buffer_get_managed_scope = 0;
global custom_buffer_send_end_signal_type *buffer_send_end_signal = 0;
global custom_create_buffer_type *create_buffer = 0;
global custom_buffer_save_type *buffer_save = 0;
global custom_buffer_kill_type *buffer_kill = 0;
global custom_buffer_reopen_type *buffer_reopen = 0;
global custom_buffer_get_file_attributes_type *buffer_get_file_attributes = 0;
global custom_get_view_next_type *get_view_next = 0;
global custom_get_view_prev_type *get_view_prev = 0;
global custom_get_this_ctx_view_type *get_this_ctx_view = 0;
global custom_get_active_view_type *get_active_view = 0;
global custom_view_exists_type *view_exists = 0;
global custom_view_get_buffer_type *view_get_buffer = 0;
global custom_view_get_cursor_pos_type *view_get_cursor_pos = 0;
global custom_view_get_mark_pos_type *view_get_mark_pos = 0;
global custom_view_get_preferred_x_type *view_get_preferred_x = 0;
global custom_view_set_preferred_x_type *view_set_preferred_x = 0;
global custom_view_get_screen_rect_type *view_get_screen_rect = 0;
global custom_view_get_panel_type *view_get_panel = 0;
global custom_panel_get_view_type *panel_get_view = 0;
global custom_panel_is_split_type *panel_is_split = 0;
global custom_panel_is_leaf_type *panel_is_leaf = 0;
global custom_panel_split_type *panel_split = 0;
global custom_panel_set_split_type *panel_set_split = 0;
global custom_panel_swap_children_type *panel_swap_children = 0;
global custom_panel_get_root_type *panel_get_root = 0;
global custom_panel_get_parent_type *panel_get_parent = 0;
global custom_panel_get_child_type *panel_get_child = 0;
global custom_view_close_type *view_close = 0;
global custom_view_get_buffer_region_type *view_get_buffer_region = 0;
global custom_view_get_buffer_scroll_type *view_get_buffer_scroll = 0;
global custom_view_set_active_type *view_set_active = 0;
global custom_view_enqueue_command_function_type *view_enqueue_command_function = 0;
global custom_view_get_setting_type *view_get_setting = 0;
global custom_view_set_setting_type *view_set_setting = 0;
global custom_view_get_managed_scope_type *view_get_managed_scope = 0;
global custom_buffer_compute_cursor_type *buffer_compute_cursor = 0;
global custom_view_compute_cursor_type *view_compute_cursor = 0;
global custom_view_set_camera_bounds_type *view_set_camera_bounds = 0;
global custom_view_get_camera_bounds_type *view_get_camera_bounds = 0;
global custom_view_set_cursor_type *view_set_cursor = 0;
global custom_view_set_buffer_scroll_type *view_set_buffer_scroll = 0;
global custom_view_set_mark_type *view_set_mark = 0;
global custom_view_quit_ui_type *view_quit_ui = 0;
global custom_view_set_buffer_type *view_set_buffer = 0;
global custom_view_push_context_type *view_push_context = 0;
global custom_view_pop_context_type *view_pop_context = 0;
global custom_view_alter_context_type *view_alter_context = 0;
global custom_view_current_context_type *view_current_context = 0;
global custom_view_current_context_hook_memory_type *view_current_context_hook_memory = 0;
global custom_create_user_managed_scope_type *create_user_managed_scope = 0;
global custom_destroy_user_managed_scope_type *destroy_user_managed_scope = 0;
global custom_get_global_managed_scope_type *get_global_managed_scope = 0;
global custom_get_managed_scope_with_multiple_dependencies_type *get_managed_scope_with_multiple_dependencies = 0;
global custom_managed_scope_clear_contents_type *managed_scope_clear_contents = 0;
global custom_managed_scope_clear_self_all_dependent_scopes_type *managed_scope_clear_self_all_dependent_scopes = 0;
global custom_managed_scope_allocator_type *managed_scope_allocator = 0;
global custom_managed_id_group_highest_id_type *managed_id_group_highest_id = 0;
global custom_managed_id_declare_type *managed_id_declare = 0;
global custom_managed_id_get_type *managed_id_get = 0;
global custom_managed_scope_get_attachment_type *managed_scope_get_attachment = 0;
global custom_managed_scope_attachment_erase_type *managed_scope_attachment_erase = 0;
global custom_alloc_managed_memory_in_scope_type *alloc_managed_memory_in_scope = 0;
global custom_alloc_buffer_markers_on_buffer_type *alloc_buffer_markers_on_buffer = 0;
global custom_managed_object_get_item_size_type *managed_object_get_item_size = 0;
global custom_managed_object_get_item_count_type *managed_object_get_item_count = 0;
global custom_managed_object_get_pointer_type *managed_object_get_pointer = 0;
global custom_managed_object_get_type_type *managed_object_get_type = 0;
global custom_managed_object_get_containing_scope_type *managed_object_get_containing_scope = 0;
global custom_managed_object_free_type *managed_object_free = 0;
global custom_managed_object_store_data_type *managed_object_store_data = 0;
global custom_managed_object_load_data_type *managed_object_load_data = 0;
global custom_get_next_input_raw_type *get_next_input_raw = 0;
global custom_get_current_input_sequence_number_type *get_current_input_sequence_number = 0;
global custom_get_current_input_type *get_current_input = 0;
global custom_set_current_input_type *set_current_input = 0;
global custom_leave_current_input_unhandled_type *leave_current_input_unhandled = 0;
global custom_set_custom_hook_type *set_custom_hook = 0;
global custom_get_custom_hook_type *get_custom_hook = 0;
global custom_set_custom_hook_memory_size_type *set_custom_hook_memory_size = 0;
global custom_get_mouse_state_type *get_mouse_state = 0;
global custom_get_active_query_bars_type *get_active_query_bars = 0;
global custom_start_query_bar_type *start_query_bar = 0;
global custom_end_query_bar_type *end_query_bar = 0;
global custom_clear_all_query_bars_type *clear_all_query_bars = 0;
global custom_print_message_type *print_message = 0;
global custom_log_string_type *log_string = 0;
global custom_get_largest_face_id_type *get_largest_face_id = 0;
global custom_set_global_face_type *set_global_face = 0;
global custom_buffer_history_get_max_record_index_type *buffer_history_get_max_record_index = 0;
global custom_buffer_history_get_record_info_type *buffer_history_get_record_info = 0;
global custom_buffer_history_get_group_sub_record_type *buffer_history_get_group_sub_record = 0;
global custom_buffer_history_get_current_state_index_type *buffer_history_get_current_state_index = 0;
global custom_buffer_history_set_current_state_index_type *buffer_history_set_current_state_index = 0;
global custom_buffer_history_merge_record_range_type *buffer_history_merge_record_range = 0;
global custom_buffer_history_clear_after_current_state_type *buffer_history_clear_after_current_state = 0;
global custom_global_history_edit_group_begin_type *global_history_edit_group_begin = 0;
global custom_global_history_edit_group_end_type *global_history_edit_group_end = 0;
global custom_buffer_set_face_type *buffer_set_face = 0;
global custom_get_face_description_type *get_face_description = 0;
global custom_get_face_metrics_type *get_face_metrics = 0;
global custom_get_face_advance_map_type *get_face_advance_map = 0;
global custom_get_face_id_type *get_face_id = 0;
global custom_try_create_new_face_type *try_create_new_face = 0;
global custom_try_modify_face_type *try_modify_face = 0;
global custom_try_release_face_type *try_release_face = 0;
global custom_push_hot_directory_type *push_hot_directory = 0;
global custom_set_hot_directory_type *set_hot_directory = 0;
global custom_send_exit_signal_type *send_exit_signal = 0;
global custom_hard_exit_type *hard_exit = 0;
global custom_set_window_title_type *set_window_title = 0;
global custom_acquire_global_frame_mutex_type *acquire_global_frame_mutex = 0;
global custom_release_global_frame_mutex_type *release_global_frame_mutex = 0;
global custom_draw_string_oriented_type *draw_string_oriented = 0;
global custom_get_string_advance_type *get_string_advance = 0;
global custom_draw_rectangle_type *draw_rectangle = 0;
global custom_draw_rectangle_outline_type *draw_rectangle_outline = 0;
global custom_draw_set_clip_type *draw_set_clip = 0;
global custom_text_layout_create_type *text_layout_create = 0;
global custom_text_layout_region_type *text_layout_region = 0;
global custom_text_layout_get_buffer_type *text_layout_get_buffer = 0;
global custom_text_layout_get_visible_range_type *text_layout_get_visible_range = 0;
global custom_text_layout_line_on_screen_type *text_layout_line_on_screen = 0;
global custom_text_layout_character_on_screen_type *text_layout_character_on_screen = 0;
global custom_paint_text_color_type *paint_text_color = 0;
global custom_paint_text_color_blend_type *paint_text_color_blend = 0;
global custom_text_layout_free_type *text_layout_free = 0;
global custom_draw_text_layout_type *draw_text_layout = 0;
global custom_open_color_picker_type *open_color_picker = 0;
global custom_animate_in_n_milliseconds_type *animate_in_n_milliseconds = 0;
global custom_buffer_find_all_matches_type *buffer_find_all_matches = 0;
global custom_get_core_profile_list_type *get_core_profile_list = 0;
global custom_get_custom_layer_boundary_docs_type *get_custom_layer_boundary_docs = 0;
#undef DYNAMIC_LINK_API
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,179 @@
api(custom) function b32 global_set_setting(Application_Links* app, Global_Setting_ID setting, i64 value);
api(custom) function Rect_f32 global_get_screen_rectangle(Application_Links* app);
api(custom) function Thread_Context* get_thread_context(Application_Links* app);
api(custom) function Child_Process_ID create_child_process(Application_Links* app, String_Const_u8 path, String_Const_u8 command);
api(custom) function b32 child_process_set_target_buffer(Application_Links* app, Child_Process_ID child_process_id, Buffer_ID buffer_id, Child_Process_Set_Target_Flags flags);
api(custom) function Child_Process_ID buffer_get_attached_child_process(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Buffer_ID child_process_get_attached_buffer(Application_Links* app, Child_Process_ID child_process_id);
api(custom) function Process_State child_process_get_state(Application_Links* app, Child_Process_ID child_process_id);
api(custom) function b32 enqueue_virtual_event(Application_Links* app, Input_Event* event);
api(custom) function i32 get_buffer_count(Application_Links* app);
api(custom) function Buffer_ID get_buffer_next(Application_Links* app, Buffer_ID buffer_id, Access_Flag access);
api(custom) function Buffer_ID get_buffer_by_name(Application_Links* app, String_Const_u8 name, Access_Flag access);
api(custom) function Buffer_ID get_buffer_by_file_name(Application_Links* app, String_Const_u8 file_name, Access_Flag access);
api(custom) function b32 buffer_read_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, u8* out);
api(custom) function b32 buffer_replace_range(Application_Links* app, Buffer_ID buffer_id, Range_i64 range, String_Const_u8 string);
api(custom) function b32 buffer_batch_edit(Application_Links* app, Buffer_ID buffer_id, Batch_Edit* batch);
api(custom) function String_Match buffer_seek_string(Application_Links* app, Buffer_ID buffer, String_Const_u8 needle, Scan_Direction direction, i64 start_pos);
api(custom) function String_Match buffer_seek_character_class(Application_Links* app, Buffer_ID buffer, Character_Predicate* predicate, Scan_Direction direction, i64 start_pos);
api(custom) function f32 buffer_line_y_difference(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line_a, i64 line_b);
api(custom) function Line_Shift_Vertical buffer_line_shift_y(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 line, f32 y_shift);
api(custom) function i64 buffer_pos_at_relative_xy(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, Vec2_f32 relative_xy);
api(custom) function Rect_f32 buffer_relative_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
api(custom) function Rect_f32 buffer_padded_box_of_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
api(custom) function i64 buffer_relative_character_from_pos(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 pos);
api(custom) function i64 buffer_pos_from_relative_character(Application_Links* app, Buffer_ID buffer_id, f32 width, Face_ID face_id, i64 base_line, i64 relative_character);
api(custom) function f32 view_line_y_difference(Application_Links* app, View_ID view_id, i64 line_a, i64 line_b);
api(custom) function Line_Shift_Vertical view_line_shift_y(Application_Links* app, View_ID view_id, i64 line, f32 y_shift);
api(custom) function i64 view_pos_at_relative_xy(Application_Links* app, View_ID view_id, i64 base_line, Vec2_f32 relative_xy);
api(custom) function Rect_f32 view_relative_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
api(custom) function Rect_f32 view_padded_box_of_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
api(custom) function i64 view_relative_character_from_pos(Application_Links* app, View_ID view_id, i64 base_line, i64 pos);
api(custom) function i64 view_pos_from_relative_character(Application_Links* app, View_ID view_id, i64 base_line, i64 character);
api(custom) function b32 buffer_exists(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Access_Flag buffer_get_access_flags(Application_Links* app, Buffer_ID buffer_id);
api(custom) function i64 buffer_get_size(Application_Links* app, Buffer_ID buffer_id);
api(custom) function i64 buffer_get_line_count(Application_Links* app, Buffer_ID buffer_id);
api(custom) function String_Const_u8 push_buffer_base_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
api(custom) function String_Const_u8 push_buffer_unique_name(Application_Links* app, Arena* out, Buffer_ID buffer_id);
api(custom) function String_Const_u8 push_buffer_file_name(Application_Links* app, Arena* arena, Buffer_ID buffer_id);
api(custom) function Dirty_State buffer_get_dirty_state(Application_Links* app, Buffer_ID buffer_id);
api(custom) function b32 buffer_set_dirty_state(Application_Links* app, Buffer_ID buffer_id, Dirty_State dirty_state);
api(custom) function b32 buffer_set_layout(Application_Links* app, Buffer_ID buffer_id, Layout_Function* layout_func);
api(custom) function b32 buffer_clear_layout_cache(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Layout_Function* buffer_get_layout(Application_Links* app, Buffer_ID buffer_id);
api(custom) function b32 buffer_get_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64* value_out);
api(custom) function b32 buffer_set_setting(Application_Links* app, Buffer_ID buffer_id, Buffer_Setting_ID setting, i64 value);
api(custom) function Managed_Scope buffer_get_managed_scope(Application_Links* app, Buffer_ID buffer_id);
api(custom) function b32 buffer_send_end_signal(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Buffer_ID create_buffer(Application_Links* app, String_Const_u8 file_name, Buffer_Create_Flag flags);
api(custom) function b32 buffer_save(Application_Links* app, Buffer_ID buffer_id, String_Const_u8 file_name, Buffer_Save_Flag flags);
api(custom) function Buffer_Kill_Result buffer_kill(Application_Links* app, Buffer_ID buffer_id, Buffer_Kill_Flag flags);
api(custom) function Buffer_Reopen_Result buffer_reopen(Application_Links* app, Buffer_ID buffer_id, Buffer_Reopen_Flag flags);
api(custom) function File_Attributes buffer_get_file_attributes(Application_Links* app, Buffer_ID buffer_id);
api(custom) function View_ID get_view_next(Application_Links* app, View_ID view_id, Access_Flag access);
api(custom) function View_ID get_view_prev(Application_Links* app, View_ID view_id, Access_Flag access);
api(custom) function View_ID get_this_ctx_view(Application_Links* app, Access_Flag access);
api(custom) function View_ID get_active_view(Application_Links* app, Access_Flag access);
api(custom) function b32 view_exists(Application_Links* app, View_ID view_id);
api(custom) function Buffer_ID view_get_buffer(Application_Links* app, View_ID view_id, Access_Flag access);
api(custom) function i64 view_get_cursor_pos(Application_Links* app, View_ID view_id);
api(custom) function i64 view_get_mark_pos(Application_Links* app, View_ID view_id);
api(custom) function f32 view_get_preferred_x(Application_Links* app, View_ID view_id);
api(custom) function b32 view_set_preferred_x(Application_Links* app, View_ID view_id, f32 x);
api(custom) function Rect_f32 view_get_screen_rect(Application_Links* app, View_ID view_id);
api(custom) function Panel_ID view_get_panel(Application_Links* app, View_ID view_id);
api(custom) function View_ID panel_get_view(Application_Links* app, Panel_ID panel_id, Access_Flag access);
api(custom) function b32 panel_is_split(Application_Links* app, Panel_ID panel_id);
api(custom) function b32 panel_is_leaf(Application_Links* app, Panel_ID panel_id);
api(custom) function b32 panel_split(Application_Links* app, Panel_ID panel_id, Dimension split_dim);
api(custom) function b32 panel_set_split(Application_Links* app, Panel_ID panel_id, Panel_Split_Kind kind, f32 t);
api(custom) function b32 panel_swap_children(Application_Links* app, Panel_ID panel_id);
api(custom) function Panel_ID panel_get_root(Application_Links* app);
api(custom) function Panel_ID panel_get_parent(Application_Links* app, Panel_ID panel_id);
api(custom) function Panel_ID panel_get_child(Application_Links* app, Panel_ID panel_id, Side which_child);
api(custom) function b32 view_close(Application_Links* app, View_ID view_id);
api(custom) function Rect_f32 view_get_buffer_region(Application_Links* app, View_ID view_id);
api(custom) function Buffer_Scroll view_get_buffer_scroll(Application_Links* app, View_ID view_id);
api(custom) function b32 view_set_active(Application_Links* app, View_ID view_id);
api(custom) function b32 view_enqueue_command_function(Application_Links* app, View_ID view_id, Custom_Command_Function* custom_func);
api(custom) function b32 view_get_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64* value_out);
api(custom) function b32 view_set_setting(Application_Links* app, View_ID view_id, View_Setting_ID setting, i64 value);
api(custom) function Managed_Scope view_get_managed_scope(Application_Links* app, View_ID view_id);
api(custom) function Buffer_Cursor buffer_compute_cursor(Application_Links* app, Buffer_ID buffer, Buffer_Seek seek);
api(custom) function Buffer_Cursor view_compute_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
api(custom) function b32 view_set_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32 margin, Vec2_f32 push_in_multiplier);
api(custom) function b32 view_get_camera_bounds(Application_Links* app, View_ID view_id, Vec2_f32* margin, Vec2_f32* push_in_multiplier);
api(custom) function b32 view_set_cursor(Application_Links* app, View_ID view_id, Buffer_Seek seek);
api(custom) function b32 view_set_buffer_scroll(Application_Links* app, View_ID view_id, Buffer_Scroll scroll, Set_Buffer_Scroll_Rule rule);
api(custom) function b32 view_set_mark(Application_Links* app, View_ID view_id, Buffer_Seek seek);
api(custom) function b32 view_quit_ui(Application_Links* app, View_ID view_id);
api(custom) function b32 view_set_buffer(Application_Links* app, View_ID view_id, Buffer_ID buffer_id, Set_Buffer_Flag flags);
api(custom) function b32 view_push_context(Application_Links* app, View_ID view_id, View_Context* ctx);
api(custom) function b32 view_pop_context(Application_Links* app, View_ID view_id);
api(custom) function b32 view_alter_context(Application_Links* app, View_ID view_id, View_Context* ctx);
api(custom) function View_Context view_current_context(Application_Links* app, View_ID view_id);
api(custom) function String_Const_u8 view_current_context_hook_memory(Application_Links* app, View_ID view_id, Hook_ID hook_id);
api(custom) function Managed_Scope create_user_managed_scope(Application_Links* app);
api(custom) function b32 destroy_user_managed_scope(Application_Links* app, Managed_Scope scope);
api(custom) function Managed_Scope get_global_managed_scope(Application_Links* app);
api(custom) function Managed_Scope get_managed_scope_with_multiple_dependencies(Application_Links* app, Managed_Scope* scopes, i32 count);
api(custom) function b32 managed_scope_clear_contents(Application_Links* app, Managed_Scope scope);
api(custom) function b32 managed_scope_clear_self_all_dependent_scopes(Application_Links* app, Managed_Scope scope);
api(custom) function Base_Allocator* managed_scope_allocator(Application_Links* app, Managed_Scope scope);
api(custom) function u64 managed_id_group_highest_id(Application_Links* app, String_Const_u8 group);
api(custom) function Managed_ID managed_id_declare(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
api(custom) function Managed_ID managed_id_get(Application_Links* app, String_Const_u8 group, String_Const_u8 name);
api(custom) function void* managed_scope_get_attachment(Application_Links* app, Managed_Scope scope, Managed_ID id, u64 size);
api(custom) function b32 managed_scope_attachment_erase(Application_Links* app, Managed_Scope scope, Managed_ID id);
api(custom) function Managed_Object alloc_managed_memory_in_scope(Application_Links* app, Managed_Scope scope, i32 item_size, i32 count);
api(custom) function Managed_Object alloc_buffer_markers_on_buffer(Application_Links* app, Buffer_ID buffer_id, i32 count, Managed_Scope* optional_extra_scope);
api(custom) function u32 managed_object_get_item_size(Application_Links* app, Managed_Object object);
api(custom) function u32 managed_object_get_item_count(Application_Links* app, Managed_Object object);
api(custom) function void* managed_object_get_pointer(Application_Links* app, Managed_Object object);
api(custom) function Managed_Object_Type managed_object_get_type(Application_Links* app, Managed_Object object);
api(custom) function Managed_Scope managed_object_get_containing_scope(Application_Links* app, Managed_Object object);
api(custom) function b32 managed_object_free(Application_Links* app, Managed_Object object);
api(custom) function b32 managed_object_store_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem);
api(custom) function b32 managed_object_load_data(Application_Links* app, Managed_Object object, u32 first_index, u32 count, void* mem_out);
api(custom) function User_Input get_next_input_raw(Application_Links* app);
api(custom) function i64 get_current_input_sequence_number(Application_Links* app);
api(custom) function User_Input get_current_input(Application_Links* app);
api(custom) function void set_current_input(Application_Links* app, User_Input* input);
api(custom) function void leave_current_input_unhandled(Application_Links* app);
api(custom) function void set_custom_hook(Application_Links* app, Hook_ID hook_id, Void_Func* func_ptr);
api(custom) function Void_Func* get_custom_hook(Application_Links* app, Hook_ID hook_id);
api(custom) function b32 set_custom_hook_memory_size(Application_Links* app, Hook_ID hook_id, u64 size);
api(custom) function Mouse_State get_mouse_state(Application_Links* app);
api(custom) function b32 get_active_query_bars(Application_Links* app, View_ID view_id, i32 max_result_count, Query_Bar_Ptr_Array* array_out);
api(custom) function b32 start_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
api(custom) function void end_query_bar(Application_Links* app, Query_Bar* bar, u32 flags);
api(custom) function void clear_all_query_bars(Application_Links* app, View_ID view_id);
api(custom) function void print_message(Application_Links* app, String_Const_u8 message);
api(custom) function b32 log_string(Application_Links* app, String_Const_u8 str);
api(custom) function Face_ID get_largest_face_id(Application_Links* app);
api(custom) function b32 set_global_face(Application_Links* app, Face_ID id);
api(custom) function History_Record_Index buffer_history_get_max_record_index(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Record_Info buffer_history_get_record_info(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
api(custom) function Record_Info buffer_history_get_group_sub_record(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index, i32 sub_index);
api(custom) function History_Record_Index buffer_history_get_current_state_index(Application_Links* app, Buffer_ID buffer_id);
api(custom) function b32 buffer_history_set_current_state_index(Application_Links* app, Buffer_ID buffer_id, History_Record_Index index);
api(custom) function b32 buffer_history_merge_record_range(Application_Links* app, Buffer_ID buffer_id, History_Record_Index first_index, History_Record_Index last_index, Record_Merge_Flag flags);
api(custom) function b32 buffer_history_clear_after_current_state(Application_Links* app, Buffer_ID buffer_id);
api(custom) function void global_history_edit_group_begin(Application_Links* app);
api(custom) function void global_history_edit_group_end(Application_Links* app);
api(custom) function b32 buffer_set_face(Application_Links* app, Buffer_ID buffer_id, Face_ID id);
api(custom) function Face_Description get_face_description(Application_Links* app, Face_ID face_id);
api(custom) function Face_Metrics get_face_metrics(Application_Links* app, Face_ID face_id);
api(custom) function Face_Advance_Map get_face_advance_map(Application_Links* app, Face_ID face_id);
api(custom) function Face_ID get_face_id(Application_Links* app, Buffer_ID buffer_id);
api(custom) function Face_ID try_create_new_face(Application_Links* app, Face_Description* description);
api(custom) function b32 try_modify_face(Application_Links* app, Face_ID id, Face_Description* description);
api(custom) function b32 try_release_face(Application_Links* app, Face_ID id, Face_ID replacement_id);
api(custom) function String_Const_u8 push_hot_directory(Application_Links* app, Arena* arena);
api(custom) function void set_hot_directory(Application_Links* app, String_Const_u8 string);
api(custom) function void send_exit_signal(Application_Links* app);
api(custom) function void hard_exit(Application_Links* app);
api(custom) function void set_window_title(Application_Links* app, String_Const_u8 title);
api(custom) function void acquire_global_frame_mutex(Application_Links* app);
api(custom) function void release_global_frame_mutex(Application_Links* app);
api(custom) function Vec2_f32 draw_string_oriented(Application_Links* app, Face_ID font_id, ARGB_Color color, String_Const_u8 str, Vec2_f32 point, u32 flags, Vec2_f32 delta);
api(custom) function f32 get_string_advance(Application_Links* app, Face_ID font_id, String_Const_u8 str);
api(custom) function void draw_rectangle(Application_Links* app, Rect_f32 rect, f32 roundness, ARGB_Color color);
api(custom) function void draw_rectangle_outline(Application_Links* app, Rect_f32 rect, f32 roundness, f32 thickness, ARGB_Color color);
api(custom) function Rect_f32 draw_set_clip(Application_Links* app, Rect_f32 new_clip);
api(custom) function Text_Layout_ID text_layout_create(Application_Links* app, Buffer_ID buffer_id, Rect_f32 rect, Buffer_Point buffer_point);
api(custom) function Rect_f32 text_layout_region(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function Buffer_ID text_layout_get_buffer(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function Range_i64 text_layout_get_visible_range(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function Range_f32 text_layout_line_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 line_number);
api(custom) function Rect_f32 text_layout_character_on_screen(Application_Links* app, Text_Layout_ID layout_id, i64 pos);
api(custom) function void paint_text_color(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color);
api(custom) function void paint_text_color_blend(Application_Links* app, Text_Layout_ID layout_id, Range_i64 range, ARGB_Color color, f32 blend);
api(custom) function b32 text_layout_free(Application_Links* app, Text_Layout_ID text_layout_id);
api(custom) function void draw_text_layout(Application_Links* app, Text_Layout_ID layout_id, ARGB_Color special_color, ARGB_Color ghost_color);
api(custom) function void open_color_picker(Application_Links* app, Color_Picker* picker);
api(custom) function void animate_in_n_milliseconds(Application_Links* app, u32 n);
api(custom) function String_Match_List buffer_find_all_matches(Application_Links* app, Arena* arena, Buffer_ID buffer, i32 string_id, Range_i64 range, String_Const_u8 needle, Character_Predicate* predicate, Scan_Direction direction);
api(custom) function Profile_Global_List* get_core_profile_list(Application_Links* app);
api(custom) function Doc_Cluster* get_custom_layer_boundary_docs(Application_Links* app, Arena* arena);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,375 @@
#if !defined(FCODER_LEX_GEN_HAND_WRITTEN_TYPES)
#define FCODER_LEX_GEN_HAND_WRITTEN_TYPES
struct Lexeme_Table_Value{
Token_Base_Kind base_kind;
u16 sub_kind;
};
struct Lexeme_Table_Lookup{
b32 found_match;
Token_Base_Kind base_kind;
u16 sub_kind;
};
#endif
typedef u16 Token_Cpp_Kind;
enum{
TokenCppKind_EOF = 0,
TokenCppKind_Whitespace = 1,
TokenCppKind_LexError = 2,
TokenCppKind_BlockComment = 3,
TokenCppKind_LineComment = 4,
TokenCppKind_Backslash = 5,
TokenCppKind_LiteralInteger = 6,
TokenCppKind_LiteralIntegerU = 7,
TokenCppKind_LiteralIntegerL = 8,
TokenCppKind_LiteralIntegerUL = 9,
TokenCppKind_LiteralIntegerLL = 10,
TokenCppKind_LiteralIntegerULL = 11,
TokenCppKind_LiteralIntegerHex = 12,
TokenCppKind_LiteralIntegerHexU = 13,
TokenCppKind_LiteralIntegerHexL = 14,
TokenCppKind_LiteralIntegerHexUL = 15,
TokenCppKind_LiteralIntegerHexLL = 16,
TokenCppKind_LiteralIntegerHexULL = 17,
TokenCppKind_LiteralIntegerOct = 18,
TokenCppKind_LiteralIntegerOctU = 19,
TokenCppKind_LiteralIntegerOctL = 20,
TokenCppKind_LiteralIntegerOctUL = 21,
TokenCppKind_LiteralIntegerOctLL = 22,
TokenCppKind_LiteralIntegerOctULL = 23,
TokenCppKind_LiteralFloat32 = 24,
TokenCppKind_LiteralFloat64 = 25,
TokenCppKind_LiteralString = 26,
TokenCppKind_LiteralStringWide = 27,
TokenCppKind_LiteralStringUTF8 = 28,
TokenCppKind_LiteralStringUTF16 = 29,
TokenCppKind_LiteralStringUTF32 = 30,
TokenCppKind_LiteralStringRaw = 31,
TokenCppKind_LiteralStringWideRaw = 32,
TokenCppKind_LiteralStringUTF8Raw = 33,
TokenCppKind_LiteralStringUTF16Raw = 34,
TokenCppKind_LiteralStringUTF32Raw = 35,
TokenCppKind_LiteralCharacter = 36,
TokenCppKind_LiteralCharacterWide = 37,
TokenCppKind_LiteralCharacterUTF8 = 38,
TokenCppKind_LiteralCharacterUTF16 = 39,
TokenCppKind_LiteralCharacterUTF32 = 40,
TokenCppKind_PPIncludeFile = 41,
TokenCppKind_PPErrorMessage = 42,
TokenCppKind_KeywordGeneric = 43,
TokenCppKind_BraceOp = 44,
TokenCppKind_BraceCl = 45,
TokenCppKind_ParenOp = 46,
TokenCppKind_BrackOp = 47,
TokenCppKind_ParenCl = 48,
TokenCppKind_BrackCl = 49,
TokenCppKind_Semicolon = 50,
TokenCppKind_Colon = 51,
TokenCppKind_DotDotDot = 52,
TokenCppKind_ColonColon = 53,
TokenCppKind_PlusPlus = 54,
TokenCppKind_MinusMinus = 55,
TokenCppKind_Dot = 56,
TokenCppKind_Arrow = 57,
TokenCppKind_Plus = 58,
TokenCppKind_Minus = 59,
TokenCppKind_Not = 60,
TokenCppKind_Tilde = 61,
TokenCppKind_Star = 62,
TokenCppKind_And = 63,
TokenCppKind_DotStar = 64,
TokenCppKind_ArrowStar = 65,
TokenCppKind_Div = 66,
TokenCppKind_Mod = 67,
TokenCppKind_LeftLeft = 68,
TokenCppKind_RightRight = 69,
TokenCppKind_Compare = 70,
TokenCppKind_Less = 71,
TokenCppKind_LessEq = 72,
TokenCppKind_Grtr = 73,
TokenCppKind_GrtrEq = 74,
TokenCppKind_EqEq = 75,
TokenCppKind_NotEq = 76,
TokenCppKind_Xor = 77,
TokenCppKind_Or = 78,
TokenCppKind_AndAnd = 79,
TokenCppKind_OrOr = 80,
TokenCppKind_Ternary = 81,
TokenCppKind_Eq = 82,
TokenCppKind_PlusEq = 83,
TokenCppKind_MinusEq = 84,
TokenCppKind_StarEq = 85,
TokenCppKind_DivEq = 86,
TokenCppKind_ModEq = 87,
TokenCppKind_LeftLeftEq = 88,
TokenCppKind_RightRightEq = 89,
TokenCppKind_Comma = 90,
TokenCppKind_PPStringify = 91,
TokenCppKind_PPConcat = 92,
TokenCppKind_Void = 93,
TokenCppKind_Bool = 94,
TokenCppKind_Char = 95,
TokenCppKind_Int = 96,
TokenCppKind_Float = 97,
TokenCppKind_Double = 98,
TokenCppKind_Long = 99,
TokenCppKind_Short = 100,
TokenCppKind_Unsigned = 101,
TokenCppKind_Signed = 102,
TokenCppKind_Const = 103,
TokenCppKind_Volatile = 104,
TokenCppKind_Asm = 105,
TokenCppKind_Break = 106,
TokenCppKind_Case = 107,
TokenCppKind_Catch = 108,
TokenCppKind_Continue = 109,
TokenCppKind_Default = 110,
TokenCppKind_Do = 111,
TokenCppKind_Else = 112,
TokenCppKind_For = 113,
TokenCppKind_Goto = 114,
TokenCppKind_If = 115,
TokenCppKind_Return = 116,
TokenCppKind_Switch = 117,
TokenCppKind_Try = 118,
TokenCppKind_While = 119,
TokenCppKind_StaticAssert = 120,
TokenCppKind_ConstCast = 121,
TokenCppKind_DynamicCast = 122,
TokenCppKind_ReinterpretCast = 123,
TokenCppKind_StaticCast = 124,
TokenCppKind_Class = 125,
TokenCppKind_Enum = 126,
TokenCppKind_Struct = 127,
TokenCppKind_Typedef = 128,
TokenCppKind_Union = 129,
TokenCppKind_Template = 130,
TokenCppKind_Typename = 131,
TokenCppKind_Friend = 132,
TokenCppKind_Namespace = 133,
TokenCppKind_Private = 134,
TokenCppKind_Protected = 135,
TokenCppKind_Public = 136,
TokenCppKind_Using = 137,
TokenCppKind_Extern = 138,
TokenCppKind_Export = 139,
TokenCppKind_Inline = 140,
TokenCppKind_Static = 141,
TokenCppKind_Virtual = 142,
TokenCppKind_AlignAs = 143,
TokenCppKind_Explicit = 144,
TokenCppKind_NoExcept = 145,
TokenCppKind_NullPtr = 146,
TokenCppKind_Operator = 147,
TokenCppKind_Register = 148,
TokenCppKind_This = 149,
TokenCppKind_ThreadLocal = 150,
TokenCppKind_SizeOf = 151,
TokenCppKind_AlignOf = 152,
TokenCppKind_DeclType = 153,
TokenCppKind_TypeID = 154,
TokenCppKind_New = 155,
TokenCppKind_Delete = 156,
TokenCppKind_LiteralTrue = 157,
TokenCppKind_LiteralFalse = 158,
TokenCppKind_Identifier = 159,
TokenCppKind_PPInclude = 160,
TokenCppKind_PPVersion = 161,
TokenCppKind_PPDefine = 162,
TokenCppKind_PPUndef = 163,
TokenCppKind_PPIf = 164,
TokenCppKind_PPIfDef = 165,
TokenCppKind_PPIfNDef = 166,
TokenCppKind_PPElse = 167,
TokenCppKind_PPElIf = 168,
TokenCppKind_PPEndIf = 169,
TokenCppKind_PPError = 170,
TokenCppKind_PPImport = 171,
TokenCppKind_PPUsing = 172,
TokenCppKind_PPLine = 173,
TokenCppKind_PPPragma = 174,
TokenCppKind_PPUnknown = 175,
TokenCppKind_PPDefined = 176,
TokenCppKind_COUNT = 177,
};
char *token_cpp_kind_names[] = {
"EOF",
"Whitespace",
"LexError",
"BlockComment",
"LineComment",
"Backslash",
"LiteralInteger",
"LiteralIntegerU",
"LiteralIntegerL",
"LiteralIntegerUL",
"LiteralIntegerLL",
"LiteralIntegerULL",
"LiteralIntegerHex",
"LiteralIntegerHexU",
"LiteralIntegerHexL",
"LiteralIntegerHexUL",
"LiteralIntegerHexLL",
"LiteralIntegerHexULL",
"LiteralIntegerOct",
"LiteralIntegerOctU",
"LiteralIntegerOctL",
"LiteralIntegerOctUL",
"LiteralIntegerOctLL",
"LiteralIntegerOctULL",
"LiteralFloat32",
"LiteralFloat64",
"LiteralString",
"LiteralStringWide",
"LiteralStringUTF8",
"LiteralStringUTF16",
"LiteralStringUTF32",
"LiteralStringRaw",
"LiteralStringWideRaw",
"LiteralStringUTF8Raw",
"LiteralStringUTF16Raw",
"LiteralStringUTF32Raw",
"LiteralCharacter",
"LiteralCharacterWide",
"LiteralCharacterUTF8",
"LiteralCharacterUTF16",
"LiteralCharacterUTF32",
"PPIncludeFile",
"PPErrorMessage",
"KeywordGeneric",
"BraceOp",
"BraceCl",
"ParenOp",
"BrackOp",
"ParenCl",
"BrackCl",
"Semicolon",
"Colon",
"DotDotDot",
"ColonColon",
"PlusPlus",
"MinusMinus",
"Dot",
"Arrow",
"Plus",
"Minus",
"Not",
"Tilde",
"Star",
"And",
"DotStar",
"ArrowStar",
"Div",
"Mod",
"LeftLeft",
"RightRight",
"Compare",
"Less",
"LessEq",
"Grtr",
"GrtrEq",
"EqEq",
"NotEq",
"Xor",
"Or",
"AndAnd",
"OrOr",
"Ternary",
"Eq",
"PlusEq",
"MinusEq",
"StarEq",
"DivEq",
"ModEq",
"LeftLeftEq",
"RightRightEq",
"Comma",
"PPStringify",
"PPConcat",
"Void",
"Bool",
"Char",
"Int",
"Float",
"Double",
"Long",
"Short",
"Unsigned",
"Signed",
"Const",
"Volatile",
"Asm",
"Break",
"Case",
"Catch",
"Continue",
"Default",
"Do",
"Else",
"For",
"Goto",
"If",
"Return",
"Switch",
"Try",
"While",
"StaticAssert",
"ConstCast",
"DynamicCast",
"ReinterpretCast",
"StaticCast",
"Class",
"Enum",
"Struct",
"Typedef",
"Union",
"Template",
"Typename",
"Friend",
"Namespace",
"Private",
"Protected",
"Public",
"Using",
"Extern",
"Export",
"Inline",
"Static",
"Virtual",
"AlignAs",
"Explicit",
"NoExcept",
"NullPtr",
"Operator",
"Register",
"This",
"ThreadLocal",
"SizeOf",
"AlignOf",
"DeclType",
"TypeID",
"New",
"Delete",
"LiteralTrue",
"LiteralFalse",
"Identifier",
"PPInclude",
"PPVersion",
"PPDefine",
"PPUndef",
"PPIf",
"PPIfDef",
"PPIfNDef",
"PPElse",
"PPElIf",
"PPEndIf",
"PPError",
"PPImport",
"PPUsing",
"PPLine",
"PPPragma",
"PPUnknown",
"PPDefined",
};

View File

@ -0,0 +1,59 @@
function void
initialize_managed_id_metadata(Application_Links *app){
defcolor_bar = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_bar"));
defcolor_base = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_base"));
defcolor_pop1 = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_pop1"));
defcolor_pop2 = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_pop2"));
defcolor_back = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_back"));
defcolor_margin = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin"));
defcolor_margin_hover = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin_hover"));
defcolor_margin_active = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_margin_active"));
defcolor_list_item = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item"));
defcolor_list_item_hover = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item_hover"));
defcolor_list_item_active = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_list_item_active"));
defcolor_cursor = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_cursor"));
defcolor_at_cursor = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_at_cursor"));
defcolor_highlight_cursor_line = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_cursor_line"));
defcolor_highlight = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight"));
defcolor_at_highlight = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_at_highlight"));
defcolor_mark = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_mark"));
defcolor_text_default = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_text_default"));
defcolor_comment = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_comment"));
defcolor_comment_pop = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_comment_pop"));
defcolor_keyword = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_keyword"));
defcolor_str_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_str_constant"));
defcolor_char_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_char_constant"));
defcolor_int_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_int_constant"));
defcolor_float_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_float_constant"));
defcolor_bool_constant = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_bool_constant"));
defcolor_preproc = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_preproc"));
defcolor_include = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_include"));
defcolor_special_character = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_special_character"));
defcolor_ghost_character = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_ghost_character"));
defcolor_highlight_junk = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_junk"));
defcolor_highlight_white = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_highlight_white"));
defcolor_paste = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_paste"));
defcolor_undo = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_undo"));
defcolor_back_cycle = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_back_cycle"));
defcolor_text_cycle = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_text_cycle"));
defcolor_line_numbers_back = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_line_numbers_back"));
defcolor_line_numbers_text = managed_id_declare(app, string_u8_litexpr("colors"), string_u8_litexpr("defcolor_line_numbers_text"));
view_rewrite_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_rewrite_loc"));
view_next_rewrite_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_next_rewrite_loc"));
view_paste_index_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_paste_index_loc"));
view_is_passive_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_is_passive_loc"));
view_snap_mark_to_cursor = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_snap_mark_to_cursor"));
view_ui_data = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_ui_data"));
view_highlight_range = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_highlight_range"));
view_highlight_buffer = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_highlight_buffer"));
view_render_hook = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_render_hook"));
view_word_complete_menu = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_word_complete_menu"));
view_lister_loc = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_lister_loc"));
view_previous_buffer = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("view_previous_buffer"));
buffer_map_id = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_map_id"));
buffer_eol_setting = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_eol_setting"));
buffer_lex_task = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_lex_task"));
buffer_wrap_lines = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("buffer_wrap_lines"));
sticky_jump_marker_handle = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("sticky_jump_marker_handle"));
attachment_tokens = managed_id_declare(app, string_u8_litexpr("attachment"), string_u8_litexpr("attachment_tokens"));
}

View File

@ -0,0 +1,123 @@
function void
system_api_fill_vtable(API_VTable_system *vtable){
vtable->error_box = system_error_box;
vtable->get_path = system_get_path;
vtable->get_canonical = system_get_canonical;
vtable->get_file_list = system_get_file_list;
vtable->quick_file_attributes = system_quick_file_attributes;
vtable->load_handle = system_load_handle;
vtable->load_attributes = system_load_attributes;
vtable->load_file = system_load_file;
vtable->load_close = system_load_close;
vtable->save_file = system_save_file;
vtable->load_library = system_load_library;
vtable->release_library = system_release_library;
vtable->get_proc = system_get_proc;
vtable->now_time = system_now_time;
vtable->now_date_time_universal = system_now_date_time_universal;
vtable->local_date_time_from_universal = system_local_date_time_from_universal;
vtable->universal_date_time_from_local = system_universal_date_time_from_local;
vtable->wake_up_timer_create = system_wake_up_timer_create;
vtable->wake_up_timer_release = system_wake_up_timer_release;
vtable->wake_up_timer_set = system_wake_up_timer_set;
vtable->signal_step = system_signal_step;
vtable->sleep = system_sleep;
vtable->get_clipboard = system_get_clipboard;
vtable->post_clipboard = system_post_clipboard;
vtable->set_clipboard_catch_all = system_set_clipboard_catch_all;
vtable->get_clipboard_catch_all = system_get_clipboard_catch_all;
vtable->cli_call = system_cli_call;
vtable->cli_begin_update = system_cli_begin_update;
vtable->cli_update_step = system_cli_update_step;
vtable->cli_end_update = system_cli_end_update;
vtable->open_color_picker = system_open_color_picker;
vtable->get_screen_scale_factor = system_get_screen_scale_factor;
vtable->thread_launch = system_thread_launch;
vtable->thread_join = system_thread_join;
vtable->thread_free = system_thread_free;
vtable->thread_get_id = system_thread_get_id;
vtable->acquire_global_frame_mutex = system_acquire_global_frame_mutex;
vtable->release_global_frame_mutex = system_release_global_frame_mutex;
vtable->mutex_make = system_mutex_make;
vtable->mutex_acquire = system_mutex_acquire;
vtable->mutex_release = system_mutex_release;
vtable->mutex_free = system_mutex_free;
vtable->condition_variable_make = system_condition_variable_make;
vtable->condition_variable_wait = system_condition_variable_wait;
vtable->condition_variable_signal = system_condition_variable_signal;
vtable->condition_variable_free = system_condition_variable_free;
vtable->memory_allocate = system_memory_allocate;
vtable->memory_set_protection = system_memory_set_protection;
vtable->memory_free = system_memory_free;
vtable->memory_annotation = system_memory_annotation;
vtable->show_mouse_cursor = system_show_mouse_cursor;
vtable->set_fullscreen = system_set_fullscreen;
vtable->is_fullscreen = system_is_fullscreen;
vtable->get_keyboard_modifiers = system_get_keyboard_modifiers;
vtable->set_key_mode = system_set_key_mode;
vtable->set_source_mixer = system_set_source_mixer;
vtable->set_destination_mixer = system_set_destination_mixer;
}
#if defined(DYNAMIC_LINK_API)
function void
system_api_read_vtable(API_VTable_system *vtable){
system_error_box = vtable->error_box;
system_get_path = vtable->get_path;
system_get_canonical = vtable->get_canonical;
system_get_file_list = vtable->get_file_list;
system_quick_file_attributes = vtable->quick_file_attributes;
system_load_handle = vtable->load_handle;
system_load_attributes = vtable->load_attributes;
system_load_file = vtable->load_file;
system_load_close = vtable->load_close;
system_save_file = vtable->save_file;
system_load_library = vtable->load_library;
system_release_library = vtable->release_library;
system_get_proc = vtable->get_proc;
system_now_time = vtable->now_time;
system_now_date_time_universal = vtable->now_date_time_universal;
system_local_date_time_from_universal = vtable->local_date_time_from_universal;
system_universal_date_time_from_local = vtable->universal_date_time_from_local;
system_wake_up_timer_create = vtable->wake_up_timer_create;
system_wake_up_timer_release = vtable->wake_up_timer_release;
system_wake_up_timer_set = vtable->wake_up_timer_set;
system_signal_step = vtable->signal_step;
system_sleep = vtable->sleep;
system_get_clipboard = vtable->get_clipboard;
system_post_clipboard = vtable->post_clipboard;
system_set_clipboard_catch_all = vtable->set_clipboard_catch_all;
system_get_clipboard_catch_all = vtable->get_clipboard_catch_all;
system_cli_call = vtable->cli_call;
system_cli_begin_update = vtable->cli_begin_update;
system_cli_update_step = vtable->cli_update_step;
system_cli_end_update = vtable->cli_end_update;
system_open_color_picker = vtable->open_color_picker;
system_get_screen_scale_factor = vtable->get_screen_scale_factor;
system_thread_launch = vtable->thread_launch;
system_thread_join = vtable->thread_join;
system_thread_free = vtable->thread_free;
system_thread_get_id = vtable->thread_get_id;
system_acquire_global_frame_mutex = vtable->acquire_global_frame_mutex;
system_release_global_frame_mutex = vtable->release_global_frame_mutex;
system_mutex_make = vtable->mutex_make;
system_mutex_acquire = vtable->mutex_acquire;
system_mutex_release = vtable->mutex_release;
system_mutex_free = vtable->mutex_free;
system_condition_variable_make = vtable->condition_variable_make;
system_condition_variable_wait = vtable->condition_variable_wait;
system_condition_variable_signal = vtable->condition_variable_signal;
system_condition_variable_free = vtable->condition_variable_free;
system_memory_allocate = vtable->memory_allocate;
system_memory_set_protection = vtable->memory_set_protection;
system_memory_free = vtable->memory_free;
system_memory_annotation = vtable->memory_annotation;
system_show_mouse_cursor = vtable->show_mouse_cursor;
system_set_fullscreen = vtable->set_fullscreen;
system_is_fullscreen = vtable->is_fullscreen;
system_get_keyboard_modifiers = vtable->get_keyboard_modifiers;
system_set_key_mode = vtable->set_key_mode;
system_set_source_mixer = vtable->set_source_mixer;
system_set_destination_mixer = vtable->set_destination_mixer;
}
#undef DYNAMIC_LINK_API
#endif

View File

@ -0,0 +1,292 @@
#define system_error_box_sig() void system_error_box(char* msg)
#define system_get_path_sig() String_Const_u8 system_get_path(Arena* arena, System_Path_Code path_code)
#define system_get_canonical_sig() String_Const_u8 system_get_canonical(Arena* arena, String_Const_u8 name)
#define system_get_file_list_sig() File_List system_get_file_list(Arena* arena, String_Const_u8 directory)
#define system_quick_file_attributes_sig() File_Attributes system_quick_file_attributes(Arena* scratch, String_Const_u8 file_name)
#define system_load_handle_sig() b32 system_load_handle(Arena* scratch, char* file_name, Plat_Handle* out)
#define system_load_attributes_sig() File_Attributes system_load_attributes(Plat_Handle handle)
#define system_load_file_sig() b32 system_load_file(Plat_Handle handle, char* buffer, u32 size)
#define system_load_close_sig() b32 system_load_close(Plat_Handle handle)
#define system_save_file_sig() File_Attributes system_save_file(Arena* scratch, char* file_name, String_Const_u8 data)
#define system_load_library_sig() b32 system_load_library(Arena* scratch, String_Const_u8 file_name, System_Library* out)
#define system_release_library_sig() b32 system_release_library(System_Library handle)
#define system_get_proc_sig() Void_Func* system_get_proc(System_Library handle, char* proc_name)
#define system_now_time_sig() u64 system_now_time(void)
#define system_now_date_time_universal_sig() Date_Time system_now_date_time_universal(void)
#define system_local_date_time_from_universal_sig() Date_Time system_local_date_time_from_universal(Date_Time* date_time)
#define system_universal_date_time_from_local_sig() Date_Time system_universal_date_time_from_local(Date_Time* date_time)
#define system_wake_up_timer_create_sig() Plat_Handle system_wake_up_timer_create(void)
#define system_wake_up_timer_release_sig() void system_wake_up_timer_release(Plat_Handle handle)
#define system_wake_up_timer_set_sig() void system_wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds)
#define system_signal_step_sig() void system_signal_step(u32 code)
#define system_sleep_sig() void system_sleep(u64 microseconds)
#define system_get_clipboard_sig() String_Const_u8 system_get_clipboard(Arena* arena, i32 index)
#define system_post_clipboard_sig() void system_post_clipboard(String_Const_u8 str, i32 index)
#define system_set_clipboard_catch_all_sig() void system_set_clipboard_catch_all(b32 enabled)
#define system_get_clipboard_catch_all_sig() b32 system_get_clipboard_catch_all(void)
#define system_cli_call_sig() b32 system_cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out)
#define system_cli_begin_update_sig() void system_cli_begin_update(CLI_Handles* cli)
#define system_cli_update_step_sig() b32 system_cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount)
#define system_cli_end_update_sig() b32 system_cli_end_update(CLI_Handles* cli)
#define system_open_color_picker_sig() void system_open_color_picker(Color_Picker* picker)
#define system_get_screen_scale_factor_sig() f32 system_get_screen_scale_factor(void)
#define system_thread_launch_sig() System_Thread system_thread_launch(Thread_Function* proc, void* ptr)
#define system_thread_join_sig() void system_thread_join(System_Thread thread)
#define system_thread_free_sig() void system_thread_free(System_Thread thread)
#define system_thread_get_id_sig() i32 system_thread_get_id(void)
#define system_acquire_global_frame_mutex_sig() void system_acquire_global_frame_mutex(Thread_Context* tctx)
#define system_release_global_frame_mutex_sig() void system_release_global_frame_mutex(Thread_Context* tctx)
#define system_mutex_make_sig() System_Mutex system_mutex_make(void)
#define system_mutex_acquire_sig() void system_mutex_acquire(System_Mutex mutex)
#define system_mutex_release_sig() void system_mutex_release(System_Mutex mutex)
#define system_mutex_free_sig() void system_mutex_free(System_Mutex mutex)
#define system_condition_variable_make_sig() System_Condition_Variable system_condition_variable_make(void)
#define system_condition_variable_wait_sig() void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex)
#define system_condition_variable_signal_sig() void system_condition_variable_signal(System_Condition_Variable cv)
#define system_condition_variable_free_sig() void system_condition_variable_free(System_Condition_Variable cv)
#define system_memory_allocate_sig() void* system_memory_allocate(u64 size, String_Const_u8 location)
#define system_memory_set_protection_sig() b32 system_memory_set_protection(void* ptr, u64 size, u32 flags)
#define system_memory_free_sig() void system_memory_free(void* ptr, u64 size)
#define system_memory_annotation_sig() Memory_Annotation system_memory_annotation(Arena* arena)
#define system_show_mouse_cursor_sig() void system_show_mouse_cursor(i32 show)
#define system_set_fullscreen_sig() b32 system_set_fullscreen(b32 full_screen)
#define system_is_fullscreen_sig() b32 system_is_fullscreen(void)
#define system_get_keyboard_modifiers_sig() Input_Modifier_Set system_get_keyboard_modifiers(Arena* arena)
#define system_set_key_mode_sig() void system_set_key_mode(Key_Mode mode)
#define system_set_source_mixer_sig() void system_set_source_mixer(void* ctx, Audio_Mix_Sources_Function* mix_func)
#define system_set_destination_mixer_sig() void system_set_destination_mixer(Audio_Mix_Destination_Function* mix_func)
typedef void system_error_box_type(char* msg);
typedef String_Const_u8 system_get_path_type(Arena* arena, System_Path_Code path_code);
typedef String_Const_u8 system_get_canonical_type(Arena* arena, String_Const_u8 name);
typedef File_List system_get_file_list_type(Arena* arena, String_Const_u8 directory);
typedef File_Attributes system_quick_file_attributes_type(Arena* scratch, String_Const_u8 file_name);
typedef b32 system_load_handle_type(Arena* scratch, char* file_name, Plat_Handle* out);
typedef File_Attributes system_load_attributes_type(Plat_Handle handle);
typedef b32 system_load_file_type(Plat_Handle handle, char* buffer, u32 size);
typedef b32 system_load_close_type(Plat_Handle handle);
typedef File_Attributes system_save_file_type(Arena* scratch, char* file_name, String_Const_u8 data);
typedef b32 system_load_library_type(Arena* scratch, String_Const_u8 file_name, System_Library* out);
typedef b32 system_release_library_type(System_Library handle);
typedef Void_Func* system_get_proc_type(System_Library handle, char* proc_name);
typedef u64 system_now_time_type(void);
typedef Date_Time system_now_date_time_universal_type(void);
typedef Date_Time system_local_date_time_from_universal_type(Date_Time* date_time);
typedef Date_Time system_universal_date_time_from_local_type(Date_Time* date_time);
typedef Plat_Handle system_wake_up_timer_create_type(void);
typedef void system_wake_up_timer_release_type(Plat_Handle handle);
typedef void system_wake_up_timer_set_type(Plat_Handle handle, u32 time_milliseconds);
typedef void system_signal_step_type(u32 code);
typedef void system_sleep_type(u64 microseconds);
typedef String_Const_u8 system_get_clipboard_type(Arena* arena, i32 index);
typedef void system_post_clipboard_type(String_Const_u8 str, i32 index);
typedef void system_set_clipboard_catch_all_type(b32 enabled);
typedef b32 system_get_clipboard_catch_all_type(void);
typedef b32 system_cli_call_type(Arena* scratch, char* path, char* script, CLI_Handles* cli_out);
typedef void system_cli_begin_update_type(CLI_Handles* cli);
typedef b32 system_cli_update_step_type(CLI_Handles* cli, char* dest, u32 max, u32* amount);
typedef b32 system_cli_end_update_type(CLI_Handles* cli);
typedef void system_open_color_picker_type(Color_Picker* picker);
typedef f32 system_get_screen_scale_factor_type(void);
typedef System_Thread system_thread_launch_type(Thread_Function* proc, void* ptr);
typedef void system_thread_join_type(System_Thread thread);
typedef void system_thread_free_type(System_Thread thread);
typedef i32 system_thread_get_id_type(void);
typedef void system_acquire_global_frame_mutex_type(Thread_Context* tctx);
typedef void system_release_global_frame_mutex_type(Thread_Context* tctx);
typedef System_Mutex system_mutex_make_type(void);
typedef void system_mutex_acquire_type(System_Mutex mutex);
typedef void system_mutex_release_type(System_Mutex mutex);
typedef void system_mutex_free_type(System_Mutex mutex);
typedef System_Condition_Variable system_condition_variable_make_type(void);
typedef void system_condition_variable_wait_type(System_Condition_Variable cv, System_Mutex mutex);
typedef void system_condition_variable_signal_type(System_Condition_Variable cv);
typedef void system_condition_variable_free_type(System_Condition_Variable cv);
typedef void* system_memory_allocate_type(u64 size, String_Const_u8 location);
typedef b32 system_memory_set_protection_type(void* ptr, u64 size, u32 flags);
typedef void system_memory_free_type(void* ptr, u64 size);
typedef Memory_Annotation system_memory_annotation_type(Arena* arena);
typedef void system_show_mouse_cursor_type(i32 show);
typedef b32 system_set_fullscreen_type(b32 full_screen);
typedef b32 system_is_fullscreen_type(void);
typedef Input_Modifier_Set system_get_keyboard_modifiers_type(Arena* arena);
typedef void system_set_key_mode_type(Key_Mode mode);
typedef void system_set_source_mixer_type(void* ctx, Audio_Mix_Sources_Function* mix_func);
typedef void system_set_destination_mixer_type(Audio_Mix_Destination_Function* mix_func);
struct API_VTable_system{
system_error_box_type *error_box;
system_get_path_type *get_path;
system_get_canonical_type *get_canonical;
system_get_file_list_type *get_file_list;
system_quick_file_attributes_type *quick_file_attributes;
system_load_handle_type *load_handle;
system_load_attributes_type *load_attributes;
system_load_file_type *load_file;
system_load_close_type *load_close;
system_save_file_type *save_file;
system_load_library_type *load_library;
system_release_library_type *release_library;
system_get_proc_type *get_proc;
system_now_time_type *now_time;
system_now_date_time_universal_type *now_date_time_universal;
system_local_date_time_from_universal_type *local_date_time_from_universal;
system_universal_date_time_from_local_type *universal_date_time_from_local;
system_wake_up_timer_create_type *wake_up_timer_create;
system_wake_up_timer_release_type *wake_up_timer_release;
system_wake_up_timer_set_type *wake_up_timer_set;
system_signal_step_type *signal_step;
system_sleep_type *sleep;
system_get_clipboard_type *get_clipboard;
system_post_clipboard_type *post_clipboard;
system_set_clipboard_catch_all_type *set_clipboard_catch_all;
system_get_clipboard_catch_all_type *get_clipboard_catch_all;
system_cli_call_type *cli_call;
system_cli_begin_update_type *cli_begin_update;
system_cli_update_step_type *cli_update_step;
system_cli_end_update_type *cli_end_update;
system_open_color_picker_type *open_color_picker;
system_get_screen_scale_factor_type *get_screen_scale_factor;
system_thread_launch_type *thread_launch;
system_thread_join_type *thread_join;
system_thread_free_type *thread_free;
system_thread_get_id_type *thread_get_id;
system_acquire_global_frame_mutex_type *acquire_global_frame_mutex;
system_release_global_frame_mutex_type *release_global_frame_mutex;
system_mutex_make_type *mutex_make;
system_mutex_acquire_type *mutex_acquire;
system_mutex_release_type *mutex_release;
system_mutex_free_type *mutex_free;
system_condition_variable_make_type *condition_variable_make;
system_condition_variable_wait_type *condition_variable_wait;
system_condition_variable_signal_type *condition_variable_signal;
system_condition_variable_free_type *condition_variable_free;
system_memory_allocate_type *memory_allocate;
system_memory_set_protection_type *memory_set_protection;
system_memory_free_type *memory_free;
system_memory_annotation_type *memory_annotation;
system_show_mouse_cursor_type *show_mouse_cursor;
system_set_fullscreen_type *set_fullscreen;
system_is_fullscreen_type *is_fullscreen;
system_get_keyboard_modifiers_type *get_keyboard_modifiers;
system_set_key_mode_type *set_key_mode;
system_set_source_mixer_type *set_source_mixer;
system_set_destination_mixer_type *set_destination_mixer;
};
#if defined(STATIC_LINK_API)
internal void system_error_box(char* msg);
internal String_Const_u8 system_get_path(Arena* arena, System_Path_Code path_code);
internal String_Const_u8 system_get_canonical(Arena* arena, String_Const_u8 name);
internal File_List system_get_file_list(Arena* arena, String_Const_u8 directory);
internal File_Attributes system_quick_file_attributes(Arena* scratch, String_Const_u8 file_name);
internal b32 system_load_handle(Arena* scratch, char* file_name, Plat_Handle* out);
internal File_Attributes system_load_attributes(Plat_Handle handle);
internal b32 system_load_file(Plat_Handle handle, char* buffer, u32 size);
internal b32 system_load_close(Plat_Handle handle);
internal File_Attributes system_save_file(Arena* scratch, char* file_name, String_Const_u8 data);
internal b32 system_load_library(Arena* scratch, String_Const_u8 file_name, System_Library* out);
internal b32 system_release_library(System_Library handle);
internal Void_Func* system_get_proc(System_Library handle, char* proc_name);
internal u64 system_now_time(void);
internal Date_Time system_now_date_time_universal(void);
internal Date_Time system_local_date_time_from_universal(Date_Time* date_time);
internal Date_Time system_universal_date_time_from_local(Date_Time* date_time);
internal Plat_Handle system_wake_up_timer_create(void);
internal void system_wake_up_timer_release(Plat_Handle handle);
internal void system_wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds);
internal void system_signal_step(u32 code);
internal void system_sleep(u64 microseconds);
internal String_Const_u8 system_get_clipboard(Arena* arena, i32 index);
internal void system_post_clipboard(String_Const_u8 str, i32 index);
internal void system_set_clipboard_catch_all(b32 enabled);
internal b32 system_get_clipboard_catch_all(void);
internal b32 system_cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out);
internal void system_cli_begin_update(CLI_Handles* cli);
internal b32 system_cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount);
internal b32 system_cli_end_update(CLI_Handles* cli);
internal void system_open_color_picker(Color_Picker* picker);
internal f32 system_get_screen_scale_factor(void);
internal System_Thread system_thread_launch(Thread_Function* proc, void* ptr);
internal void system_thread_join(System_Thread thread);
internal void system_thread_free(System_Thread thread);
internal i32 system_thread_get_id(void);
internal void system_acquire_global_frame_mutex(Thread_Context* tctx);
internal void system_release_global_frame_mutex(Thread_Context* tctx);
internal System_Mutex system_mutex_make(void);
internal void system_mutex_acquire(System_Mutex mutex);
internal void system_mutex_release(System_Mutex mutex);
internal void system_mutex_free(System_Mutex mutex);
internal System_Condition_Variable system_condition_variable_make(void);
internal void system_condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex);
internal void system_condition_variable_signal(System_Condition_Variable cv);
internal void system_condition_variable_free(System_Condition_Variable cv);
internal void* system_memory_allocate(u64 size, String_Const_u8 location);
internal b32 system_memory_set_protection(void* ptr, u64 size, u32 flags);
internal void system_memory_free(void* ptr, u64 size);
internal Memory_Annotation system_memory_annotation(Arena* arena);
internal void system_show_mouse_cursor(i32 show);
internal b32 system_set_fullscreen(b32 full_screen);
internal b32 system_is_fullscreen(void);
internal Input_Modifier_Set system_get_keyboard_modifiers(Arena* arena);
internal void system_set_key_mode(Key_Mode mode);
internal void system_set_source_mixer(void* ctx, Audio_Mix_Sources_Function* mix_func);
internal void system_set_destination_mixer(Audio_Mix_Destination_Function* mix_func);
#undef STATIC_LINK_API
#elif defined(DYNAMIC_LINK_API)
global system_error_box_type *system_error_box = 0;
global system_get_path_type *system_get_path = 0;
global system_get_canonical_type *system_get_canonical = 0;
global system_get_file_list_type *system_get_file_list = 0;
global system_quick_file_attributes_type *system_quick_file_attributes = 0;
global system_load_handle_type *system_load_handle = 0;
global system_load_attributes_type *system_load_attributes = 0;
global system_load_file_type *system_load_file = 0;
global system_load_close_type *system_load_close = 0;
global system_save_file_type *system_save_file = 0;
global system_load_library_type *system_load_library = 0;
global system_release_library_type *system_release_library = 0;
global system_get_proc_type *system_get_proc = 0;
global system_now_time_type *system_now_time = 0;
global system_now_date_time_universal_type *system_now_date_time_universal = 0;
global system_local_date_time_from_universal_type *system_local_date_time_from_universal = 0;
global system_universal_date_time_from_local_type *system_universal_date_time_from_local = 0;
global system_wake_up_timer_create_type *system_wake_up_timer_create = 0;
global system_wake_up_timer_release_type *system_wake_up_timer_release = 0;
global system_wake_up_timer_set_type *system_wake_up_timer_set = 0;
global system_signal_step_type *system_signal_step = 0;
global system_sleep_type *system_sleep = 0;
global system_get_clipboard_type *system_get_clipboard = 0;
global system_post_clipboard_type *system_post_clipboard = 0;
global system_set_clipboard_catch_all_type *system_set_clipboard_catch_all = 0;
global system_get_clipboard_catch_all_type *system_get_clipboard_catch_all = 0;
global system_cli_call_type *system_cli_call = 0;
global system_cli_begin_update_type *system_cli_begin_update = 0;
global system_cli_update_step_type *system_cli_update_step = 0;
global system_cli_end_update_type *system_cli_end_update = 0;
global system_open_color_picker_type *system_open_color_picker = 0;
global system_get_screen_scale_factor_type *system_get_screen_scale_factor = 0;
global system_thread_launch_type *system_thread_launch = 0;
global system_thread_join_type *system_thread_join = 0;
global system_thread_free_type *system_thread_free = 0;
global system_thread_get_id_type *system_thread_get_id = 0;
global system_acquire_global_frame_mutex_type *system_acquire_global_frame_mutex = 0;
global system_release_global_frame_mutex_type *system_release_global_frame_mutex = 0;
global system_mutex_make_type *system_mutex_make = 0;
global system_mutex_acquire_type *system_mutex_acquire = 0;
global system_mutex_release_type *system_mutex_release = 0;
global system_mutex_free_type *system_mutex_free = 0;
global system_condition_variable_make_type *system_condition_variable_make = 0;
global system_condition_variable_wait_type *system_condition_variable_wait = 0;
global system_condition_variable_signal_type *system_condition_variable_signal = 0;
global system_condition_variable_free_type *system_condition_variable_free = 0;
global system_memory_allocate_type *system_memory_allocate = 0;
global system_memory_set_protection_type *system_memory_set_protection = 0;
global system_memory_free_type *system_memory_free = 0;
global system_memory_annotation_type *system_memory_annotation = 0;
global system_show_mouse_cursor_type *system_show_mouse_cursor = 0;
global system_set_fullscreen_type *system_set_fullscreen = 0;
global system_is_fullscreen_type *system_is_fullscreen = 0;
global system_get_keyboard_modifiers_type *system_get_keyboard_modifiers = 0;
global system_set_key_mode_type *system_set_key_mode = 0;
global system_set_source_mixer_type *system_set_source_mixer = 0;
global system_set_destination_mixer_type *system_set_destination_mixer = 0;
#undef DYNAMIC_LINK_API
#endif

View File

@ -0,0 +1,262 @@
function API_Definition*
system_api_construct(Arena *arena){
API_Definition *result = begin_api(arena, "system");
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("error_box"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "char*", "msg");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_path"), string_u8_litexpr("String_Const_u8"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
api_param(arena, call, "System_Path_Code", "path_code");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_canonical"), string_u8_litexpr("String_Const_u8"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
api_param(arena, call, "String_Const_u8", "name");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_file_list"), string_u8_litexpr("File_List"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
api_param(arena, call, "String_Const_u8", "directory");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("quick_file_attributes"), string_u8_litexpr("File_Attributes"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "scratch");
api_param(arena, call, "String_Const_u8", "file_name");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("load_handle"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "scratch");
api_param(arena, call, "char*", "file_name");
api_param(arena, call, "Plat_Handle*", "out");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("load_attributes"), string_u8_litexpr("File_Attributes"), string_u8_litexpr(""));
api_param(arena, call, "Plat_Handle", "handle");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("load_file"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Plat_Handle", "handle");
api_param(arena, call, "char*", "buffer");
api_param(arena, call, "u32", "size");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("load_close"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Plat_Handle", "handle");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("save_file"), string_u8_litexpr("File_Attributes"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "scratch");
api_param(arena, call, "char*", "file_name");
api_param(arena, call, "String_Const_u8", "data");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("load_library"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "scratch");
api_param(arena, call, "String_Const_u8", "file_name");
api_param(arena, call, "System_Library*", "out");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("release_library"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "System_Library", "handle");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_proc"), string_u8_litexpr("Void_Func*"), string_u8_litexpr(""));
api_param(arena, call, "System_Library", "handle");
api_param(arena, call, "char*", "proc_name");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("now_time"), string_u8_litexpr("u64"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("now_date_time_universal"), string_u8_litexpr("Date_Time"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("local_date_time_from_universal"), string_u8_litexpr("Date_Time"), string_u8_litexpr(""));
api_param(arena, call, "Date_Time*", "date_time");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("universal_date_time_from_local"), string_u8_litexpr("Date_Time"), string_u8_litexpr(""));
api_param(arena, call, "Date_Time*", "date_time");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("wake_up_timer_create"), string_u8_litexpr("Plat_Handle"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("wake_up_timer_release"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Plat_Handle", "handle");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("wake_up_timer_set"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Plat_Handle", "handle");
api_param(arena, call, "u32", "time_milliseconds");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("signal_step"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "u32", "code");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("sleep"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "u64", "microseconds");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_clipboard"), string_u8_litexpr("String_Const_u8"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
api_param(arena, call, "i32", "index");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("post_clipboard"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "String_Const_u8", "str");
api_param(arena, call, "i32", "index");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_clipboard_catch_all"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "b32", "enabled");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_clipboard_catch_all"), string_u8_litexpr("b32"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("cli_call"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "scratch");
api_param(arena, call, "char*", "path");
api_param(arena, call, "char*", "script");
api_param(arena, call, "CLI_Handles*", "cli_out");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("cli_begin_update"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "CLI_Handles*", "cli");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("cli_update_step"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "CLI_Handles*", "cli");
api_param(arena, call, "char*", "dest");
api_param(arena, call, "u32", "max");
api_param(arena, call, "u32*", "amount");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("cli_end_update"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "CLI_Handles*", "cli");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("open_color_picker"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Color_Picker*", "picker");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_screen_scale_factor"), string_u8_litexpr("f32"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("thread_launch"), string_u8_litexpr("System_Thread"), string_u8_litexpr(""));
api_param(arena, call, "Thread_Function*", "proc");
api_param(arena, call, "void*", "ptr");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("thread_join"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Thread", "thread");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("thread_free"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Thread", "thread");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("thread_get_id"), string_u8_litexpr("i32"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("acquire_global_frame_mutex"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Thread_Context*", "tctx");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("release_global_frame_mutex"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Thread_Context*", "tctx");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("mutex_make"), string_u8_litexpr("System_Mutex"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("mutex_acquire"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Mutex", "mutex");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("mutex_release"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Mutex", "mutex");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("mutex_free"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Mutex", "mutex");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("condition_variable_make"), string_u8_litexpr("System_Condition_Variable"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("condition_variable_wait"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Condition_Variable", "cv");
api_param(arena, call, "System_Mutex", "mutex");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("condition_variable_signal"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Condition_Variable", "cv");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("condition_variable_free"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "System_Condition_Variable", "cv");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_allocate"), string_u8_litexpr("void*"), string_u8_litexpr(""));
api_param(arena, call, "u64", "size");
api_param(arena, call, "String_Const_u8", "location");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_set_protection"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "void*", "ptr");
api_param(arena, call, "u64", "size");
api_param(arena, call, "u32", "flags");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_free"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "void*", "ptr");
api_param(arena, call, "u64", "size");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("memory_annotation"), string_u8_litexpr("Memory_Annotation"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("show_mouse_cursor"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "i32", "show");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_fullscreen"), string_u8_litexpr("b32"), string_u8_litexpr(""));
api_param(arena, call, "b32", "full_screen");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("is_fullscreen"), string_u8_litexpr("b32"), string_u8_litexpr(""));
(void)call;
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("get_keyboard_modifiers"), string_u8_litexpr("Input_Modifier_Set"), string_u8_litexpr(""));
api_param(arena, call, "Arena*", "arena");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_key_mode"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Key_Mode", "mode");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_source_mixer"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "void*", "ctx");
api_param(arena, call, "Audio_Mix_Sources_Function*", "mix_func");
}
{
API_Call *call = api_call_with_location(arena, result, string_u8_litexpr("set_destination_mixer"), string_u8_litexpr("void"), string_u8_litexpr(""));
api_param(arena, call, "Audio_Mix_Destination_Function*", "mix_func");
}
return(result);
}

View File

@ -0,0 +1,57 @@
api(system) function void error_box(char* msg);
api(system) function String_Const_u8 get_path(Arena* arena, System_Path_Code path_code);
api(system) function String_Const_u8 get_canonical(Arena* arena, String_Const_u8 name);
api(system) function File_List get_file_list(Arena* arena, String_Const_u8 directory);
api(system) function File_Attributes quick_file_attributes(Arena* scratch, String_Const_u8 file_name);
api(system) function b32 load_handle(Arena* scratch, char* file_name, Plat_Handle* out);
api(system) function File_Attributes load_attributes(Plat_Handle handle);
api(system) function b32 load_file(Plat_Handle handle, char* buffer, u32 size);
api(system) function b32 load_close(Plat_Handle handle);
api(system) function File_Attributes save_file(Arena* scratch, char* file_name, String_Const_u8 data);
api(system) function b32 load_library(Arena* scratch, String_Const_u8 file_name, System_Library* out);
api(system) function b32 release_library(System_Library handle);
api(system) function Void_Func* get_proc(System_Library handle, char* proc_name);
api(system) function u64 now_time(void);
api(system) function Date_Time now_date_time_universal(void);
api(system) function Date_Time local_date_time_from_universal(Date_Time* date_time);
api(system) function Date_Time universal_date_time_from_local(Date_Time* date_time);
api(system) function Plat_Handle wake_up_timer_create(void);
api(system) function void wake_up_timer_release(Plat_Handle handle);
api(system) function void wake_up_timer_set(Plat_Handle handle, u32 time_milliseconds);
api(system) function void signal_step(u32 code);
api(system) function void sleep(u64 microseconds);
api(system) function String_Const_u8 get_clipboard(Arena* arena, i32 index);
api(system) function void post_clipboard(String_Const_u8 str, i32 index);
api(system) function void set_clipboard_catch_all(b32 enabled);
api(system) function b32 get_clipboard_catch_all(void);
api(system) function b32 cli_call(Arena* scratch, char* path, char* script, CLI_Handles* cli_out);
api(system) function void cli_begin_update(CLI_Handles* cli);
api(system) function b32 cli_update_step(CLI_Handles* cli, char* dest, u32 max, u32* amount);
api(system) function b32 cli_end_update(CLI_Handles* cli);
api(system) function void open_color_picker(Color_Picker* picker);
api(system) function f32 get_screen_scale_factor(void);
api(system) function System_Thread thread_launch(Thread_Function* proc, void* ptr);
api(system) function void thread_join(System_Thread thread);
api(system) function void thread_free(System_Thread thread);
api(system) function i32 thread_get_id(void);
api(system) function void acquire_global_frame_mutex(Thread_Context* tctx);
api(system) function void release_global_frame_mutex(Thread_Context* tctx);
api(system) function System_Mutex mutex_make(void);
api(system) function void mutex_acquire(System_Mutex mutex);
api(system) function void mutex_release(System_Mutex mutex);
api(system) function void mutex_free(System_Mutex mutex);
api(system) function System_Condition_Variable condition_variable_make(void);
api(system) function void condition_variable_wait(System_Condition_Variable cv, System_Mutex mutex);
api(system) function void condition_variable_signal(System_Condition_Variable cv);
api(system) function void condition_variable_free(System_Condition_Variable cv);
api(system) function void* memory_allocate(u64 size, String_Const_u8 location);
api(system) function b32 memory_set_protection(void* ptr, u64 size, u32 flags);
api(system) function void memory_free(void* ptr, u64 size);
api(system) function Memory_Annotation memory_annotation(Arena* arena);
api(system) function void show_mouse_cursor(i32 show);
api(system) function b32 set_fullscreen(b32 full_screen);
api(system) function b32 is_fullscreen(void);
api(system) function Input_Modifier_Set get_keyboard_modifiers(Arena* arena);
api(system) function void set_key_mode(Key_Mode mode);
api(system) function void set_source_mixer(void* ctx, Audio_Mix_Sources_Function* mix_func);
api(system) function void set_destination_mixer(Audio_Mix_Destination_Function* mix_func);

View File

@ -469,7 +469,7 @@ int main(void){
path_to_self = string_remove_last_folder(path_to_self);
String_Const_u8 path_to_src = string_remove_last_folder(path_to_self);
String_Const_u8 test_file_name = push_u8_stringf(arena, "%.*s/languages/4coder_cpp_lexer_test.cpp",
String_Const_u8 test_file_name = push_u8_stringf(arena, "%.*s/languages/4coder_lexer_cpp_test.cpp",
string_expand(path_to_src));
FILE *test_file = fopen((char*)test_file_name.str, "rb");

View File

@ -1,14 +1,11 @@
/* Generated by "code/4ed_font_api.cpp" */
function void
font_api_fill_vtable(API_VTable_font *vtable){
vtable->make_face = font_make_face;
vtable->make_face = font_make_face;
}
#if defined(DYNAMIC_LINK_API)
function void
font_api_read_vtable(API_VTable_font *vtable){
font_make_face = vtable->make_face;
font_make_face = vtable->make_face;
}
#undef DYNAMIC_LINK_API
#endif

View File

@ -1,17 +1,11 @@
/* Generated by "code/4ed_font_api.cpp" */
#define font_make_face_sig() Face* font_make_face(Arena* arena, Face_Description* description, f32 scale_factor)
typedef Face* font_make_face_type(Arena* arena, Face_Description* description, f32 scale_factor);
struct API_VTable_font{
font_make_face_type *make_face;
font_make_face_type *make_face;
};
#if defined(STATIC_LINK_API)
internal Face* font_make_face(Arena* arena, Face_Description* description, f32 scale_factor);
#undef STATIC_LINK_API
#elif defined(DYNAMIC_LINK_API)
global font_make_face_type *font_make_face = 0;
#undef DYNAMIC_LINK_API

View File

@ -1,18 +1,13 @@
/* Generated by "code/4ed_graphics_api.cpp" */
function void
graphics_api_fill_vtable(API_VTable_graphics *vtable){
vtable->get_texture = graphics_get_texture;
vtable->fill_texture = graphics_fill_texture;
vtable->free_texture = graphics_free_texture;
vtable->get_texture = graphics_get_texture;
vtable->fill_texture = graphics_fill_texture;
}
#if defined(DYNAMIC_LINK_API)
function void
graphics_api_read_vtable(API_VTable_graphics *vtable){
graphics_get_texture = vtable->get_texture;
graphics_fill_texture = vtable->fill_texture;
graphics_free_texture = vtable->free_texture;
graphics_get_texture = vtable->get_texture;
graphics_fill_texture = vtable->fill_texture;
}
#undef DYNAMIC_LINK_API
#endif

View File

@ -1,28 +1,17 @@
/* Generated by "code/4ed_graphics_api.cpp" */
#define graphics_get_texture_sig() u32 graphics_get_texture(Vec3_i32 dim, Texture_Kind texture_kind)
#define graphics_fill_texture_sig() b32 graphics_fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data)
#define graphics_free_texture_sig() void graphics_free_texture(u32 texid)
typedef u32 graphics_get_texture_type(Vec3_i32 dim, Texture_Kind texture_kind);
typedef b32 graphics_fill_texture_type(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data);
typedef void graphics_free_texture_type(u32 texid);
struct API_VTable_graphics{
graphics_get_texture_type *get_texture;
graphics_fill_texture_type *fill_texture;
graphics_free_texture_type *free_texture;
graphics_get_texture_type *get_texture;
graphics_fill_texture_type *fill_texture;
};
#if defined(STATIC_LINK_API)
internal u32 graphics_get_texture(Vec3_i32 dim, Texture_Kind texture_kind);
internal b32 graphics_fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data);
internal void graphics_free_texture(u32 texid);
#undef STATIC_LINK_API
#elif defined(DYNAMIC_LINK_API)
global graphics_get_texture_type *graphics_get_texture = 0;
global graphics_fill_texture_type *graphics_fill_texture = 0;
global graphics_free_texture_type *graphics_free_texture = 0;
#undef DYNAMIC_LINK_API
#endif

View File

@ -57,7 +57,7 @@ struct Metal_Texture_Slot_List{
Metal_Texture_Slot *last_free_slot;
};
global_const u32 metal__invalid_texture_slot_locator = 0;
global_const u32 metal__invalid_texture_slot_locator = (u32)-1;
////////////////////////////////
@ -67,7 +67,6 @@ global_const u32 metal__invalid_texture_slot_locator = 0;
- (u32)get_texture_of_dim:(Vec3_i32)dim kind:(Texture_Kind)kind;
- (b32)fill_texture:(u32)texture kind:(Texture_Kind)kind pos:(Vec3_i32)p dim:(Vec3_i32)dim data:(void*)data;
- (void)bind_texture:(u32)handle encoder:(id<MTLRenderCommandEncoder>)render_encoder;
- (void)free_texture:(u32)handle;
- (Metal_Texture_Slot*)get_texture_slot_at_locator:(Metal_Texture_Slot_Locator)locator;
- (Metal_Texture_Slot*)get_texture_slot_at_handle:(u32)handle;
@ -285,11 +284,6 @@ metal__make_buffer(u32 size, id<MTLDevice> device){
// NOTE(yuval): Initialize the texture slot list
block_zero_struct(&_texture_slots);
// NOTE(simon): Other platforms use 0 as invalid handle, so we allocate the first texture here (it should be 0),
// and never use it so we can use 0 as the invalid handle.
u32 reserved_texture_slot_do_not_use = [self get_texture_of_dim:V3i32(2, 2, 1) kind:TextureKind_Mono];
Assert( reserved_texture_slot_do_not_use == 0 );
// NOTE(yuval): Create the fallback texture
_target->fallback_texture_id = [self get_texture_of_dim:V3i32(2, 2, 1)
kind:TextureKind_Mono];
@ -516,7 +510,7 @@ metal__make_buffer(u32 size, id<MTLDevice> device){
texture_descriptor.pixelFormat = MTLPixelFormatR8Unorm;
texture_descriptor.width = dim.x;
texture_descriptor.height = dim.y;
texture_descriptor.arrayLength = dim.z;
texture_descriptor.depth = dim.z;
// NOTE(yuval): Create the texture from the device using the descriptor and add it to the textures array.
Metal_Texture texture = [_device newTextureWithDescriptor:texture_descriptor];
@ -537,20 +531,16 @@ metal__make_buffer(u32 size, id<MTLDevice> device){
Metal_Texture texture = texture_slot->texture;
if (texture != 0){
// https://developer.apple.com/documentation/metal/mtlregion
// for 2d texture origin.z is 0, and depth is 1
MTLRegion replace_region = {
{(NSUInteger)p.x, (NSUInteger)p.y, 0},
{(NSUInteger)dim.x, (NSUInteger)dim.y, 1}
{(NSUInteger)p.x, (NSUInteger)p.y, (NSUInteger)p.z},
{(NSUInteger)dim.x, (NSUInteger)dim.y, (NSUInteger)dim.z}
};
// NOTE(yuval): Fill the texture with data
[texture replaceRegion:replace_region
mipmapLevel:0
slice:p.z
withBytes:data
bytesPerRow:dim.x
bytesPerImage:0];
bytesPerRow:dim.x];
result = true;
}
@ -571,14 +561,6 @@ metal__make_buffer(u32 size, id<MTLDevice> device){
}
}
- (void)free_texture:(u32)handle{
Metal_Texture_Slot *texture_slot = [self get_texture_slot_at_handle:handle];
if (texture_slot){
sll_queue_push(_texture_slots.first_free_slot, _texture_slots.last_free_slot, texture_slot);
}
}
- (Metal_Texture_Slot*)get_texture_slot_at_locator:(Metal_Texture_Slot_Locator)locator{
Metal_Texture_Slot *result = 0;

View File

@ -53,11 +53,6 @@ gl__fill_texture(Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 di
return(result);
}
internal void
gl__free_texture(u32 texture){
glDeleteTextures(1, &texture);
}
internal void
gl__error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char *message, const void *userParam){
switch (id){
@ -73,7 +68,7 @@ gl__error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsiz
}
}
char *gl__header = R"foo(#version 150
char *gl__header = R"foo(#version 130
)foo";
char *gl__vertex = R"foo(

View File

@ -588,11 +588,6 @@ graphics_fill_texture_sig(){
return(gl__fill_texture(texture_kind, texture, p, dim, data));
}
internal
graphics_free_texture_sig(){
gl__free_texture(texid);
}
////////////////////////////
internal Face*
@ -705,8 +700,8 @@ glx_create_context(GLXFBConfig fb_config){
ctx = glXCreateNewContext(linuxvars.dpy, fb_config, GLX_RGBA_TYPE, 0, True);
} else {
static const int context_attribs[] = {
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
GLX_CONTEXT_MINOR_VERSION_ARB, 2,
GLX_CONTEXT_MAJOR_VERSION_ARB, 2,
GLX_CONTEXT_MINOR_VERSION_ARB, 1,
GLX_CONTEXT_PROFILE_MASK_ARB , GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
#if GL_DEBUG_MODE
GLX_CONTEXT_FLAGS_ARB , GLX_CONTEXT_DEBUG_BIT_ARB,
@ -714,6 +709,7 @@ glx_create_context(GLXFBConfig fb_config){
None
};
//LOG("Creating GL 2.1 context... ");
ctx = glXCreateContextAttribsARB(linuxvars.dpy, fb_config, 0, True, context_attribs);
}

View File

@ -348,7 +348,7 @@ os_popup_error(char *title, char *message){
#if defined(FRED_INTERNAL)
function inline void
mac_profile(char *name, u64 begin, u64 end){
//printf("%s Time: %fs\n", name, ((end - begin) / 1000000.0f));
printf("%s Time: %fs\n", name, ((end - begin) / 1000000.0f));
}
#define MacProfileScope(name) for (u64 glue(_i_, __LINE__) = 0, glue(_begin_, __LINE__) = system_now_time();\
@ -701,14 +701,7 @@ mac_toggle_fullscreen(void){
[super dealloc];
}
- (void)viewDidChangBackingProperties{
NSWindow* window = self.window;
f32 max_dpi = [window screen].backingScaleFactor;
mac_vars.screen_scale_factor = max_dpi;
// TODO(PS): we want to call try_modify_face here for all active faces
// try_modify_face(app, face_id, &description);
- (void)viewDidChangeBackingProperties{
// TODO(yuval): If the screen scale factor changed, modify the current face to use the new screen scale factor.
mac_resize(mac_vars.window);
}
@ -916,7 +909,7 @@ mac_toggle_fullscreen(void){
mac_profile("Frame", prev_timer_start, mac_vars.timer_start);
#if FRED_INTERNAL
//printf("\n");
printf("\n");
#endif
}
@ -953,7 +946,7 @@ mac_toggle_fullscreen(void){
- (void)keyDown:(NSEvent*)event{
// NOTE(yuval): Process keyboard event
[self process_keyboard_event:event down:true];
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
// TODO(allen): Deduplicate with insertText version
// NOTE(allen): We need to manually send text for '\n' and '\t'
@ -968,9 +961,9 @@ mac_toggle_fullscreen(void){
}
if ((c == '\t') || (c == '\n')){
u8 *str = push_array(&mac_vars.frame_arena, u8, 1);
str[0] = (u8)c;
str[0] = (u8)c;
Input_Event *event = push_input_event(&mac_vars.frame_arena, &mac_vars.input_chunk.trans.event_list);
Input_Event *event = push_input_event(&mac_vars.frame_arena, &mac_vars.input_chunk.trans.event_list);
event->kind = InputEventKind_TextInsert;
event->text.string = SCu8(str, 1);
event->text.next_text = 0;
@ -1173,7 +1166,6 @@ mac_toggle_fullscreen(void){
Input_Modifier_Set_Fixed *mods = &mac_vars.input_chunk.pers.modifiers;
b8 command;
// NOTE(yuval): Set control modifiers
{
Control_Keys *controls = &mac_vars.input_chunk.pers.controls;
@ -1186,7 +1178,7 @@ mac_toggle_fullscreen(void){
}
b8 shift = (controls->r_shift || controls->l_shift);
command = (controls->r_command || controls->l_command);
b8 command = (controls->r_command || controls->l_command);
set_modifier(mods, KeyCode_Control, ctrl);
set_modifier(mods, KeyCode_Alt, alt);
@ -1214,17 +1206,11 @@ mac_toggle_fullscreen(void){
system_signal_step(0);
}
} else {
} else{
mac_vars.active_key_stroke = 0;
mac_vars.active_text_input = 0;
if (key != 0){
// NOTE(PS): when releasing the command key, assume all keys being pressed
// are released
if (key == KeyCode_Command) {
mods->count = 0;
}
Input_Event *event = push_input_event(&mac_vars.frame_arena, &mac_vars.input_chunk.trans.event_list);
event->kind = InputEventKind_KeyRelease;
event->key.code = key;
@ -1232,6 +1218,7 @@ mac_toggle_fullscreen(void){
remove_modifier(mods, key);
}
system_signal_step(0);
}
}
@ -1268,15 +1255,6 @@ main(int arg_count, char **args){
FCoder_App_Delegate *app_delegate = [[FCoder_App_Delegate alloc] init];
[NSApp setDelegate:app_delegate];
// workaround for "no key-up sent while Cmd is pressed" taken from GLFW:
NSEvent* (^keyup_monitor)(NSEvent*) = ^NSEvent* (NSEvent* event) {
if ([event modifierFlags] & NSEventModifierFlagCommand) {
[[NSApp keyWindow] sendEvent:event];
}
return event;
};
id keyup_monitor_ = [NSEvent addLocalMonitorForEventsMatchingMask:NSEventMaskKeyUp handler:keyup_monitor];
mac_init_recursive_mutex(&memory_tracker_mutex);
// NOTE(yuval): Context setup
@ -1465,7 +1443,6 @@ main(int arg_count, char **args){
// NOTE(yuval): Display window and view
[content_view addSubview:mac_vars.view];
[NSApp activateIgnoringOtherApps: YES];
[mac_vars.window makeKeyAndOrderFront:nil];
// NOTE(yuval): Initialize the renderer

View File

@ -976,11 +976,6 @@ graphics_fill_texture_sig(){
return(result);
}
function
graphics_free_texture_sig(){
renderer->free_texture(renderer, texid);
}
////////////////////////////////
/******************/

View File

@ -16,7 +16,7 @@ struct Mac_Metal{
function
mac_render_sig(mac_metal__render){
#if defined(FRED_INTERNAL)
//printf("Redering using Metal!\n");
printf("Redering using Metal!\n");
#endif
Mac_Metal *metal = (Mac_Metal*)renderer;
@ -44,12 +44,6 @@ mac_fill_texture_sig(mac_metal__fill_texture){
return(result);
}
function
mac_free_texture_sig(mac_metal__free_texture){
Mac_Metal *metal = (Mac_Metal*)renderer;
[metal->renderer free_texture:texture];
}
function Mac_Metal*
mac_metal__init(NSWindow *window, Render_Target *target){
// NOTE(yuval): Create the Mac Metal rendere
@ -58,7 +52,6 @@ mac_metal__init(NSWindow *window, Render_Target *target){
metal->base.render = mac_metal__render;
metal->base.get_texture = mac_metal__get_texture;
metal->base.fill_texture = mac_metal__fill_texture;
metal->base.free_texture = mac_metal__free_texture;
// NOTE(yuval): Create the Metal view
NSView *content_view = [window contentView];

View File

@ -144,11 +144,6 @@ mac_fill_texture_sig(mac_gl__fill_texture){
return(result);
}
function
mac_free_texture_sig(mac_gl__free_texture){
gl__free_texture(texture);
}
function Mac_OpenGL*
mac_gl__init(NSWindow *window, Render_Target *target){
// NOTE(yuval): Create the Mac OpenGL Renderer
@ -157,7 +152,6 @@ mac_gl__init(NSWindow *window, Render_Target *target){
gl->base.render = mac_gl__render;
gl->base.get_texture = mac_gl__get_texture;
gl->base.fill_texture = mac_gl__fill_texture;
gl->base.free_texture = mac_gl__free_texture;
// NOTE(yuval): Create the OpenGL view
NSView *content_view = [window contentView];

View File

@ -18,9 +18,6 @@ typedef mac_get_texture_sig(mac_get_texture_type);
#define mac_fill_texture_sig(name) b32 name(Mac_Renderer *renderer, Texture_Kind texture_kind, u32 texture, Vec3_i32 p, Vec3_i32 dim, void* data)
typedef mac_fill_texture_sig(mac_fill_texture_type);
#define mac_free_texture_sig(name) void name(Mac_Renderer *renderer, u32 texture)
typedef mac_free_texture_sig(mac_free_texture_type);
typedef i32 Mac_Renderer_Kind;
enum{
MacRenderer_OpenGL,
@ -34,7 +31,6 @@ struct Mac_Renderer{
mac_get_texture_type *get_texture;
mac_fill_texture_type *fill_texture;
mac_free_texture_type *free_texture;
};
////////////////////////////////

View File

@ -1,658 +0,0 @@
#define DX11_MAX_TEXTURE_COUNT 32
struct DX11Texture {
ID3D11Texture2D* pointer;
ID3D11ShaderResourceView* view;
};
struct GL_Program {
ID3D11VertexShader* vertex;
ID3D11InputLayout* layout;
ID3D11PixelShader* pixel;
b8 valid;
};
struct DX11 {
b8 initialized;
ID3D11Device1* device;
ID3D11DeviceContext1* context;
IDXGISwapChain1* swap_chain;
ID3D11SamplerState* sampler;
ID3D11RenderTargetView* render_target_view;
GL_Program gpu_program;
ID3D11Buffer* vertex_buffer;
ID3D11Buffer* constants_buffer;
// NOTE(simon, 28/02/24): To keep the API the same since the OpenGL texture handle are store in
// other places than the graphics parts (e.g. in the font Face struct), we create an array of
// textures, and use the indices as texture handles.
DX11Texture textures[ DX11_MAX_TEXTURE_COUNT + 1 ];
// NOTE(simon, 28/02/24): The first slot in the array should not be used so we can consider an
// index of 0 to be invalid. OpenGL should not return 0 for texture handle, so we sort of do
// the same.
u32 texture_count;
};
global DX11 g_dx11 = { };
// NOTE(simon, 28/02/24): Passing 0 for texid use the reserved texture in the array, and passing a
// resource view of zero unbinds the resource.
internal void
gl__bind_texture(Render_Target *t, i32 texid){
if (t->bound_texture != texid){
DX11Texture* texture = g_dx11.textures + texid;
g_dx11.context->PSSetShaderResources( 0, 1, &texture->view );
t->bound_texture = texid;
}
}
internal void
gl__bind_any_texture(Render_Target *t){
if (t->bound_texture == 0){
Assert(t->fallback_texture_id != 0);
DX11Texture* texture = g_dx11.textures + t->fallback_texture_id;
g_dx11.context->PSSetShaderResources( 0, 1, &texture->view );
t->bound_texture = t->fallback_texture_id;
}
}
internal u32
gl__get_texture(Vec3_i32 dim, Texture_Kind texture_kind){
u32 texid = 0;
if ( g_dx11.texture_count < ArrayCount( g_dx11.textures ) ) {
texid = g_dx11.texture_count;
g_dx11.texture_count++;
} else {
for ( u32 i = 1; i < g_dx11.texture_count; i++ ) {
DX11Texture* texture = g_dx11.textures + i;
if ( !texture->pointer && !texture->view ) {
texid = i;
break;
}
}
}
if ( texid ) {
DX11Texture* texture = g_dx11.textures + texid;
Assert( texture->pointer == 0 );
Assert( texture->view == 0 );
D3D11_TEXTURE2D_DESC texture_desc = { 0 };
texture_desc.Width = dim.x;
texture_desc.Height = dim.y;
texture_desc.MipLevels = 1;
texture_desc.ArraySize = dim.z;
texture_desc.Format = DXGI_FORMAT_A8_UNORM;
texture_desc.SampleDesc.Count = 1;
texture_desc.Usage = D3D11_USAGE_DEFAULT;
texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
texture_desc.CPUAccessFlags = 0; // D3D11_CPU_ACCESS_WRITE;
// NOTE(simon, 28/02/24): I initialize the texture with zeros. In practice it doesn't seem
// to matter, but since the shader use a bilinear filter, the unitialized data in the
// texture could change the result of the filtering for texel at the edge of a character.
// I did some tests with the rectangle packer to have a border around character but got the
// exact same render, so It doesn't matter much.
D3D11_SUBRESOURCE_DATA* texture_data = push_array_zero( &win32vars.frame_arena, D3D11_SUBRESOURCE_DATA, dim.z );
u8* initial_data = push_array_zero( &win32vars.frame_arena, u8, dim.x * dim.y );
for ( i32 i = 0; i < dim.z; i++ ) {
texture_data[ i ].pSysMem = initial_data;
texture_data[ i ].SysMemPitch = dim.x;
}
HRESULT hr = g_dx11.device->CreateTexture2D( &texture_desc, texture_data, &texture->pointer );
pop_array( &win32vars.frame_arena, u8, dim.x * dim.y );
pop_array( &win32vars.frame_arena, D3D11_SUBRESOURCE_DATA, dim.z );
if ( SUCCEEDED( hr ) ) {
hr = g_dx11.device->CreateShaderResourceView( ( ID3D11Resource* ) texture->pointer, 0, &texture->view );
}
if ( FAILED( hr ) ) {
// NOTE(simon, 28/02/24): When we fail, we donc decrement the texture count, but the
// loop at the beginning of the function will reuse texture when
// texture_count == DX11_MAX_TEXTURE_COUNT.
texid = 0;
if ( texture->pointer ) {
texture->pointer->Release( );
texture->pointer = 0;
}
if ( texture->view ) {
texture->view->Release( );
texture->view = 0;
}
}
}
return(texid);
}
internal b32
gl__fill_texture(Texture_Kind texture_kind, u32 texid, Vec3_i32 p, Vec3_i32 dim, void *data){
// NOTE(simon, 28/02/24): The OpenGL version always returns false.
b32 result = false;
// NOTE(simon, 28/02/24): In the OpenGL version, if we pass zero as texture handle, the
// function works on the currently bound texture. In directx we need to get the texture pointer.
// We could retrieve that from Render_Target->bound_texture, but we don't have that as a
// parameter to this function and don't want to change the signature since it's used by the
// font rendering code and other platforms. Fortunately the only call that specified 0 for the
// texture handle was for the creation of the fallback texture in gl_render, and we can modify
// that call to pass the fallback texture handle.
Assert( texid != 0 );
if (dim.x > 0 && dim.y > 0 && dim.z > 0){
DX11Texture* texture = g_dx11.textures + texid;
D3D11_BOX box = { };
box.left = p.x;
box.right = p.x + dim.x;
box.top = p.y;
box.bottom = p.y + dim.y;
box.front = 0;
box.back = 1;
u32 sub_resource_index = D3D11CalcSubresource( 0 /* MipSlice */, p.z /* ArraySlice */, 1 /* MipLevels */ );
g_dx11.context->UpdateSubresource( texture->pointer, sub_resource_index, &box, data, dim.x, dim.x * dim.y );
}
return(result);
}
internal void gl__free_texture( u32 texid ) {
if ( texid ) {
DX11Texture* texture = g_dx11.textures + texid;
if ( texture->view ) {
texture->view->Release( );
texture->view = 0;
}
if ( texture->pointer ) {
texture->pointer->Release( );
texture->pointer = 0;
}
}
}
char *gl__vertex = R"foo(
// NOTE(simon, 28/02/24): The layout of this is (constants are store in 16 bytes vectors (4 floats))
// vector1: view_m._11, view_m._12, 0, 0
// vector2: view_m._21, view_m._22, view_t.x, view_t.y
cbuffer constants : register( b0 ) {
row_major float2x2 view_m;
float2 view_t;
}
struct input_t {
float2 vertex_p : POSITION;
float3 vertex_t : UVW;
float4 vertex_c : COLOR;
float vertex_ht : THICKNESS;
};
struct output_t {
float4 position : SV_POSITION;
float4 color : COLOR;
float3 uvw : UVW;
float2 xy : XY;
float2 adjusted_half_dim: HALF_DIM;
float half_thickness : THICKNESS;
};
output_t main(input_t input) {
output_t output;
output.position = float4( mul( view_m, ( input.vertex_p - view_t ) ), 0.0, 1.0 );
// NOTE(simon, 28/02/24): The input colors are BGRA, we need them as RGBA.
output.color = input.vertex_c.zyxw;
output.uvw = input.vertex_t;
output.xy = input.vertex_p;
output.half_thickness = input.vertex_ht;
float2 center = input.vertex_t.xy;
float2 half_dim = abs( input.vertex_p - center );
output.adjusted_half_dim = half_dim - input.vertex_t.zz + float2( 0.5, 0.5 );
return output;
}
)foo";
char *gl__fragment = R"foo(
struct input_t {
float4 position : SV_POSITION;
float4 color : COLOR;
float3 uvw : UVW;
float2 xy : XY;
float2 adjusted_half_dim: HALF_DIM;
float half_thickness : THICKNESS;
};
Texture2DArray alpha : register( t0 );
SamplerState alpha_sampler : register( s0 );
float rectangle_sd( float2 p, float2 b ) {
float2 d = abs( p ) - b;
return( length( max( d, float2( 0.0, 0.0 ) ) ) + min( max( d.x, d.y ), 0.0 ) );
}
float4 main( input_t input ) : SV_TARGET {
float has_thickness = step( 0.49, input.half_thickness );
float does_not_have_thickness = 1.0 - has_thickness;
float sample_value = alpha.Sample( alpha_sampler, input.uvw ).a;
sample_value *= does_not_have_thickness;
float2 center = input.uvw.xy;
float roundness = input.uvw.z;
float sd = rectangle_sd( input.xy - center, input.adjusted_half_dim );
sd = sd - roundness;
sd = abs( sd + input.half_thickness ) - input.half_thickness;
float shape_value = 1.0 - smoothstep(-1.0, 0.0, sd);
shape_value *= has_thickness;
float4 result = float4( input.color.xyz, input.color.a * ( sample_value + shape_value ) );
return result;
}
)foo";
// NOTE(simon, 28/02/24): This function is not generic. It can compile any shader, but the vertex
// input layout is fixed. 4coder only has one vertex format and shader, so we could remove this
// function and move its content in the win32_gl_create_window. I removed the header parameter as
// it's not useful in directx.
internal GL_Program
gl__make_program( char* vertex, char* pixel ) {
GL_Program result = { };
u32 vertex_length = 0;
while ( vertex && vertex[ vertex_length ] != 0 ) {
vertex_length++;
}
u32 pixel_length = 0;
while ( pixel && pixel[ pixel_length ] != 0 ) {
pixel_length++;
}
ID3DBlob* vs_blob = 0;
ID3DBlob* vs_error_blob = 0;
ID3D11VertexShader* vertex_shader = 0;
ID3D11InputLayout* input_layout = 0;
ID3DBlob* ps_blob = 0;
ID3DBlob* ps_error_blob = 0;
ID3D11PixelShader* pixel_shader = 0;
do {
HRESULT hr = D3DCompile( vertex, vertex_length, 0, 0, 0, "main", "vs_5_0", 0, 0, &vs_blob, &vs_error_blob );
if ( FAILED( hr ) ) {
log_os( "Failed to compile vertex shader.\n" );
if ( vs_error_blob ) {
u8* error_message = ( u8* ) vs_error_blob->GetBufferPointer( );
u32 length = ( u32 ) vs_error_blob->GetBufferSize( );
log_os( "vertex shader error:\n%.*s\n", length, error_message );
}
break;
}
hr = g_dx11.device->CreateVertexShader( vs_blob->GetBufferPointer( ), vs_blob->GetBufferSize( ), 0, &vertex_shader );
if ( FAILED( hr ) ) {
log_os( "Failed to create a vertex shader.\n" );
break;
}
D3D11_INPUT_ELEMENT_DESC layout_desc[ 4 ] = { };
layout_desc[ 0 ].SemanticName = "POSITION";
layout_desc[ 0 ].Format = DXGI_FORMAT_R32G32_FLOAT;
layout_desc[ 0 ].AlignedByteOffset = 0;
layout_desc[ 0 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
layout_desc[ 1 ].SemanticName = "UVW";
layout_desc[ 1 ].Format = DXGI_FORMAT_R32G32B32_FLOAT;
layout_desc[ 1 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
layout_desc[ 1 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
layout_desc[ 2 ].SemanticName = "COLOR";
layout_desc[ 2 ].Format = DXGI_FORMAT_R8G8B8A8_UNORM;
layout_desc[ 2 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
layout_desc[ 2 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
layout_desc[ 3 ].SemanticName = "THICKNESS";
layout_desc[ 3 ].Format = DXGI_FORMAT_R32_FLOAT;
layout_desc[ 3 ].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
layout_desc[ 3 ].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
hr = g_dx11.device->CreateInputLayout( layout_desc, ArrayCount( layout_desc ), vs_blob->GetBufferPointer( ), vs_blob->GetBufferSize( ), &input_layout );
if ( FAILED( hr ) ) {
log_os( "Failed to create input layout.\n" );
break;
}
hr = D3DCompile( pixel, pixel_length, 0, 0, 0, "main", "ps_5_0", 0, 0, &ps_blob, &ps_error_blob );
if ( FAILED( hr ) ) {
log_os( "Failed to compile pixel shader.\n" );
if ( ps_error_blob ) {
u8* error_message = ( u8* ) ps_error_blob->GetBufferPointer( );
u32 length = ( u32 ) ps_error_blob->GetBufferSize( );
log_os( "pixel shader error:\n%.*s\n", length, error_message );
}
break;
}
hr = g_dx11.device->CreatePixelShader( ps_blob->GetBufferPointer( ), ps_blob->GetBufferSize( ), 0, &pixel_shader );
if ( FAILED( hr ) ) {
log_os( "Failed to create a pixel shader.\n" );
break;
}
result.vertex = vertex_shader;
result.layout = input_layout;
result.pixel = pixel_shader;
result.valid = true;
} while ( 0 );
if ( vs_blob ) {
vs_blob->Release( );
vs_blob = 0;
}
if ( vs_error_blob ) {
vs_error_blob->Release( );
vs_error_blob = 0;
}
if ( ps_blob ) {
ps_blob->Release( );
ps_blob = 0;
}
if ( ps_error_blob ) {
ps_error_blob->Release( );
ps_error_blob = 0;
}
if ( !result.valid ) {
if ( vertex_shader ) {
vertex_shader->Release( );
vertex_shader = 0;
}
if ( input_layout ) {
input_layout->Release( );
input_layout = 0;
}
if ( pixel_shader ) {
pixel_shader->Release( );
pixel_shader = 0;
}
os_popup_error( "Error", "Shader compilation failed." );
}
return result;
}
internal void
gl_render(Render_Target *t){
Font_Set *font_set = (Font_Set*)t->font_set;
local_persist b32 first_call = true;
if (first_call){
// NOTE(simon, 28/02/24): Most of the code here has been moved in win32_gl_create_window
// because if that code fails we should exit the application directly.
first_call = false;
u32 stride = sizeof( Render_Vertex );
u32 offset = 0;
g_dx11.context->IASetVertexBuffers( 0, 1, &g_dx11.vertex_buffer, &stride, &offset );
g_dx11.context->IASetInputLayout( g_dx11.gpu_program.layout );
g_dx11.context->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
g_dx11.context->VSSetShader( g_dx11.gpu_program.vertex, 0, 0 );
g_dx11.context->VSSetConstantBuffers( 0, 1, &g_dx11.constants_buffer );
g_dx11.context->PSSetShader( g_dx11.gpu_program.pixel, 0, 0 );
g_dx11.context->PSSetSamplers( 0, 1, &g_dx11.sampler );
{
t->fallback_texture_id = gl__get_texture(V3i32(2, 2, 1), TextureKind_Mono);
u8 white_block[] = { 0xFF, 0xFF, 0xFF, 0xFF, };
// NOTE(simon, 28/02/24): Passing the fallback texture, because we can't rely on the
// fact that gl__get_texture has bound the fallback texture.
gl__fill_texture(TextureKind_Mono, t->fallback_texture_id, V3i32(0, 0, 0), V3i32(2, 2, 1), white_block);
}
}
// NOTE(simon, 28/02/24): OMSetRenderTargets needs to be set each frame when using a FLIP swap
// chain.
g_dx11.context->OMSetRenderTargets( 1, &g_dx11.render_target_view, 0 );
i32 width = t->width;
i32 height = t->height;
// NOTE(simon, 28/02/24): Viewport (0, 0) is top left in directx. Important for viewport and
// scissor calls.
D3D11_VIEWPORT viewport = {
0, // TopLeftX
0, // TopLeftY
( float ) width, // Width
( float ) height, // Height
0, // MinDepth
1// MaxDepth
};
g_dx11.context->RSSetViewports( 1, &viewport );
D3D11_RECT scissor = {
0, // left
0, // top
width, // right
height // bottom
};
g_dx11.context->RSSetScissorRects( 1, &scissor );
float magenta[ 4 ] = { 1.0f, 0.0f, 1.0f, 1.0f };
g_dx11.context->ClearRenderTargetView( g_dx11.render_target_view, magenta );
// NOTE(simon, 28/02/24): The constants (uniforms) were set in the render loop in the OpenGL
// version. But since they don't vary between draw calls I moved the code before the render
// loop.
D3D11_MAPPED_SUBRESOURCE constants_map = { };
HRESULT hr = g_dx11.context->Map( ( ID3D11Resource* ) g_dx11.constants_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &constants_map );
// NOTE(simon, 28/02/24): The layout of the constants buffer was a bit confusing. This link
// explains a little about how data is laid out:
// https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-packing-rules
// The article doesn't explain anything about matrices. What I found out while making this work
// is that each row or column (depending on if we use column or row major matrices) of a matrix
// needs to start on a new 16 bytes vector. For a 2 by 2 matrix, this means that there are two
// register elements at the end of the first vector that aren't used.
// Another thing is that the second vector only needs the first two elements for the matrix,
// so the two elements we want to put next can be in the same vector.
// NOTE(simon, 28/02/24): The code here could be shorter, but I prefer to make it clear what's
// happening.
f32 view_m[ 4 ] = {
2.0f / width, 0,
0, -2.0f / height
};
f32 view_t[ 2 ] = { width / 2.0f, height / 2.0f };
f32* vector_1 = ( f32* ) constants_map.pData;
f32* vector_2 = vector_1 + 4;
vector_1[ 0 ] = view_m[ 0 ];
vector_1[ 1 ] = view_m[ 1 ];
vector_1[ 2 ] = 0; // Padding
vector_1[ 3 ] = 0; // Padding
vector_2[ 0 ] = view_m[ 2 ];
vector_2[ 1 ] = view_m[ 3 ];
vector_2[ 2 ] = view_t[ 0 ];
vector_2[ 3 ] = view_t[ 1 ];
g_dx11.context->Unmap( ( ID3D11Resource* ) g_dx11.constants_buffer, 0 );
gl__bind_texture( t, 0 );
for (Render_Free_Texture *free_texture = t->free_texture_first;
free_texture != 0;
free_texture = free_texture->next){
gl__free_texture( free_texture->tex_id );
}
t->free_texture_first = 0;
t->free_texture_last = 0;
D3D11_BUFFER_DESC vertex_buffer_desc = { };
g_dx11.vertex_buffer->GetDesc( &vertex_buffer_desc );
for (Render_Group *group = t->group_first;
group != 0;
group = group->next){
Rect_i32 box = Ri32(group->clip_box);
// NOTE(FS): Ignore this group if we our scissor rectangle is not well defined
if ((rect_width(box) <= 0) || (rect_height(box) <= 0)) {
continue;
}
D3D11_RECT group_scissor = { };
group_scissor.left = box.x0;
group_scissor.right = box.x1;
group_scissor.top = box.y0;
group_scissor.bottom = box.y1;
g_dx11.context->RSSetScissorRects( 1, &group_scissor );
i32 vertex_count = group->vertex_list.vertex_count;
if (vertex_count > 0){
Face *face = font_set_face_from_id(font_set, group->face_id);
if (face != 0){
gl__bind_texture(t, face->texture);
}
else{
gl__bind_any_texture(t);
}
// NOTE(simon, 29/03/24): 4coder doesn't appear to clip character outside the screen
// horizontally. Even with line wrapping enabled, you can have cases where the line
// won't wrap, for example "{0,0,0,0,...}" with a lot of zero and no space will not
// wrap. The consequence of that is that we might send a lot of vertex data that's
// offscreen and the assumption about the vertex buffer size I made, can be wrong.
// So in this loop we release the previous vertex and create a new one when necessary.
u32 size_required = vertex_count * sizeof( Render_Vertex );
if ( size_required > vertex_buffer_desc.ByteWidth ) {
u32 new_size = vertex_buffer_desc.ByteWidth * 2;
while ( new_size < size_required ) {
new_size *= 2;
}
// NOTE(simon, 29/03/24): Create a new buffer and only release the previous one if
// the creation succeeded. If the creation fails, we skip this vertex group, which
// means the user will see an empty panel, but at least we won't stop rendering.
D3D11_BUFFER_DESC new_vertex_buffer_desc = vertex_buffer_desc;
new_vertex_buffer_desc.ByteWidth = new_size;
ID3D11Buffer* new_vertex_buffer = 0;
hr = g_dx11.device->CreateBuffer( &new_vertex_buffer_desc, 0, &new_vertex_buffer );
if ( FAILED( hr ) ) {
continue;
}
g_dx11.vertex_buffer->Release( );
g_dx11.vertex_buffer = new_vertex_buffer;
vertex_buffer_desc.ByteWidth = new_size;
u32 stride = sizeof( Render_Vertex );
u32 offset = 0;
g_dx11.context->IASetVertexBuffers( 0, 1, &g_dx11.vertex_buffer, &stride, &offset );
}
// NOTE(simon, 28/02/24): We fill the buffer, draw what we filled and then do the next
// group, which allows to always start drawing from vertex 0. Alternatively we could
// do a pass to fill the vertex buffer completly so we only map the vertex buffer once,
// and then a second pass that just execute the draw calls. It doesn't seems necessary
// since we have less than 10 draw call.
D3D11_MAPPED_SUBRESOURCE vertex_map = { };
hr = g_dx11.context->Map( ( ID3D11Resource* ) g_dx11.vertex_buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &vertex_map );
if ( FAILED( hr ) ) {
// NOTE(simon, 28/02/24): It's improbable that Map will fail, but if it does we
// just stop rendering, and we'll try on the next frame. We could just skip the
// group and try with the next (using 'continue' instead of 'break'), but Map would
// probably fail again. Waiting for the next frame "might" work. I don't really
// know. We could also just exit the application assuming we won't be able to
// render anything.
break;
}
u8* bytes = ( u8* ) vertex_map.pData;
for (Render_Vertex_Array_Node *node = group->vertex_list.first;
node != 0;
node = node->next){
i32 size = node->vertex_count*sizeof(*node->vertices);
memcpy( bytes, node->vertices, size );
bytes += size;
}
g_dx11.context->Unmap( ( ID3D11Resource* ) g_dx11.vertex_buffer, 0 );
g_dx11.context->Draw( vertex_count, 0 );
}
}
}

View File

@ -12,8 +12,6 @@
// #define FPS 144
// #define frame_useconds (1000000 / FPS)
// #define WIN32_DX11
#include <stdio.h>
#include "4coder_base_types.h"
@ -58,6 +56,7 @@
#define function static
#include "win32_utf8.h"
#include "win32_gl.h"
////////////////////////////////
@ -448,7 +447,6 @@ win32_post_clipboard(Arena *scratch, char *text, i32 len){
SetClipboardData(CF_TEXT, memory_handle);
}
CloseClipboard();
win32vars.clipboard_sequence = GetClipboardSequenceNumber();
}
}
@ -457,10 +455,14 @@ system_get_clipboard_sig(){
String_Const_u8 result = {};
DWORD new_number = GetClipboardSequenceNumber();
if (new_number != win32vars.clipboard_sequence){
result = win32_read_clipboard_contents(win32vars.tctx, arena);
if (result.str != 0){
win32vars.clipboard_sequence = new_number;
}
win32vars.clipboard_sequence = new_number;
for (i32 R = 0; R < 8; ++R){
result = win32_read_clipboard_contents(win32vars.tctx, arena);
if (result.str == 0){
break;
}
}
}
return(result);
}
@ -647,18 +649,18 @@ system_cli_end_update_sig(){
function void
os_popup_error(char *title, char *message){
MessageBoxA(0, message, title, MB_OK);
MessageBoxA(0, title, message, MB_OK);
ExitProcess(1);
}
#include "4ed_font_provider_freetype.h"
#include "4ed_font_provider_freetype.cpp"
#if defined( WIN32_DX11 )
#include "win32_dx11.cpp"
#else
#include "win32_opengl.cpp"
#endif
#include <GL/gl.h>
#include "opengl/4ed_opengl_defines.h"
#define GL_FUNC(N,R,P) typedef R (CALL_CONVENTION N##_Function)P; N##_Function *N = 0;
#include "opengl/4ed_opengl_funcs.h"
#include "opengl/4ed_opengl_render.cpp"
internal
graphics_get_texture_sig(){
@ -670,11 +672,6 @@ graphics_fill_texture_sig(){
return(gl__fill_texture(texture_kind, texture, p, dim, data));
}
internal
graphics_free_texture_sig(){
gl__free_texture(texid);
}
internal
font_make_face_sig(){
return(ft__font_make_face(arena, description, scale_factor));
@ -782,13 +779,13 @@ win32_keycode_init(void){
keycode_lookup_table[VK_NUMPAD8] = KeyCode_NumPad8;
keycode_lookup_table[VK_NUMPAD9] = KeyCode_NumPad9;
for (i32 i = 0; i < 30; i += 1){
keycode_lookup_table[0xDF + i] = KeyCode_Ex0 + i;
for (i32 i = 0xDF; i < 0xFF; i += 1){
keycode_lookup_table[i] = KeyCode_Ex0 + 1;
}
}
internal b32
keycode_physical_translation_is_wrong(u64 vk){
keycode_physical_translaion_is_wrong(u64 vk){
b32 result = false;
switch (vk){
case VK_UP: case VK_DOWN: case VK_LEFT: case VK_RIGHT:
@ -826,73 +823,6 @@ win32_resize(i32 width, i32 height){
if (width > 0 && height > 0){
target.width = width;
target.height = height;
#if defined( WIN32_DX11 )
HRESULT hr = S_OK;
ID3D11Texture2D* frame_buffer = 0;
do {
if ( g_dx11.initialized ) {
if ( g_dx11.render_target_view ) {
g_dx11.render_target_view->Release( );
g_dx11.render_target_view = 0;
}
hr = g_dx11.swap_chain->ResizeBuffers( 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0 );
if ( FAILED( hr ) ) {
log_os( "Failed to resize the swap chain buffers.\n" );
break;
}
hr = g_dx11.swap_chain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( void** ) &frame_buffer );
if ( FAILED( hr ) ) {
log_os( "Failled to get the swap chain back buffer.\n" );
break;
}
D3D11_RENDER_TARGET_VIEW_DESC render_target_view_desc = { 0 };
// NOTE(simon, 28/02/24): 4coder checks for sRGB support but never actually enables
// it in the OpenGL version (never calls glEnable( GL_FRAMEBUFFER_SRGB ) ).
// Note that enabling it would require to convert collors
// passed to the shader to linear (when using sRBG back buffer, the shader values
// must be linear values). This would be more problematic than just passing linear
// values as the blending wouldn't produce the same result as with sRGB off.
// render_target_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
render_target_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
render_target_view_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
hr = g_dx11.device->CreateRenderTargetView( ( ID3D11Resource* ) frame_buffer, &render_target_view_desc, &g_dx11.render_target_view );
if ( FAILED( hr ) ) {
log_os( "Failed to create a render target view.\n" );
break;
}
}
} while ( 0 );
if ( frame_buffer ) {
frame_buffer->Release( );
frame_buffer = 0;
}
if ( FAILED( hr ) ) {
if ( g_dx11.render_target_view ) {
g_dx11.render_target_view->Release( );
g_dx11.render_target_view = 0;
}
// NOTE(simon, 28/02/24): Failing here means no rendering possible, so we exit.
exit( 1 );
}
#endif
}
}
@ -971,10 +901,10 @@ internal void
date_time_from_win32_system_time(Date_Time *out, SYSTEMTIME *in){
out->year = in->wYear;
out->mon = (u8)(in->wMonth - 1);
out->day = (u8)(in->wDay - 1);
out->hour = (u8)(in->wHour);
out->min = (u8)(in->wMinute);
out->sec = (u8)(in->wSecond);
out->day = (u8)(in->wDay - 1);
out->hour = (u8)(in->wHour);
out->min = (u8)(in->wMinute);
out->sec = (u8)(in->wSecond);
out->msec = in->wMilliseconds;
}
@ -1227,7 +1157,7 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
u64 vk = wParam;
if (win32vars.key_mode == KeyMode_Physical &&
!keycode_physical_translation_is_wrong(vk)){
!keycode_physical_translaion_is_wrong(vk)){
UINT scan_code = ((lParam >> 16) & bitmask_8);
vk = MapVirtualKeyEx(scan_code, MAPVK_VSC_TO_VK_EX, win32vars.kl_universal);
}
@ -1502,7 +1432,249 @@ win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
//-
internal b32
win32_wgl_good(Void_Func *f){
return(f != 0 &&
f != (Void_Func*)1 &&
f != (Void_Func*)2 &&
f != (Void_Func*)3 &&
f != (Void_Func*)-1);
}
typedef HGLRC (CALL_CONVENTION wglCreateContextAttribsARB_Function)(HDC,HGLRC,i32*);
typedef BOOL (CALL_CONVENTION wglChoosePixelFormatARB_Function)(HDC,i32*,f32*,u32,i32*,u32*);
typedef char* (CALL_CONVENTION wglGetExtensionsStringEXT_Function)();
typedef VOID (CALL_CONVENTION wglSwapIntervalEXT_Function)(i32);
global wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0;
global wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0;
global wglGetExtensionsStringEXT_Function *wglGetExtensionsStringEXT = 0;
global wglSwapIntervalEXT_Function *wglSwapIntervalEXT = 0;
internal b32
win32_gl_create_window(HWND *wnd_out, HGLRC *context_out, DWORD style, RECT rect){
HINSTANCE this_instance = GetModuleHandle(0);
local_persist b32 srgb_support = false;
local_persist b32 register_success = true;
local_persist b32 first_call = true;
if (first_call){
log_os(" GL bootstrapping...\n");
first_call = false;
// NOTE(allen): Create the GL bootstrap window
log_os(" registering bootstrap class...\n");
WNDCLASSW wglclass = {};
wglclass.lpfnWndProc = DefWindowProcW;
wglclass.hInstance = this_instance;
wglclass.lpszClassName = L"wgl-loader";
if (RegisterClassW(&wglclass) == 0){
register_success = false;
goto fail_register;
}
log_os(" creating bootstrap window...\n");
HWND wglwindow = CreateWindowW(wglclass.lpszClassName, L"", 0, 0, 0, 0, 0,
0, 0, this_instance, 0);
if (wglwindow == 0){
register_success = false;
goto fail_register;
}
// NOTE(allen): Create the GL bootstrap context
log_os(" setting bootstrap pixel format...\n");
HDC wgldc = GetDC(wglwindow);
PIXELFORMATDESCRIPTOR format = {};
format.nSize = sizeof(format);
format.nVersion = 1;
format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
format.iPixelType = PFD_TYPE_RGBA;
format.cColorBits = 32;
format.cAlphaBits = 8;
format.cDepthBits = 24;
format.iLayerType = PFD_MAIN_PLANE;
i32 suggested_format_index = ChoosePixelFormat(wgldc, &format);
if (!SetPixelFormat(wgldc, suggested_format_index, &format)){
register_success = false;
goto fail_register;
}
log_os(" creating bootstrap GL context...\n");
HGLRC wglcontext = wglCreateContext(wgldc);
if (wglcontext == 0){
register_success = false;
goto fail_register;
}
log_os(" making bootstrap GL context current...\n");
if (!wglMakeCurrent(wgldc, wglcontext)){
register_success = false;
goto fail_register;
}
// NOTE(allen): Load wgl extensions
log_os(" loading wgl extensions...\n");
#define LoadWGL(f,l) Stmnt((f) = (f##_Function*)wglGetProcAddress(#f); \
(l) = (l) && win32_wgl_good((Void_Func*)(f));)
b32 load_success = true;
LoadWGL(wglCreateContextAttribsARB, load_success);
LoadWGL(wglChoosePixelFormatARB, load_success);
LoadWGL(wglGetExtensionsStringEXT, load_success);
if (!load_success){
register_success = false;
goto fail_register;
}
log_os(" checking wgl extensions...\n");
char *extensions_c = wglGetExtensionsStringEXT();
String_Const_u8 extensions = SCu8((u8*)extensions_c);
{
String_Const_u8 s = string_skip_whitespace(extensions);
for (;s.size > 0;){
u64 end = string_find_first_whitespace(s);
String_Const_u8 m = string_prefix(s, end);
if (string_match(m, string_u8_litexpr("WGL_EXT_framebuffer_sRGB")) ||
string_match(m, string_u8_litexpr("WGL_ARB_framebuffer_sRGB"))){
srgb_support = true;
}
else if (string_match(m, string_u8_litexpr("WGL_EXT_swap_interval"))){
b32 wgl_swap_interval_ext = true;
LoadWGL(wglSwapIntervalEXT, wgl_swap_interval_ext);
if (!wgl_swap_interval_ext){
wglSwapIntervalEXT = 0;
}
}
s = string_skip_whitespace(string_skip(s, end));
}
}
// NOTE(allen): Load gl functions
log_os(" loading core GL functions...\n");
#define GL_FUNC(f,R,P) LoadWGL(f,load_success);
#include "opengl/4ed_opengl_funcs.h"
if (!load_success){
register_success = false;
goto fail_register;
}
// NOTE(allen): Cleanup the GL bootstrap resources
log_os(" cleaning up boostrap resources...\n");
ReleaseDC(wglwindow, wgldc);
DestroyWindow(wglwindow);
wglDeleteContext(wglcontext);
// NOTE(allen): Register the graphics window class
log_os(" registering graphics class...\n");
WNDCLASSW wndclass = {};
wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndclass.lpfnWndProc = win32_proc;
wndclass.hIcon = LoadIconW(GetModuleHandle(0), L"main");
wndclass.hInstance = this_instance;
wndclass.lpszClassName = L"GRAPHICS-WINDOW-NAME";
if (RegisterClassW(&wndclass) == 0){
register_success = false;
goto fail_register;
}
}
fail_register:;
b32 result = false;
if (register_success){
// NOTE(allen): Create the graphics window
log_os(" creating graphics window...\n");
HWND wnd = CreateWindowExW(0, L"GRAPHICS-WINDOW-NAME", L"GRAPHICS", style,
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top,
0, 0, this_instance, 0);
*wnd_out = 0;
*context_out = 0;
if (wnd != 0){
log_os(" setting graphics pixel format...\n");
HDC dc = GetDC(wnd);
PIXELFORMATDESCRIPTOR format = {};
i32 pixel_attrib_list[] = {
/* 0*/WGL_DRAW_TO_WINDOW_ARB, TRUE,
/* 2*/WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
/* 4*/WGL_SUPPORT_OPENGL_ARB, TRUE,
/* 6*/WGL_DOUBLE_BUFFER_ARB, false,
/* 8*/WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
/*10*/WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,
/*12*/0,
};
if (!srgb_support){
pixel_attrib_list[10] = 0;
}
i32 suggested_format_index = 0;
u32 ignore = 0;
if (!wglChoosePixelFormatARB(dc, pixel_attrib_list, 0, 1, &suggested_format_index, &ignore)){
goto fail_window_init;
}
DescribePixelFormat(dc, suggested_format_index, sizeof(format), &format);
if (!SetPixelFormat(dc, suggested_format_index, &format)){
goto fail_window_init;
}
log_os(" setting graphics attributes...\n");
i32 context_attrib_list[] = {
/*0*/WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
/*2*/WGL_CONTEXT_MINOR_VERSION_ARB, 2,
/*4*/WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
#if GL_DEBUG_MODE
|WGL_CONTEXT_DEBUG_BIT_ARB
#endif
,
/*6*/WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
/*8*/0
};
log_os(" creating graphics GL context...\n");
HGLRC context = wglCreateContextAttribsARB(dc, 0, context_attrib_list);
if (context == 0){
goto fail_window_init;
}
log_os(" making graphics GL context current...\n");
wglMakeCurrent(dc, context);
if (wglSwapIntervalEXT != 0){
log_os(" setting swap interval...\n");
wglSwapIntervalEXT(1);
}
*wnd_out = wnd;
*context_out = context;
result = true;
if (false){
fail_window_init:;
DWORD error = GetLastError();
ReleaseDC(wnd, dc);
DestroyWindow(wnd);
SetLastError(error);
}
}
}
return(result);
}
//-
@ -1525,6 +1697,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
log_os("Initializing thread context...\n");
// NOTE(allen): This thing
InitializeCriticalSection(&memory_tracker_mutex);
// NOTE(allen): context setup
@ -1746,21 +1919,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
window_style |= WS_MAXIMIZE;
}
log_os(" windowed dimensions: %d, %d\n"
" initially maximized: %d\n",
" initially maximized: %d",
window_rect.right - window_rect.left,
window_rect.bottom - window_rect.top,
((window_style & WS_MAXIMIZE) != 0));
#if defined( WIN32_DX11 )
if( !win32_gl_create_window( &win32vars.window_handle, window_style, window_rect ) ) {
exit(1);
}
#else
HGLRC window_opengl_context = 0;
if (!win32_gl_create_window(&win32vars.window_handle, &window_opengl_context, window_style, window_rect)){
exit(1);
}
#endif
log_os(" window created successfully\n");
@ -1861,7 +2028,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
// NOTE(allen): while we're doing this (and possibly sleeping)
// we can let async processes get there time in.
system_release_global_frame_mutex(win32vars.tctx);
system_release_global_frame_mutex(win32vars.tctx);
b32 get_more_messages = true;
do{
@ -1939,7 +2106,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
}while (get_more_messages);
system_acquire_global_frame_mutex(win32vars.tctx);
system_acquire_global_frame_mutex(win32vars.tctx);
}
// NOTE(allen): Mouse Out of Window Detection
@ -2044,15 +2211,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
win32vars.lctrl_lalt_is_altgr = (b8)result.lctrl_lalt_is_altgr;
// NOTE(allen): render
#if defined( WIN32_DX11 )
gl_render(&target);
g_dx11.swap_chain->Present( 1, 0 );
#else
HDC hdc = GetDC(win32vars.window_handle);
gl_render(&target);
SwapBuffers(hdc);
ReleaseDC(win32vars.window_handle, hdc);
#endif
// NOTE(allen): toggle full screen
if (win32vars.do_toggle){
@ -2069,7 +2231,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
}
// NOTE(allen): sleep a bit to cool off :)
system_release_global_frame_mutex(win32vars.tctx);
system_release_global_frame_mutex(win32vars.tctx);
u64 timer_end = system_now_time();
u64 end_target = timer_start + frame_useconds;
@ -2088,10 +2250,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
win32vars.first = false;
}
#if defined( WIN32_DX11 ) && !SHIP_MODE
win32_gl_cleanup( );
#endif
return(0);
}

View File

@ -1,544 +0,0 @@
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
#include <initguid.h>
#include <d3d11_1.h>
#include <dxgi1_3.h>
#include <d3dcompiler.h>
#if !SHIP_MODE
#include <dxgidebug.h>
IDXGIDebug1* dxgi_debug;
#endif
#include "4ed_dx11_render.cpp"
internal LRESULT CALL_CONVENTION
win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
internal b32
win32_gl_create_window(HWND *wnd_out, DWORD style, RECT rect){
local_persist b32 srgb_support = false;
local_persist b32 first_call = true;
b32 result = false;
*wnd_out = 0;
Assert( g_dx11.initialized == 0 );
Assert( g_dx11.device == 0 );
Assert( g_dx11.context == 0 );
Assert( g_dx11.swap_chain == 0 );
Assert( g_dx11.sampler == 0 );
Assert( g_dx11.render_target_view == 0 );
Assert( g_dx11.gpu_program.vertex == 0 );
Assert( g_dx11.gpu_program.layout == 0 );
Assert( g_dx11.gpu_program.pixel == 0 );
Assert( g_dx11.gpu_program.valid == 0 );
Assert( g_dx11.vertex_buffer == 0 );
Assert( g_dx11.constants_buffer == 0 );
Assert( g_dx11.texture_count == 0 );
g_dx11 = { };
HINSTANCE this_instance = GetModuleHandle(0);
HWND wnd = 0;
ID3D11Device* base_device = 0;
ID3D11DeviceContext* base_device_context = 0;
IDXGIDevice1* dxgi_device = 0;
IDXGIAdapter* dxgi_adapter = 0;
IDXGIFactory2* dxgi_factory = 0;
ID3D11BlendState* blend_state = 0;
ID3D11RasterizerState1* rasterizer_state = 0;
do {
// NOTE(simon, 28/02/24): There is nothing in the code suggesting that this function could
// be called several time. If it is called several time, we would need to make sure that
// we cleaned up previous dx11 resources. The reason this function could be called twice
// would be if it failed previously, and in that case we clean up everything before
// exiting the function so we should be good. Still we assume it's only ever call once.
Assert( first_call );
if (first_call){
first_call = false;
log_os( " Registering graphics class...\n" );
WNDCLASSW wndclass = {};
wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndclass.lpfnWndProc = win32_proc;
wndclass.hIcon = LoadIconW(GetModuleHandle(0), L"main");
wndclass.hInstance = this_instance;
wndclass.lpszClassName = L"GRAPHICS-WINDOW-NAME";
if (RegisterClassW(&wndclass) == 0){
log_os(" Failed.\n");
break;
}
}
log_os( " Creating graphics window...\n" );
wnd = CreateWindowExW(0, L"GRAPHICS-WINDOW-NAME", L"GRAPHICS", style,
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top,
0, 0, this_instance, 0);
if (wnd == 0) {
log_os( " Failed.\n" );
break;
}
log_os( " Creating a d3d11 hardware device and context...\n" );
// NOTE(simon, 28/02/24): We are creating a directx 11.1 device and context (supported
// since windows 8).
D3D_FEATURE_LEVEL feature_levels[ ] = { D3D_FEATURE_LEVEL_11_1 };
u32 device_flags = 0;
// device_flags = D3D11_CREATE_DEVICE_BGRA_SUPPORT;
#if !SHIP_MODE
device_flags |= D3D11_CREATE_DEVICE_DEBUG;
#endif
HRESULT hr = D3D11CreateDevice( 0, D3D_DRIVER_TYPE_HARDWARE, 0, device_flags, feature_levels, ArrayCount( feature_levels ), D3D11_SDK_VERSION, &base_device, 0, &base_device_context );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
log_os( " Creating a d3d11 software (WARP) device and context...\n" );
// NOTE(simon, 28/02/24): Try creating a high performance software device as a fallback.
hr = D3D11CreateDevice( 0, D3D_DRIVER_TYPE_WARP, 0, device_flags, feature_levels, ArrayCount( feature_levels ), D3D11_SDK_VERSION, &base_device, 0, &base_device_context );
}
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
log_os( " Creating a ID3D11Device1...\n" );
hr = base_device->QueryInterface( __uuidof( ID3D11Device1 ), ( void** ) &g_dx11.device );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
log_os( " Creating a ID3D11DeviceContext1...\n" );
hr = base_device_context->QueryInterface( __uuidof( ID3D11DeviceContext1 ), ( void** ) &g_dx11.context );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
ID3D11Device1* device = g_dx11.device;
ID3D11DeviceContext1* context = g_dx11.context;
#if !SHIP_MODE
log_os( " Getting ID3D11InfoQueue. This is not important if you're not debugging graphics...\n" );
ID3D11InfoQueue* info;
hr = device->QueryInterface( __uuidof( ID3D11InfoQueue ), ( void** ) &info );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
} else {
info->SetBreakOnSeverity( D3D11_MESSAGE_SEVERITY_CORRUPTION, TRUE );
info->SetBreakOnSeverity( D3D11_MESSAGE_SEVERITY_ERROR, TRUE );
info->Release( );
}
log_os( " Getting IDXGIDebug1. This is not important if you're not debugging graphics...\n" );
hr = DXGIGetDebugInterface1( 0, __uuidof( IDXGIDebug1 ), ( void** ) &dxgi_debug );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
}
#endif
// NOTE(simon, 28/02/24): sRGB should be supported by any hardware now, but there was a
// check so I added one. The OpenGL version never enables sRGB.
DXGI_FORMAT back_buffer_format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB;
UINT format_support = 0;
if ( SUCCEEDED( device->CheckFormatSupport( back_buffer_format, &format_support ) ) ) {
u32 required = D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_DISPLAY;
srgb_support = ( ( format_support & required ) == required );
}
if ( !srgb_support ) {
log_os( " sRBG back buffer not supported.\n" );
back_buffer_format = DXGI_FORMAT_R8G8B8A8_UNORM;
} else {
log_os( " sRBG back buffer supported.\n" );
}
log_os( " Getting a IDXGIFactory2...\n" );
log_os( " Qurey for the IDXGIDevice1...\n" );
hr = device->QueryInterface( __uuidof( IDXGIDevice1 ), ( void** ) &dxgi_device );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
log_os( " Getting the IDXGIAdapter...\n" );
dxgi_device->GetAdapter( &dxgi_adapter );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
log_os( " Getting the IDXGIFactor2...\n" );
dxgi_adapter->GetParent( __uuidof( IDXGIFactory2 ), ( void** ) &dxgi_factory );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
DXGI_SWAP_CHAIN_DESC1 swap_chain_desc = { };
// NOTE(simon, 28/02/24): Can't request sRGB format here when using FLIP_* swap chain. It's
// requested when creating the render target view.
swap_chain_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
swap_chain_desc.SampleDesc.Count = 1;
swap_chain_desc.SampleDesc.Quality = 0;
swap_chain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swap_chain_desc.BufferCount = 2;
swap_chain_desc.Scaling = DXGI_SCALING_NONE;
swap_chain_desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
log_os( " Creating a IDXGISwapChain1...\n" );
hr = dxgi_factory->CreateSwapChainForHwnd( device, wnd, &swap_chain_desc, 0, 0, &g_dx11.swap_chain );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
log_os( " Prevent DXGI handling ALT + ENTER...\n" );
hr = dxgi_factory->MakeWindowAssociation( wnd, DXGI_MWA_NO_ALT_ENTER );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
}
// NOTE(simon, 28/02/24): We setup alpha blending here as it's always on in 4coder.
D3D11_BLEND_DESC blend_state_desc = { };
blend_state_desc.RenderTarget[ 0 ].BlendEnable = TRUE;
blend_state_desc.RenderTarget[ 0 ].SrcBlend = D3D11_BLEND_SRC_ALPHA;
blend_state_desc.RenderTarget[ 0 ].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
blend_state_desc.RenderTarget[ 0 ].BlendOp = D3D11_BLEND_OP_ADD;
blend_state_desc.RenderTarget[ 0 ].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
blend_state_desc.RenderTarget[ 0 ].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
blend_state_desc.RenderTarget[ 0 ].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blend_state_desc.RenderTarget[ 0 ].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
log_os( " Creating a blend state...\n" );
hr = device->CreateBlendState( &blend_state_desc, &blend_state );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
context->OMSetBlendState( blend_state, 0, 0xffffffff );
// NOTE(simon, 28/02/24): Enable scissor and disable backface culling.
D3D11_RASTERIZER_DESC1 rasterizer_desc = { };
rasterizer_desc.FillMode = D3D11_FILL_SOLID;
rasterizer_desc.CullMode = D3D11_CULL_NONE;
rasterizer_desc.DepthClipEnable = TRUE;
rasterizer_desc.ScissorEnable = TRUE;
log_os( " Creating a rasterizer state...\n" );
hr = device->CreateRasterizerState1( &rasterizer_desc, &rasterizer_state );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
context->RSSetState( rasterizer_state );
// NOTE(simon, 28/02/24): Not setting depth stencil as 4coder doesn't use it.
// NOTE(simon, 28/02/24): Swap interval is a parameter of swap_chain->present.
D3D11_SAMPLER_DESC linear_desc = { };
linear_desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
linear_desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
linear_desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
linear_desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
linear_desc.ComparisonFunc = D3D11_COMPARISON_NEVER;
linear_desc.MinLOD = 0;
linear_desc.MaxLOD = D3D11_FLOAT32_MAX;
log_os( " Creating a sampler state...\n" );
hr = device->CreateSamplerState( &linear_desc, &g_dx11.sampler );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
// NOTE(simon, 28/02/24): We create the vertex buffer, constants buffers and shader here
// because if we can't create them we won't be able to render anything and so we should
// just exit the program.
D3D11_BUFFER_DESC vertex_buffer_desc = { };
// NOTE(simon, 28/02/24): Reserving 400K vertices which is about 11 megabytes and would
// allow 100K characters. On a 1080p monitor, with 4 by 10 pixels characters we would need
// (1920/4)*(1080/10) = 51840 characters to fill the screen.
vertex_buffer_desc.ByteWidth = 400000 * sizeof( Render_Vertex );
vertex_buffer_desc.Usage = D3D11_USAGE_DYNAMIC;
vertex_buffer_desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertex_buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
log_os( " Creating a vertex buffer...\n" );
hr = device->CreateBuffer( &vertex_buffer_desc, 0, &g_dx11.vertex_buffer );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
D3D11_BUFFER_DESC constants_buffer_desc = { };
// NOTE(simon, 28/02/24): constants buffer size needs to be a multiple of 16.
// NOTE(simon, 28/02/24): The layout is explained where we set the values in the buffer in
// gl_render.
constants_buffer_desc.ByteWidth = 32;
constants_buffer_desc.Usage = D3D11_USAGE_DYNAMIC;
constants_buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
constants_buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
log_os( " Creating a constants buffer...\n" );
hr = device->CreateBuffer( &constants_buffer_desc, 0, &g_dx11.constants_buffer );
if ( FAILED( hr ) ) {
log_os( " Failed.\n" );
break;
}
g_dx11.gpu_program = gl__make_program( gl__vertex, gl__fragment );
if ( !g_dx11.gpu_program.valid ) {
break;
}
*wnd_out = wnd;
// NOTE(simon, 28/02/24): Reserve the first texture slot as a invalid/unbind texture.
g_dx11.texture_count = 1;
g_dx11.initialized = true;
result = true;
} while ( 0 );
if ( !result ) {
if ( wnd ) {
DestroyWindow( wnd );
( *wnd_out ) = 0;
}
if ( g_dx11.context ) {
g_dx11.context->OMSetBlendState( 0, 0, 0xffffffff );
g_dx11.context->RSSetState( 0 );
}
if ( g_dx11.constants_buffer ) {
g_dx11.constants_buffer->Release( );
g_dx11.constants_buffer = 0;
}
if ( g_dx11.vertex_buffer ) {
g_dx11.vertex_buffer->Release( );
g_dx11.vertex_buffer = 0;
}
if ( g_dx11.gpu_program.valid ) {
if ( g_dx11.gpu_program.vertex ) {
g_dx11.gpu_program.vertex->Release( );
g_dx11.gpu_program.vertex = 0;
}
if ( g_dx11.gpu_program.layout ) {
g_dx11.gpu_program.layout->Release( );
g_dx11.gpu_program.layout = 0;
}
if ( g_dx11.gpu_program.pixel ) {
g_dx11.gpu_program.pixel->Release( );
g_dx11.gpu_program.pixel = 0;
}
}
// NOTE(simon, 28/02/24): No render target view at this point as it's created in the
// WM_SIZE message.
if ( g_dx11.sampler ) {
g_dx11.sampler->Release( );
g_dx11.sampler = 0;
}
if ( g_dx11.swap_chain ) {
g_dx11.swap_chain->Release( );
g_dx11.swap_chain = 0;
}
if ( g_dx11.context ) {
g_dx11.context->Release( );
g_dx11.context = 0;
}
if ( g_dx11.device ) {
g_dx11.device->Release( );
g_dx11.device = 0;
}
g_dx11.initialized = false;
#if SHIP_MODE
os_popup_error( "Error", "Window creation failed.");
#endif
}
if( base_device ) {
base_device->Release( );
base_device = 0;
}
if ( base_device_context ) {
base_device_context->Release( );
base_device_context = 0;
}
if ( dxgi_device ) {
dxgi_device->Release( );
dxgi_device = 0;
}
if ( dxgi_adapter ) {
dxgi_adapter->Release( );
dxgi_adapter = 0;
}
if ( dxgi_factory ) {
dxgi_factory->Release( );
dxgi_factory = 0;
}
if ( blend_state ) {
blend_state->Release( );
blend_state = 0;
}
if ( rasterizer_state ) {
rasterizer_state->Release( );
rasterizer_state = 0;
}
return(result);
}
#if !SHIP_MODE
// NOTE(simon, 28/02/24): Only call this when working on 4coder, to make sure we don't do something
// stupid. In SHIP_MODE we let the os clean up resources.
internal void
win32_gl_cleanup( void ) {
if ( dxgi_debug && g_dx11.initialized ) {
OutputDebugString( L"win32_gl_cleanup start report...\n" );
dxgi_debug->ReportLiveObjects( DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL );
g_dx11.initialized = false;
if ( g_dx11.context ) {
g_dx11.context->OMSetBlendState( 0, 0, 0xffffffff );
g_dx11.context->RSSetState( 0 );
}
for ( u32 i = 1; i < g_dx11.texture_count; i++ ) {
DX11Texture* texture = g_dx11.textures + i;
if ( texture->view ) {
texture->view->Release( );
texture->view = 0;
}
if ( texture->pointer ) {
texture->pointer->Release( );
texture->pointer = 0;
}
}
g_dx11.texture_count = 0;
if ( g_dx11.constants_buffer ) {
g_dx11.constants_buffer->Release( );
g_dx11.constants_buffer = 0;
}
if ( g_dx11.vertex_buffer ) {
g_dx11.vertex_buffer->Release( );
g_dx11.vertex_buffer = 0;
}
if ( g_dx11.gpu_program.valid ) {
if ( g_dx11.gpu_program.vertex ) {
g_dx11.gpu_program.vertex->Release( );
g_dx11.gpu_program.vertex = 0;
}
if ( g_dx11.gpu_program.layout ) {
g_dx11.gpu_program.layout->Release( );
g_dx11.gpu_program.layout = 0;
}
if ( g_dx11.gpu_program.pixel ) {
g_dx11.gpu_program.pixel->Release( );
g_dx11.gpu_program.pixel = 0;
}
}
if ( g_dx11.render_target_view ) {
g_dx11.render_target_view->Release( );
g_dx11.render_target_view = 0;
}
if ( g_dx11.sampler ) {
g_dx11.sampler->Release( );
g_dx11.sampler = 0;
}
if ( g_dx11.swap_chain ) {
g_dx11.swap_chain->Release( );
g_dx11.swap_chain = 0;
}
if ( g_dx11.context ) {
g_dx11.context->Release( );
g_dx11.context = 0;
}
if ( g_dx11.device ) {
g_dx11.device->Release( );
g_dx11.device = 0;
}
OutputDebugString( L"win32_gl_cleanup end report (nothing printed after this line means everything is OK)...\n" );
dxgi_debug->ReportLiveObjects( DXGI_DEBUG_ALL, DXGI_DEBUG_RLO_ALL );
}
}
#endif

View File

@ -1,257 +0,0 @@
#pragma comment(lib, "OpenGL32.lib")
#include "win32_gl.h"
#include <GL/gl.h>
#include "opengl/4ed_opengl_defines.h"
#define GL_FUNC(N,R,P) typedef R (CALL_CONVENTION N##_Function)P; N##_Function *N = 0;
#include "opengl/4ed_opengl_funcs.h"
#include "opengl/4ed_opengl_render.cpp"
internal b32
win32_wgl_good(Void_Func *f){
return(f != 0 &&
f != (Void_Func*)1 &&
f != (Void_Func*)2 &&
f != (Void_Func*)3 &&
f != (Void_Func*)-1);
}
typedef HGLRC (CALL_CONVENTION wglCreateContextAttribsARB_Function)(HDC,HGLRC,i32*);
typedef BOOL (CALL_CONVENTION wglChoosePixelFormatARB_Function)(HDC,i32*,f32*,u32,i32*,u32*);
typedef char* (CALL_CONVENTION wglGetExtensionsStringEXT_Function)();
typedef VOID (CALL_CONVENTION wglSwapIntervalEXT_Function)(i32);
global wglCreateContextAttribsARB_Function *wglCreateContextAttribsARB = 0;
global wglChoosePixelFormatARB_Function *wglChoosePixelFormatARB = 0;
global wglGetExtensionsStringEXT_Function *wglGetExtensionsStringEXT = 0;
global wglSwapIntervalEXT_Function *wglSwapIntervalEXT = 0;
internal LRESULT CALL_CONVENTION
win32_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
internal b32
win32_gl_create_window(HWND *wnd_out, HGLRC *context_out, DWORD style, RECT rect){
HINSTANCE this_instance = GetModuleHandle(0);
local_persist b32 srgb_support = false;
local_persist b32 register_success = true;
local_persist b32 first_call = true;
if (first_call){
log_os(" GL bootstrapping...\n");
first_call = false;
// NOTE(allen): Create the GL bootstrap window
log_os(" registering bootstrap class...\n");
WNDCLASSW wglclass = {};
wglclass.lpfnWndProc = DefWindowProcW;
wglclass.hInstance = this_instance;
wglclass.lpszClassName = L"wgl-loader";
if (RegisterClassW(&wglclass) == 0){
register_success = false;
goto fail_register;
}
log_os(" creating bootstrap window...\n");
HWND wglwindow = CreateWindowW(wglclass.lpszClassName, L"", 0, 0, 0, 0, 0,
0, 0, this_instance, 0);
if (wglwindow == 0){
register_success = false;
goto fail_register;
}
// NOTE(allen): Create the GL bootstrap context
log_os(" setting bootstrap pixel format...\n");
HDC wgldc = GetDC(wglwindow);
PIXELFORMATDESCRIPTOR format = {};
format.nSize = sizeof(format);
format.nVersion = 1;
format.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER;
format.iPixelType = PFD_TYPE_RGBA;
format.cColorBits = 32;
format.cAlphaBits = 8;
format.cDepthBits = 24;
format.iLayerType = PFD_MAIN_PLANE;
i32 suggested_format_index = ChoosePixelFormat(wgldc, &format);
if (!SetPixelFormat(wgldc, suggested_format_index, &format)){
register_success = false;
goto fail_register;
}
log_os(" creating bootstrap GL context...\n");
HGLRC wglcontext = wglCreateContext(wgldc);
if (wglcontext == 0){
register_success = false;
goto fail_register;
}
log_os(" making bootstrap GL context current...\n");
if (!wglMakeCurrent(wgldc, wglcontext)){
register_success = false;
goto fail_register;
}
// NOTE(allen): Load wgl extensions
log_os(" loading wgl extensions...\n");
#define LoadWGL(f,l) Stmnt((f) = (f##_Function*)wglGetProcAddress(#f); \
(l) = (l) && win32_wgl_good((Void_Func*)(f));)
b32 load_success = true;
LoadWGL(wglCreateContextAttribsARB, load_success);
LoadWGL(wglChoosePixelFormatARB, load_success);
LoadWGL(wglGetExtensionsStringEXT, load_success);
if (!load_success){
register_success = false;
goto fail_register;
}
log_os(" checking wgl extensions...\n");
char *extensions_c = wglGetExtensionsStringEXT();
String_Const_u8 extensions = SCu8((u8*)extensions_c);
{
String_Const_u8 s = string_skip_whitespace(extensions);
for (;s.size > 0;){
u64 end = string_find_first_whitespace(s);
String_Const_u8 m = string_prefix(s, end);
if (string_match(m, string_u8_litexpr("WGL_EXT_framebuffer_sRGB")) ||
string_match(m, string_u8_litexpr("WGL_ARB_framebuffer_sRGB"))){
srgb_support = true;
}
else if (string_match(m, string_u8_litexpr("WGL_EXT_swap_interval"))){
b32 wgl_swap_interval_ext = true;
LoadWGL(wglSwapIntervalEXT, wgl_swap_interval_ext);
if (!wgl_swap_interval_ext){
wglSwapIntervalEXT = 0;
}
}
s = string_skip_whitespace(string_skip(s, end));
}
}
// NOTE(allen): Load gl functions
log_os(" loading core GL functions...\n");
#define GL_FUNC(f,R,P) LoadWGL(f,load_success);
#include "opengl/4ed_opengl_funcs.h"
if (!load_success){
register_success = false;
goto fail_register;
}
// NOTE(allen): Cleanup the GL bootstrap resources
log_os(" cleaning up boostrap resources...\n");
ReleaseDC(wglwindow, wgldc);
DestroyWindow(wglwindow);
wglDeleteContext(wglcontext);
// NOTE(allen): Register the graphics window class
log_os(" registering graphics class...\n");
WNDCLASSW wndclass = {};
wndclass.style = CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS;
wndclass.lpfnWndProc = win32_proc;
wndclass.hIcon = LoadIconW(GetModuleHandle(0), L"main");
wndclass.hInstance = this_instance;
wndclass.lpszClassName = L"GRAPHICS-WINDOW-NAME";
if (RegisterClassW(&wndclass) == 0){
register_success = false;
goto fail_register;
}
}
fail_register:;
b32 result = false;
if (register_success){
// NOTE(allen): Create the graphics window
log_os(" creating graphics window...\n");
HWND wnd = CreateWindowExW(0, L"GRAPHICS-WINDOW-NAME", L"GRAPHICS", style,
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top,
0, 0, this_instance, 0);
*wnd_out = 0;
*context_out = 0;
if (wnd != 0){
log_os(" setting graphics pixel format...\n");
HDC dc = GetDC(wnd);
PIXELFORMATDESCRIPTOR format = {};
i32 pixel_attrib_list[] = {
/* 0*/WGL_DRAW_TO_WINDOW_ARB, TRUE,
/* 2*/WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
/* 4*/WGL_SUPPORT_OPENGL_ARB, TRUE,
/* 6*/WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
/* 8*/WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
/*10*/WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,
/*12*/0,
};
if (!srgb_support){
pixel_attrib_list[10] = 0;
}
i32 suggested_format_index = 0;
u32 ignore = 0;
if (!wglChoosePixelFormatARB(dc, pixel_attrib_list, 0, 1, &suggested_format_index, &ignore)){
goto fail_window_init;
}
DescribePixelFormat(dc, suggested_format_index, sizeof(format), &format);
if (!SetPixelFormat(dc, suggested_format_index, &format)){
goto fail_window_init;
}
log_os(" setting graphics attributes...\n");
i32 context_attrib_list[] = {
/*0*/WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
/*2*/WGL_CONTEXT_MINOR_VERSION_ARB, 2,
/*4*/WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
#if GL_DEBUG_MODE
|WGL_CONTEXT_DEBUG_BIT_ARB
#endif
,
/*6*/WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
/*8*/0
};
log_os(" creating graphics GL context...\n");
HGLRC context = wglCreateContextAttribsARB(dc, 0, context_attrib_list);
if (context == 0){
goto fail_window_init;
}
log_os(" making graphics GL context current...\n");
wglMakeCurrent(dc, context);
if (wglSwapIntervalEXT != 0){
log_os(" setting swap interval...\n");
wglSwapIntervalEXT(1);
}
*wnd_out = wnd;
*context_out = context;
result = true;
if (false){
fail_window_init:;
DWORD error = GetLastError();
ReleaseDC(wnd, dc);
DestroyWindow(wnd);
SetLastError(error);
}
}
}
return(result);
}

View File

@ -20,10 +20,10 @@ use_scope_highlight = true;
use_paren_helper = true;
use_comment_keywords = true;
lister_whole_word_backspace_when_modified = true;
show_line_number_margins = true;
show_line_number_margins = false;
enable_output_wrapping = false;
enable_undo_fade_out = false;
enable_undo_fade_out = true;
// cursor_roundess is a value [0,50] setting the radius of
// the cursor and mark's roundness as a percentage of their width
@ -40,14 +40,14 @@ mark_thickness = 2;
lister_roundness = 20;
// Code Wrapping
treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm.js.ts.tsx.css.html.jai.json.mm.metal.glsl.hlsl";
enable_virtual_whitespace = false;
virtual_whitespace_regular_indent = 2;
enable_code_wrapping = false;
treat_as_code = ".cpp.c.hpp.h.cc.cs.java.rs.glsl.m.mm";
enable_virtual_whitespace = true;
virtual_whitespace_regular_indent = 4;
enable_code_wrapping = true;
// This only applies to code files in code-wrapping mode.
// Plain text and code files without virtual-whitespace will not be effected.
automatically_indent_text_on_save = false;
automatically_indent_text_on_save = true;
// When set to true, all unsaved changes will be saved on a build.
automatically_save_changes_on_build = true;
@ -57,16 +57,16 @@ automatically_load_project = false;
// Indentation
indent_with_tabs = false;
indent_width = 2;
default_tab_width = 2;
indent_width = 4;
default_tab_width = 4;
// Theme
default_theme_name = "theme-gs";
default_theme_name = "4coder";
// Font
default_font_name = "liberation-mono.ttf";
default_font_size = 14;
default_font_hinting = true;
default_font_size = 16;
default_font_hinting = false;
// aa modes:
// 8bit - mono-chrome 0-255 opacity channel per pixel
@ -74,7 +74,7 @@ default_font_hinting = true;
default_font_aa_mode = "8bit";
// User
user_name = "PS";
user_name = "not-set";
// Keyboard AltGr setting
lalt_lctrl_is_altgr = false;

View File

@ -1,69 +0,0 @@
defcolor_bar = 0xFF1e1e1e;
defcolor_base = 0xFFfcaa05;
defcolor_pop1 = 0xffde8150;
defcolor_pop2 = 0xFFFF0000;
defcolor_back = 0xFF1e1e1e;
defcolor_margin = 0xFF222425;
defcolor_margin_hover = 0xff63523d;
defcolor_margin_active = 0xff63523d;
defcolor_list_item = { 0xFF222425, defcolor_back};
defcolor_list_item_hover = { 0xff362e25, defcolor_margin};
defcolor_list_item_active = { 0xff63523d, defcolor_margin};
defcolor_cursor = { 0xFF00EE00, 0xffe0741b, 0xff1be094, 0xffba60c4 };
defcolor_at_cursor = 0xFF0C0C0C;
defcolor_highlight_cursor_line = 0xFF1E1E1E;
defcolor_highlight = 0xFF303040;
defcolor_at_highlight = 0xFFFF44DD;
defcolor_mark = 0xFF494949;
defcolor_text_default = 0xffd4d4d4;
defcolor_comment = 0xff6a9956;
defcolor_comment_pop = { 0xff2ab34f, 0xFFdb2828 };
defcolor_keyword = 0xffc586c0;
defcolor_str_constant = 0xffa77864;
defcolor_char_constant = 0xffa77864;
defcolor_int_constant = 0xffb4cda7;
defcolor_float_constant = 0xffb4cda7;
defcolor_bool_constant = 0xffb4cda7;
defcolor_preproc = 0xFFc485bf;
defcolor_include = 0xffc485bf;
defcolor_special_character = 0xFFFF0000;
defcolor_ghost_character = 0xFF4E5E46;
defcolor_highlight_junk = 0xFF3A0000;
defcolor_highlight_white = 0xFF003A3A;
defcolor_paste = 0xFFDDEE00;
defcolor_undo = 0xFF00DDEE;
defcolor_back_cycle = { 0xff282828, 0xff323232, 0xff3C3C3C, defcolor_back, };
defcolor_text_cycle = { 0xFFA00000, 0xFF00A000, 0xFF0030B0, 0xFFA0A000 };
defcolor_line_numbers_back = defcolor_back;
defcolor_line_numbers_text = 0xFF404040;
fleury_color_syntax_crap = 0xff5c4d3c;
fleury_color_operators = 0xFFbd2d2d;
fleury_color_inactive_pane_overlay = 0x44000000;
fleury_color_inactive_pane_background = 0xff1e1e1e;
fleury_color_file_progress_bar = 0x60634323;
fleury_color_brace_highlight = { 0xff8ffff2 };
fleury_color_brace_line = { 0x809ba290 };
fleury_color_brace_annotation = { 0x809ba290 };
fleury_color_index_product_type = 0xFFedb211;
fleury_color_index_sum_type = 0xFFa7eb13;
fleury_color_index_function = 0xFFde451f;
fleury_color_index_macro = 0xFF2895c7;
fleury_color_index_constant = 0xff6eb535;
fleury_color_index_comment_tag = 0xffffae00;
fleury_color_index_decl = 0xffc9598a;
fleury_color_cursor_macro = 0xffde2368;
fleury_color_cursor_power_mode = 0xffefaf2f;
fleury_color_cursor_inactive = 0xFF880000;
fleury_color_plot_cycle = { 0xff03d3fc, 0xff22b80b, 0xfff0bb0c, 0xfff0500c };
fleury_color_token_highlight = 0x88f2d357;
fleury_color_token_minor_highlight = 0x44d19045;
fleury_color_error_annotation = 0xffff0000;
fleury_color_lego_grab = 0xffefaf6f;
fleury_color_lego_splat = 0xffefaaef;
fleury_color_comment_user_name = 0xffffdd23;
defcolor_function = 0xffdadaa9;
defcolor_operator = 0xffc5c5c5;
defcolor_type = 0xff4dc5ac;
defcolor_macro = 0xff5190c5;

View File

@ -1,41 +0,0 @@
version(2);
project_name = "4ed.exe";
patterns = {
"*.c",
"*.cpp",
"*.h",
"*.m",
"*.bat",
"*.sh",
"*.4coder",
"*.mm",
};
blacklist_patterns = {
".*",
};
load_paths_base = {
{ ".", .relative = true, .recursive = true, },
};
load_paths = {
.win = load_paths_base,
.linux = load_paths_base,
.mac = load_paths_base,
};
commands = {
.build = {
.out = "*compilation*",
.footer_panel = true,
.save_dirty_files = true,
.win = "code\\bin\\build.bat",
.linux = "./code/bin/package.sh",
.mac = "code/bin/package-mac.sh", },
.run = { .out = "*run*", .footer_panel = false, .save_dirty_files = false,
.win = "build\\4ed.exe",
.linux = "build/4ed",
.mac = "build/4ed", },
};
fkey_command = {
.F1 = "build",
.F2 = "run",
};

View File

@ -1,203 +0,0 @@
# 4coder Build System Analysis
## Overview
The 4coder build system is a sophisticated multi-tier architecture designed to handle cross-platform compilation for Windows, Linux, and macOS. The system consists of three main components:
1. **Meta-Build System**: A C++ program that generates platform-specific build commands
2. **Platform-Specific Entry Scripts**: Shell/batch scripts that compile and execute the meta-build program
3. **Custom Layer Build System**: Separate compilation process for the customizable editor layer
## Architecture Deep Dive
### 1. Meta-Build System (`code/bin/4ed_build.cpp`)
The core of the build system is a 720-line C++ program that serves as a build configuration generator. Key features:
- **Platform Detection**: Automatically detects Windows, Linux, or macOS
- **Compiler Support**: Handles CL (MSVC), GCC, and Clang compilers
- **Architecture Support**: Supports both x64 and x86 architectures
- **Build Tiers**: Manages Demo vs Super build configurations
- **Flag Management**: Centralized handling of compilation flags and options
#### Key Data Structures:
```cpp
typedef u32 Platform_Code;
enum { Platform_Windows, Platform_Linux, Platform_Mac };
typedef u32 Compiler_Code;
enum { Compiler_CL, Compiler_GCC, Compiler_Clang };
typedef u32 Arch_Code;
enum { Arch_X64, Arch_X86 };
typedef u32 Tier_Code;
enum { Tier_Demo, Tier_Super };
```
#### Build Flags System:
```cpp
enum {
OPTS = 0x1, // Compiler warnings/options
LIBS = 0x2, // Link libraries
ICON = 0x4, // Windows icon resource
SHARED_CODE = 0x8, // Build as shared library
DEBUG_INFO = 0x10, // Debug symbols
OPTIMIZATION = 0x20, // Optimization level
SUPER = 0x40, // Super tier features
INTERNAL = 0x80, // Internal build flags
SHIP = 0x100, // Shipping build
};
```
### 2. Platform-Specific Entry Scripts
Each platform has dedicated build scripts that:
1. Compile the meta-build system (`4ed_build.cpp`)
2. Execute the compiled meta-build program with appropriate flags
3. Handle platform-specific compiler setup
#### macOS (`code/bin/build-mac-dev.sh`):
```bash
#!/bin/bash
g++ -std=c++11 -DDEV_BUILD -Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch -o ../build/4ed_build 4ed_build.cpp
../build/4ed_build $1
```
#### Linux (`code/bin/build-linux.sh`):
```bash
#!/bin/bash
g++ -g -std=c++11 -DDEV_BUILD -Wno-write-strings -Wno-comment -Wno-null-dereference -Wno-logical-op-parentheses -Wno-switch -o ../build/4ed_build 4ed_build.cpp
../build/4ed_build $1
```
#### Windows (`code/bin/build.bat`):
```batch
@echo off
IF NOT EXIST ..\build mkdir ..\build
pushd ..\build
cl /I..\code /DDEV_BUILD /std:c++11 /Zi /Fe:4ed_build.exe ..\code\bin\4ed_build.cpp /link /INCREMENTAL:NO /RELEASE > NUL
4ed_build.exe %1
popd
```
### 3. Custom Layer Build System
The custom layer (editor behavior/commands) uses a sophisticated multi-stage build process:
#### Stage 1: Preprocessing with Meta Macros
```bash
clang++ -I../code -I../code/custom -I../code/custom/generated -DMETA_PASS -E 4coder_default_bindings.cpp -o 4coder_default_bindings.i
```
#### Stage 2: Metadata Generator Compilation
```bash
clang++ -I../code -I../code/custom -I../code/custom/generated -o metadata_generator 4coder_metadata_generator.cpp
```
#### Stage 3: Metadata Generation
```bash
./metadata_generator -R ../code/custom/generated/ 4coder_default_bindings.i
```
#### Stage 4: Final Custom Layer Compilation
```bash
clang++ -I../code -I../code/custom -I../code/custom/generated -shared -fPIC -o custom_4coder.so 4coder_default_bindings.cpp
```
### 4. Compiler-Specific Configurations
#### Visual Studio (CL):
```cpp
#define CL_OPTS \
"-W4 -wd4310 -wd4100 -wd4201 -wd4505 -wd4996 " \
"-wd4127 -wd4510 -wd4512 -wd4610 -wd4390 " \
"-wd4611 -wd4189 -WX -GR- -EHa- -nologo -FC"
#define CL_LIBS_COMMON \
"user32.lib winmm.lib gdi32.lib opengl32.lib comdlg32.lib userenv.lib "
```
#### GCC (Linux):
```cpp
#define GCC_OPTS \
"-Wno-write-strings " \
"-D_GNU_SOURCE -fPIC " \
"-fno-threadsafe-statics -pthread " \
"-Wno-unused-result " \
"-std=c++11"
#define GCC_LIBS_COMMON \
"-lX11 -lpthread -lm -lrt " \
"-lGL -ldl -lXfixes -lfreetype -lfontconfig"
```
#### Clang (macOS):
```cpp
#define CLANG_OPTS \
"-Wno-write-strings -Wno-deprecated-declarations " \
"-Wno-comment -Wno-switch -Wno-null-dereference " \
"-Wno-tautological-compare -Wno-unused-result " \
"-Wno-missing-declarations -Wno-nullability-completeness " \
"-std=c++11 "
#define CLANG_LIBS_COMMON \
"-framework Cocoa -framework QuartzCore " \
"-framework CoreServices " \
"-framework OpenGL -framework IOKit -framework Metal -framework MetalKit "
```
### 5. Build Process Flow
#### Development Build Flow:
1. **Entry Script** (platform-specific) compiles `4ed_build.cpp`
2. **Meta-Build Program** generates compiler commands based on platform/arch/flags
3. **Custom Layer Build** (parallel process):
- Preprocesses source with meta macros
- Builds metadata generator
- Generates API bindings
- Compiles custom layer as shared library
4. **Core Engine Build**:
- Compiles `4ed_app_target.cpp` as shared library (`4ed_app.so`)
- Compiles platform layer as main executable (`4ed`)
5. **Resource Management**: Copies themes, fonts, configs to build directory
#### Packaging Build Flow:
1. **Standard Build** (as above)
2. **Distribution Preparation**:
- Creates versioned directory structure
- Copies executables and shared libraries
- Includes source code (Super tier only)
- Copies documentation and resources
3. **Archive Creation**: Creates ZIP files for distribution
### 6. Key Build Outputs
The build system produces:
- **`4ed`**: Main editor executable (platform layer)
- **`4ed_app.so`**: Core application logic (shared library)
- **`custom_4coder.so`**: Custom layer with user commands (shared library)
- **Resources**: Themes, fonts, configuration files
- **Debug Symbols**: `.dSYM` directories (macOS), `.pdb` files (Windows)
### 7. Build Complexity Analysis
The current system is complex due to:
1. **Multi-tier Architecture**: Three separate compilation units with interdependencies
2. **Cross-platform Abstraction**: Different compilers, flags, and linking requirements
3. **Dynamic API Generation**: Metadata generation for extensible command system
4. **Packaging Requirements**: Multiple build tiers and distribution formats
5. **Debug/Release Variants**: Different optimization and debugging configurations
### 8. Simplification Opportunities
The build system could be simplified by:
1. **Unified Build Scripts**: Single bash script per platform instead of meta-build system
2. **Direct Compiler Calls**: Eliminate C++ meta-build program in favor of direct clang/gcc invocations
3. **Simplified Metadata**: Reduce or eliminate runtime metadata generation
4. **Merged Compilation Units**: Combine core and custom layers into single executable
5. **Standardized Toolchain**: Use consistent compiler (clang) across all platforms
The current complexity stems from the editor's plugin architecture and cross-platform requirements, but many of these features could be maintained with a simpler build system that uses direct bash scripts calling clang with appropriate flags.

Some files were not shown because too many files have changed in this diff Show More