Child count for plugins

Child count for plugins - Сообщения

#1 Опубликовано: 17.07.2010 20:30:35
Edward Ulle

Edward Ulle

20 сообщений из 182 понравились пользователям.

Группа: 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 Опубликовано: 17.07.2010 21:57:53
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: 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 Опубликовано: 18.07.2010 08:00:52
Edward Ulle

Edward Ulle

20 сообщений из 182 понравились пользователям.

Группа: 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 Опубликовано: 18.07.2010 08:27:01
Andrey Ivashov

Andrey Ivashov

2270 сообщений из 3734 понравились пользователям.

Группа: 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 Опубликовано: 18.07.2010 09:25:25
Edward Ulle

Edward Ulle

20 сообщений из 182 понравились пользователям.

Группа: 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
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений