raysan5 / raylib

A simple and easy-to-use library to enjoy videogames programming
http://www.raylib.com
zlib License
21.81k stars 2.21k forks source link

[parser] Distinguish array and reference for `T *` in `raylib_api.json` #3352

Closed blueloveTH closed 1 year ago

blueloveTH commented 1 year ago

Please, before submitting a new issue verify and check:

Issue description

I am writing raylib bindings for pocketpy via python and I am using raylib_api.json to automatically generate bindings.

However, when parsing a function parameter of T *, there is no information about whether it is an array or a simple reference. For example, if a T * is an array pointer, I will convert it into list[T]. Otherwise, I convert it into a reference of T.

Environment

The latest version.

Code Example

This is an array pointer, with manual confirmation.

    {
      "name": "DrawLineStrip",
      "description": "Draw lines sequence",
      "returnType": "void",
      "params": [
        {
          "type": "Vector2 *",
          "name": "points"
        },

This is not.

    {
      "name": "UpdateCamera",
      "description": "Update camera position for selected mode",
      "returnType": "void",
      "params": [
        {
          "type": "Camera *",
          "name": "camera"
        },
      ]
    },

I suggest using T * for reference pointer and T[] for array pointer.

blueloveTH commented 1 year ago

Nevermind~ I will find another way.