1 /*********************************************************************************
\r
3 * --------------------------------------------------------------------------------
\r
5 * This file is part of MiMic
\r
6 * Copyright (C)2011 Ryo Iizuka
\r
8 * MiMic is free software: you can redistribute it and/or modify
\r
9 * it under the terms of the GNU Lesser General Public License as published
\r
10 * by the Free Software Foundation, either version 3 of the License, or
\r
11 * (at your option) any later version.
\r
13 * This program is distributed in the hope that it will be useful,
\r
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 * GNU General Public License for more details.
\r
18 * You should have received a copy of the GNU Lesser General Public License
\r
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
21 * For further information please contact.
\r
23 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
\r
25 *********************************************************************************/
\r
26 #ifndef NYLPC_CMIMICTXTCOMPILER_H_
\r
27 #define NYLPC_CMIMICTXTCOMPILER_H_
\r
28 #include "NyLPC_cMiMicVM.h"
\r
32 #endif /* __cplusplus */
\r
37 * NyLPC_cMiMicTxtCompilerクラスは、MiMicBCのTXTパートを、MiMicVMのインストラクション配列に変換します。
\r
38 * MiMicBCは任意区切りのフラグメントテキストで入力できます。
\r
40 typedef struct NyLPC_TcMiMicTxtCompiler NyLPC_TcMiMicTxtCompiler_t;
\r
43 typedef NyLPC_TUInt8 NyLPC_TcMiMicTxtCompiler_ST;
\r
44 #define NyLPC_TcMiMicTxtCompiler_ST_OPC 0x01 //OPをパース中
\r
45 #define NyLPC_TcMiMicTxtCompiler_ST_OPR 0x02 //オペランドを解析中
\r
46 #define NyLPC_TcMiMicTxtCompiler_ST_CTR 0x03 //制御パラメータを解析中
\r
47 #define NyLPC_TcMiMicTxtCompiler_ST_OK 0x04 //パースを完了した。
\r
48 #define NyLPC_TcMiMicTxtCompiler_ST_NG 0xff //パースでエラーが発生ウェーイ
\r
51 struct NyLPC_TcMiMicTxtCompiler{
\r
52 NyLPC_TUInt8* out_buf;
\r
53 NyLPC_TUInt8 st;//ステータス
\r
54 NyLPC_TcMiMicVM_OP_TYPE _current_opc; //解析中のオペコード
\r
55 NyLPC_TUInt8 _current_oprtype; //解析中のオペランドタイプ
\r
56 NyLPC_TUInt8 _inst_len; //解析中のインストラクションセットの長さ
\r
57 NyLPC_TUInt8 _oprbc_len; //オペコード解析の一時変数
\r
58 NyLPC_TUInt8 tmp_len;//tmpに格納したデータの数を数えたり。
\r
59 NyLPC_TChar tmp[24];
\r
62 typedef NyLPC_TUInt8 NyLPC_TcMiMicTxtCompiler_RET;
\r
63 #define NyLPC_TcMiMicTxtCompiler_RET_OK 0x00
\r
64 #define NyLPC_TcMiMicTxtCompiler_RET_OK_END 0x01 //命令のパースに成功し、かつEND命令を検出。
\r
65 #define NyLPC_TcMiMicTxtCompiler_RET_CONTINUE 0x02 //続きのBCを要求している。
\r
66 #define NyLPC_TcMiMicTxtCompiler_RET_NG 0x80
\r
70 void NyLPC_cMiMicTxtCompiler_initialize(NyLPC_TcMiMicTxtCompiler_t* i_inst);
\r
71 #define NyLPC_cMiMicTxtCompiler_finalize(i)
\r
72 NyLPC_TcMiMicTxtCompiler_RET NyLPC_cMiMicTxtCompiler_compileFragment(NyLPC_TcMiMicTxtCompiler_t* i_inst,const struct NyLPC_TCharArrayPtr* i_bc,struct NyLPC_TUInt32ArrayPtr* i_bin,NyLPC_TUInt16* o_bin_len,NyLPC_TUInt16* o_parsed_bc);
\r
73 NyLPC_TcMiMicTxtCompiler_RET NyLPC_cMiMicTxtCompiler_compileFragment2(NyLPC_TcMiMicTxtCompiler_t* i_inst,NyLPC_TChar i_bc,struct NyLPC_TUInt32ArrayPtr* i_bin,NyLPC_TUInt16* o_bin_len);
\r
78 #endif /* __cplusplus */
\r
81 #endif /* NYLPC_CMIMICTXTCOMPILER_H_ */
\r