Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 90 lines (82 sloc) 2.757 kb
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
1 #ifndef _REGMACH_H_
2 #define _REGMACH_H_
3
4 #include <stdio.h>
5 #include <math.h>
92bda63 - start of external Imager API access:
Tony Cook authored
6 #include "imager.h"
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
7
8 enum rm_byte_codes {
9 rbc_add, /* ra + rb -> r*/
10 rbc_subtract, /* ra - rb -> r */
11 rbc_mult, /* ra * rb -> r */
12 rbc_div, /* ra / rb -> r */
13 rbc_mod, /* ra % rb -> r */
14 rbc_pow, /* ra ** rb -> r */
15 rbc_uminus, /* -ra -> r */
16 rbc_multp, /* pa ** rb -> p */
17 rbc_addp, /* pa + pb -> p */
18 rbc_subtractp, /* pa - pb -> p */
19 /* rbcParm, we just preload a register */
20 rbc_sin, /* sin(ra) -> r */
21 rbc_cos, /* cos(ra) -> r */
22 rbc_atan2, /* atan2(ra,rb) -> r */
23 rbc_sqrt, /* sqrt(ra) -> r */
24 rbc_distance, /* distance(rx, ry, rx, ry) -> r */
25 /* getp? codes must be in order */
26 rbc_getp1, /* getp1(ra, rb) -> p */
27 rbc_getp2, /* getp2(ra, rb) -> p */
28 rbc_getp3, /* getp3(ra, rb) -> p */
29 rbc_value, /* value(pa) -> r */
30 rbc_hue, /* hue(pa) -> r */
31 rbc_sat, /* sat(pa) -> r */
32 rbc_hsv, /* hsv(rh, rs, rv) -> p */
33 rbc_red, /* red(pa) -> r */
34 rbc_green, /* green(pa) -> r */
35 rbc_blue, /* blue(pa) -> r */
36 rbc_rgb, /* rgb(rr, rg, rb) -> p */
37 rbc_int, /* int(ra) -> r */
38 rbc_if, /* if(rc, rt, rf) -> r */
39 rbc_ifp, /* if(rc, pt, pf) -> p */
40 rbc_le, /* ra <= rb -> r */
41 rbc_lt, /* ra < rb -> r */
42 rbc_ge, /* ra >= rb -> r */
43 rbc_gt, /* ra > rb -> r */
44 rbc_eq, /* ra == rb -> r -- does approx equal */
45 rbc_ne, /* ra != rb -> r -- does approx equal */
46 rbc_and, /* ra && rb -> r */
47 rbc_or, /* ra || rb -> r */
48 rbc_not, /* !ra -> r */
49 rbc_abs, /* abs(ra) -> r */
50 rbc_ret, /* returns pa */
51 rbc_jump, /* jump to ja */
52 rbc_jumpz, /* jump if ra == 0 to jb */
53 rbc_jumpnz, /* jump if ra != 0 to jb */
54 rbc_set, /* ra -> r */
55 rbc_setp, /* pa -> p*/
3309187 - added the det() function to the transform2() engine.
Tony Cook authored
56 rbc_print, /* print(ra) -> r -- prints, leaves on stack */
e5744e0 - added comment support the postfix transform2() expression
Tony Cook authored
57 rbc_rgba, /* rgba(ra, rb, rc, rd) -> p */
58 rbc_hsva, /* hsva(ra, rb, rc, rd) -> p */
59 rbc_alpha, /* alpha(pa) -> r */
aed9d07 - added log() and exp() functions to transform2()
Tony Cook authored
60 rbc_log, /* log(ra) -> r */
61 rbc_exp, /* exp(ra) -> r */
3309187 - added the det() function to the transform2() engine.
Tony Cook authored
62 rbc_det, /* det(ra, rb, rc, rd) -> r */
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
63 rbc_op_count
64 };
65
66 /* rm_word was originally char, but even for some simpler expressions
67 I was getting close to running out of register numbers.
68 It should also simplify structure alignment issues. (I hope.)
69 */
70 typedef int rm_word;
71 #define RM_WORD_PACK "i"
72
73 struct rm_op {
74 rm_word code; /* op code */
75 rm_word ra; /* first operand */
76 rm_word rb; /* possible second operand */
77 rm_word rc; /* possible third operand */
78 rm_word rd; /* possible fourth operand */
79 rm_word rout; /* output register */
80 };
81
b33c08f hide or rename any symbols that are likely to conflict with other
Tony Cook authored
82 i_color i_rm_run(struct rm_op codes[], size_t code_count,
83 double n_regs[], size_t n_regs_count,
84 i_color c_regs[], size_t c_regs_count,
85 i_img *images[], size_t image_count);
02d1d62 Initial revision
Arnar Mar Hrafnkelsson authored
86
87 /* op_run(fx, sizeof(fx), parms, 2)) */
88
89 #endif /* _REGMACH_H_ */
Something went wrong with that request. Please try again.