| @@ -677,6 +677,50 @@ int sk_param_out(sk_core *core, · 676 unmodified lines |
| 677 | =sk_param_out= will take an output cable of a node | 677 | =sk_param_out= will take an output cable of a node |
| 678 | (referenced by index), and push it onto the sndkit stack. | 678 | (referenced by index), and push it onto the sndkit stack. |
| 679 | It will also push the cable's buffer onto the stack. | 679 | It will also push the cable's buffer onto the stack. |
| | 680 | ** Pushing/Popping Generic Pointers |
| | 681 | #+NAME: funcdefs |
| | 682 | #+BEGIN_SRC c |
| | 683 | int sk_core_generic_push(sk_core *core, void *ptr); |
| | 684 | int sk_core_generic_pop(sk_core *core, void **ptr); |
| | 685 | #+END_SRC |
| | 686 | |
| | 687 | #+NAME: funcs |
| | 688 | #+BEGIN_SRC c |
| | 689 | int sk_core_generic_push(sk_core *core, void *ptr) |
| | 690 | { |
| | 691 | int rc; |
| | 692 | sk_stacklet *s; |
| | 693 | |
| | 694 | rc = sk_stack_push(&core->stack, &s); |
| | 695 | SK_ERROR_CHECK(rc); |
| | 696 | |
| | 697 | s->type = SK_TYPE_GENERIC; |
| | 698 | s->ptr = ptr; |
| | 699 | |
| | 700 | return rc; |
| | 701 | } |
| | 702 | #+END_SRC |
| | 703 | |
| | 704 | #+NAME: funcs |
| | 705 | #+BEGIN_SRC c |
| | 706 | int sk_core_generic_pop(sk_core *core, void **ptr) |
| | 707 | { |
| | 708 | int rc; |
| | 709 | sk_stacklet *s; |
| | 710 | |
| | 711 | rc = sk_stack_pop(&core->stack, &s); |
| | 712 | |
| | 713 | SK_ERROR_CHECK(rc); |
| | 714 | |
| | 715 | if (s->type != SK_TYPE_GENERIC) { |
| | 716 | return 1; |
| | 717 | } |
| | 718 | |
| | 719 | if (ptr != NULL) *ptr = s->ptr; |
| | 720 | |
| | 721 | return rc; |
| | 722 | } |
| | 723 | #+END_SRC |
| 680 | * Registers | 724 | * Registers |
| 681 | A register interface is used alongside the stack | 725 | A register interface is used alongside the stack |
| 682 | interface to store and retrieve data. A value stored | 726 | interface to store and retrieve data. A value stored |