Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e682c74
Add configured unreal files also to release
JBenda Jan 11, 2024
3906542
add redefine for list/list_flag
JBenda Jan 15, 2024
efb7c4e
UE fixes
JBenda Jan 15, 2024
d0d5819
Fix list only iterator
JBenda Jan 15, 2024
d030e72
restore after done to allow parallel execution
JBenda Jan 15, 2024
d99b081
add test case for crash behaivior
JBenda Jan 16, 2024
0086fc4
new snapshot
JBenda Jan 16, 2024
553702f
UE Fixes + invert index for snapshot recreation
JBenda Jan 16, 2024
127fb45
Use Enum Ref for InkList Contains
JBenda Jan 17, 2024
77e3c2f
Clean upd
JBenda Jan 17, 2024
437a1bc
format
JBenda Jan 17, 2024
dcde74c
Support Full flag names for list operations
JBenda Jan 17, 2024
b062d6e
remove legacy deps
JBenda Jan 17, 2024
eb90204
FIxe ink file
JBenda Jan 17, 2024
7491ed2
Add UE docu
JBenda Jan 18, 2024
f097442
UE TagList tweaks
JBenda Jan 19, 2024
9a580cb
Advanced unreal doxygen documentation
JBenda Jan 21, 2024
83c185d
Further documentation refinement
JBenda Jan 21, 2024
cf78a9c
Add ue blueprint filter
JBenda Jan 21, 2024
b05d56f
Fix Doxygen warnings
JBenda Jan 21, 2024
73aea98
formatting
JBenda Jan 21, 2024
3d1d9f5
UE fixes + avoid newlines
JBenda Jan 21, 2024
eca52bc
last docu changes
JBenda Jan 21, 2024
b2f4528
Add Unreal demo project
JBenda Jan 21, 2024
c8ed383
bump
JBenda Jan 21, 2024
ad768b8
format
JBenda Jan 21, 2024
1e75206
Move demo project to repair link
JBenda Jan 21, 2024
e47df33
correct flag
JBenda Jan 21, 2024
616ba01
Install newer doxygen version
JBenda Jan 22, 2024
85ed6d7
add sudo to install
JBenda Jan 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
echo "INKLECATE=${{ matrix.inklecate_pre }}$GITHUB_WORKSPACE/inklecate/inklecate${{ matrix.inklecate_post }}" >> $GITHUB_ENV

# Setup python
- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
if: ${{ matrix.proof }}
with:
python-version: '3.7'
Expand Down Expand Up @@ -192,7 +192,13 @@ jobs:
with:
python-version: "3.x"
- name: Install Doxygen
run: sudo apt-get install doxygen graphviz -y
run: |
sudo apt-get install graphviz -y
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz
gunzip doxygen-*.tar.gz
tar xf doxygen-*.tar
cd doxygen-1.10.0/
sudo make install
- name: Setup cmake
uses: jwlawson/[email protected]
with:
Expand All @@ -202,7 +208,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DINKCPP_PY=ON
run: cmake $GITHUB_WORKSPACE -DINKCPP_PY=ON -DINKCPP_DOC_BlueprintUE=ON
- name: Build
working-directory: ${{github.workspace}}/build
shell: bash
Expand Down Expand Up @@ -290,7 +296,7 @@ jobs:
pull-requests: write
steps:
# Download Ink Proof Results
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: results
path: "results"
Expand Down Expand Up @@ -327,19 +333,19 @@ jobs:
- uses: actions/checkout@v4

# Download Ink Proof page for Linux
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: linux-www
path: www/proof

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: doxygen
path: www

# Deploy to Github Pages
- name: Deploy Page
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@4
with:
branch: inkproof-page
folder: www
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Download artifacts
uses: marcofaggian/[email protected]
with:
names: linux-cl linux-lib linux-clib unreal macos-cl macos-lib macos-clib win64-cl win64-lib win64-clib python-package-distribution
paths: linux-cl linux-lib linux-clib unreal macos-cl macos-lib macos-clib win64-cl win64-lib win64-clib dist
workflow: build.yml
branch: master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ID=$(gh run list -b master --limit 1 --json databaseId | jq '.[0].databaseId')
gh run download $ID -n linux-cl -n linux-lib -n linux-clib -n unreal -n macos-cl -n macos-lib -n macos-clib -n win64-cl -n win64-lib -n win64-clib -n python-package-distribution
mv python-package-distribution dist
- name: Zip
run: |
for f in linux-cl linux-lib linux-clib unreal macos-cl macos-lib macos-clib win64-cl win64-lib win64-clib; do zip -r $f $f; done
Expand Down
28 changes: 26 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16)
enable_testing()

