Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sch2pcb: Rewrite the function pkg-line->element() in Scheme #1063

Merged
merged 66 commits into from
Jun 26, 2024

Conversation

vzh
Copy link
Member

@vzh vzh commented May 15, 2024

The function pkg-line->element() has been wholly rewritten in
Scheme. The following changes have been made:

  • A new module, (sch2pcb element) has been added. The module
    currently contains two functions for creating the structure
    PcbElement from a text string in Scheme,
    pkg-line->element(), and its helper, free-element, that
    allows for freeing the C foreign instance memory. The former
    function has been significantly refactored in Scheme.
  • Scheme accessors for some fields of the structure PcbElement
    fields have been added and moved into the module.
  • Several UTS tests have been added for the above functions in
    order to cover their base functionality and some corner cases.
  • Unlike in the previous C code, there is no restriction to the
    maximal number of "PKG_" line arguments in Scheme.
  • The current code seems to maintain the "bug-for-bug"
    compatibility with the previous C one though can obviously have
    some new bugs despite of better testing in UTS :-) It will be
    refactored further more than once, I think.

vzh added 30 commits June 20, 2024 20:46
The module will contain procedures related to PcbElement
processing.  Currently it contains an only procedure,
pkg-line->element().
This is a temporary function that will be used in Scheme code
instead of the foreign function pcb_element_free().
…ht parens

The tests contain either several right parens or a paren and some
text after it.  The current C code drops anything starting with
the first right paren found.
The pointer argument of the pkg-line->element() function has been
replaced with a Scheme string one to simplify using it in
Scheme.  The tests have been amended accordingly.
This is needed to re-use the found paren index in further
computations.
vzh added 26 commits June 20, 2024 20:46
Unlike in the previous C code, there is no restriction to the
maximal number of arguments in Scheme.
…field

This is a verbatim translation of the C code into Scheme.  In this
case, the 4th argument in the processed "PKG_" string is
considered the part of the 3rd one, the value.
@vzh vzh force-pushed the sch2pcb-pkg-line-to-element branch from 37eef4b to d2cf07a Compare June 20, 2024 17:46
@vzh vzh merged commit d2cf07a into lepton-eda:master Jun 26, 2024
1 check passed
@vzh vzh added this to the 1.9.19 milestone Jun 26, 2024
@vzh vzh deleted the sch2pcb-pkg-line-to-element branch June 26, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant