Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
NyLPC_cMiMicTxtCompiler.h
00001 /********************************************************************************* 00002 * PROJECT: MiMic 00003 * -------------------------------------------------------------------------------- 00004 * 00005 * This file is part of MiMic 00006 * Copyright (C)2011 Ryo Iizuka 00007 * 00008 * MiMic is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published 00010 * by the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 * For further information please contact. 00022 * http://nyatla.jp/ 00023 * <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp> 00024 * 00025 *********************************************************************************/ 00026 #ifndef NYLPC_CMIMICTXTCOMPILER_H_ 00027 #define NYLPC_CMIMICTXTCOMPILER_H_ 00028 #include "NyLPC_cMiMicVM.h" 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif /* __cplusplus */ 00033 00034 00035 /** 00036 * クラス型を定義します。 00037 * NyLPC_cMiMicTxtCompilerクラスは、MiMicBCのTXTパートを、MiMicVMのインストラクション配列に変換します。 00038 * MiMicBCは任意区切りのフラグメントテキストで入力できます。 00039 */ 00040 typedef struct NyLPC_TcMiMicTxtCompiler NyLPC_TcMiMicTxtCompiler_t; 00041 00042 00043 typedef NyLPC_TUInt8 NyLPC_TcMiMicTxtCompiler_ST; 00044 #define NyLPC_TcMiMicTxtCompiler_ST_OPC 0x01 //OPをパース中 00045 #define NyLPC_TcMiMicTxtCompiler_ST_OPR 0x02 //オペランドを解析中 00046 #define NyLPC_TcMiMicTxtCompiler_ST_CTR 0x03 //制御パラメータを解析中 00047 #define NyLPC_TcMiMicTxtCompiler_ST_OK 0x04 //パースを完了した。 00048 #define NyLPC_TcMiMicTxtCompiler_ST_NG 0xff //パースでエラーが発生ウェーイ 00049 00050 00051 struct NyLPC_TcMiMicTxtCompiler{ 00052 NyLPC_TUInt8* out_buf; 00053 NyLPC_TUInt8 st;//ステータス 00054 NyLPC_TcMiMicVM_OP_TYPE _current_opc; //解析中のオペコード 00055 NyLPC_TUInt8 _current_oprtype; //解析中のオペランドタイプ 00056 NyLPC_TUInt8 _inst_len; //解析中のインストラクションセットの長さ 00057 NyLPC_TUInt8 _oprbc_len; //オペコード解析の一時変数 00058 NyLPC_TUInt8 tmp_len;//tmpに格納したデータの数を数えたり。 00059 NyLPC_TChar tmp[24]; 00060 }; 00061 00062 typedef NyLPC_TUInt8 NyLPC_TcMiMicTxtCompiler_RET; 00063 #define NyLPC_TcMiMicTxtCompiler_RET_OK 0x00 00064 #define NyLPC_TcMiMicTxtCompiler_RET_OK_END 0x01 //命令のパースに成功し、かつEND命令を検出。 00065 #define NyLPC_TcMiMicTxtCompiler_RET_CONTINUE 0x02 //続きのBCを要求している。 00066 #define NyLPC_TcMiMicTxtCompiler_RET_NG 0x80 00067 00068 00069 00070 void NyLPC_cMiMicTxtCompiler_initialize(NyLPC_TcMiMicTxtCompiler_t* i_inst); 00071 #define NyLPC_cMiMicTxtCompiler_finalize(i) 00072 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); 00073 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); 00074 00075 00076 #ifdef __cplusplus 00077 } 00078 #endif /* __cplusplus */ 00079 00080 00081 #endif /* NYLPC_CMIMICTXTCOMPILER_H_ */
Generated on Tue Jul 12 2022 16:22:58 by
