Visual Servoing Platform
version 3.7.0
Loading...
Searching...
No Matches
vpMyio.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 "myio.c" contient les procedures d'entree/sortie
32
* des types definis dans le module "my.h".
33
* Les entrees non specifiees sont effectuees
34
* sur le fichier "source" du module "lex.c".
35
* Pour les mots cles des "fprintf_..." voir "token.c".
36
*
37
* Authors:
38
* Jean-Luc CORRE
39
*/
40
41
#include "vpMyio.h"
42
#include "vpLex.h"
43
#include "vpToken.h"
44
45
#include <stdio.h>
46
#include <stdlib.h>
47
#include <string.h>
48
49
#ifndef DOXYGEN_SHOULD_SKIP_THIS
50
51
extern
char
*mytext;
/* chaine du symbole courant */
52
53
BEGIN_VISP_NAMESPACE
54
/*
55
* La procedure "fscanf_float" lit en ascii un nombre flottant.
56
* Entree :
57
* fp Nombre flottant a lire.
58
*/
59
void
fscanf_float(
float
*fp)
60
{
61
int
t
;
62
63
if
((t = lex()) != T_FLOAT && t != T_INT)
64
lexerr(
"start"
,
"float expected"
, NULL);
65
*fp = (
t
== T_INT) ?
static_cast<
float
>
(myint) : myfloat;
66
}
67
68
/*
69
* La procedure "fscanf_Index" lit en ascii un indice.
70
* Entree :
71
* ip Indice a lire.
72
*/
73
void
fscanf_Index(Index *ip)
74
{
75
if
(lex() != T_INT)
76
lexerr(
"start"
,
"integer expected"
, NULL);
77
*ip = (Index)myint;
78
}
79
80
/*
81
* La procedure "fscanf_int" lit en ascii un nombre entier.
82
* Entree :
83
* ip Nombre entier a lire.
84
*/
85
void
fscanf_int(
int
*ip)
86
{
87
if
(lex() != T_INT)
88
lexerr(
"start"
,
"integer expected"
, NULL);
89
*ip = myint;
90
}
91
92
/*
93
* La procedure "fscanf_string" lit en ascii une chaine de caracteres.
94
* Entree :
95
* str Chaine a lire.
96
*/
97
void
fscanf_string(
char
**str)
98
{
99
if
(lex() != T_STRING)
100
lexerr(
"start"
,
"string expected"
, NULL);
101
if
(*str == NULL)
102
*
str
= (
char
*)malloc(
static_cast<
size_t
>
(mylength + 1) *
sizeof
(
char
));
103
else
104
*
str
= (
char
*)realloc(*str,
static_cast<
size_t
>
(mylength + 1) *
sizeof
(
char
));
105
106
if
(*str == NULL) {
107
printf(
"Unable to read the string: bad memory allocation"
);
108
return
;
109
}
110
111
strncpy(*str, mytext,
static_cast<
size_t
>
(mylength));
112
}
113
114
/*
115
* La procedure "fscanf_Type" lit en ascii un octet.
116
* Entree :
117
* ip Type a lire.
118
*/
119
void
fscanf_Type(Type *ip)
120
{
121
if
(lex() != T_INT)
122
lexerr(
"start"
,
"integer expected"
, NULL);
123
*ip = (Type)myint;
124
}
125
END_VISP_NAMESPACE
126
#endif
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
ibvs-four-points.str
str
Definition
ibvs-four-points.py:152
pbvs-four-points.t
t
Definition
pbvs-four-points.py:220
modules
robot
src
wireframe-simulator
vpMyio.cpp
Generated by
1.15.0