GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

#include <stdint.h> #define SCOPES_BEGIN_MODULE namespace scopes { #define SCOPES_END_MODULE } #define SCOPES_DEFINE_BITSET_MEMBER(NAME, IDX) \ NAME = 1 << IDX, #define SCOPES_DEFINE_TYPE_BITSET(NAME) \ namespace n_bitset_ ## NAME { \ enum bitset_ ## NAME { \ TYPE_BITSET_ ## NAME(SCOPES_DEFINE_BITSET_MEMBER) \ }; \ } \ typedef n_bitset_ ## NAME::bitset_ ## NAME NAME; #define SCOPES_DEFINE_ENUM_MEMBER(NAME) NAME, #define SCOPES_INHERIT_ENUM_MEMBER(NAME, SUPER) NAME = (int)SUPER::NAME, #define SCOPES_DEFINE_TYPE_ENUM(NAME) \ enum class NAME { \ TYPE_ENUM_ ## NAME(SCOPES_DEFINE_ENUM_MEMBER, SCOPES_INHERIT_ENUM_MEMBER) \ }; #define SCOPES_i32 int32_t #define SCOPES_OPTIONAL_TYPE(T) T::OptionalType #define SCOPES_DEFINE_STRUCT_MEMBER(NAME, TYPE) TYPE NAME; #define SCOPES_DEFINE_STRUCT(NAME) \ struct NAME { \ STRUCT_FIELDS_ ## NAME(SCOPES_DEFINE_STRUCT_MEMBER) \ }; #define SCOPES_BEGIN_ROOT_TYPE(NAME) \ struct NAME { \ typedef NAME ThisType; \ typedef ThisType OptionalType; #define SCOPES_BEGIN_TYPE(NAME, SUPER) \ struct NAME : SUPER { #define SCOPES_BEGIN_SUPERTYPE(NAME, SUPER) \ struct NAME : SUPER { #define SCOPES_TYPE_USES_ENUM(NAME) \ typedef NAME EnumType; #define SCOPES_END_TYPE };

Download link

https://cdn.masto.host/mastodongamedevplace/media_attachments/files/114/262/324/250/109/120/original/4627537e56be3321.png

Notices where this attachment appears

  1. Embed this notice
    Leonard Ritter (lritter@mastodon.gamedev.place)'s status on Friday, 02-May-2025 07:16:29 JST Leonard Ritter Leonard Ritter
    in reply to

    we have generated some code. instead of generating plain C++ expressions i employ the same technique i did with the scopes² prototype: generate macro expressions and let the preprocessor translate.

    left is an impression of what the output looks like (header file). right is the file used to translate it to C definitions. most of it is stubs so the code compiles at all.

    #devlog #scopes

    In conversation about a month ago from gnusocial.jp permalink
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.