Technical information

RMS NetLinx Virtual Device API
126
RMS Enterprise - NetLinx Programmer’s Guide
RMS Command Escaping Functions (Cont.)
RmsParseCmdParam
Ex (Cont.)
Syntax (Cont.):
CASE 2: //ST_COLLECT
{
// If in quotes, just grab the characters
IF (bInquotes)
{
// Ah...found a quote, jump to end quote state
IF (chC == '"' )
{
nState = 3; //ST_END_QUOTE
BREAK;
}
}
// Not in quotes, look for separator
ELSE IF (chC == cSep)
{
// I am done
bDone = TRUE;
BREAK;
}
// Not in quotes, look for quotes (this would be wrong)
// But instead of barfing, I will just add the quote (below)
ELSE IF (chC == '"' )
{
// I will check to see if it should be escaped
IF (nLoop < LENGTH_ARRAY(cCmd))
{
// If this is 2 quotes back to back, just include the one
IF (cCmd[nLoop+1] = '"')
nLoop++;
}
}
// Add character to collection
cTemp = "cTemp,chC"
BREAK;
}
// End Quote
CASE 3: //ST_END_QUOTE
{
// Hit a separator
IF (chC == cSep)
{
// I am done
bDone = TRUE;
}
// OK, found a quote right after another quote. So this is escaped.
ELSE IF (chC == '"')
{
cTemp = "cTemp,chC"
nState = 2; //ST_COLLECT
}
BREAK;
}
}
// OK, if end of string or done, process and exit
IF (bDone == TRUE || nLoop >= LENGTH_ARRAY(cCmd
))
{
// remove cTemp from cCmd
cCmd = MID_STRING(cCmd, nLoop + 1, LENGTH_STRING(cCmd) - nLoop)
// cTemp is done
RETURN cTemp;
}
}
// Well...we should never hit this
RETURN "";
}