Skip to content

rust: Port util/cf-lexer.c (cf preprocessor) to obs-util #1499

Open

Description

@vpacher

Unit

Port libobs/util/cf-lexer.c.h (the former cf-lexer.c) to obs-util: the cf preprocessor (cf_preprocessor_init, cf_preprocessor_free, cf_preprocess, cf_preprocessor_add_def, cf_preprocessor_remove_def) and its internal steps (#include, #define with and without parameters, #undef, #ifdef/#ifndef/#else/#endif, define expansion).

Phase and position

Phase 3, lexer/parser step 3, deferred follow-up tracked by #43. After this, the libobs.util-cf group is Rust: the tokenizer is already in obs-util::cf_tokenizer, and cf-parser.c in obs-util::cf_parser (#1466). It also opens graphics/shader-parser.c and the effect parser for a later port.

Dependencies and existing tests

Uses obs_util::cf_tokenizer, obs_util::lexer (strref, base_token), dstr, darray layout and os_quick_read_utf8_file (Rust since #1444). Callers: graphics/effect-parser.c, graphics/shader-parser.c, and callback/decl (which does not run the preprocessor in the Rust port).

test/cmocka/test_cf_lexer.c covers #define, #ifdef/#else, preprocessor errors and add/remove of defines. Not covered yet: #include (local and system include, include directories, missing file, nested include), function-like macros with parameters, #undef, #ifndef, nested conditionals and recursive define expansion. A C-only characterization PR for these comes first.

Notes

Preserve public headers, exported signatures, token and preprocessor layouts and existing C tests. The port follows docs/rust-port/testing-policy.md: RED then GREEN, Tier 1 mirrors, layout checks, differential parity against the C oracle on arbitrary input (including invalid UTF-8 and unterminated directives), file tests in their own temp directories, unchanged Tier 2 OFF/ON. No intended behavior changes; any difference is listed in the parity test header and rust/README.md.

Current authorized work is the claim and the characterization PR; the Rust implementation follows separately.

Activity

  1. vpacher commented on Oct 20, 2026

    @vpacher
    MemberAuthor

    Claiming: #1499

    Plan: one C-only characterization PR first (the gaps listed above, in test/cmocka/test_cf_lexer.c or a new test_cf_preprocessor.c), then the port PR (RED on a todo!() core, then GREEN, with differential parity against the oracle).

  2. added
    claimed
    on Oct 20, 2026
  3. removed
    claimed
    on Oct 22, 2026
  4. nathan-v commented on Oct 22, 2026

    @nathan-v
    Contributor

    Claiming: #1499 — cf preprocessor Rust port. Taking over stale claim from @vpacher; C characterization #1502 is merged.

    1. Mirror the existing C assertions in the existing Rust test category against safe-core stubs, record RED, and open a draft PR targeting master in this session.
    2. Implement the safe core and C ABI adapter, real-header layout checks, and differential C-oracle coverage; preserve existing C tests and public headers.
    3. Run local lint and Rust/Tier 2 OFF/ON CI before pushing GREEN, then wait for current-head PR CI to pass before marking ready for review.
  5. added
    claimed
    on Oct 22, 2026
  6. vpacher commented on Oct 22, 2026

    @vpacher
    MemberAuthor

    @nathan-v Please hold off on this claim for now and check with @zackees first. The #1499 port is tied to related work that is still being coordinated with Zach, and a port branch already exists. Starting in parallel would likely duplicate or conflict with it. Sorry the claim went stale; I should have refreshed it.

  7. nathan-v commented on Oct 22, 2026

    @nathan-v
    Contributor

    Just saw your note. I'll drop the PR. No worries!

  8. nathan-v commented on Oct 22, 2026

    @nathan-v
    Contributor

    Releasing #1499 — handing it to @vpacher. The original work remains active; the stale claim was a missed refresh. Duplicate PR #1807 is closed.

  9. vpacher commented on Oct 24, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on non-public work that is coordinated with a maintainer.

  10. added
    claim-blocked
    on Oct 24, 2026
  11. moved this from In progress to Blocked in obs-rust Multiviewon Oct 25, 2026
  12. 17 remaining items

  13. vpacher commented on Nov 8, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on non-public work that is coordinated with a maintainer.

  14. removed
    claim-blocked
    on Nov 15, 2026
  15. vpacher commented on Nov 16, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on non-public work that is coordinated with a maintainer.

  16. github-actions commented on Nov 16, 2026

    @github-actions

    Claim bot: @vpacher, nothing is claimed here, so there is no claim to mark blocked.

  17. vpacher commented on Nov 16, 2026

    @vpacher
    MemberAuthor

    Claiming: #1499

  18. vpacher commented on Nov 16, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on non-public work that is coordinated with a maintainer.

  19. added
    claim-blocked
    on Nov 16, 2026
  20. vpacher commented on Nov 23, 2026

    @vpacher
    MemberAuthor

    Blocked: waiting on non-public work that is coordinated with a maintainer.

  21. removed
    claim-blocked
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions