/* builtins.h generated by make from xoscope.css and xoscope.glade.*/
/* DO NOT EDIT THIS FILE! */
char * xoscope_css =
"/* xoscope.css generated by make from xoscope.css.in and xoscope.css.m4.*/ "
"/* DO NOT EDIT THIS FILE! */ "
"*#top_grid {background-image: none; background-color: black; } "
"*#display_box {background-image: none; background-color: black; } "
"*#bottom_grid {background-image: none; background-color: black; } "
"*#databox {background-image: none; background-color: black; } "
"*#databox_aspectframe {color: red; } "
"*#databox_hscrollbar {color: white; background-image: none; background-color: #a00000; } "
"*#databox_hscrollbar:hover {color: white; background-image: none; background-color: red; } "
"*#databox_hscrollbar:active {color: white; background-image: none; background-color: #600000; } "
"button.toggle {background-image: none; background-color: black; } "
"button.toggle:active {background-image: none; background-color: grey; } "
"button.toggle:checked {background-image: none; background-color: #25251b; } "
"*#top_grid label {font-family: Liberation Sans; font-size: 16px; } "
"*#bottom_grid label {font-family: Liberation Sans; font-size: 16px; } "
"*#top_grid label {color: white; } "
"*#display_box label {color: white; } "
"*#bottom_grid label {color: white; } "
"label#sample_rate_label {color: lightgreen; } "
"label#samples_per_frame_label {color: lightgreen; } "
"label#period_label {color: lightgreen; } "
"label#min_max_label {color: lightgreen; } "
"label#Ch1_label {color: lightgreen; } "
"label#Ch1_scale_label {color: lightgreen; } "
"label#Ch1_position_label {color: lightgreen; } "
"label#Ch1_source_label {color: lightgreen; } "
"label#Ch2_label {color: cyan; } "
"label#Ch2_scale_label {color: cyan; } "
"label#Ch2_position_label {color: cyan; } "
"label#Ch2_source_label {color: cyan; } "
"label#Ch3_label {color: yellow; } "
"label#Ch3_scale_label {color: yellow; } "
"label#Ch3_position_label {color: yellow; } "
"label#Ch3_source_label {color: yellow; } "
"label#Ch4_label {color: orange; } "
"label#Ch4_scale_label {color: orange; } "
"label#Ch4_position_label {color: orange; } "
"label#Ch4_source_label {color: orange; } "
"label#Ch5_label {color: violet; } "
"label#Ch5_scale_label {color: violet; } "
"label#Ch5_position_label {color: violet; } "
"label#Ch5_source_label {color: violet; } "
"label#Ch6_label {color: #6688ff; } "
"label#Ch6_scale_label {color: #6688ff; } "
"label#Ch6_position_label {color: #6688ff; } "
"label#Ch6_source_label {color: #6688ff; } "
"label#Ch7_label {color: red; } "
"label#Ch7_scale_label {color: red; } "
"label#Ch7_position_label {color: red; } "
"label#Ch7_source_label {color: red; } "
"label#Ch8_label {color: white; } "
"label#Ch8_scale_label {color: white; } "
"label#Ch8_position_label {color: white; } "
"label#Ch8_source_label {color: white; } "
"label#tab_help_label {color: lightgreen; } "
"label#scale_help_label {color: lightgreen; } "
"label#position_help_label {color: lightgreen; } "
"label#signal_help_label {color: lightgreen; } "
"label#memory_help_label {color: lightgreen; } "
"label#store_help_label {color: lightgreen; } "
"label#recall_help_label {color: lightgreen; } "
"label#escape_key_label {color: violet; } "
"label#enter_key_label {color: violet; } "
"label#at_key_label {color: violet; } "
"label#comma_key_label {color: violet; } "
"label#pound_key_label {color: violet; } "
"label#dash_key_label {color: violet; } "
"label#plus_key_label {color: violet; } "
"label#period_key_label {color: violet; } "
"label#ampersand_key_label {color: violet; } "
"label#asterisk_key_label {color: violet; } "
"label#exclaim_key_label {color: violet; } "
"label#space_key_label {color: violet; } "
"label#tab_key_label {color: violet; } "
"label#left_brace_key_label {color: violet; } "
"label#right_brace_key_label {color: violet; } "
"label#left_bracket_key_label {color: violet; } "
"label#right_bracket_key_label {color: violet; } "
"label#caret_key_label {color: violet; } "
"label#9_key_label {color: violet; } "
"label#0_key_label {color: violet; } "
"label#left_paren_key_label {color: violet; } "
"label#right_paren_key_label {color: violet; } "
"label#registers_left_key_label {color: violet; } "
"label#registers_right_key_label {color: violet; } "
"label#signal_key_label {color: violet; } "
"label#store_key_label {color: violet; } "
"label#recall_key_label {color: violet; } "
;
char * gladestring =
""
""
""
" "
" "
" "
" "
" "
" 100"
" 1"
" 10"
" "
" "
" True"
" False"
" Xoscope"
" xoscope"
" "
" "
" "
" "
" "
" True"
" False"
" vertical"
" "
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" "
" True"
" False"
" start"
" "
" "
" True"
" False"
" end"
" start"
" 0"
" (Esc)"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" Quit"
" "
" "
" 1"
" 0"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" xoscope"
" "
" "
" 2"
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" period"
" "
" "
" 4"
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" Refresh"
" "
" "
" 10"
" 0"
" "
" "
" "
" "
" True"
" False"
" end"
" start"
" (@)"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" Load"
" "
" "
" 1"
" 1"
" "
" "
" "
" "
" True"
" False"
" end"
" (#)"
" 0"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Save"
" "
" "
" 1"
" 2"
" "
" "
" "
" "
" True"
" False"
" end"
" (&)"
" 0"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" source"
" 2"
" "
" "
" 1"
" 3"
" "
" "
" "
" "
" True"
" False"
" start"
" (*)"
" "
" "
" 2"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" (!)"
" 1"
" "
" "
" 2"
" 4"
" "
" "
" "
" "
" True"
" False"
" line style"
" "
" "
" 3"
" 4"
" 2"
" "
" "
" "
" "
" True"
" False"
" scroll mode"
" "
" "
" 5"
" 4"
" 2"
" "
" "
" "
" "
" True"
" False"
" start"
" ver: x.x"
" "
" "
" 2"
" 1"
" 2"
" "
" "
" "
" "
" True"
" False"
" start"
" min-max"
" "
" "
" 4"
" 1"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" start"
" True"
" 2"
" (,)"
" "
" "
" 9"
" 1"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" Graticule"
" "
" "
" 10"
" 1"
" "
" "
" "
" "
" True"
" False"
" end"
" 2"
" (.)"
" "
" "
" 9"
" 2"
" "
" "
" "
" "
" True"
" False"
" In Front"
" "
" "
" 10"
" 2"
" "
" "
" "
" "
" True"
" False"
" end"
" 2"
" (?)"
" "
" "
" 9"
" 3"
" "
" "
" "
" "
" True"
" False"
" Help"
" "
" "
" 10"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" 0"
" (space)"
" "
" "
" 8"
" 4"
" 2"
" "
" "
" "
" "
" True"
" False"
" run-stop"
" "
" "
" 10"
" 4"
" "
" "
" "
" "
" True"
" False"
" end"
" start"
" (Enter)"
" right"
" "
" "
" 8"
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" trigger"
" "
" "
" 5"
" 2"
" "
" "
" "
" "
" True"
" False"
" end"
" 0"
" (_) (-)"
" "
" "
" 4"
" 2"
" "
" "
" "
" "
" True"
" False"
" start"
" (=) (+)"
" "
" "
" 6"
" 2"
" "
" "
" "
" "
" True"
" False"
" trigger source"
" "
" "
" 4"
" 3"
" 3"
" "
" "
" "
" "
" True"
" False"
" opt1"
" "
" "
" 3"
" 3"
" "
" "
" "
" "
" True"
" False"
" True"
" fps"
" 0"
" "
" "
" 7"
" 3"
" 2"
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" "
" True"
" False"
" end"
" "
" "
" True"
" False"
" end"
" (Tab)"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" end"
" ({)"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" end"
" ([)"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" end"
" (^)"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" Visible"
" "
" "
" 1"
" 0"
" "
" "
" "
" "
" True"
" False"
" Scale"
" True"
" "
" "
" 1"
" 1"
" "
" "
" "
" "
" True"
" False"
" Pos."
" True"
" "
" "
" 1"
" 2"
" "
" "
" "
" "
" True"
" False"
" opt2"
" "
" "
" 1"
" 3"
" "
" "
" "
" "
" True"
" False"
" start"
" (})"
" "
" "
" 2"
" 1"
" "
" "
" "
" "
" True"
" False"
" start"
" (])"
" "
" "
" 2"
" 2"
" "
" "
" "
" "
" True"
" False"
" 5"
" True"
" status 0"
" "
" "
" 3"
" 0"
" "
" "
" "
" "
" True"
" False"
" status 2"
" "
" "
" 3"
" 1"
" "
" "
" "
" "
" True"
" False"
" status 4"
" "
" "
" 3"
" 2"
" "
" "
" "
" "
" True"
" False"
" status 6"
" "
" "
" 3"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" True"
" (9)"
" "
" "
" 4"
" 0"
" "
" "
" "
" "
" True"
" False"
" end"
" (()"
" "
" "
" 4"
" 1"
" "
" "
" "
" "
" True"
" False"
" samples per frame"
" "
" "
" 4"
" 2"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" ("
" "
" "
" 4"
" 3"
" "
" "
" "
" "
" True"
" False"
" True"
" timebase"
" "
" "
" 5"
" 0"
" "
" "
" "
" "
" True"
" False"
" sample rate"
" "
" "
" 5"
" 1"
" "
" "
" "
" "
" True"
" False"
" start"
" True"
" (0)"
" "
" "
" 6"
" 0"
" "
" "
" "
" "
" True"
" False"
" start"
" ())"
" "
" "
" 6"
" 1"
" "
" "
" "
" "
" True"
" False"
" True"
" status 1"
" right"
" "
" "
" 7"
" 0"
" "
" "
" "
" "
" True"
" False"
" status 3"
" right"
" "
" "
" 7"
" 1"
" "
" "
" "
" "
" True"
" False"
" status 5"
" right"
" "
" "
" 7"
" 2"
" "
" "
" "
" "
" True"
" False"
" status 7"
" right"
" "
" "
" 7"
" 3"
" "
" "
" "
" "
" True"
" False"
" registers"
" "
" "
" 5"
" 3"
" "
" "
" "
" "
" True"
" False"
" start"
" )"
" "
" "
" 6"
" 3"
" "
" "
" "
" "
" True"
" False"
" end"
" (a-b)"
" "
" "
" 9"
" 0"
" "
" "
" "
" "
" True"
" False"
" Signal"
" "
" "
" 10"
" 0"
" "
" "
" "
" "
" True"
" False"
" Memory"
" "
" "
" 10"
" 1"
" "
" "
" "
" "
" True"
" False"
" end"
" (A-W)"
" "
" "
" 9"
" 2"
" "
" "
" "
" "
" True"
" False"
" Store"
" "
" "
" 10"
" 2"
" "
" "
" "
" "
" True"
" False"
" end"
" (a-z)"
" "
" "
" 9"
" 3"
" "
" "
" "
" "
" True"
" False"
" Recall"
" "
" "
" 10"
" 3"
" "
" "
" "
" "
" True"
" False"
" "
" "
" 8"
" 0"
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" True"
" True"
" "
" "
" "
" True"
" False"
" vertical"
" "
" "
" True"
" False"
" 1"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" start"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Ch1_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" Ch1_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch1_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Channel 1"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" start"
" True"
" 2"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Ch2_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" Ch2_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch2_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Channel 2"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" start"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Ch3_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" Ch3_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch3_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Channel 3"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" start"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Channel 4"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" Ch4_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Ch4_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch4_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" False"
" True"
" 0"
" "
" "
" "
" "
" "
" True"
" False"
" 5"
" 5"
" True"
" True"
" "
" "
" True"
" False"
" databox_hadj"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" 0.5"
" False"
" "
" "
" 300"
" 300"
" True"
" True"
" False"
" True"
" True"
" False"
" False"
" databox_hadj"
" "
" "
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" False"
" True"
" 1"
" "
" "
" "
" "
" "
" True"
" False"
" vertical"
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" end"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Channel 5"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" Ch5_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Ch5_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch5_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" end"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Channel 8"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" Ch8_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Ch8_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch8_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" end"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Channel 7"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" Ch7_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Ch7_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch7_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" 0"
" 1"
" none"
" "
" "
" True"
" True"
" True"
" end"
" True"
" 3"
" "
" "
" "
" "
" True"
" False"
" vertical"
" True"
" "
" "
" True"
" False"
" Channel 6"
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" Ch6_scale"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" True"
" False"
" Ch6_position"
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" True"
" False"
" Ch6_source"
" "
" "
" 0"
" 3"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" False"
" "
" "
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" False"
" True"
" 2"
" "
" "
" "
" "
" 0"
" 2"
" "
" "
" "
" "
" "
" "
" True"
" "
" "
" "
" "
" "
" "
" "
" "
" True"
" "
" "
" "
" "
" "
" "
" "
" "
" False"
" Xoscope - external command"
" True"
" xoscope"
" dialog"
" "
" "
" "
" True"
" False"
" True"
" True"
" vertical"
" 2"
" "
" "
" True"
" False"
" end"
" "
" "
" Run "
" True"
" True"
" True"
" True"
" "
" "
" True"
" True"
" 0"
" "
" "
" "
" "
" Cancel "
" True"
" True"
" True"
" "
" "
" True"
" True"
" 1"
" "
" "
" "
" "
" False"
" False"
" 0"
" "
" "
" "
" "
" "
" True"
" False"
" vertical"
" 2"
" "
" "
" True"
" False"
" start"
" 10"
" True"
" True"
" "
"External command and arguments:"
""
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" True"
" 10"
" 10"
" True"
" True"
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" False"
" True"
" 1"
" "
" "
" "
" "
" "
" extcom_run"
" extcom_cancel"
" "
" "
" "
" "
" False"
" True"
" xoscope"
" dialog"
" north-east"
" True"
" "
" "
" "
" "
" True"
" False"
" 2"
" 2"
" 2"
" 2"
" False"
" False"
" vertical"
" 2"
" "
" "
" 650"
" 450"
" True"
" True"
" True"
" True"
" in"
" "
" "
" True"
" True"
" True"
" True"
" False"
" False"
" help_buffer"
" True"
" "
" "
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" close"
" True"
" True"
" True"
" True"
" "
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" "
" "
" False"
" Xoscope - perl function"
" True"
" dialog"
" "
" "
" "
" False"
" vertical"
" 2"
" "
" "
" False"
" end"
" "
" "
" Run "
" True"
" True"
" True"
" True"
" "
" "
" True"
" True"
" 0"
" "
" "
" "
" "
" Help "
" True"
" True"
" True"
" "
" "
" True"
" True"
" 1"
" "
" "
" "
" "
" Cancel "
" True"
" True"
" True"
" "
" "
" True"
" True"
" 2"
" "
" "
" "
" "
" False"
" False"
" 0"
" "
" "
" "
" "
" "
" True"
" False"
" vertical"
" 2"
" "
" "
" True"
" False"
" start"
" True"
" True"
" "
"Perl function:"
""
" "
" "
" 0"
" 0"
" "
" "
" "
" "
" True"
" False"
" True"
" "
" - $ch1 + $ch2
"
" - abs($ch1)
"
" - $ch1 - $ch1[0]
"
" - $ch1 > $ch2 ? $ch1 : $ch2
"
" - $t / (44100/2/250) % 2 ? 64 : -64
"
" - sin($t * $pi / (44100/2/250)) * 64
"
" - cos($t * $pi / (44100/2/250)) * 64
"
" "
" "
" "
" False"
" $ch1 + $ch2"
" True"
" "
" "
" "
" "
" 0"
" 1"
" "
" "
" "
" "
" False"
" True"
" 1"
" "
" "
" "
" "
" "
" perl_run"
" perl_help"
" perl_cancel"
" "
" "
""
;
char * operl_program =
"\n"
"# Copyright (C) 1996 - 2001 Tim Witham \n"
"# Copyright (C) 2015 Brent Baccala \n"
"\n"
"# (see the files README and COPYING for more details)\n"
"\n"
"# xoscope external math filter command example in perl\n"
"\n"
"# !!! Please see bottom of this file for instructions and examples !!!\n"
"\n"
"$| = 1; # unbuffer stdout\n"
"$0 =~ s!.*/!!; # reduce to program basename\n"
"$func = $ENV{FUNC}; # get function to run from environment\n"
"$samples = $ARGV[1] || 640; # assume 640 total samples per screen\n"
"$func =~ s/\\#.*$//; # toss comments\n"
"$func =~ s/^\\s*(\\$0\\s*=)?\\s*//; # and assumed leading/trailing stuff, if any\n"
"$func =~ s/\\s*;*\\s*$//;\n"
"die \"usage: $0 'perl math function of \\$t, \\$ch1 and \\$ch2' [sample length]\\n\"\n"
" unless $func; # oops\n"
"$func = \"\\$out = $func;\"; # '$out=' and ';' are implied around function\n"
"\n"
"open(IN, '<&3') # open non-standard input for reading\n"
" || die \"$0: Can't read input: $!\\n\";\n"
"open(OUT, '>-') # and stdout for writing\n"
" || die \"$0: Can't write stdout: $!\\n\";\n"
"\n"
"$pi = 3.14159265359; # define pi for user's convenience\n"
"$t = 0; # sample position number (time)\n"
"for (1..$samples) { # initialize sample memory \"shift registers\"\n"
" push(@ch1, 0); # channel 1 (left)\n"
" push(@ch2, 0); # channel 2 (right)\n"
" push(@out, 0); # output back to software channel\n"
"}\n"
"\n"
"# For efficiency, we now dynamically build a while loop around the\n"
"# user's function then evaluate (compile and run) it once.\n"
"\n"
"# begin of loop: how to read the samples (two shorts) from stdin:\n"
"$begin = '\n"
"while(1) {\n"
" sysread(IN, $buff, 2) || exit;\n"
" $ch1 = unpack(\\'s\\', $buff);\n"
" sysread(IN, $buff, 2) || exit;\n"
" $ch2 = unpack(\\'s\\', $buff);\n"
"\n"
"';\n"
"\n"
"# end: how to increment time, remember the samples, and write result to stdout:\n"
"$end = '\n"
"\n"
" $t = 0 if ++$t >= $samples;';\n"
"\n"
"# sample history is expensive, so we only remember those the function needs:\n"
"$end .= '\n"
" pop(@ch1); unshift(@ch1, $ch1);' if $func =~ /\\$ch1\\[/;\n"
"$end .= '\n"
" pop(@ch2); unshift(@ch2, $ch2);' if $func =~ /\\$ch2\\[/;\n"
"$end .= '\n"
" pop(@out); unshift(@out, $out);' if $func =~ /\\$out\\[/;\n"
"\n"
"$end .= '\n"
" syswrite(OUT, pack(\\'s\\', $out), 2) || exit;\n"
"}\n"
"';\n"
"\n"
"# now put the loop around the user's function\n"
"eval $begin.$func.$end; # and finally run the loop forever\n"
"warn \"$@\\n\" if $@; # show any user syntax errors on stderr\n"
"\n"
"__END__\n"
"{}\n"
;
char * operl_help_text =
"\n"
" Arbitrary signal math with Perl functions\n"
"\n"
"Variables available for your function:\n"
"\n"
"$ch1 channel 1 input\n"
"$ch2 channel 2 input\n"
"$out output: '$out = ' is assumed before your function; don't use $out\n"
"@ch1 channel 1 \"memory\", $ch1[0] = previous sample, $ch1[1] = one before that\n"
"@ch2 channel 2 \"memory\", ... all the way to sample length\n"
"@out output \"memory\", $out[0] = previous function output calculation, ...\n"
"$t sample number, or \"time\", 0=left edge or trigger point\n"
"$pi a constant: 3.14159265359, for your trigonometric convenience\n"
"\n"
" Example functions\n"
"\n"
"Functions of channel 1 (would also work for channel 2):\n"
"\n"
"abs($ch1) # rectify (absolute value)\n"
"-$ch1 # negate (invert)\n"
"$ch1 - $ch1[0] # integral or rate of change since last sample\n"
"$ch1 - $ch1[2] # same but over more time (3 sample periods)\n"
"$ch1 + 32 # add a \"DC offset\" of 32 sample units\n"
"$t > 43 ? $ch1[43] : 0 # delay by 1 msec @ 44000 S/s = 44th sample\n"
"\n"
"Functions of both channel 1 and channel 2:\n"
"\n"
"$ch1 * $ch2 # multiply 1 * 2\n"
"$ch1 / ($ch2 || 1) # divide 1 / 2, avoiding divide by 0 error\n"
"$ch2 / ($ch1 || 1) # divide 2 / 1\n"
"$ch1 > $ch2 ? $ch1 : $ch2 # max(1, 2)\n"
"$ch1 < $ch2 ? $ch1 : $ch2 # min(1, 2)\n"
"$ch1 + $ch2 # sum, like the oscope builtin\n"
"$ch1 - $ch2 # diff, like the oscope builtin\n"
"($ch1 + $ch2) / 2 # average, like the oscope builtin\n"
"\n"
"Time position ($t) functions, independent of channel 1 and 2 inputs:\n"
"\n"
"$t / 88 % 2 ? 64 : -64 # 250 Hz square wave (88 = 44000 / 2 / 250)\n"
"sin($t * $pi / 44) * 64 # 500 Hz sin wave (44 = 44000 / 2 / 500)\n"
"cos($t * $pi / 22) * 64 # 1000 Hz cosine wave (22 = 44000 / 2 / 1000)\n"
"\n"
"Low-pass filter: a difference equation of previous input and output:\n"
"\n"
"1.899105 * $out[0] - .901531 * $out[1] + .001213 * ($ch1 + $ch1[1] + 2 * $ch1[0])\n"
;