# Project setup
project(inkcpp VERSION 0.1.2)
project(inkcpp VERSION 0.1.3)
SET(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_INSTALL_LIBRARY_DIR lib)
Expand Down Expand Up @@ -71,13 +71,36 @@ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_GROUPING IGNORE)
include(CPack)

if(NOT WHEEL_BUILD)
find_package(Doxygen)
if (DOXYGEN_FOUND)

set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
# enable if update to cmake version 3.28
# doxygen_add_docs(doc WORKING_DIR ${PROJECT_SOURCE_DIR} CONFIG_FILE "${PROJECT_SOURCE_DIR}/Doxyfile" COMMENT "Generate docs")
set(INPUT_FILTER "")

if (INKCPP_DOC_BlueprintUE)
# TODO: make as dependecy
file(COPY "${PROJECT_SOURCE_DIR}/unreal/blueprint_filter.js" DESTINATION ${PROJECT_BINARY_DIR})
file(DOWNLOAD
"https://blueprintue.com/bue-render/render.css"
"${PROJECT_BINARY_DIR}/render.css"
EXPECTED_HASH SHA256=875364e36f8aa5d6c1d41d58043f13b48a499b5c969e8daef35bd29bbf7c6e8d)
file(APPEND "${PROJECT_BINARY_DIR}/render.css" ".bue-render .icon { background-color: unset; }")
file(READ "${PROJECT_SOURCE_DIR}/Doxyfile" DOXYFILE)
string(REPLACE "FILTER_PATTERNS =" "FILTER_PATTERNS = \"*/unreal/*=node ${PROJECT_BINARY_DIR}/blueprint_filter.js\"" DOXYFILE2 ${DOXYFILE})
string(REPLACE "HTML_EXTRA_STYLESHEET =" "HTML_EXTRA_STYLESHEET = ${PROJECT_BINARY_DIR}/render.css " DOXYFILE ${DOXYFILE2})
file(WRITE "${PROJECT_BINARY_DIR}/Doxyfile" ${DOXYFILE})
else ()
configure_file(
"${PROJECT_SOURCE_DIR}/Doxyfile"
"${PROJECT_BINARY_DIR}/Doxyfile"
COPYONLY)
endif()

