From 77e7fb03e8ed61fa4df227188788958c13d27fdf Mon Sep 17 00:00:00 2001 From: Ákos Kőrösi Date: Wed, 20 May 2026 11:31:24 +0200 Subject: quicksave --- redes/syntax.h | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'redes/syntax.h') diff --git a/redes/syntax.h b/redes/syntax.h index 8404d15..1c43e49 100644 --- a/redes/syntax.h +++ b/redes/syntax.h @@ -1,6 +1,6 @@ # pragma once -#include "utils.h" +#include "../src/utils.h" // Stage 1 @@ -106,8 +106,9 @@ typedef struct { typedef enum { - REDIR_FILE_IN, - REDIR_FILE_OUT, + REDIR_WRITE_TRUNC, + REDIR_WRITE_APPEND, + REDIR_READ, REDIR_FDS, } RedirectKind; @@ -121,13 +122,23 @@ typedef struct { DECLARE_VEC(Redirect, RedirectVec) +typedef struct PlCommand PlCommand; + +typedef enum { + ARG_PS_IN, + ARG_PS_OUT, + ARG_LIT, +} ArgKind; + typedef struct { - char** args; - RedirectVec redirects; -} SimpleCommand; + ArgKind kind; + union { + char* lit_str; + PlCommand* sub_tree; + } as; +} Arg; -DECLARE_VEC(SimpleCommand, SimpleCommandVec) -DECLARE_VEC(SimpleCommand*, SimpleCommandPtrVec) +DECLARE_VEC(Arg, ArgVec) typedef enum { @@ -135,18 +146,13 @@ typedef enum { CONN_EOL, } Connector; -typedef struct { - SimpleCommand* cmd; - SimpleCommandPtrVec deps; +struct PlCommand { + ArgVec args; + RedirectVec redirects; Connector conn; -} PlCommand; - -DECLARE_VEC(PlCommand, PlCommandVec) +}; -typedef struct { - SimpleCommandVec commands; - PlCommandVec pipeline; -} ExecTree; +DECLARE_VEC(PlCommand, Pipeline) -- cgit v1.2.3