File: fromobject.alg

package info (click to toggle)
nyquist 3.24%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 58,156 kB
  • sloc: ansic: 74,757; lisp: 18,169; java: 10,942; cpp: 6,688; sh: 175; xml: 58; makefile: 40; python: 15
file content (36 lines) | stat: -rw-r--r-- 1,008 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(FROMOBJ-ALG
  (NAME "fromobject")
  (ARGUMENTS ("time_type" "t0") ("rate_type" "sr") ("LVAL" "src"))
  (SUPPORT-FUNCTIONS "
/* IMPLEMENTATION NOTE:
 * The src argument is an XLisp object that returns either a
 *  FLONUM sample or NIL. The output of fromobj is simply the
 * sequence of the samples. 
 */

#include \"samples.h\"
")

  (SAMPLE-RATE "sr")
  (STATE
        ("boolean" "done" "false")
        ("LVAL" "src" "src"))
  
  (OUTER-LOOP "        if (susp->done) {
            togo = 0; /* indicate termination */
            break;    /* we're done */
        }
")
  (INNER-LOOP "LVAL rslt = xleval(cons(s_send, cons(src,
                                                 consa(s_next))));
            if (floatp(rslt)) {
                output = (sample_type) getflonum(rslt);
            } else {
                done = true;
                /* adjust togo to what it should have been */
                break;
            }")
  (CONSTANT "length" "samples" "array" "src")
  (TERMINATE COMPUTED)
)