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