Compare commits
2 Commits
8bb636c517
...
e7f7f3e321
Author | SHA1 | Date | |
---|---|---|---|
e7f7f3e321 | |||
c061916a98 |
216
.clang-format
Normal file
216
.clang-format
Normal file
@ -0,0 +1,216 @@
|
|||||||
|
---
|
||||||
|
Language: Cpp
|
||||||
|
# BasedOnStyle: LLVM
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
AlignAfterOpenBracket: Align
|
||||||
|
AlignArrayOfStructures: None
|
||||||
|
AlignConsecutiveAssignments:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignEscapedNewlines: Right
|
||||||
|
AlignOperands: Align
|
||||||
|
AlignTrailingComments: true
|
||||||
|
AllowAllArgumentsOnNextLine: true
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: true
|
||||||
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortLambdasOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLoopsOnASingleLine: false
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
|
AlwaysBreakAfterReturnType: None
|
||||||
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
|
AlwaysBreakTemplateDeclarations: MultiLine
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
|
BinPackArguments: true
|
||||||
|
BinPackParameters: true
|
||||||
|
BraceWrapping:
|
||||||
|
AfterCaseLabel: false
|
||||||
|
AfterClass: false
|
||||||
|
AfterControlStatement: Never
|
||||||
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: false
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
SplitEmptyNamespace: true
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Attach
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakBeforeTernaryOperators: true
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
|
BreakStringLiterals: true
|
||||||
|
ColumnLimit: 120
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
QualifierAlignment: Leave
|
||||||
|
CompactNamespaces: false
|
||||||
|
ConstructorInitializerIndentWidth: 4
|
||||||
|
ContinuationIndentWidth: 4
|
||||||
|
Cpp11BracedListStyle: true
|
||||||
|
DeriveLineEnding: true
|
||||||
|
DerivePointerAlignment: false
|
||||||
|
DisableFormat: false
|
||||||
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
BasedOnStyle: ''
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
|
FixNamespaceComments: true
|
||||||
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
IndentCaseLabels: false
|
||||||
|
IndentCaseBlocks: false
|
||||||
|
IndentGotoLabels: true
|
||||||
|
IndentPPDirectives: BeforeHash
|
||||||
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 2
|
||||||
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
|
MaxEmptyLinesToKeep: 1
|
||||||
|
NamespaceIndentation: All
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
|
ObjCSpaceAfterProperty: false
|
||||||
|
ObjCSpaceBeforeProtocolList: true
|
||||||
|
PenaltyBreakAssignment: 2
|
||||||
|
PenaltyBreakBeforeFirstCallParameter: 19
|
||||||
|
PenaltyBreakComment: 300
|
||||||
|
PenaltyBreakFirstLessLess: 120
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
|
PenaltyBreakString: 1000
|
||||||
|
PenaltyBreakTemplateDeclaration: 10
|
||||||
|
PenaltyExcessCharacter: 1000000
|
||||||
|
PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
|
PointerAlignment: Right
|
||||||
|
PPIndentWidth: 1
|
||||||
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: true
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: CaseSensitive
|
||||||
|
SortJavaStaticImport: Before
|
||||||
|
SortUsingDeclarations: true
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
SpaceAfterLogicalNot: false
|
||||||
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
|
SpaceBeforeCpp11BracedList: false
|
||||||
|
SpaceBeforeCtorInitializerColon: true
|
||||||
|
SpaceBeforeInheritanceColon: true
|
||||||
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: true
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceInEmptyBlock: false
|
||||||
|
SpaceInEmptyParentheses: false
|
||||||
|
SpacesBeforeTrailingComments: 1
|
||||||
|
SpacesInAngles: Never
|
||||||
|
SpacesInConditionalStatement: false
|
||||||
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
|
SpacesInParentheses: false
|
||||||
|
SpacesInSquareBrackets: false
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
|
BitFieldColonSpacing: Both
|
||||||
|
Standard: Latest
|
||||||
|
StatementAttributeLikeMacros:
|
||||||
|
- Q_EMIT
|
||||||
|
StatementMacros:
|
||||||
|
- Q_UNUSED
|
||||||
|
- QT_REQUIRE_VERSION
|
||||||
|
TabWidth: 8
|
||||||
|
UseCRLF: false
|
||||||
|
UseTab: Never
|
||||||
|
WhitespaceSensitiveMacros:
|
||||||
|
- STRINGIZE
|
||||||
|
- PP_STRINGIZE
|
||||||
|
- BOOST_PP_STRINGIZE
|
||||||
|
- NS_SWIFT_NAME
|
||||||
|
- CF_SWIFT_NAME
|
||||||
|
...
|
||||||
|
|
144
README.md
144
README.md
@ -1,3 +1,143 @@
|
|||||||
# goff
|
# Goff Film Scanner Software
|
||||||
|
|
||||||
Software driver for Nikon Coolscan Scanners
|
Goff is software application to work with the Nikon Coolscan line of scanners,
|
||||||
|
specifically (Coolscan IV LS-40ED, Coolscan LS-4000 ED, Coolscan LS-5000 ED /
|
||||||
|
Coolscan LS-50 ED, Coolscan LS-8000 ED, Coolscan LS-9000 ED). Its sole purpose
|
||||||
|
is to be a modern equivalent of the now discontinued NikonScan software.
|
||||||
|
|
||||||
|
The primary plan for now is to be feature complete with NikonScan, with emphasis
|
||||||
|
on taking advantage of modern hardware capabilities to improve speed, and better
|
||||||
|
user experience compared to the OG NikonScan.
|
||||||
|
|
||||||
|
## Guarantees
|
||||||
|
This application guarantees the following:
|
||||||
|
- x86-64 architecture support
|
||||||
|
- Support for Windows 10 and above.
|
||||||
|
- Complete support for the following Coolscan scanners:
|
||||||
|
- Coolscan IV LS-40ED
|
||||||
|
- Coolscan LS-4000 ED
|
||||||
|
- Coolscan LS-5000 ED / Coolscan LS-50 ED
|
||||||
|
- Coolscan LS-8000 ED
|
||||||
|
- Coolscan LS-9000 ED
|
||||||
|
|
||||||
|
## Status
|
||||||
|
Goff is currently in the Pre-Alpha stage, meaning things it is not anywhere near
|
||||||
|
a useable product and things are expected to break and change without any notice.
|
||||||
|
|
||||||
|
|
||||||
|
## Development Setup Instructions
|
||||||
|
|
||||||
|
**Note: Only x64 Windows development is supported.**
|
||||||
|
|
||||||
|
### 1. Installing the Required Tools (MSVC & Windows SDK)
|
||||||
|
|
||||||
|
In order to work with the codebase, you'll need the [Microsoft C/C++ Build Tools
|
||||||
|
v15 (2017) or later](https://aka.ms/vs/17/release/vs_BuildTools.exe), for both
|
||||||
|
the Windows SDK and the MSVC compiler and linker.
|
||||||
|
|
||||||
|
If the Windows SDK is installed (e.g. via installation of the Microsoft C/C++
|
||||||
|
Build Tools). At this time, support for other compilers like clang is not
|
||||||
|
supported.
|
||||||
|
|
||||||
|
### 2. Build Environment Setup
|
||||||
|
|
||||||
|
Building the codebase can be done in a terminal which is equipped with the
|
||||||
|
ability to call MSVC from command line.
|
||||||
|
|
||||||
|
This is generally done by calling `vcvarsall.bat x64`, which is included in the
|
||||||
|
Microsoft C/C++ Build Tools. This script is automatically called by the `x64
|
||||||
|
Native Tools Command Prompt for VS <year>` variant of the vanilla `cmd.exe`. If
|
||||||
|
you've installed the build tools, this command prompt may be easily located by
|
||||||
|
searching for `Native` from the Windows Start Menu search. Alternatively you
|
||||||
|
could run the following command in your preferred console emulator on windows
|
||||||
|
|
||||||
|
```
|
||||||
|
"C:\Program Files\Microsoft Visual Studio\<year>\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
|
```
|
||||||
|
|
||||||
|
You can ensure that the MSVC compiler is accessible from your command line by
|
||||||
|
running:
|
||||||
|
|
||||||
|
```
|
||||||
|
cl
|
||||||
|
```
|
||||||
|
|
||||||
|
If everything is set up correctly, you should have output very similar to the
|
||||||
|
following:
|
||||||
|
|
||||||
|
```
|
||||||
|
Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33811 for x64
|
||||||
|
Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
usage: cl [ option... ] filename... [ /link linkoption... ]
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Building
|
||||||
|
|
||||||
|
Within this terminal, `cd` to the root directory of the codebase, and just run
|
||||||
|
the `build.bat` script:
|
||||||
|
|
||||||
|
```
|
||||||
|
build
|
||||||
|
```
|
||||||
|
|
||||||
|
You should see the following output:
|
||||||
|
```
|
||||||
|
[debug mode]
|
||||||
|
[msvc compile]
|
||||||
|
[default mode, assuming `goff` build]
|
||||||
|
goff_main.c
|
||||||
|
```
|
||||||
|
|
||||||
|
If everything worked as it should, the executable will be in the `run_tree` folder
|
||||||
|
in the root of the codebase, and it will contain a freshly-builth `Goff Scan.exe`
|
||||||
|
|
||||||
|
## Top-Level Directory Descriptions
|
||||||
|
- `run_tree`: This directory contains everything that is needed for a debug build
|
||||||
|
of the application to run.
|
||||||
|
- `run_tree/data` Contains small binary files (i.e. .rc files, logo, fonts, etc)
|
||||||
|
used when building, to embed or package with the application.
|
||||||
|
- `src`: All the source code.
|
||||||
|
|
||||||
|
|
||||||
|
## Codebase Introduction
|
||||||
|
|
||||||
|
The codebase is organized into *layers*. Layers are separated either to isolate
|
||||||
|
certain problems, and to allow inclusion into various builds without needing to
|
||||||
|
pull everything in the codebase into a build. Layers correspond with folders
|
||||||
|
inside of the `src` directory. Sometimes, one folder inside of the `src`
|
||||||
|
directory will include multiple sub-layers, but the structure is intended to be
|
||||||
|
fairly flat.
|
||||||
|
|
||||||
|
Layers correspond roughly 1-to-1 with *namespaces*. The term "namespaces" in
|
||||||
|
this context does not refer to specific namespace language features, but rather
|
||||||
|
a naming convention for C-style namespaces, which are written in the codebase as
|
||||||
|
a short prefix, usually 1-3 characters, followed by an underscore. These
|
||||||
|
namespaces are used such that the layer to which certain code belongs may be
|
||||||
|
quickly understood by glancing at code. The namespaces are generally quite short
|
||||||
|
to ensure that they aren't much of a hassle to write. Sometimes, multiple sub-
|
||||||
|
layers will share a namespace. A few layers do not have a namespace, but most
|
||||||
|
do. Namespaces are either all-caps or lowercase depending on the context in
|
||||||
|
which they're used. For structs, enum values, and some macros, they are
|
||||||
|
capitalized. For functions and global variables, they are lowercase.
|
||||||
|
|
||||||
|
Layers depend on other layers, but circular dependencies would break the
|
||||||
|
separability and isolation utility of layers (in effect, forming one big layer),
|
||||||
|
so in other words, layers are arranged into a directed acyclic graph.
|
||||||
|
|
||||||
|
A list of layers in the codebase and their associated namespaces are below:
|
||||||
|
- `base` (no namespace): Universal, codebase-wide constructs. It contains
|
||||||
|
strings, math, memory allocators, threading, and logging.
|
||||||
|
It depends on no other codebase layers.
|
||||||
|
- `es/core` (`ES_`): Short for Engine Subsystem. Implements the
|
||||||
|
- `es/gfx` (`ES_`): Engine Subsystem graphical frontend. Builds on top of
|
||||||
|
`es/core` to provide graphical features such as windows, panels, and all
|
||||||
|
interfaces needed for using the scanner. It is the main user of `os/gfx`.
|
||||||
|
- `os/core` (`OS_`): An abstraction layer that provides core, non-graphical
|
||||||
|
functionality from the operating sytem under a general use abstraction API.
|
||||||
|
This is implemented per supported operating system.
|
||||||
|
- `os/gfx` (`OS_`): This layer builds on top of `os/core`, it provides
|
||||||
|
graphical operating functionalities under a general use abstraction API.
|
||||||
|
- `ui` (`UI_`): For building graphical user interfaces. Provides a core
|
||||||
|
immediate mode hierarchical user interface data structure building API, and
|
||||||
|
has helper layers for building higher level widgets.
|
74
build.bat
Normal file
74
build.bat
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
cd /D "%~dp0"
|
||||||
|
|
||||||
|
:: --- Unpack Arguments ---------------------------------------------------------------
|
||||||
|
for %%a in (%*) do set "%%a=1"
|
||||||
|
if not "%msvc%"=="1" if not "%clang%"=="1" set msvc=1
|
||||||
|
if not "%release%"=="1" set debug=1
|
||||||
|
if "%debug%"=="1" set release=0 && echo [debug mode]
|
||||||
|
if "%release%"=="1" set debug=0 && echo [release mode]
|
||||||
|
if "%msvc%"=="1" set clang=0 && echo [msvc compile]
|
||||||
|
if "%clang%"=="1" set msvc=0 && echo [clang compile]
|
||||||
|
if "%~1"=="" echo [default mode, assuming `goff` build] && set goff=1
|
||||||
|
|
||||||
|
:: --- Compile/Link Line Definitions -------------------------------------------------
|
||||||
|
set cl_common= /I..\src\ /nologo /FC /Z7
|
||||||
|
set cl_out= /out:
|
||||||
|
rem Add back resource.res to cl_link
|
||||||
|
set cl_link= /link /MANIFEST:EMBED /INCREMENTAL:NO resource.res
|
||||||
|
set cl_debug= call cl /Od /DBUILD_DEBUG=1 %cl_common%
|
||||||
|
set cl_release= call cl /O2 /DBUILD_DEBUG=0 %cl_common%
|
||||||
|
|
||||||
|
set clang_common=
|
||||||
|
set clang_out= -o
|
||||||
|
set clang_link=
|
||||||
|
set clang_debug= call cl -g -O0 -DBUILD_DEBUG=1 %clang_common%
|
||||||
|
set clang_release= call cl -g -O2 -DBUILD_DEBUG=0 %clang_common%
|
||||||
|
|
||||||
|
:: --- Per-Build Settings ----------------------------------------------------
|
||||||
|
:: set link_dll=-DLL
|
||||||
|
if "%msvc%"=="1" set only_compile=/c
|
||||||
|
if "%msvc%"=="1" set EHsc=/EHsc
|
||||||
|
if "%msvc%"=="1" set rc=rc.exe
|
||||||
|
|
||||||
|
if "%clang%"=="1" set EHsc=
|
||||||
|
if "%clang%"=="1" set only_compile=-c
|
||||||
|
if "%clang%"=="1" set rc=llvm-rc.exe
|
||||||
|
|
||||||
|
:: --- Choose Compile/Link Lines ---------------------------------------------
|
||||||
|
if "%msvc%"=="1" set compile_debug=%cl_debug%
|
||||||
|
if "%msvc%"=="1" set compile_release=%cl_release%
|
||||||
|
if "%msvc%"=="1" set compile_link=%cl_link%
|
||||||
|
if "%msvc%"=="1" set out=%cl_out%
|
||||||
|
if "%debug%"=="1" set compile=%compile_debug%
|
||||||
|
if "%release%"=="1" set compile=%compile_release%
|
||||||
|
|
||||||
|
:: --- Get Current Git Commit Id ----------------------------------------------
|
||||||
|
for /f %%i in ('call git describe --always --dirty') do set compile=%compile% -DBUILD_GIT_HASH=\"%%i\"
|
||||||
|
|
||||||
|
:: --- Prep Directory --------------------------------------------------------
|
||||||
|
if not exist run_tree (
|
||||||
|
mkdir run_tree
|
||||||
|
echo "[WARNING] creating run_tree, data files may not exist."
|
||||||
|
)
|
||||||
|
|
||||||
|
:: --- Produce Logo Icon File ------------------------------------------------
|
||||||
|
pushd run_tree
|
||||||
|
%rc% /nologo /fo resource.res data\resource.rc || exit /b 1
|
||||||
|
popd
|
||||||
|
|
||||||
|
:: --- Build Everything (@build_targets) -------------------------------------
|
||||||
|
pushd run_tree
|
||||||
|
if "%goff%"=="1" %compile% %gfx% ..\src\goff\goff_main.c %compile_link% %out%"Goff Scan.exe" || exit /b 1
|
||||||
|
popd
|
||||||
|
|
||||||
|
:: --- Unset -----------------------------------------------------------------
|
||||||
|
for %%a in (%*) do set "%%a=0"
|
||||||
|
set goff=
|
||||||
|
set compile=
|
||||||
|
set compile_link=
|
||||||
|
set out=
|
||||||
|
set msvc=
|
||||||
|
set debug=
|
||||||
|
|
117
src/base/base_context_switching.h
Normal file
117
src/base/base_context_switching.h
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#ifndef BASE_CONTEXT_SWITCHING_H
|
||||||
|
#define BASE_CONTEXT_SWITCHING_H
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define COMPILER_MSVC 1
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define OS_WINDOWS 1
|
||||||
|
#else
|
||||||
|
#error Compiler/OS combination is not supported.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_M_AMD64)
|
||||||
|
#define ARCH_X64 1
|
||||||
|
#elif defined(_M_IX86)
|
||||||
|
#define ARCH_x86 1
|
||||||
|
#else
|
||||||
|
#error Architecture not supported.
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Architecture Context
|
||||||
|
#if defined(ARCH_X64)
|
||||||
|
#define ARCH_64BIT 1
|
||||||
|
#elif defined(ARCH_X86)
|
||||||
|
#define ARCH_32BIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ARCH_X64 || ARCH_X86
|
||||||
|
#define ARCH_LITTLE_ENDIAN 1
|
||||||
|
#else
|
||||||
|
#error Endianess of this architecture is not supported.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Language Context
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
#define LANG_CPP 1
|
||||||
|
#else
|
||||||
|
#define LANG_C 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//=================================
|
||||||
|
//~ tijani: Build Options
|
||||||
|
#if !defined(BUILD_DEBUG)
|
||||||
|
#define BUILD_DEBUG 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_VERSION_MAJOR)
|
||||||
|
#define BUILD_VERSION_MAJOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_VERSION_MINOR)
|
||||||
|
#define BUILD_VERSION_MINOR 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_VERSION_PATCH)
|
||||||
|
#define BUILD_VERSION_PATCH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BUILD_VERSION_STRING_LITERAL \
|
||||||
|
Stringify(BUILD_VERSION_MAJOR) "." Stringify(BUILD_VERSION_MINOR) "." Stringify(BUILD_VERSION_PATCH)
|
||||||
|
|
||||||
|
#if BUILD_DEBUG
|
||||||
|
#define BUILD_MODE_STRING_LITERAL_APPEND " [Debug]"
|
||||||
|
#else
|
||||||
|
#define BUILD_MODE_STRING_LITERAL_APPEND ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(BUILD_GIT_HASH)
|
||||||
|
#define BUILD_GIT_HASH_STRING_LITERAL_APPEND " [" BUILD_GIT_HASH "]"
|
||||||
|
#else
|
||||||
|
#define BUILD_GITH_HASH_STRING_LITERAL_APPEND ""
|
||||||
|
#endif
|
||||||
|
#if !defined(BUILD_TITLE)
|
||||||
|
#define BUILD_TITLE "Untitled"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_RELEASE_PHASE_STRING_LITERAL)
|
||||||
|
#define BUILD_RELEASE_PHASE_STRING_LITERAL "ALPHA"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(BUILD_ISSUES_LINK_STRING_LITERAL)
|
||||||
|
#define BUILD_ISSUES_LINK_STRING_LITERAL ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BUILD_TITLE_STRING_LITERAL \
|
||||||
|
BUILD_TITLE \
|
||||||
|
" (" BUILD_VERSION_STRING_LITERAL " " BUILD_RELEASE_PHASE_STRING_LITERAL ") - " __DATE__ \
|
||||||
|
"" BUILD_GIT_HASH_STRING_LITERAL_APPEND BUILD_MODE_STRING_LITERAL_APPEND
|
||||||
|
|
||||||
|
//=============================
|
||||||
|
//~ tijani: Zero Undefined Options
|
||||||
|
#if !defined(COMPILER_MSVC)
|
||||||
|
#define COMPILER_MSVC 0
|
||||||
|
#endif
|
||||||
|
#if !defined(OS_WINDOWS)
|
||||||
|
#define OS_WINDOWS 0
|
||||||
|
#endif
|
||||||
|
#if !defined(ARCH_X64)
|
||||||
|
#define ARCH_X64 0
|
||||||
|
#endif
|
||||||
|
#if !defined(ARCH_X86)
|
||||||
|
#define ARCH_X86 0
|
||||||
|
#endif
|
||||||
|
#if !defined(ARCH_32BIT)
|
||||||
|
#define ARCH_32BIT 0
|
||||||
|
#endif
|
||||||
|
#if !defined(ARCH_64BIT)
|
||||||
|
#define ARCH_64BIT 0
|
||||||
|
#endif
|
||||||
|
#if !defined(LANG_CPP)
|
||||||
|
#define LANG_CPP 0
|
||||||
|
#endif
|
||||||
|
#if !defined(LANG_C)
|
||||||
|
#define LANG_C 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // BASE_CONTEXT_SWITCHING_H
|
29
src/base/base_core.h
Normal file
29
src/base/base_core.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef BASE_CORE_H
|
||||||
|
#define BASE_CORE_H
|
||||||
|
|
||||||
|
#define global static
|
||||||
|
#define local static
|
||||||
|
#define internal static
|
||||||
|
|
||||||
|
|
||||||
|
// Base Types
|
||||||
|
typedef uint8_t u8;
|
||||||
|
typedef uint16_t u16;
|
||||||
|
typedef uint32_t u32;
|
||||||
|
typedef uint64_t u64;
|
||||||
|
|
||||||
|
typedef int8_t s8;
|
||||||
|
typedef int16_t s16;
|
||||||
|
typedef int32_t s32;
|
||||||
|
typedef int64_t s64;
|
||||||
|
|
||||||
|
typedef s8 b8;
|
||||||
|
typedef s16 b16;
|
||||||
|
typedef s32 b32;
|
||||||
|
typedef s64 b64;
|
||||||
|
|
||||||
|
typedef float f32;
|
||||||
|
typedef double f64;
|
||||||
|
|
||||||
|
|
||||||
|
#endif // BASE_CORE_H
|
5
src/base/base_inc.c
Normal file
5
src/base/base_inc.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// clang-format off
|
||||||
|
#include "base_core.c"
|
||||||
|
#include "base_arena.c"
|
||||||
|
|
||||||
|
// clang-format on
|
14
src/base/base_inc.h
Normal file
14
src/base/base_inc.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef BASE_INC_H
|
||||||
|
#define BASE_INC_H
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
#include "base_context_switching.h"
|
||||||
|
#include "base_core.h"
|
||||||
|
|
||||||
|
#include "base_arena.h"
|
||||||
|
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
|
||||||
|
#endif // BASE_INC_H
|
Loading…
Reference in New Issue
Block a user