aversive_10-03-12/modules/ihm/parse/parse.c File Reference

#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <ctype.h>
#include <aversive/pgmspace.h>
#include "parse.h"

Go to the source code of this file.

Defines

#define debug_printf(args...)   do {} while(0)

Functions

int isendoftoken (char c)
int8_t parse (parse_pgm_ctx_t ctx[], const char *buf)
int8_t complete (parse_pgm_ctx_t ctx[], const char *buf, int16_t *state, char *dst, uint8_t size)


Define Documentation

#define debug_printf ( args...   )     do {} while(0)

Definition at line 35 of file parse.c.


Function Documentation

int8_t complete ( parse_pgm_ctx_t  ctx[],
const char *  buf,
int16_t *  state,
char *  dst,
uint8_t  size 
)

complete() must be called with *state==0. It returns < 0 on error.

Else it returns: 2 on completion (one possible choice). In this case, the chars are appended in dst buffer. 1 if there is several possible choices. In this case, you must call the function again, keeping the value of state intact. 0 when the iteration is finished. The dst is not valid for this last call.

The returned dst buf ends with .

Definition at line 259 of file parse.c.

References token_ops::complete_get_elt, token_ops::complete_get_nb, debug_printf, token_ops::get_help, inst_pgm::help_str, parse_symbols::l, token_hdr::ops, and inst_pgm::tokens.

int isendoftoken ( char  c  ) 

Definition at line 56 of file parse.c.

Referenced by parse_num(), and parse_string().

int8_t parse ( parse_pgm_ctx_t  ctx[],
const char *  buf 
)

Try to parse a buffer according to the specified context. The argument buf must ends with "\n\0". The function returns PARSE_AMBIGUOUS, PARSE_NOMATCH or PARSE_BAD_ARGS on error. Else it calls the associated function (defined in the context) and returns 0 (PARSE_SUCCESS).

Definition at line 152 of file parse.c.

References inst_pgm::data, debug_printf, parse_symbols::f, inst_pgm::f, PARSE_AMBIGUOUS, PARSE_BAD_ARGS, and PARSE_NOMATCH.


Generated on Fri Mar 12 06:32:07 2010 for AVR by  doxygen 1.5.6