3 * NyLPC_cFormatTextReader.c
\r
4 * このクラスは、書式テキスト読み出し関数を集約します。
\r
5 * Created on: 2013/04/18
\r
11 #include "NyLPC_cFormatTextReader.h"
\r
13 * [a-zA-Z0-9_-]で構成されるワードを取得します。
\r
14 * This function peek a word from string.
\r
18 NyLPC_TInt32 NyLPC_cFormatTextReader_readWord(const NyLPC_TChar* buf,const NyLPC_TChar** top)
\r
20 const NyLPC_TChar* p=buf;
\r
22 for(;*p!='\0' && (isalnum(*p)|| (strchr("_-",*p)!=NULL));p++);//skip words
\r
27 * 文字列からIPアドレスを取得します。
\r
28 * [:number:]\.[:number:]\.[:number:]\.[:number:]
\r
29 * [:number:]は0-255までに制限されます。
\r
33 NyLPC_TInt32 NyLPC_cFormatTextReader_readIpAddr(const NyLPC_TChar* buf,NyLPC_TUInt8 v[4])
\r
36 const NyLPC_TChar* p=buf;
\r
40 for(;isdigit(*p);p++){
\r
41 t=t*10+NyLPC_ctoi(*p);
\r
52 }else if(!isspace(*p) && *p!='\0'){
\r
59 * 文字列からMACアドレスを取得します。
\r
60 * [:hex:]:[:hex:]:[:hex:]:[:hex:]
\r
62 NyLPC_TInt32 NyLPC_cFormatTextReader_readMacAddr(const NyLPC_TChar* buf,NyLPC_TUInt8 v[6])
\r
65 const NyLPC_TChar* p=buf;
\r
68 for(;isxdigit(*p);p++){
\r
69 t=t*16+NyLPC_ctox(*p);
\r
80 }else if(!isspace(*p) && *p!='\0'){
\r
91 NyLPC_TInt32 NyLPC_cFormatTextReader_seekSpace(const NyLPC_TChar* s)
\r
93 const NyLPC_TChar* p=s;
\r
94 for(;*p!='\0' && isspace(*p);p++);
\r