// Evaluates a let expression and makes a new frame that will point to the frame that is given to it // as a parameter Value evalLet(Value tree, Frame *env){ if(tree.type != consType){ return evaluationError("improper use of \'let\'"); } if(!tree.consValue){ return evaluationError("no arguments given to \'let\'"); } // Get the bindings and the body Value bindings = getNth(tree.consValue,0); Value body = getNth(tree.consValue,1); if( (body.type == openType) || (bindings.type == openType) ){ return evaluationError("not enough arguments given to a \'let\'"); } // Make a new frame from the bindings list Frame *newEnv = makeFrame(env); insertVectorItem(envGarbage, envGarbage->size, (void *)newEnv); if(!addBindings(newEnv, bindings)){ return evaluationError("poorly formed \'let\'"); } return eval(body, newEnv); }
KstBindEllipse::KstBindEllipse(KJS::ExecState *exec, KJS::Object *globalObject, const char *name) : KstBindViewObject(exec, globalObject, name ? name : "Ellipse") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { KstBindViewObject::addFactory("Ellipse", KstBindEllipse::bindFactory); } }
KstBindScalar::KstBindScalar(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindObject(exec, globalObject, "Scalar") { KJS::Object o(this); addBindings(exec, o); if (!globalObject) { _d = new KstScalar; } }
KstBindPowerSpectrum::KstBindPowerSpectrum(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindDataObject(exec, globalObject, "PowerSpectrum") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { KstBindDataObject::addFactory("PowerSpectrum", KstBindPowerSpectrum::bindFactory); } }
KstBindPoint::KstBindPoint(KJS::ExecState *exec, KJS::Object *globalObject) : KstBinding("Point"), _x(0), _y(0) { KJS::Object o(this); addBindings(exec, o); if (globalObject) { globalObject->put(exec, "Point", o); } }
KstBindLegend::KstBindLegend(KJS::ExecState *exec, KJS::Object *globalObject, const char *name) : KstBindBorderedViewObject(exec, globalObject, name ? name : "Legend") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { KstBindBorderedViewObject::addFactory("Legend", KstBindLegend::bindFactory); } }
KstBindCubicBezier::KstBindCubicBezier(KJS::ExecState *exec, KJS::Object *globalObject, const char *name) : KstBindViewObject(exec, globalObject, name ? name : "CubicBezier") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { KstBindViewObject::addFactory("Bezier", KstBindCubicBezier::bindFactory); } }
KstBindObject::KstBindObject(KJS::ExecState *exec, KJS::Object *globalObject, const char *name) : KstBinding(name ? name : "Object") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { globalObject->put(exec, name ? name : "Object", o); } }
KstBindDebug::KstBindDebug(KJS::ExecState *exec, KJS::Object *globalObject) : KstBinding("Debug", false) { KJS::Object o(this); addBindings(exec, o); if (globalObject) { globalObject->put(exec, "Debug", o); } }
KstBindSize::KstBindSize(KJS::ExecState *exec, KJS::Object *globalObject) : KstBinding("Size") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { globalObject->put(exec, "Size", o); } }
KstBindCurve::KstBindCurve(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindDataObject(exec, globalObject, "Curve") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { KstBindDataObject::addFactory("Curve", KstBindCurve::bindFactory); } }
KstBindPlot::KstBindPlot(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindBorderedViewObject(exec, globalObject, "Plot") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { //globalObject->put(exec, "Plot", o); KstBindBorderedViewObject::addFactory("Plot", KstBindPlot::bindFactory); } }
KstBindWindow::KstBindWindow(KJS::ExecState *exec, KJS::Object *globalObject) : KstBinding("Window") { KJS::Object o(this); addBindings(exec, o); if (globalObject) { globalObject->put(exec, "Window", o); } else { _d = new KstViewWindow; } }
static void addBindings(MultinameHashtable* bindings, TraitsBindingsp tb, uint32_t flags) { if (!tb) return; if ((flags & TypeDescriber::HIDE_OBJECT) && !tb->base) return; addBindings(bindings, tb->base, flags); for (int32_t index = 0; (index = tb->next(index)) != 0; ) { bindings->add(tb->keyAt(index), tb->nsAt(index), tb->valueAt(index)); } }
KJS::Object QDirLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const { JSOpaqueProxy * prx; if ( args.size() == 0 ) { prx = new JSOpaqueProxy( new QDir( QDir::current() ), "QDir" ); } else { QString arg0 = ( args.size() >= 1 ) ? args[ 0 ].toString( exec ).qstring() : QString::null; prx = new JSOpaqueProxy( new QDir( arg0 ), "QDir" ); } prx->setOwner( JSProxy::JavaScript ); KJS::Object proxyObj( prx ); addBindings( jspart, exec, proxyObj ); return proxyObj; }
KstBindCurve::KstBindCurve(KJS::ExecState *exec, KstVCurvePtr d) : KstBindDataObject(exec, d.data(), "Curve") { KJS::Object o(this); addBindings(exec, o); }
KstBindPlotLabel::KstBindPlotLabel(KJS::ExecState *exec, Kst2DPlotPtr d) : QObject(), KstBinding("PlotLabel", false), _d(d.data()) { KJS::Object o(this); addBindings(exec, o); }
KstBindObject::KstBindObject(KJS::ExecState *exec, KstObjectPtr d, const char *name) : KstBinding(name ? name : "Object"), _d(d) { KJS::Object o(this); addBindings(exec, o); }
KstBindTimeInterpretation::KstBindTimeInterpretation(KJS::ExecState *exec, KstBindAxis *d) : KstBinding("TimeInterpretation", false), _d(d) { KJS::Object o(this); addBindings(exec, o); }
KstBindBorderedViewObject::KstBindBorderedViewObject(KJS::ExecState *exec, KstBorderedViewObjectPtr d, const char *name) : KstBindViewObject(exec, d.data(), name ? name : "BorderedViewObject") { KJS::Object o(this); addBindings(exec, o); }
KstBindWindow::KstBindWindow(KJS::ExecState *exec, KstViewWindow *d) : KstBinding("Window"), _d(d) { KJS::Object o(this); addBindings(exec, o); }
KstBindCubicBezier::KstBindCubicBezier(KJS::ExecState *exec, KstViewBezierPtr d, const char *name) : KstBindViewObject(exec, d.data(), name ? name : "CubicBezier") { KJS::Object o(this); addBindings(exec, o); }
KstBindPoint::KstBindPoint(KJS::ExecState *exec, double x, double y) : KstBinding("Point"), _x(x), _y(y) { KJS::Object o(this); addBindings(exec, o); }
KstBindDataSource::KstBindDataSource(KJS::ExecState *exec, KstDataSourcePtr s) : KstBindObject(exec, s.data(), "DataSource") { KJS::Object o(this); addBindings(exec, o); }
KstBindEllipse::KstBindEllipse(KJS::ExecState *exec, KstViewEllipsePtr d, const char *name) : KstBindViewObject(exec, d.data(), name ? name : "Ellipse") { KJS::Object o(this); addBindings(exec, o); }
KstBindDataSource::KstBindDataSource(KJS::ExecState *exec, KJS::Object *globalObject) : KstBindObject(exec, globalObject, "DataSource") { KJS::Object o(this); addBindings(exec, o); }
KstBindSize::KstBindSize(KJS::ExecState *exec, const QSize& sz) : KstBinding("Size"), _sz(sz) { KJS::Object o(this); addBindings(exec, o); }
KstBindSize::KstBindSize(KJS::ExecState *exec, int w, int h) : KstBinding("Size"), _sz(w, h) { KJS::Object o(this); addBindings(exec, o); }
KstBindViewObject::KstBindViewObject(KJS::ExecState *exec, KJS::Object *globalObject, const char *name) : KstBindObject(exec, globalObject, name ? name : "ViewObject") { KJS::Object o(this); addBindings(exec, o); }
KstBindLegend::KstBindLegend(KJS::ExecState *exec, KstViewLegendPtr d, const char *name) : KstBindBorderedViewObject(exec, d.data(), name ? name : "Legend") { KJS::Object o(this); addBindings(exec, o); }