Fixup links and add description to X Macros article.

This commit is contained in:
Danila Fedorin 2023-10-09 20:33:21 -07:00
parent 88c5daa561
commit dd232cedb5
1 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ title: "My Favorite C++ Pattern: X Macros"
date: 2023-10-09T15:06:11-07:00
draft: true
tags: ["C++", "Chapel", "Compilers"]
description: "In this post, I talk about my favorite C/C++ pattern involving macros."
---
When I first joined the [Chapel](https://github.com/chapel-lang/chapel/) team,
@ -544,7 +545,7 @@ the use of X Macros here.
I used the same `<` and `>` trick to generate the `parentTypeFor` each tag:
{{< githubsnippet "chapel-lang/chapel" "31a296e80cfb69bfc0c79a48d5cc9e8891f54818" "tools/chapel-py/chapel.cpp" "C++" 158 >}}
{{< githubsnippet "chapel-lang/chapel" "31a296e80cfb69bfc0c79a48d5cc9e8891f54818" "tools/chapel-py/chapel.cpp" "C++" 157 >}}
static PyTypeObject* parentTypeFor(chpl::uast::asttags::AstTag tag) {
#define AST_NODE(NAME)
#define AST_LEAF(NAME)
@ -638,7 +639,7 @@ and other CPython-specific things), whereas the `METHOD_PROTOTYPE` is used
to refer to methods that needed explicit implementations. With
this, the method tables are generated as follows:
{{< githubsnippet "chapel-lang/chapel" "31a296e80cfb69bfc0c79a48d5cc9e8891f54818" "tools/chapel-py/method-tables.h" "C++" 548 >}}
{{< githubsnippet "chapel-lang/chapel" "31a296e80cfb69bfc0c79a48d5cc9e8891f54818" "tools/chapel-py/chapel.cpp" "C++" 548 >}}
#define CLASS_BEGIN(TAG) \
template <> \
struct PerNodeInfo<chpl::uast::asttags::TAG> { \