add_custom_target(doc
${DOXYGEN_EXECUTABLE} "${PROJECT_SOURCE_DIR}/Doxyfile"
${DOXYGEN_EXECUTABLE} "${PROJECT_BINARY_DIR}/Doxyfile"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Generate doxygen documentation")
set(PY_HTML "${PROJECT_SOURCE_DIR}/Documentation/inkcpp_py.html")
Expand All @@ -101,3 +124,4 @@ if (DOXYGEN_FOUND)
else(DOXYGEN_FOUND)
message("Doxygen needed to generate documntation!")
endif(DOXYGEN_FOUND)
endif(NOT WHEEL_BUILD)
4 changes: 2 additions & 2 deletions Documentation/cmake_example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ find_package(inkcpp CONFIG REQUIRED)

# for CXX builds
add_executable(main_cpp main.cpp)
target_link_libraries(main inkcpp inkcpp_compiler)
target_link_libraries(main_cpp inkcpp inkcpp_compiler)

# for C builds
# add_executable(main_c main.c)
# target_link_libraries(main inkcpp_c)
# target_link_libraries(main_c inkcpp_c)
Binary file added Documentation/unreal/InkCPP_DEMO.zip
Binary file not shown.
Binary file added Documentation/unreal/imgs/CreateThread.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/HandleChoice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/ListElementOf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/MinimalRuntime.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/MinimalThread.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/ObseverChange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/TagListGetValue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/unreal/imgs/YieldResume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ EXCLUDE_PATTERNS =
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# ANamespace::AClass, ANamespace::*Test

EXCLUDE_SYMBOLS = ink::list_flag
EXCLUDE_SYMBOLS = ink::list_flag ink::runtime::internal* ink::internal*

# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
Expand Down Expand Up @@ -2348,15 +2348,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2389,7 +2389,11 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = DOXYGEN \
INK_ENABLE_STL \
INK_ENABLE_CSTD \
INK_ENABLE_UNREAL \
UFUNCTION(...):=

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand All @@ -2398,7 +2402,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED = UFUNCTION

# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
Expand Down
2 changes: 2 additions & 0 deletions inkcpp/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class managed_restorable_array : public managed_array<T, dynamic, initialCapacit

bool has_changed() const { return base::size() != _last_size; }

size_t last_size() const { return _last_size; }

size_t snap(unsigned char* data, const snapshot_interface::snapper& snapper) const
{
unsigned char* ptr = data;
Expand Down
4 changes: 2 additions & 2 deletions inkcpp/globals_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ void globals_impl::gc()

void globals_impl::save()
{
for (int i = 0; i < _num_containers; ++i) {
for (uint32_t i = 0; i < _num_containers; ++i) {
_visit_counts_backup[i] = _visit_counts[i];
}
_variables.save();
}

void globals_impl::restore()
{
for (int i = 0; i < _num_containers; ++i) {
for (uint32_t i = 0; i < _num_containers; ++i) {
_visit_counts[i] = _visit_counts_backup[i];
}
_variables.restore();
Expand Down
140 changes: 81 additions & 59 deletions inkcpp/include/choice.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,76 +3,98 @@

namespace ink
{
namespace runtime
namespace runtime
{
namespace internal
{
namespace internal
{
class basic_stream;
class runner_impl;
class string_table;
class list_table;
}
class basic_stream;
class runner_impl;
class string_table;
class list_table;
} // namespace internal

/**
* An ink choice that is being presented to the user
*
* Contains all the data about a single choice being faced
* by an ink runner. Of primary concern is the index and the
* text.
*
* @see runner
*/
class choice
{
public:
/**
* Choice index
*
* Pass this to the runner to choose this choice and
* have it follow its branch.
*
* @returns index of the choice. 0 is the first, etc.
*/
int index() const { return _index; }

/**
* An ink choice that is being presented to the user
* Choice text
*
* Contains all the data about a single choice being faced
* by an ink runner. Of primary concern is the index and the
* text.
* Text to display to the user for choosing this choice.
*
* @see runner
*/
class choice
* @returns choice text as a string
*/
const char* text() const { return _text; }

/** @private */
choice()
: choice(0)
{
public:
/**
* Choice index
*
* Pass this to the runner to choose this choice and
* have it follow its branch.
*
* @returns index of the choice. 0 is the first, etc.
*/
int index() const { return _index; }
}

/**
* Choice text
*
* Text to display to the user for choosing this choice.
*
* @returns choice text as a string
*/
const char* text() const { return _text; }
/** @private */
choice(int)
: _tags{nullptr}
, _text{nullptr}
, _index{~0}
, _path{~0u}
, _thread{~0u}
{
}

choice() : choice(0) {}
choice(int) : _tags{nullptr}, _text{nullptr}, _index{~0}, _path{~0u}, _thread{~0u} {}
/** does this choice has tags? */
bool has_tags() const { return _tags != nullptr; }

bool has_tags() const { return _tags != nullptr; }
size_t num_tags() const
{
size_t i = 0;
if (has_tags()) while ( _tags[i] != nullptr )
{
/** number of tags assoziated with this choice
* @see @ref ink::runtime::choice::has_tags() "has_tags()"
*/
size_t num_tags() const
{
size_t i = 0;
if (has_tags())
while (_tags[i] != nullptr) {
++i;
};
return i;
}
const char* get_tag(size_t index) const {
return _tags[index];
}
return i;
}

/** @copydoc ink::runtime::runner_interface::get_tag() */
const char* get_tag(size_t index) const { return _tags[index]; }

private:
friend class internal::runner_impl;

private:
friend class internal::runner_impl;
uint32_t path() const { return _path; }

uint32_t path() const { return _path; }
choice& setup( internal::basic_stream&, internal::string_table& strings, internal::list_table& lists, int index, uint32_t path, thread_t thread, const char* const* tags );
choice& setup(
internal::basic_stream&, internal::string_table& strings, internal::list_table& lists,
int index, uint32_t path, thread_t thread, const char* const* tags
);

protected:
const char* const* _tags;
const char* _text;
int _index;
uint32_t _path;
thread_t _thread;
};
}
}
protected:
const char* const* _tags; ///< @private
const char* _text; ///< @private
int _index; ///< @private
uint32_t _path; ///< @private
thread_t _thread; ///< @private
};
} // namespace runtime
} // namespace ink
Loading