You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

3 years ago
  1. # raylib parser
  2. This parser scans [`raylib.h`](../src/raylib.h) to get information about `structs`, `enums` and `functions`.
  3. All data is separated into parts, usually as strings. The following types are used for data:
  4. - `struct FunctionInfo`
  5. - `struct StructInfo`
  6. - `struct EnumInfo`
  7. Check `raylib_parser.c` for details about those structs.
  8. ## Command Line Arguments
  9. The parser can take a few options...
  10. - `--help` Displays help information about the parser
  11. - `--json` Outputs the header information in JSON format
  12. ## Constraints
  13. This parser is specifically designed to work with raylib.h, so, it has some constraints:
  14. - Functions are expected as a single line with the following structure:
  15. ```
  16. <retType> <name>(<paramType[0]> <paramName[0]>, <paramType[1]> <paramName[1]>); <desc>
  17. ```
  18. Be careful with functions broken into several lines, it breaks the process!
  19. - Structures are expected as several lines with the following form:
  20. ```
  21. <desc>
  22. typedef struct <name> {
  23. <fieldType[0]> <fieldName[0]>; <fieldDesc[0]>
  24. <fieldType[1]> <fieldName[1]>; <fieldDesc[1]>
  25. <fieldType[2]> <fieldName[2]>; <fieldDesc[2]>
  26. } <name>;
  27. ```
  28. - Enums are expected as several lines with the following form:
  29. ```
  30. <desc>
  31. typedef enum {
  32. <valueName[0]> = <valueInteger[0]>, <valueDesc[0]>
  33. <valueName[1]>,
  34. <valueName[2]>, <valueDesc[2]>
  35. <valueName[3]> <valueDesc[3]>
  36. } <name>;
  37. ```
  38. _NOTE: For enums, multiple options are supported:_
  39. - If value is not provided, (<valueInteger[i -1]> + 1) is assigned
  40. - Value description can be provided or not
  41. ## Additional notes
  42. This parser _could_ work with other C header files if mentioned constraints are followed.
  43. This parser **does not require `<string.h>` library**, all data is parsed directly from char buffers.
  44. ### LICENSE: zlib/libpng
  45. raylib-parser is licensed under an unmodified zlib/libpng license, which is an OSI-certified, BSD-like license that allows static linking with closed source software. Check [LICENSE](LICENSE) for further details.