增加了ReadInput函数
This commit is contained in:
parent
ced5f41220
commit
635ea8bdfa
33
src/bus_io.c
33
src/bus_io.c
|
@ -2,3 +2,36 @@
|
||||||
// Created by ricardo on 2022/5/6.
|
// Created by ricardo on 2022/5/6.
|
||||||
//
|
//
|
||||||
#include "bus_io.h"
|
#include "bus_io.h"
|
||||||
|
#include "define.h"
|
||||||
|
|
||||||
|
int ReadInput(char* inputString)
|
||||||
|
{
|
||||||
|
|
||||||
|
char src[20];
|
||||||
|
int num;
|
||||||
|
sscanf(inputString,"%[a-z] %d",src,&num);
|
||||||
|
if (0 == strcmp("clock",src))
|
||||||
|
{
|
||||||
|
return IO_CLOCK;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("counterclockwise",src))
|
||||||
|
{
|
||||||
|
bus_query_t *CreateQuery(BUS_COUNTER_CLOCK_WISE, FindNode(num));
|
||||||
|
return IO_READING;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("clockwise",src))
|
||||||
|
{
|
||||||
|
bus_query_t *CreateQuery(BUS_CLOCK_WISE,FindNode(num));
|
||||||
|
return IO_READING;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("target",src))
|
||||||
|
{
|
||||||
|
bus_query_t *CreateQuery(BUS_TARGET,FindNode(num));
|
||||||
|
return IO_READING;
|
||||||
|
}
|
||||||
|
else if (0 == strcmp("end",src))
|
||||||
|
{
|
||||||
|
return IO_END;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user