feat(ir): replace Rpl with GraphIr
Semi-broken as atm the CLI just does nothing except printing the parsed IR, instead of actually executing it.
This commit is contained in:
parent
ccbccfb11b
commit
fcf7e909ee
14 changed files with 198 additions and 143 deletions
|
@ -1,4 +1,4 @@
|
|||
use rpl::instructions::{Filter, Instruction};
|
||||
use ir::instruction::{Filter, Kind};
|
||||
|
||||
use crate::value::Dynamic;
|
||||
mod instructions;
|
||||
|
@ -6,12 +6,12 @@ mod instructions;
|
|||
pub struct Executor;
|
||||
|
||||
impl crate::Executor for Executor {
|
||||
fn execute(instruction: Instruction, input: Option<Dynamic>) -> Option<Dynamic> {
|
||||
fn execute(instruction: Kind, input: Option<Dynamic>) -> Option<Dynamic> {
|
||||
match instruction {
|
||||
Instruction::Read(read_instruction) => {
|
||||
Kind::Read(read_instruction) => {
|
||||
Some(Dynamic::Image(instructions::read::read(read_instruction)))
|
||||
}
|
||||
Instruction::Write(write_instruction) => {
|
||||
Kind::Write(write_instruction) => {
|
||||
instructions::write::write(
|
||||
write_instruction,
|
||||
match input {
|
||||
|
@ -21,10 +21,10 @@ impl crate::Executor for Executor {
|
|||
);
|
||||
None
|
||||
}
|
||||
Instruction::Math(_) => todo!(),
|
||||
Instruction::Blend(_) => todo!(),
|
||||
Instruction::Noise(_) => todo!(),
|
||||
Instruction::Filter(filter_instruction) => match filter_instruction {
|
||||
Kind::Math(_) => todo!(),
|
||||
Kind::Blend(_) => todo!(),
|
||||
Kind::Noise(_) => todo!(),
|
||||
Kind::Filter(filter_instruction) => match filter_instruction {
|
||||
Filter::Invert => Some(Dynamic::Image(instructions::filters::invert::invert(
|
||||
match input {
|
||||
Some(Dynamic::Image(img)) => img,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue