问题:使用PlanUML画流程图,表达continue语法
以下是C代码模块:
void appRS422FrameMsg(unsigned char *msgBuffer)
{
int i;
unsigned short checkSum;
unsigned int recvCheckSum;
while(1)
{
UartRecData(RS422_CHANNEL,(char *)(msgBuffer),1); /*采集串口数据帧头*/
if((msgBuffer)[0]!=0x5A)
continue;
UartRecData(RS422_CHANNEL,(char *)(msgBuffer)+1,1); /*采集串口数据帧头*/
if((msgBuffer)[1]!=0x54)
continue;
for(i=0;i<RS422_FRAME_SIZE-2;i++) /*去掉帧头,获取剩余帧数据*/
{
if(!UartRecData(RS422_CHANNEL, (char*)(msgBuffer)+2+i, 1))
{
LOG_ERR(" appRS422FrameMsg error!");
}
}
if((msgBuffer)[RS422_FRAME_SIZE-1] != 0xFE || (msgBuffer)[RS422_FRAME_SIZE-2] != 0x5A || (msgBuffer)[RS422_FRAME_SIZE-3] !=(RS422_FRAME_SIZE-8))
continue; /*判断帧尾*/
/*CRC校验,使用时必须进行初始化处理*/
checkSum=GetCheckSum((msgBuffer)+4,(RS422_FRAME_SIZE-10)); /*计算数据区的校验和*/
recvCheckSum=*((unsigned short*)((msgBuffer)+RS422_FRAME_SIZE-5)); /*获取串口帧中的校验和*/
if(checkSum != recvCheckSum)
{
LOG_ERR(" appRS422FrameMsg CRC checkSum error.");
continue;
}
return;
}
}
以下是PlanUML伪代码模块,只编写了前面部分:
title RS422Process.c\n <b>appRS422FrameMsg(unsigned char *msgBuffer)</b>
start
repeat
:UartRecData();
if((msgBuffer)[0]!=0x5A?) then (yes)
continue
endif
:UartRecData();
repeat while(1)
stop
运行报语法错误
尝试过查阅文献,部分解释可以对代码优化,将continue转换为其他形式,但是有些形式比如上面不太好转换未能找到关于continue的直接描述。