Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
ee360dde
Commit
ee360dde
authored
May 06, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NMps convert, adapted to 64 bit alignment
parent
ed3f964c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
15 deletions
+49
-15
nmps/lib/nmps/src/nmps_cnv.c
nmps/lib/nmps/src/nmps_cnv.c
+49
-15
No files found.
nmps/lib/nmps/src/nmps_cnv.c
View file @
ee360dde
...
@@ -80,6 +80,7 @@ int cnv_CreateConvTable(
...
@@ -80,6 +80,7 @@ int cnv_CreateConvTable(
char
out_str
[
5
][
80
];
char
out_str
[
5
][
80
];
int
nr
;
int
nr
;
int
i
,
j
;
int
i
,
j
;
int
offset
;
cnv_eParType
to_type
[
CNV_CONVDEF_SIZE
];
cnv_eParType
to_type
[
CNV_CONVDEF_SIZE
];
int
to_offset
[
CNV_CONVDEF_SIZE
];
int
to_offset
[
CNV_CONVDEF_SIZE
];
int
to_size
[
CNV_CONVDEF_SIZE
];
int
to_size
[
CNV_CONVDEF_SIZE
];
...
@@ -108,7 +109,7 @@ int cnv_CreateConvTable(
...
@@ -108,7 +109,7 @@ int cnv_CreateConvTable(
nr
=
dcli_parse
(
from_convdef
->
Param
[
i
],
" "
,
""
,
(
char
*
)
out_str
,
nr
=
dcli_parse
(
from_convdef
->
Param
[
i
],
" "
,
""
,
(
char
*
)
out_str
,
sizeof
(
out_str
)
/
sizeof
(
out_str
[
0
]),
sizeof
(
out_str
[
0
]),
0
);
sizeof
(
out_str
)
/
sizeof
(
out_str
[
0
]),
sizeof
(
out_str
[
0
]),
0
);
if
(
nr
!=
2
&&
nr
!=
3
)
if
(
nr
!=
2
&&
nr
!=
3
&&
nr
!=
4
)
{
{
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
from_convdef
->
Param
[
i
]),
NULL
);
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
from_convdef
->
Param
[
i
]),
NULL
);
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
...
@@ -130,10 +131,20 @@ int cnv_CreateConvTable(
...
@@ -130,10 +131,20 @@ int cnv_CreateConvTable(
}
}
if
(
from_convdef_count
==
0
)
if
(
from_convdef_count
==
0
)
from_offset
[
from_convdef_count
]
=
0
;
from_offset
[
from_convdef_count
]
=
0
;
else
else
{
from_offset
[
from_convdef_count
]
=
if
(
nr
==
4
)
{
sts
=
sscanf
(
out_str
[
3
],
"%d"
,
&
offset
);
if
(
sts
!=
1
)
{
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
from_convdef
->
Param
[
i
]),
NULL
);
return
CNV__SYNTAX
;
}
from_offset
[
from_convdef_count
]
=
offset
;
}
else
from_offset
[
from_convdef_count
]
=
from_offset
[
from_convdef_count
-
1
]
+
from_offset
[
from_convdef_count
-
1
]
+
from_size
[
from_convdef_count
-
1
];
from_size
[
from_convdef_count
-
1
];
}
from_convdef_count
++
;
from_convdef_count
++
;
}
}
...
@@ -148,7 +159,7 @@ int cnv_CreateConvTable(
...
@@ -148,7 +159,7 @@ int cnv_CreateConvTable(
nr
=
dcli_parse
(
to_convdef
->
Param
[
i
],
" "
,
""
,
(
char
*
)
out_str
,
nr
=
dcli_parse
(
to_convdef
->
Param
[
i
],
" "
,
""
,
(
char
*
)
out_str
,
sizeof
(
out_str
)
/
sizeof
(
out_str
[
0
]),
sizeof
(
out_str
[
0
]),
0
);
sizeof
(
out_str
)
/
sizeof
(
out_str
[
0
]),
sizeof
(
out_str
[
0
]),
0
);
if
(
nr
!=
2
&&
nr
!=
3
)
if
(
nr
!=
2
&&
nr
!=
3
&&
nr
!=
4
)
{
{
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
to_convdef
->
Param
[
i
]),
NULL
);
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
to_convdef
->
Param
[
i
]),
NULL
);
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
...
@@ -168,10 +179,20 @@ int cnv_CreateConvTable(
...
@@ -168,10 +179,20 @@ int cnv_CreateConvTable(
cdh_ToUpper
(
to_param
[
to_convdef_count
],
out_str
[
1
]);
cdh_ToUpper
(
to_param
[
to_convdef_count
],
out_str
[
1
]);
if
(
to_convdef_count
==
0
)
if
(
to_convdef_count
==
0
)
to_offset
[
to_convdef_count
]
=
0
;
to_offset
[
to_convdef_count
]
=
0
;
else
else
{
to_offset
[
to_convdef_count
]
=
if
(
nr
==
4
)
{
sts
=
sscanf
(
out_str
[
3
],
"%d"
,
&
offset
);
if
(
sts
!=
1
)
{
errh_CErrLog
(
CNV__SYNTAX
,
errh_ErrArgAF
(
to_convdef
->
Param
[
i
]),
NULL
);
return
CNV__SYNTAX
;
}
to_offset
[
to_convdef_count
]
=
offset
;
}
else
to_offset
[
to_convdef_count
]
=
to_offset
[
to_convdef_count
-
1
]
+
to_offset
[
to_convdef_count
-
1
]
+
to_size
[
to_convdef_count
-
1
];
to_size
[
to_convdef_count
-
1
];
}
to_convdef_count
++
;
to_convdef_count
++
;
}
}
...
@@ -520,7 +541,7 @@ static int cnv_string_to_partype( char *string,
...
@@ -520,7 +541,7 @@ static int cnv_string_to_partype( char *string,
else
if
(
!
strcmp
(
string
,
"FLOAT32"
))
else
if
(
!
strcmp
(
string
,
"FLOAT32"
))
{
{
/* Format may be given as an argument */
/* Format may be given as an argument */
if
(
args
==
3
)
if
(
args
>=
3
&&
strcmp
(
third_arg
,
"-"
)
!=
0
)
strcpy
(
format
,
third_arg
);
strcpy
(
format
,
third_arg
);
*
type
=
cnv_eParType_Float32
;
*
type
=
cnv_eParType_Float32
;
*
size
=
4
;
*
size
=
4
;
...
@@ -534,7 +555,7 @@ static int cnv_string_to_partype( char *string,
...
@@ -534,7 +555,7 @@ static int cnv_string_to_partype( char *string,
{
{
/* Size should be given as an argument */
/* Size should be given as an argument */
/* Third arg is size */
/* Third arg is size */
if
(
args
!=
3
)
if
(
args
<
3
||
strcmp
(
third_arg
,
"-"
)
==
0
)
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
...
@@ -546,7 +567,7 @@ static int cnv_string_to_partype( char *string,
...
@@ -546,7 +567,7 @@ static int cnv_string_to_partype( char *string,
{
{
/* Size should be given as an argument */
/* Size should be given as an argument */
/* Third arg is size */
/* Third arg is size */
if
(
args
!=
3
)
if
(
args
<
3
||
strcmp
(
third_arg
,
"-"
)
==
0
)
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
...
@@ -557,7 +578,7 @@ static int cnv_string_to_partype( char *string,
...
@@ -557,7 +578,7 @@ static int cnv_string_to_partype( char *string,
else
if
(
!
strcmp
(
string
,
"BINARY"
))
else
if
(
!
strcmp
(
string
,
"BINARY"
))
{
{
/* Size should be given as an argument */
/* Size should be given as an argument */
if
(
args
!=
3
)
if
(
args
<
3
||
strcmp
(
third_arg
,
"-"
)
==
0
)
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
...
@@ -568,7 +589,7 @@ static int cnv_string_to_partype( char *string,
...
@@ -568,7 +589,7 @@ static int cnv_string_to_partype( char *string,
else
if
(
!
strcmp
(
string
,
"UNKNOWN"
))
else
if
(
!
strcmp
(
string
,
"UNKNOWN"
))
{
{
/* Size should be given as an argument */
/* Size should be given as an argument */
if
(
args
!=
3
)
if
(
args
<
3
||
strcmp
(
third_arg
,
"-"
)
==
0
)
return
CNV__SYNTAX
;
return
CNV__SYNTAX
;
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
nr
=
sscanf
(
third_arg
,
"%d"
,
size
);
...
@@ -646,6 +667,7 @@ static int cnv_GetConvTableFromClass(
...
@@ -646,6 +667,7 @@ static int cnv_GetConvTableFromClass(
char
*
attrname
;
char
*
attrname
;
int
add_size
;
int
add_size
;
int
size
;
int
size
;
int
offset
;
char
type
[
32
];
char
type
[
32
];
int
i
,
j
;
int
i
,
j
;
pwr_tStatus
sts
;
pwr_tStatus
sts
;
...
@@ -748,18 +770,25 @@ static int cnv_GetConvTableFromClass(
...
@@ -748,18 +770,25 @@ static int cnv_GetConvTableFromClass(
strcpy
(
(
*
convdef
)
->
Param
[
i
],
type
);
strcpy
(
(
*
convdef
)
->
Param
[
i
],
type
);
strcat
(
(
*
convdef
)
->
Param
[
i
],
" "
);
strcat
(
(
*
convdef
)
->
Param
[
i
],
" "
);
strcat
(
(
*
convdef
)
->
Param
[
i
],
attrname
);
strcat
(
(
*
convdef
)
->
Param
[
i
],
attrname
);
if
(
add_size
)
offset
=
parinfo
.
Offset
;
{
if
(
add_size
)
{
size
=
parinfo
.
Size
;
size
=
parinfo
.
Size
;
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" %d"
,
size
);
" %d"
,
size
);
}
}
else
{
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" -"
);
}
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" %d"
,
offset
);
i
++
;
i
++
;
}
}
else
else
{
{
for
(
j
=
0
;
j
<
(
int
)
parinfo
.
Elements
;
j
++
)
for
(
j
=
0
;
j
<
(
int
)
parinfo
.
Elements
;
j
++
)
{
{
offset
=
parinfo
.
Offset
+
j
*
parinfo
.
Size
/
parinfo
.
Elements
;
if
(
i
>=
param_size
)
if
(
i
>=
param_size
)
break
;
break
;
strcpy
(
(
*
convdef
)
->
Param
[
i
],
type
);
strcpy
(
(
*
convdef
)
->
Param
[
i
],
type
);
...
@@ -767,12 +796,17 @@ static int cnv_GetConvTableFromClass(
...
@@ -767,12 +796,17 @@ static int cnv_GetConvTableFromClass(
strcat
(
(
*
convdef
)
->
Param
[
i
],
attrname
);
strcat
(
(
*
convdef
)
->
Param
[
i
],
attrname
);
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
"[%d]"
,
j
);
"[%d]"
,
j
);
if
(
add_size
)
if
(
add_size
)
{
{
size
=
parinfo
.
Size
/
parinfo
.
Elements
;
size
=
parinfo
.
Size
/
parinfo
.
Elements
;
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" %d"
,
size
);
" %d"
,
size
);
}
}
else
{
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" -"
);
}
sprintf
(
(
*
convdef
)
->
Param
[
i
]
+
strlen
((
*
convdef
)
->
Param
[
i
]),
" %d"
,
offset
);
i
++
;
i
++
;
}
}
}
}
...
...
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