Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC Midterm Evaluation: Changing the way the serialize, serialize_into and deserialize functions work #2345

Open
wants to merge 32 commits into
base: AST-Generation
Choose a base branch
from

Conversation

FaresAtef1
Copy link

@FaresAtef1 FaresAtef1 commented Jun 15, 2023

Midterm GSoC Update

Closes #2326.
This pull request contains updates for my Google Summer of Code (GSoC) project at the midterm evaluation stage.

Second PR (Final Evaluation Part1): Implementing (de)serialization routines for generic data types
Third PR (Final Evaluation Part2): Adding support for JSON format

Existing Errors

  • Fixing existing errors.

Updating Functions

  • Updating enigma_internal_sizeof function.
  • Updating serialize_into function.
  • Updating serialize function.
  • Updating deserialize function.
  • Updating resize_buffer_for function.
  • Updating enigma_internal_deserialize function.

Testing Functions (SOG/unit tests)

  • Testing enigma_internal_sizeof function.
  • Testing serialize_into function.
  • Testing serialize function.
  • Testing deserialize function.
  • Testing resize_buffer_for function.
  • Testing enigma_internal_deserialize function.
  • SOG test for game_save_buffer and game_load_buffer

Organization

  • Making detect_size.h file.
  • Better naming for all serialization.h functions.
  • Making a Serialization directory.
  • Making serialization_fwd_decl.h file.

To Be Done Before Merging

  • Resolve multiple definitions of the function Size gist (To have Cleaner Code)
  • Replace has_byte_size_free_function_v2
  • Replace has_serialize_into_fn_free_function_v2
  • Replace has_serialize_free_function_v2
  • Replace has_deserialize_free_function_v2
  • Replace has_resize_buffer_for_free_function_v2
  • Replace has_enigma_internal_deserialize_free_function_v2

Newly Implemented Features

  • HAS_FREE_FUNCTION macro in detect_serialization.h, which is used to determine whether there exists a free function that can be called with a particular signature.
    HAS_FREE_FUNCTION(NAMESPACE, NAME, PARAMETERS...)

Adding new types for the bytes format

Create a new file in the Types_Impl_Bytes directory for your new type, and then include this file in the bytes_types_serialization_includes.h file.

Every new data type in our system should implement the following functions

is_new_type is a type trait that should be implemented in type_traits.h.

  • byte_size
    template <typename T>
    matches_t<T, std::size_t, is_new_type> inline byte_size(const T& value) {
        std::size_t totalSize = // ....
        return totalSize;
    }
  • internal_serialize_into_fn
    template <typename T>
    matches_t<T, void, is_new_type> inline internal_serialize_into_fn(std::byte *iter, T &&value) {
        // ....
    }
  • internal_serialize_fn
    template <typename T>
    matches_t<T, std::vector<std::byte>, is_new_type> inline internal_serialize_fn(T &&value) {
        std::vector<std::byte> result;
        // ....
        return result;
    }
  • internal_deserialize_fn
    template <typename T>
    matches_t<T, T, is_new_type> inline internal_deserialize_fn(std::byte *iter) {
        // ....
    }
  • internal_resize_buffer_for_fn
    template <typename T>
    matches_t<T, void, is_new_type> inline internal_resize_buffer_for_fn(std::vector<std::byte> &buffer, T &&value) {
        // ....
    }
  • enigma_internal_deserialize_fn
    template <typename T>
    matches_t<T, void, is_new_type> inline void enigma_internal_deserialize_fn(T &value, std::byte *iter, std::size_t &len) {
        value = ....
        len += ....
    }

Sample game that is compatible with the AST_Generation branch

Balloon_Pop (It is the same game in the ENIGMA site but with modified scripts).

Ongoing Work

What's Next

GSoC Final Evaluation: Implementing (de)serialization routines for generic data types

.vscode/c_cpp_properties.json Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
Compilers/Linux/gcc.ey Outdated Show resolved Hide resolved
ENIGMAsystem/SHELL/Universal_System/detect_serialization.h Outdated Show resolved Hide resolved
@FaresAtef1 FaresAtef1 marked this pull request as ready for review July 15, 2023 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants