Revision: 8413 https://osdn.net/projects/ttssh2/scm/svn/commits/8413 Author: zmatsuo Date: 2019-11-27 23:01:34 +0900 (Wed, 27 Nov 2019) Log Message: ----------- インデントを調整した Modified Paths: -------------- trunk/teraterm/ttpmacro/ttmparse.c -------------- next part -------------- Modified: trunk/teraterm/ttpmacro/ttmparse.c =================================================================== --- trunk/teraterm/ttpmacro/ttmparse.c 2019-11-27 14:01:26 UTC (rev 8412) +++ trunk/teraterm/ttpmacro/ttmparse.c 2019-11-27 14:01:34 UTC (rev 8413) @@ -723,73 +723,73 @@ return (strlen(Name)>0); } - int GetQuotedStr(PCHAR Str, BYTE q, LPWORD i) +static int GetQuotedStr(PCHAR Str, BYTE q, LPWORD i) +{ + BYTE b; + + b=0; + if (LinePtr<LineLen) b = LineBuff[LinePtr]; + while ((LinePtr<LineLen) && (b>=' '||b=='\t') && (b!=q)) { - BYTE b; + if (*i<MaxStrLen-1) + { + Str[*i] = b; + (*i)++; + } - b=0; + LinePtr++; if (LinePtr<LineLen) b = LineBuff[LinePtr]; - while ((LinePtr<LineLen) && (b>=' '||b=='\t') && (b!=q)) - { - if (*i<MaxStrLen-1) - { - Str[*i] = b; - (*i)++; - } + } + if (b==q) { + if (LinePtr<LineLen) + LinePtr++; + } + else + return (ErrSyntax); + return 0; +} + +static WORD GetCharByCode(PCHAR Str, LPWORD i) +{ + BYTE b; + WORD n; + + b=0; + n = 0; + if (LinePtr<LineLen) b = LineBuff[LinePtr]; + if (!isdigit(b) && (b!='$')) return ErrSyntax; + + if (b!='$') { /* decimal */ + while ((LinePtr<LineLen) && isdigit(b)) { // [0-9] + n = n * 10 + b - '0'; LinePtr++; if (LinePtr<LineLen) b = LineBuff[LinePtr]; } - if (b==q) { - if (LinePtr<LineLen) - LinePtr++; - } - else - return (ErrSyntax); - - return 0; } - - WORD GetCharByCode(PCHAR Str, LPWORD i) - { - BYTE b; - WORD n; - - b=0; - n = 0; + else { /* hexadecimal */ + LinePtr++; if (LinePtr<LineLen) b = LineBuff[LinePtr]; - if (!isdigit(b) && (b!='$')) return ErrSyntax; - - if (b!='$') { /* decimal */ - while ((LinePtr<LineLen) && isdigit(b)) { // [0-9] - n = n * 10 + b - '0'; - LinePtr++; - if (LinePtr<LineLen) b = LineBuff[LinePtr]; - } - } - else { /* hexadecimal */ + while ((LinePtr<LineLen) && isxdigit(b)) { // [0-9A-Fa-f] + if (isalpha(b)) + b = (b|0x20) - 'a' + 10; + else + b = b - '0'; + n = n * 16 + b; LinePtr++; if (LinePtr<LineLen) b = LineBuff[LinePtr]; - while ((LinePtr<LineLen) && isxdigit(b)) { // [0-9A-Fa-f] - if (isalpha(b)) - b = (b|0x20) - 'a' + 10; - else - b = b - '0'; - n = n * 16 + b; - LinePtr++; - if (LinePtr<LineLen) b = LineBuff[LinePtr]; - } } + } - if ((n==0) || (n>255)) return ErrSyntax; + if ((n==0) || (n>255)) return ErrSyntax; - if (*i<MaxStrLen-1) - { - Str[*i] = (char)n; - (*i)++; - } - return 0; + if (*i<MaxStrLen-1) + { + Str[*i] = (char)n; + (*i)++; } + return 0; +} BOOL GetString(PCHAR Str, LPWORD Err) {