← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Math expression support for pad editor.

 

I patched NumericEvaluator to use the system locale to pick the right
decimal separator character. I have tested it on Windows and Linux, no
issues found. In my opinion it is ready to be merged and could be a nice
bonus for v5. Sincerely, I love this feature, so I might be a bit biased.

Cheers,
Orson

On 11/24/2017 10:35 AM, Maciej Sumiński wrote:
> Thank you Michael, I have just updated the files and pushed to my
> branch. I am about to test the code on Windows and check for decimal
> separator character issues.
> 
> Cheers,
> Orson
> 
> On 11/24/2017 09:04 AM, Michael Geselbracht wrote:
>> Hi,
>> I have added some comments and examples to the code. The archive also
>> contains a simple main() function (in main.cpp) and a Makefile in order to
>> test the parser.
>> The lemon parser generator is required to be installed and the macro
>> "TEST_MODE" in numeric_evaluator.cpp  needs to be set to 1.
>>
>> There is also a bugfix in "newString()". Without it an empty input string
>> results in an invalid output string.
>>
>>  - Michael
>>
>> On Thu, Nov 23, 2017 at 11:01 PM, Michael Geselbracht <
>> mgeselbracht3@xxxxxxxxx> wrote:
>>
>>> Hi Russell,
>>>
>>> the class can handle variables in two ways:
>>> NumericEvaluator eval;
>>> 1. Assignment within expressions: eval.process("x=1; y=5");
>>> 2. Assignment from c++ code: eval.setVar("posx", -3.4);
>>>
>>> So it would be up to the dialog to add a variable to an eval object
>>> within a "focus lost" or "value changed" event.
>>> In case of (2) the variable "posx" could be used in following expressions.
>>> But this would require a shared eval object for all text boxes. Like one
>>> object for each dialog.
>>>
>>>  - Michael
>>>
>>>
>>> On Thu, Nov 23, 2017 at 9:02 PM, Russell Oliver <roliver8143@xxxxxxxxx>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Just a query for Michael: can your parser be modified to include
>>>> references to dialog variables, ie while writing an expression for y axis
>>>> position, using the label posx or something would refer to the value
>>>> currently within that text box?
>>>>
>>>> Kind Regards
>>>> Russell
>>>>
>>>>
>>>> On 24 Nov 2017 06:54, "jp charras" <jp.charras@xxxxxxxxxx> wrote:
>>>>
>>>> Le 23/11/2017 à 20:45, Michael Geselbracht a écrit :
>>>>> Hi,
>>>>> I have replaced the useless file info comments by a GPLv3 header  in
>>>> order to make my "libeval" code
>>>>> license-wise compatible to the Kicad project.
>>>>>
>>>>>  - Michael
>>>>>
>>>>>
>>>>
>>>> Thanks Michael,
>>>>
>>>> Could you add a bit of comments?
>>>> Currently God and you know the meaning of the code.
>>>> One day, only God will know the meaning of this code.
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> --
>>>> Jean-Pierre CHARRAS
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
> 
> 
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 


Attachment: signature.asc
Description: OpenPGP digital signature


Follow ups

References