Visual Servoing Platform version 3.5.0
vpSkipio.cpp
1/****************************************************************************
2 *
3 * ViSP, open source Visual Servoing Platform software.
4 * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5 *
6 * This software is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * See the file LICENSE.txt at the root directory of this source
11 * distribution for additional information about the GNU GPL.
12 *
13 * For using ViSP with software that can not be combined with the GNU
14 * GPL, please contact Inria about acquiring a ViSP Professional
15 * Edition License.
16 *
17 * See http://visp.inria.fr for more information.
18 *
19 * This software was developed at:
20 * Inria Rennes - Bretagne Atlantique
21 * Campus Universitaire de Beaulieu
22 * 35042 Rennes Cedex
23 * France
24 *
25 * If you have questions regarding the use of this file, please contact
26 * Inria at visp@inria.fr
27 *
28 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30 *
31 * Description:
32 * Le module "skipio.c" contient les procedures d'analyse
33 * syntaxique du fichier "source" qui permettent de traiter
34 * les commandes inconnues.
35 *
36 * Authors:
37 * Jean-Luc CORRE
38 *
39 *****************************************************************************/
40
41#include <visp3/core/vpConfig.h>
42
43#ifndef DOXYGEN_SHOULD_SKIP_THIS
44#include "vpLex.h"
45#include "vpMy.h"
46#include "vpSkipio.h"
47#include "vpToken.h"
48#include <stdio.h>
49
50/*
51 * La procedure "skip_cmd" saute les structures d'une commande
52 * jusqu'a reconnaitre le debut d'une nouvelle commande.
53 * Entree :
54 * f Fichier en sortie.
55 */
56void skip_cmd(void)
57{
58 int token;
59
60 fprintf(stderr, "\n$ ");
61 fwrite(mytext, (size_t)mylength, 1, stderr);
62 while ((token = lexecho(stderr, '$')) != T_EOF && token != '$') {
63 };
64 unlex();
65}
66
67/*
68 * La procedure "skip_keyword" saute les structures des articles
69 * jusqu'a reconnaitre le mot cle de jeton "token".
70 * Entree :
71 * token Jeton du mot cle a reconnaitre.
72 * err Message d'erreur si le mot cle n'est pas reconnu.
73 */
74void skip_keyword(int token, const char *err)
75{
76 int t;
77
78 switch (t = lex()) {
79 case T_IDENT: /* saute le mot cle inconnu */
80 while ((t = lex()) != 0) {
81 switch (t) {
82 case '$': /* nouvelle commande */
83 case T_EOF: /* fin de fichier */
84 lexerr("start", err, NULL);
85 break;
86 default:
87 if (t == token)
88 return;
89 break;
90 }
91 }
92 break;
93 default:
94 if (t == token)
95 return;
96 break;
97 }
98 lexerr("start", err, NULL);
99}
100
101#endif