57 lines
1.1 KiB
C
57 lines
1.1 KiB
C
/*
|
|
* parser.h
|
|
*
|
|
* Created on: 10.04.2018
|
|
* Author: julian
|
|
*/
|
|
|
|
#ifndef PARSER_H_
|
|
#define PARSER_H_
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
int isWhite(char c);
|
|
int isNumber(char c);
|
|
|
|
// point that splits real numbers
|
|
int isPoint(char c);
|
|
|
|
|
|
char toLower(char in);
|
|
char toUpper(char in);
|
|
|
|
void skipWhite(const char ** start, const char * end);
|
|
|
|
// returns 1 on success
|
|
int asInt(int * result, const char ** start, const char * end);
|
|
int asFloat(float *result, const char **start, const char * end);
|
|
|
|
typedef struct argument {
|
|
char c;
|
|
float num;
|
|
} argument_t;
|
|
|
|
int nextArgument(argument_t* result, const char ** start, const char * end);
|
|
|
|
extern volatile int notok;
|
|
void error(const char * format, ...);
|
|
|
|
|
|
/** system functions **/
|
|
void move(const char * start, const char * end);
|
|
void home(const char * start, const char * end);
|
|
void state(const char * start, const char * end);
|
|
|
|
void set_move_absolute();
|
|
void set_move_relative();
|
|
|
|
/** parser functions **/
|
|
void gcode(const char * start, const char * end);
|
|
void mcode(const char * start, const char * end);
|
|
|
|
void parse(const char * start, const char * end);
|
|
|
|
|
|
#endif /* PARSER_H_ */
|