| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# testecma.cpp

    00001 /*
    00002  *  This file is part of the KDE libraries
    00003  *  Copyright (C) 2000 Harri Porten (porten@kde.org)
    00004  *
    00005  *  This library is free software; you can redistribute it and/or
    00006  *  modify it under the terms of the GNU Library General Public
    00007  *  License as published by the Free Software Foundation; either
    00008  *  version 2 of the License, or (at your option) any later version.
    00009  *
    00010  *  This library is distributed in the hope that it will be useful,
    00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  *  Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public
    00016  *  License along with this library; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    00018  */
    00019
    00034 #include <stdio.h>
    00035 #include <kjs/object.h>
    00036 #include <kjs/interpreter.h>
    00037 #include "dom/dom_doc.h"
    00038 #include "dom/dom_string.h"
    00039 #include "ecma/kjs_dom.h"
    00040
    00041
    00042 using namespace KJS;
    00043
    00044 int main(int, char **)
    00045 {
    00046   KJScript kjs;
    00047   kjs.enableDebug();
    00048   DOM::Document doc;
    00049
    00050   DOMDocument *dd = new DOMDocument(&doc);
    00051   Global::current().put("document", KJSO(dd));
    00052
    00053   printf("Entering interactive mode.\n"
    00054      "You may access the DOM via the 'document' property.\n"
    00055      "Use debug() to print to the console. Press C-d or C-c to exit.\n\n");
    00056
    00057   char buffer[1000];
    00058   FILE *in = fdopen(0, "r");
    00059
    00060   while (1) {
    00061     printf("KJS> ");
    00062     if (!fgets(buffer, 999, in))
    00063       break;
    00064     kjs.evaluate(buffer);
    00065   }
    00066   printf("\n");
    00067 }

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:19 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003