|
6 | 6 | #ifndef PRISM_OPTIONS_H |
7 | 7 | #define PRISM_OPTIONS_H |
8 | 8 |
|
9 | | -#include "prism/defines.h" |
10 | 9 | #include "prism/strings.h" |
11 | 10 |
|
12 | 11 | #include <stdbool.h> |
13 | 12 | #include <stddef.h> |
14 | | -#include <stdint.h> |
15 | 13 |
|
16 | 14 | /** |
17 | 15 | * String literals should be made frozen. |
@@ -58,7 +56,7 @@ static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_BLOCK = 0x4; |
58 | 56 | /** When the scope is fowarding with the ... parameter. */ |
59 | 57 | static const uint8_t PM_OPTIONS_SCOPE_FORWARDING_ALL = 0x8; |
60 | 58 |
|
61 | | -// Forward declaration needed by the callback typedef. |
| 59 | +/* Forward declaration needed by the callback typedef. */ |
62 | 60 | struct pm_options; |
63 | 61 |
|
64 | 62 | /** |
@@ -418,76 +416,4 @@ PRISM_EXPORTED_FUNCTION void pm_options_scope_forwarding_set(pm_options_scope_t |
418 | 416 | */ |
419 | 417 | PRISM_EXPORTED_FUNCTION void pm_options_free(pm_options_t *options); |
420 | 418 |
|
421 | | -/** |
422 | | - * Deserialize an options struct from the given binary string. This is used to |
423 | | - * pass options to the parser from an FFI call so that consumers of the library |
424 | | - * from an FFI perspective don't have to worry about the structure of our |
425 | | - * options structs. Since the source of these calls will be from Ruby |
426 | | - * implementation internals we assume it is from a trusted source. |
427 | | - * |
428 | | - * `data` is assumed to be a valid pointer pointing to well-formed data. The |
429 | | - * layout of this data should be the same every time, and is described below: |
430 | | - * |
431 | | - * | # bytes | field | |
432 | | - * | ------- | -------------------------- | |
433 | | - * | `4` | the length of the filepath | |
434 | | - * | ... | the filepath bytes | |
435 | | - * | `4` | the line number | |
436 | | - * | `4` | the length the encoding | |
437 | | - * | ... | the encoding bytes | |
438 | | - * | `1` | frozen string literal | |
439 | | - * | `1` | -p command line option | |
440 | | - * | `1` | -n command line option | |
441 | | - * | `1` | -l command line option | |
442 | | - * | `1` | -a command line option | |
443 | | - * | `1` | the version | |
444 | | - * | `1` | encoding locked | |
445 | | - * | `1` | main script | |
446 | | - * | `1` | partial script | |
447 | | - * | `1` | freeze | |
448 | | - * | `4` | the number of scopes | |
449 | | - * | ... | the scopes | |
450 | | - * |
451 | | - * The version field is an enum, so it should be one of the following values: |
452 | | - * |
453 | | - * | value | version | |
454 | | - * | ----- | ------------------------- | |
455 | | - * | `0` | use the latest version of prism | |
456 | | - * | `1` | use the version of prism that is vendored in CRuby 3.3.0 | |
457 | | - * | `2` | use the version of prism that is vendored in CRuby 3.4.0 | |
458 | | - * | `3` | use the version of prism that is vendored in CRuby 4.0.0 | |
459 | | - * | `4` | use the version of prism that is vendored in CRuby 4.1.0 | |
460 | | - * |
461 | | - * Each scope is laid out as follows: |
462 | | - * |
463 | | - * | # bytes | field | |
464 | | - * | ------- | -------------------------- | |
465 | | - * | `4` | the number of locals | |
466 | | - * | `1` | the forwarding flags | |
467 | | - * | ... | the locals | |
468 | | - * |
469 | | - * Each local is laid out as follows: |
470 | | - * |
471 | | - * | # bytes | field | |
472 | | - * | ------- | -------------------------- | |
473 | | - * | `4` | the length of the local | |
474 | | - * | ... | the local bytes | |
475 | | - * |
476 | | - * Some additional things to note about this layout: |
477 | | - * |
478 | | - * * The filepath can have a length of 0, in which case we'll consider it an |
479 | | - * empty string. |
480 | | - * * The line number should be 0-indexed. |
481 | | - * * The encoding can have a length of 0, in which case we'll use the default |
482 | | - * encoding (UTF-8). If it's not 0, it should correspond to a name of an |
483 | | - * encoding that can be passed to `Encoding.find` in Ruby. |
484 | | - * * The frozen string literal, encoding locked, main script, and partial script |
485 | | - * fields are booleans, so their values should be either 0 or 1. |
486 | | - * * The number of scopes can be 0. |
487 | | - * |
488 | | - * @param options The options struct to deserialize into. |
489 | | - * @param data The binary string to deserialize from. |
490 | | - */ |
491 | | -void pm_options_read(pm_options_t *options, const char *data); |
492 | | - |
493 | 419 | #endif |
0 commit comments