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_cPtrStream.c
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 00027 #include "NyLPC_cPtrStream_protected.h" 00028 #include <stdlib.h> 00029 00030 00031 const struct NyLPC_TcPtrStream_TInterface NyLPC_TcPtrStream_Interface={ 00032 NyLPC_cPtrStream_pread_func, 00033 NyLPC_cPtrStream_write_func, 00034 NyLPC_cPtrStream_pseek_func, 00035 NyLPC_cPtrStream_close_func 00036 }; 00037 00038 /*private*/ 00039 NyLPC_TInt32 NyLPC_cPtrStream_pread_func(NyLPC_TcPtrStream_t* i_inst,const void** o_buf_ptr,NyLPC_TUInt32 i_wait_msec) 00040 { 00041 (void)i_inst; 00042 (void)o_buf_ptr; 00043 (void)i_wait_msec; 00044 return -1; 00045 } 00046 00047 NyLPC_TBool NyLPC_cPtrStream_write_func(NyLPC_TcPtrStream_t* i_inst,const void* i_data,NyLPC_TInt16 i_length,NyLPC_TUInt32 i_wait_msec) 00048 { 00049 (void)i_inst; 00050 (void)i_data; 00051 (void)i_length; 00052 (void)i_wait_msec; 00053 return NyLPC_TBool_FALSE; 00054 } 00055 00056 00057 void NyLPC_cPtrStream_pseek_func(NyLPC_TcPtrStream_t* i_inst,NyLPC_TUInt16 i_seek) 00058 { 00059 (void)i_inst; 00060 (void)i_seek; 00061 } 00062 00063 void NyLPC_cPtrStream_close_func(NyLPC_TcPtrStream_t* i_inst) 00064 { 00065 (void)i_inst; 00066 } 00067 00068 00069 /** 00070 * See Header file. 00071 */ 00072 NyLPC_TBool NyLPC_cPtrStream_writeln(NyLPC_TcPtrStream_t* i_inst,const void* i_data,NyLPC_TInt16 i_length,NyLPC_TUInt32 i_wait_msec) 00073 { 00074 if(NyLPC_cPtrStream_write(i_inst,i_data,i_length,i_wait_msec)){ 00075 if(NyLPC_cPtrStream_write(i_inst,"\r\n",2,i_wait_msec)){ 00076 return NyLPC_TBool_TRUE; 00077 } 00078 } 00079 return NyLPC_TBool_FALSE; 00080 } 00081 /** 00082 * See Header file. 00083 */ 00084 NyLPC_TBool NyLPC_cPtrStream_writeInt(NyLPC_TcPtrStream_t* i_inst,NyLPC_TInt32 i_val,NyLPC_TUInt32 i_wait_msec,NyLPC_TUInt32 i_base) 00085 { 00086 NyLPC_TChar v[12]; 00087 NyLPC_itoa(i_val,v,i_base); 00088 if(NyLPC_cPtrStream_write(i_inst,v,strlen(v),i_wait_msec)){ 00089 return NyLPC_TBool_TRUE; 00090 } 00091 return NyLPC_TBool_FALSE; 00092 }
Generated on Tue Jul 12 2022 16:22:59 by
