EAGLE Central Forums
Where the EAGLE community meets. Sponsored by Stratford Digital.

Home » CadSoft Support Forums » eagle.suggest.eng » Enhancements to user defined functions in ULP
Enhancements to user defined functions in ULP [message #166687] Fri, 19 August 2016 09:19
rachaelp
Messages: 604
Registered: March 2015
Location: UK
Senior Member
Hi All,

EAGLE's built in functions often use arrays as their parameters yet user defined functions cannot. The only way to get an array into a function is to declare the array with global scope so that the function can see it. It works for some use cases but it's ugly and a bit restricted as you can't have a generic function which can be called to work on a number of different arrays, this requires copying local array data into the global array before calling the function which is messy.

Another thing which would be nice would be being able to have recursive function calls. I discovered this lack of capability recently and it ended up causing much more complicated code and initially less functionality than originally intended because recursion was the natural choice for what I was trying to achieve.

Finally, and this is linked with recursion, being able to declare function prototypes before the actual functions code. This way you can have two functions recursively calling each other which currently you can't do for two reasons, a) the lack of recursion and b) one of the functions (the first one declared) doesn't know about the other (as it hasn't been declared at that point) so throws an error.

I can work around all these issues for the most part but I think addressing some or all of them would make a lot of things in ULP a lot more straight forward to implement.

Many thanks,

Rachael
Previous Topic: dlgListView and keyboard
Next Topic: Making parts from datasheet into eagle library
Goto Forum:
  


Current Time: Wed Sep 20 20:13:09 GMT 2017