Giter Club home page Giter Club logo

Comments (3)

NikZak avatar NikZak commented on July 1, 2024

Here is the minimal example

{
char* temp = Fr_element2str(&signalValues[mySignalStart + 1]);
printf("%s",temp);
delete [] temp;
}

and this sed from the script removes the }

sed -e 's/FrElement\* signalValues/rust::Vec<FrElement> \&signalValues/g' \
    -e 's/std::string/rust::string/g' \
    -e 's/ctx->templateInsId2IOSignalInfo/IOSignalInfoAccessor(ctx)/g' \
    -e 's/u32\* mySubcomponents/rust::Vec<u32> mySubcomponents/g' \
    -e 's/FrElement\* circuitConstants/rust::Vec<FrElement> \&circuitConstants/g' \
    -e 's/rust::string\* listOfTemplateMessages/rust::Vec<rust::string> \&listOfTemplateMessages/g' \
    -e 's/FrElement expaux\[\([0-9]*\)\];/rust::Vec<FrElement> expaux = create_vec(\1);/g' \
    -e 's/FrElement lvar\[\([0-9]*\)\];/rust::Vec<FrElement> lvar = create_vec(\1);/g' \
    -e 's/FrElement lvarcall\[\([0-9]*\)\];/rust::Vec<FrElement> lvarcall = create_vec(\1);/g' \
    -e 's/PFrElement aux_dest/FrElement \*aux_dest/g' \
    -e 's/subcomponents = new uint\[\([0-9]*\)\];/subcomponents = create_vec_u32(\1);/g' \
    -e '/trace/d' \
    -e 's/\(ctx,\)\(lvarcall,\)\(myId,\)/\1\&\2\3/g' \
    -e '/^#include/d' \
    -e '/assert/d' \
    -e '/mySubcomponentsParallel/d' \
    -e 's/FrElement lvarcall\[\([0-9]*\)\];/rust::Vec<FrElement> lvarcall = create_vec(\1);/g' \
    -e 's/,FrElement\* lvar,/,rust::Vec<FrElement>\& lvar,/g' \
    -e 's/ctx,\&lvarcall,myId,/ctx,lvarcall,myId,/g' \
    -e '/delete/{N;d;}' -e 'N;/\ndelete/!P;D' \
    -e '/^#include/d'

from circom-witness-rs.

NikZak avatar NikZak commented on July 1, 2024

The issue is with the sed command /delete/{N;d;} which is designed to match a line containing delete, read in the next line (with N), and then delete both lines (with d). However, this is too aggressive, it does not work for my case.

Can we modify the sed command like this?

sed -e '/delete \[\] [^;]*;/d'

This new pattern matches lines that contain delete [] followed by any number of characters that are not a semicolon (indicating the end of the statement) and then a semicolon, thus ensuring that only the line with the delete statement is removed. I checked and it supposedly works as intended

from circom-witness-rs.

NikZak avatar NikZak commented on July 1, 2024

this one is correct

-e '/delete \[\][^;]*;/d'

from circom-witness-rs.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.