diff --git a/JetCore.txt b/JetCore.txt index 28095bd..1c4a393 100644 --- a/JetCore.txt +++ b/JetCore.txt @@ -11,3 +11,4 @@ itself is not passwed to the output and will not appear in the output. Skip Blank Lines options on containers will skip passing any blank lines or line containing only whitespace to the output. + diff --git a/__write.cpp b/__write.cpp new file mode 100644 index 0000000..9753ff5 --- /dev/null +++ b/__write.cpp @@ -0,0 +1,32 @@ +#include "__write.h" +#include "Exception.h" +#include "Expression.h" +#include + +namespace jet { + + __write::__set(coreutils::ZString &in, coreutils::MString &parent, Global &global) : Tag(in, parent, global) { + output = false; + processContainer(container); + if(!variableDefined("file")) + throw coreutils::Exception("write tag must have file defined."); + if(!variableDefined("expr") && variableDefined("value") && hasContainer) + throw coreutils::Exception("write tag cannot have both value and a container."); + if(variableDefined("expr") && !variableDefined("value") && hasContainer) + throw coreutils::Exception("write tag cannot have both expr and a container."); + if(variableDefined("expr") && variableDefined("value") && !hasContainer) + throw coreutils::Exception("write tag cannot have both expr and value."); + if(!variableDefined("expr") && !variableDefined("value") && !hasContainer) + throw coreutils::Exception("write tag must have a value, expr or a container."); + if(variableDefined("scope")) + throw coreutils::Exception("Cannot use scope with write tag."); + + + int fd = open(variables["file"], O_APPEND | O_TRUNC); // <--- options go here need to pick one + + + + close(fd); + + } +} diff --git a/__write.h b/__write.h new file mode 100644 index 0000000..7583ddf --- /dev/null +++ b/__write.h @@ -0,0 +1,22 @@ +#ifndef __write_h__ +#define __write_h__ + +#include "Tag.h" +#include "ZString.h" +#include "MString.h" +#include + +namespace jet { + + class __write : public Tag { + + public: + __write(coreutils::ZString &in, coreutils::MString &parent, Global &global); + + protected: + + }; + +} + +#endif