Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
wtools
wdata
Commits
15a5ce9c
Commit
15a5ce9c
authored
3 years ago
by
Gabriel Wlazłowski
Browse files
Options
Download
Email Patches
Plain Diff
Added wdata_setconst_unit
parent
c3735a8d
master
dev
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
c/wdata.c
+20
-0
c/wdata.c
c/wdata.h
+5
-0
c/wdata.h
with
25 additions
and
0 deletions
+25
-0
c/wdata.c
View file @
15a5ce9c
...
...
@@ -868,6 +868,26 @@ void wdata_setconst(wdata_metadata *md, const char *constname, double constvalue
return
;
}
void
wdata_setconst_unit
(
wdata_metadata
*
md
,
const
char
*
constname
,
double
constvalue
,
const
char
*
unit
)
{
int
i
;
for
(
i
=
0
;
i
<
md
->
nconsts
;
i
++
)
if
(
strcmp
(
md
->
consts
[
i
].
name
,
constname
)
==
0
)
{
md
->
consts
[
i
].
value
=
constvalue
;
return
;
}
wdata_const
_const
;
strcpy
(
_const
.
name
,
constname
);
strcpy
(
_const
.
unit
,
unit
);
_const
.
value
=
constvalue
;
md
->
consts
[
md
->
nconsts
]
=
_const
;
md
->
nconsts
++
;
return
;
}
int
wdata_file_exists
(
wdata_metadata
*
md
,
const
char
*
varname
)
{
wdata_goto_wrkdir
(
md
);
...
...
This diff is collapsed.
Click to expand it.
c/wdata.h
View file @
15a5ce9c
...
...
@@ -244,6 +244,11 @@ extern "C"
* Functions sets value of constant. If constant was not added before it adds it and sets its value.
* */
void
wdata_setconst
(
wdata_metadata
*
md
,
const
char
*
constname
,
double
constvalue
);
/**
* Functions sets value of constant and corresponding unit. If constant was not added before it adds it and sets its value.
* */
void
wdata_setconst_unit
(
wdata_metadata
*
md
,
const
char
*
constname
,
double
constvalue
,
const
char
*
unit
);
/**
* Function checks if binary file exists for variable.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help