From f16f239688b632fc54684c3e0e1430fd89a67db5 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 3 Jun 2011 07:18:23 +0000 Subject: I added basic support for "opaque" type variables. I think there's one more tweak to it that I would like to make, but it's fine for now. I also added open, close, read, and write functions. They work just fine, but I'll also add a readLine function, and maybe even a readToken function later. --- src/functionwrite.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/functionwrite.cpp (limited to 'src/functionwrite.cpp') diff --git a/src/functionwrite.cpp b/src/functionwrite.cpp new file mode 100644 index 0000000..7abb661 --- /dev/null +++ b/src/functionwrite.cpp @@ -0,0 +1,34 @@ +#include "functionwrite.h" +#include "filemgr.h" + +#include +PluginInterface3( pluginFunctionWrite, write, FunctionWrite, Function, + "Mike Buland", 0, 1 ); + +FunctionWrite::FunctionWrite() +{ +} + +FunctionWrite::~FunctionWrite() +{ +} + +Bu::String FunctionWrite::getName() const +{ + return "write"; +} + +Variable FunctionWrite::call( Variable &input, VarList lParams ) +{ + if( lParams.getSize() != 1 ) + { + throw Bu::ExceptionBase( + "write takes one parameter, the string to write." + ); + } + FileMgr::getInstance().get( (int)input.getOpaque() ).write( + lParams.first().toString() + ); + return Variable(); +} + -- cgit v1.2.3