Child count for plugins

Child count for plugins - Messages

#1 Posted: 7/17/2010 8:30:35 PM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

To push a function onto the stack in a plugin we need to know how to determine the child count for a built in function.

I'm trying to build a matrix from an external file. I've tried the stack and augment functions but I must be missing the correct child count. It keeps saying "Index was outside the bounds of the array". I think my child count is off.

I've been able to build a simple 1D matrix but 2D is giving my a hard time.

Any suggestions would be helpful.

Thanks.
Ed
#2 Posted: 7/17/2010 9:57:53 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Hello.

Sorry, I did not understand the question. You wrote: "To push a function onto the stack in a plugin we need to know how to determine the child count for a built in function." My questions: 1) onto what stack you want to push a function? 2) for what built-in function you want to know children count?

Anyway, if you want to generate a matrix you need to know mat(..) function pattern used in SMath Studio. It should looks so: mat( [expression], ... , [expression], [numberOfRows], [numberOfColumns] ). For a vector with 3 rows it should be written like mat(10,20,30,3,1) (or 10 20 30 3 1 mat in RPN).

Regards.
#3 Posted: 7/18/2010 8:00:52 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

By stack I mean the answer.Add(...) or answer.AddRange(...) in the plugin example.

I tried to use stack function and augment function to build a matrix.

Like in your example of mat function. To build an m by n matrix the child count is m*n+2. For the built in functions that have ellipses (...) as an argument list which are augment, concat, mat, and stack I'm not sure of the additional children required. Except now I now for mat its two additional children numberOfRows and numberOfColumns.
Ed
#4 Posted: 7/18/2010 8:27:01 AM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

There are three special functions only, that require for additional arguments: mat(..), line(..) and sys(..) - this is because they based on the same logic (f.e. they all have an behavior to increase/decrease number of rows and/or columns by the mouse or stylus). All other functions has no such requirement.

A small tip: you can discover structure of all the math objects by writing it on the SMath Studio page and copying it into the clipbord (you should select the object inside the Math region, but not the region itself). After that just paste clipboard string to the f.e. notepad and you'll see how the function in interest is composed.

Regards.
#5 Posted: 7/18/2010 9:25:25 AM
Edward Ulle

Edward Ulle

20 likes in 182 posts.

Group: Moderator

Andrey,

I know I've been keeping you busy lately. It's just that I'm new to SMath, new to VB Express and not a professonal programmer. Maybe not a very good programmer at all. Although I can by trial and error (lots of errors) figure things out. There are a lot of unknowns about the workings of SMath and plugins. I'll keep trudging along.

I figured out the matrix thing. augment and stack are just mat function in a different form.

Thanks for the tips.
Ed
  • New Posts New Posts
  • No New Posts No New Posts