1 /* libsswf_asas.h -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2009 */ 2 #ifndef LIBSSWF_ASAS_H 3 #define LIBSSWF_ASAS_H 4 5 /* 6 7 Copyright (c) 2005-2009 Made to Order Software Corp. 8 9 Permission is hereby granted, free of charge, to any 10 person obtaining a copy of this software and 11 associated documentation files (the "Software"), to 12 deal in the Software without restriction, including 13 without limitation the rights to use, copy, modify, 14 merge, publish, distribute, sublicense, and/or sell 15 copies of the Software, and to permit persons to whom 16 the Software is furnished to do so, subject to the 17 following conditions: 18 19 The above copyright notice and this permission notice 20 shall be included in all copies or substantial 21 portions of the Software. 22 23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 24 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 25 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 26 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 27 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 28 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 29 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 30 ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 SOFTWARE. 33 34 */ 35 36 #include "sswf/libsswf_as.h" 37 #include "sswf/libsswf.h" 38 39 40 //#include <wchar.h> 41 42 43 namespace sswf 44 { 45 namespace asas 46 { 47 48 49 50 51 class Compiler 52 { 53 public: 54 Compiler(void); 55 ~Compiler(); 56 57 int Compile(as::NodePtr& program, const char *code, unsigned long line, const char *filename); 58 59 void SetInputRetriever(as::InputRetriever& input); 60 void SetOptions(as::Options& options); 61 62 private: 63 as::Options f_default_options; 64 as::InputRetriever * f_input_retriever; 65 as::Options * f_options; 66 }; 67 68 69 70 /* 71 * Okay, the Assembler accepts an sswf::as::NodePtr tree 72 * which has been compiled and converts it in a list of 73 * sswf::Actions. 74 * 75 * As input, it takes a NodePtr and a TagDoAction set of 76 * references. The assembler goes through the NodePtr 77 * and generate actions that it inserts in the do action 78 * tag as required for the sswf library to generate the 79 * resulting Flash output. 80 * 81 * It is assumed that the compiler already got all the 82 * errors out so that the assembler won't have to err 83 * anything. At least, that's how it is right now. 84 */ 85 86 class Assembler 87 { 88 public: 89 Assembler(void); 90 ~Assembler(); 91 92 int AssembleClasses(as::NodePtr& program, TagBase& parent, bool& has_actions); 93 int Assemble(as::NodePtr& program, TagBase& tag, Vectors *actions); 94 95 void SetErrorStream(as::ErrorStream& error_stream); 96 void SetOptions(as::Options& options); 97 98 private: 99 as::ErrorStream f_default_error_stream; 100 as::ErrorStream * f_error_stream; 101 as::Options * f_options; 102 }; 103 104 105 106 107 108 }; // namespace asas 109 }; // namespace sswf 110 #endif /* #ifndef LIBSSWF_ASAS_H */ 111