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
1da30fe2
Commit
1da30fe2
authored
Sep 28, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master'
parents
1006a60b
a911da1b
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
168 additions
and
540 deletions
+168
-540
src/exe/rt_neth/src/rt_neth.c
src/exe/rt_neth/src/rt_neth.c
+5
-6
src/lib/co/src/co_array.c
src/lib/co/src/co_array.c
+28
-67
src/lib/co/src/co_array.h
src/lib/co/src/co_array.h
+36
-11
src/lib/dtt/src/dtt_rttsys.c
src/lib/dtt/src/dtt_rttsys.c
+24
-95
src/lib/rt/src/rt_gdh.c
src/lib/rt/src/rt_gdh.c
+15
-17
src/lib/rt/src/rt_rtt_command.c
src/lib/rt/src/rt_rtt_command.c
+24
-45
wb/lib/wb/qt/wb_foe_qt.cqt
wb/lib/wb/qt/wb_foe_qt.cqt
+1
-1
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
+2
-0
xtt/lib/cow/gtk/cow_xhelpnav_gtk.cpp
xtt/lib/cow/gtk/cow_xhelpnav_gtk.cpp
+0
-1
xtt/lib/cow/motif/cow_xhelpnav_motif.cpp
xtt/lib/cow/motif/cow_xhelpnav_motif.cpp
+0
-1
xtt/lib/cow/src/cow_xhelpnav.cpp
xtt/lib/cow/src/cow_xhelpnav.cpp
+1
-4
xtt/lib/flow/src/flow_con.cpp
xtt/lib/flow/src/flow_con.cpp
+12
-13
xtt/lib/flow/src/flow_utils.c
xtt/lib/flow/src/flow_utils.c
+0
-74
xtt/lib/flow/src/flow_utils.h
xtt/lib/flow/src/flow_utils.h
+0
-51
xtt/lib/ge/src/ge_subpalette.cpp
xtt/lib/ge/src/ge_subpalette.cpp
+5
-11
xtt/lib/glow/src/glow_con.cpp
xtt/lib/glow/src/glow_con.cpp
+14
-15
xtt/lib/glow/src/glow_utils.c
xtt/lib/glow/src/glow_utils.c
+0
-74
xtt/lib/glow/src/glow_utils.h
xtt/lib/glow/src/glow_utils.h
+0
-51
xtt/lib/xtt/src/xtt_xnav_help.cpp
xtt/lib/xtt/src/xtt_xnav_help.cpp
+1
-3
No files found.
src/exe/rt_neth/src/rt_neth.c
View file @
1da30fe2
...
...
@@ -1225,7 +1225,6 @@ static void classList(qcom_sGet* get)
int
i
;
pwr_tOid
oid
;
int
listcnt
;
array_tCtx
arr
;
pwr_tAttrRef
aref
;
gdb_ScopeLock
...
...
@@ -1239,14 +1238,14 @@ static void classList(qcom_sGet* get)
cdh_NodeIdToString
(
NULL
,
np
->
nid
,
0
,
0
));
}
array_
Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
array_
tCtx
arr
=
array_New
(
sizeof
(
pwr_tAttrRef
),
20
);
listcnt
=
0
;
if
(
mp
->
attrobjects
)
{
for
(
i
=
0
;
i
<
mp
->
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
mp
->
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
mp
->
cid
[
i
],
&
aref
,
&
aref
))
{
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
listcnt
++
;
}
}
...
...
@@ -1255,7 +1254,7 @@ static void classList(qcom_sGet* get)
for
(
sts
=
gdh_GetClassList
(
mp
->
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
listcnt
++
;
}
}
...
...
@@ -1279,10 +1278,10 @@ static void classList(qcom_sGet* get)
rmp
->
listcnt
=
0
;
}
else
{
rmp
->
listcnt
=
listcnt
;
memcpy
(
rmp
->
classlist
,
arr
->
a
,
listcnt
*
sizeof
(
pwr_tAttrRef
));
memcpy
(
rmp
->
classlist
,
arr
->
dat
a
,
listcnt
*
sizeof
(
pwr_tAttrRef
));
}
array_
Clos
e
(
arr
);
array_
Delet
e
(
arr
);
net_Reply
(
&
sts
,
get
,
&
put
,
0
);
}
src/lib/co/src/co_array.c
View file @
1da30fe2
...
...
@@ -38,90 +38,51 @@
#include "pwr.h"
#include "co_array.h"
#include "co_math.h"
int
array_Init
(
array_tCtx
*
ctx
,
int
elemsize
,
int
alloc_incr
)
array_tCtx
array_New
(
int
elemsize
,
int
alloc_incr
)
{
*
ctx
=
calloc
(
1
,
sizeof
(
array_sCtx
));
if
(
!
*
ctx
)
return
0
;
(
*
ctx
)
->
elemsize
=
elemsize
;
(
*
ctx
)
->
alloc_incr
=
alloc_incr
;
(
*
ctx
)
->
a
=
calloc
(
1
,
elemsize
*
alloc_incr
)
;
if
(
!
(
*
ctx
)
->
a
)
return
0
;
(
*
ctx
)
->
allocated
=
alloc_incr
;
return
1
;
array_tCtx
arr
=
calloc
(
1
,
sizeof
(
array_sCtx
));
if
(
!
arr
)
return
NULL
;
arr
->
data
=
calloc
(
1
,
elemsize
*
alloc_incr
)
;
if
(
!
arr
->
data
)
return
NULL
;
arr
->
elemsize
=
elemsize
;
arr
->
alloc_incr
=
alloc_incr
;
arr
->
capacity
=
alloc_incr
;
return
arr
;
}
void
array_
Close
(
array_tCtx
ctx
)
void
array_
Delete
(
array_tCtx
arr
)
{
free
((
char
*
)
ctx
->
a
);
free
((
char
*
)
ctx
);
free
((
char
*
)
arr
->
dat
a
);
free
((
char
*
)
arr
);
}
int
array_
Add
(
array_tCtx
ctx
,
void
*
elem
)
int
array_
Push
(
array_tCtx
arr
,
void
*
elem
)
{
if
(
ctx
->
allocated
<=
ctx
->
a_size
)
{
void
*
a_tmp
;
ctx
->
allocated
+=
ctx
->
alloc_incr
;
a_tmp
=
calloc
(
ctx
->
allocated
,
ctx
->
elemsize
);
if
(
!
a_tmp
)
return
0
;
memcpy
(
a_tmp
,
ctx
->
a
,
ctx
->
a_size
*
ctx
->
elemsize
);
free
((
char
*
)
ctx
->
a
);
ctx
->
a
=
a_tmp
;
}
memcpy
((
char
*
)
ctx
->
a
+
ctx
->
a_size
*
ctx
->
elemsize
,
elem
,
ctx
->
elemsize
);
ctx
->
a_size
++
;
return
1
;
return
array_Concat
(
arr
,
elem
,
1
);
}
int
array_
MAdd
(
array_tCtx
ctx
,
void
*
elem
,
int
elements
)
int
array_
Concat
(
array_tCtx
arr
,
void
*
elems
,
int
number
)
{
if
(
ctx
->
allocated
<=
ctx
->
a_size
+
elements
-
1
)
{
void
*
a_tmp
;
ctx
->
allocated
+=
ctx
->
alloc_incr
;
if
(
ctx
->
allocated
<
ctx
->
a_size
+
elements
)
ctx
->
allocated
=
ctx
->
a_size
+
elements
;
a_tmp
=
calloc
(
ctx
->
allocated
,
ctx
->
elemsize
);
if
(
arr
->
capacity
<=
arr
->
size
+
number
-
1
)
{
void
*
a_tmp
=
realloc
(
arr
->
data
,
arr
->
elemsize
*
MAX
(
arr
->
capacity
+
arr
->
alloc_incr
,
arr
->
size
+
number
));
if
(
!
a_tmp
)
return
0
;
memcpy
(
a_tmp
,
ctx
->
a
,
ctx
->
a_size
*
ctx
->
elemsize
);
free
((
char
*
)
ctx
->
a
);
ctx
->
a
=
a_tmp
;
arr
->
data
=
a_tmp
;
arr
->
capacity
=
number
;
}
memcpy
((
char
*
)
ctx
->
a
+
ctx
->
a_size
*
ctx
->
elemsize
,
elem
,
ctx
->
elemsize
*
elements
);
ctx
->
a_size
+=
elements
;
memcpy
((
char
*
)
arr
->
data
+
arr
->
size
*
arr
->
elemsize
,
elems
,
arr
->
elemsize
*
number
);
arr
->
size
+=
number
;
return
1
;
}
int
array_Get
(
array_tCtx
ctx
,
int
idx
,
void
**
elem
)
void
*
array_Copy
(
array_tCtx
arr
)
{
if
(
idx
>=
ctx
->
a_size
)
return
0
;
memcpy
(
elem
,
(
char
*
)
ctx
->
a
+
idx
*
ctx
->
elemsize
,
ctx
->
elemsize
);
return
1
;
}
int
array_Size
(
array_tCtx
ctx
)
{
return
ctx
->
a_size
;
}
void
*
array_Array
(
array_tCtx
ctx
)
{
return
ctx
->
a
;
}
void
*
array_CopyArray
(
array_tCtx
ctx
)
{
void
*
buf
;
buf
=
malloc
(
ctx
->
elemsize
*
ctx
->
a_size
);
memcpy
(
buf
,
ctx
->
a
,
ctx
->
a_size
*
ctx
->
elemsize
);
void
*
buf
=
malloc
(
arr
->
elemsize
*
arr
->
size
);
memcpy
(
buf
,
arr
->
data
,
arr
->
size
*
arr
->
elemsize
);
return
buf
;
}
src/lib/co/src/co_array.h
View file @
1da30fe2
...
...
@@ -45,22 +45,47 @@ extern "C" {
#include <stddef.h>
#endif
/*! \file co_array.h
\brief Dynamic-size array, like std::vector from C++ or ArrayList from Java.
*/
typedef
struct
{
void
*
a
;
void
*
dat
a
;
int
elemsize
;
int
allocated
;
int
capacity
;
int
alloc_incr
;
int
a_
size
;
int
size
;
}
array_sCtx
,
*
array_tCtx
;
int
array_Init
(
array_tCtx
*
ctx
,
int
elemsize
,
int
alloc_incr
);
void
array_Close
(
array_tCtx
ctx
);
int
array_Add
(
array_tCtx
ctx
,
void
*
elem
);
int
array_MAdd
(
array_tCtx
ctx
,
void
*
elem
,
int
elements
);
int
array_Get
(
array_tCtx
ctx
,
int
idx
,
void
**
elem
);
int
array_Size
(
array_tCtx
ctx
);
void
*
array_Array
(
array_tCtx
ctx
);
void
*
array_CopyArray
(
array_tCtx
ctx
);
/*! \fn array_tCtx array_New(int elemsize, int alloc_incr)
\brief Allocates a new dynamic array containing elements of size \a elemsize
\param elemsize The sizeof() an element.
\param alloc_incr How much the dynamic array should grow when it is full.
\return Returns a new dynamic array.
*/
array_tCtx
array_New
(
int
elemsize
,
int
alloc_incr
);
/*! \fn void array_Delete(array_tCtx arr)
\brief Frees the memory held by \a arr
*/
void
array_Delete
(
array_tCtx
arr
);
/*! \fn int array_Push(array_tCtx arr, void* elem)
\brief Appends \a elem to the end of the array.
*/
int
array_Push
(
array_tCtx
arr
,
void
*
elem
);
/*! \fn int array_Push(array_tCtx arr, void* elem)
\brief Concatenates \a number of elements from the fixed-size array
\a elems to the end of the dynamic array \a arr.
*/
int
array_Concat
(
array_tCtx
arr
,
void
*
elems
,
int
number
);
/*! \fn void* array_Copy(array_tCtx arr)
\brief Creates and returns a copy of \a arr.
Warning! The returned array must be free() explicitly.
*/
void
*
array_Copy
(
array_tCtx
arr
);
#ifdef __cplusplus
}
...
...
src/lib/dtt/src/dtt_rttsys.c
View file @
1da30fe2
...
...
@@ -192,8 +192,6 @@ static int logging_page = 0;
* prototypes____________________________________________________*/
static
int
rttsys_get_nodename
(
pwr_tNodeId
nid
,
char
*
nodename
);
static
int
rttsys_plclist_bubblesort
(
rttsys_t_plcpgm_list
*
plclist
,
int
size
);
static
int
rttsys_steplist_bubblesort
(
rttsys_t_step_list
*
steplist
,
int
size
);
static
int
rttsys_get_plcpgm
(
pwr_tObjid
initstep_objid
,
pwr_tObjid
*
plc_objid
);
static
int
rttsys_plclist_add
(
pwr_tObjid
plc_objid
,
rttsys_t_plcpgm_list
**
plclist
,
int
*
plclist_count
,
int
*
alloc
);
...
...
@@ -2096,71 +2094,22 @@ int RTTSYS_OBJECT_AV(menu_ctx ctx, int event, char* parameter_ptr,
#define GRAFCET_PAGESIZE 20
/*************************************************************************
*
* Name: rtt_menu_bubblesort()
*
* Type int
*
* Type Parameter IOGF Description
* rtt_t_menu *menulist I menulist.
*
* Description:
* This function sorts the items in a plclist in
* aphabetic order.
*
**************************************************************************/
static
int
rttsys_plclist_bubblesort
(
rttsys_t_plcpgm_list
*
plclist
,
int
size
)
static
int
rttsys_plclist_cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
int
i
,
j
;
char
*
str1
,
*
str2
;
rttsys_t_plcpgm_list
dum
;
rttsys_t_plcpgm_list
*
plclist_ptr
;
for
(
i
=
size
-
1
;
i
>
0
;
i
--
)
{
plclist_ptr
=
plclist
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
str1
=
plclist_ptr
->
name
;
str2
=
(
plclist_ptr
+
1
)
->
name
;
if
(
*
str2
==
0
)
break
;
if
(
strcmp
(
str1
,
str2
)
>
0
)
{
/* Change order */
memcpy
(
&
dum
,
plclist_ptr
+
1
,
sizeof
(
rttsys_t_plcpgm_list
));
memcpy
(
plclist_ptr
+
1
,
plclist_ptr
,
sizeof
(
rttsys_t_plcpgm_list
));
memcpy
(
plclist_ptr
,
&
dum
,
sizeof
(
rttsys_t_plcpgm_list
));
}
plclist_ptr
++
;
}
}
return
RTT__SUCCESS
;
char
*
str1
=
((
rttsys_t_plcpgm_list
*
)
p1
)
->
name
;
char
*
str2
=
((
rttsys_t_plcpgm_list
*
)
p2
)
->
name
;
if
(
*
str2
==
0
)
return
0
;
return
strcmp
(
str1
,
str2
);
}
static
int
rttsys_steplist_
bubblesort
(
rttsys_t_step_list
*
steplist
,
int
size
)
static
int
rttsys_steplist_
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
int
i
,
j
;
char
*
str1
,
*
str2
;
rttsys_t_step_list
dum
;
rttsys_t_step_list
*
steplist_ptr
;
for
(
i
=
size
-
1
;
i
>
0
;
i
--
)
{
steplist_ptr
=
steplist
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
str1
=
steplist_ptr
->
name
;
str2
=
(
steplist_ptr
+
1
)
->
name
;
if
(
*
str2
==
0
)
break
;
if
(
strcmp
(
str1
,
str2
)
>
0
)
{
/* Change order */
memcpy
(
&
dum
,
steplist_ptr
+
1
,
sizeof
(
rttsys_t_step_list
));
memcpy
(
steplist_ptr
+
1
,
steplist_ptr
,
sizeof
(
rttsys_t_step_list
));
memcpy
(
steplist_ptr
,
&
dum
,
sizeof
(
rttsys_t_step_list
));
}
steplist_ptr
++
;
}
}
return
RTT__SUCCESS
;
char
*
str1
=
((
rttsys_t_step_list
*
)
p1
)
->
name
;
char
*
str2
=
((
rttsys_t_step_list
*
)
p2
)
->
name
;
if
(
*
str2
==
0
)
return
0
;
return
strcmp
(
str1
,
str2
);
}
static
int
rttsys_get_plcpgm
(
pwr_tObjid
initstep_objid
,
pwr_tObjid
*
plc_objid
)
...
...
@@ -2428,7 +2377,7 @@ int RTTSYS_GRAFCET(menu_ctx ctx, int event, char* parameter_ptr,
sts
=
gdh_GetNextObject
(
initstep_objid
,
&
initstep_objid
);
}
rttsys_plclist_bubblesort
(
plclist
,
plclist_count
);
qsort
(
plclist
,
plclist_count
,
sizeof
(
rttsys_t_plcpgm_list
),
rttsys_plclist_cmp
);
menulist
=
(
rtt_t_menu_upd
*
)
ctx
->
menu
;
menu_ptr
=
menulist
;
for
(
i
=
grafcet_page
*
GRAFCET_PAGESIZE
;
...
...
@@ -2761,8 +2710,8 @@ int RTTSYS_GRAFCET_PLC(menu_ctx ctx, int event, char* parameter_ptr,
&
plclist_ptr
->
order_alloc
,
(
void
*
)
pwr_cClass_order
,
0
);
if
(
EVEN
(
sts
))
return
sts
;
rttsys_steplist_bubblesort
(
plclist_ptr
->
steps
,
plclist_ptr
->
step_count
);
rttsys_steplist_bubblesort
(
plclist_ptr
->
orders
,
plclist_ptr
->
order_count
);
qsort
(
plclist_ptr
->
steps
,
plclist_ptr
->
step_count
,
sizeof
(
rttsys_t_step_list
),
rttsys_steplist_cmp
);
qsort
(
plclist_ptr
->
orders
,
plclist_ptr
->
order_count
,
sizeof
(
rttsys_t_step_list
),
rttsys_steplist_cmp
);
i
=
0
;
/* Print the plcname in line 1, just show the segment name */
...
...
@@ -2999,7 +2948,7 @@ int RTTSYS_PLCPGM(menu_ctx ctx, int event, char* parameter_ptr,
if
(
EVEN
(
sts
))
return
sts
;
rttsys_steplist_bubblesort
(
plclist
,
plclist_count
);
qsort
(
plclist
,
plclist_count
,
sizeof
(
rttsys_t_step_list
),
rttsys_steplist_cmp
);
menulist
=
(
rtt_t_menu_upd
*
)
ctx
->
menu
;
menu_ptr
=
menulist
;
plclist_ptr
=
plclist
;
...
...
@@ -3362,7 +3311,7 @@ int RTTSYS_PLCTHREAD(menu_ctx ctx, int event, char* parameter_ptr,
return
sts
;
rttsys_objectlist_modname
(
objectlist
,
objectlist_count
);
rttsys_steplist_bubblesort
(
objectlist
,
objectlist_count
);
qsort
(
objectlist
,
objectlist_count
,
sizeof
(
rttsys_t_step_list
),
rttsys_steplist_cmp
);
rttsys_thread_update
(
ctx
,
objectlist
,
objectlist_count
,
page
);
THREAD_MAXPAGE
=
MAX
(
1
,
(
objectlist_count
-
1
)
/
THREAD_PAGESIZE
+
1
);
...
...
@@ -3624,8 +3573,6 @@ int RTTSYS_PID(menu_ctx ctx, int event, char* parameter_ptr, char* objectname,
objectlist_count
/=
2
;
rttsys_objectlist_modname_plc
(
objectlist
,
objectlist_count
);
/* rttsys_steplist_bubblesort( objectlist, objectlist_count);
*/
rttsys_pid_update
(
ctx
,
objectlist
,
objectlist_count
,
page
);
PID_MAXPAGE
=
MAX
(
1
,
(
objectlist_count
-
1
)
/
PID_PAGESIZE
+
1
);
}
...
...
@@ -4718,30 +4665,13 @@ static int rttsys_cell_dataobject(menu_ctx ctx, pwr_tObjid cell_objid,
return
RTT__SUCCESS
;
}
static
int
rttsys_cellist_
bubblesort
(
rttsys_t_cell_list
*
cellist
,
int
size
)
static
int
rttsys_cellist_
cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
int
i
,
j
;
char
*
str1
,
*
str2
;
rttsys_t_cell_list
dum
;
rttsys_t_cell_list
*
cellist_ptr
;
for
(
i
=
size
-
1
;
i
>
0
;
i
--
)
{
cellist_ptr
=
cellist
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
str1
=
cellist_ptr
->
name
;
str2
=
(
cellist_ptr
+
1
)
->
name
;
if
(
*
str2
==
0
)
break
;
if
(
strcmp
(
str1
,
str2
)
>
0
)
{
/* Change order */
memcpy
(
&
dum
,
cellist_ptr
+
1
,
sizeof
(
rttsys_t_cell_list
));
memcpy
(
cellist_ptr
+
1
,
cellist_ptr
,
sizeof
(
rttsys_t_cell_list
));
memcpy
(
cellist_ptr
,
&
dum
,
sizeof
(
rttsys_t_cell_list
));
}
cellist_ptr
++
;
}
}
return
RTT__SUCCESS
;
char
*
str1
=
((
rttsys_t_cell_list
*
)
p1
)
->
name
;
char
*
str2
=
((
rttsys_t_cell_list
*
)
p2
)
->
name
;
if
(
*
str2
==
0
)
return
0
;
return
strcmp
(
str1
,
str2
);
}
#define NMPSCELL_PAGESIZE 19
...
...
@@ -4815,8 +4745,7 @@ int RTTSYS_NMPSCELL(menu_ctx ctx, int event, char* parameter_ptr,
if
(
EVEN
(
sts
))
return
sts
;
rttsys_cellist_bubblesort
(
cellist
,
cellist_count
);
qsort
(
cellist
,
cellist_count
,
sizeof
(
rttsys_t_cell_list
),
rttsys_cellist_cmp
);
}
/**********************************************************
* Exit of the picture
...
...
src/lib/rt/src/rt_gdh.c
View file @
1da30fe2
...
...
@@ -5153,21 +5153,20 @@ pwr_tStatus gdh_GetGlobalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
pwr_tStatus
sts
;
qcom_sNode
mynode
,
node
;
pwr_tNid
nid
;
array_tCtx
arr
;
pwr_tAttrRef
*
clist
;
int
ccnt
;
int
i
;
pwr_tObjid
oid
;
pwr_tAttrRef
aref
;
array_
Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
array_
tCtx
arr
=
array_New
(
sizeof
(
pwr_tAttrRef
),
20
);
/* Add local objects */
if
(
attrobjects
)
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
cid
[
i
],
&
aref
,
&
aref
))
{
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
}
}
}
else
{
...
...
@@ -5175,7 +5174,7 @@ pwr_tStatus gdh_GetGlobalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
for
(
sts
=
gdh_GetClassList
(
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
}
}
}
...
...
@@ -5189,18 +5188,18 @@ pwr_tStatus gdh_GetGlobalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
if
(
EVEN
(
sts
))
continue
;
array_
MAdd
(
arr
,
clist
,
ccnt
);
array_
Concat
(
arr
,
clist
,
ccnt
);
}
if
(
arr
ay_Size
(
arr
)
)
*
classlist
=
array_Copy
Array
(
arr
);
if
(
arr
->
size
)
*
classlist
=
array_Copy
(
arr
);
else
{
*
classlist
=
0
;
sts
=
GDH__NOSUCHOBJ
;
}
*
listcnt
=
arr
ay_Size
(
arr
)
;
*
listcnt
=
arr
->
size
;
array_
Clos
e
(
arr
);
array_
Delet
e
(
arr
);
return
GDH__SUCCESS
;
}
...
...
@@ -5208,19 +5207,18 @@ pwr_tStatus gdh_GetLocalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
pwr_tAttrRef
*
classlist
[],
int
*
listcnt
)
{
pwr_tStatus
sts
;
array_tCtx
arr
;
int
i
;
pwr_tObjid
oid
;
pwr_tAttrRef
aref
;
array_
Init
(
&
arr
,
sizeof
(
pwr_tAttrRef
),
20
);
array_
tCtx
arr
=
array_New
(
sizeof
(
pwr_tAttrRef
),
20
);
/* Add local objects */
if
(
attrobjects
)
{
for
(
i
=
0
;
i
<
cidcnt
;
i
++
)
{
for
(
sts
=
gdh_GetClassListAttrRef
(
cid
[
i
],
&
aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
cid
[
i
],
&
aref
,
&
aref
))
{
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
}
}
}
else
{
...
...
@@ -5228,20 +5226,20 @@ pwr_tStatus gdh_GetLocalClassList(int cidcnt, pwr_tCid* cid, int attrobjects,
for
(
sts
=
gdh_GetClassList
(
cid
[
i
],
&
oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
oid
,
&
oid
))
{
aref
=
cdh_ObjidToAref
(
oid
);
array_
Add
(
arr
,
&
aref
);
array_
Push
(
arr
,
&
aref
);
}
}
}
if
(
arr
ay_Size
(
arr
)
)
*
classlist
=
array_Copy
Array
(
arr
);
if
(
arr
->
size
)
*
classlist
=
array_Copy
(
arr
);
else
{
*
classlist
=
0
;
sts
=
GDH__NOSUCHOBJ
;
}
*
listcnt
=
arr
ay_Size
(
arr
)
;
*
listcnt
=
arr
->
size
;
array_
Clos
e
(
arr
);
array_
Delet
e
(
arr
);
return
GDH__SUCCESS
;
}
...
...
src/lib/rt/src/rt_rtt_command.c
View file @
1da30fe2
...
...
@@ -6138,36 +6138,25 @@ int rtt_menu_classort(rtt_t_menu* menulist, int redo)
*
**************************************************************************/
int
rtt_menu_bubblesort
(
rtt_t_menu
*
menulist
)
static
int
rtt_menu_cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
int
i
,
j
,
size
;
char
*
str1
,
*
str2
;
rtt_t_menu
dum
;
rtt_t_menu
*
menu_ptr
;
char
*
str1
=
((
rtt_t_menu
*
)
p1
)
->
text
;
char
*
str2
=
((
rtt_t_menu
*
)
p2
)
->
text
;
if
(
*
str2
==
0
)
return
0
;
return
strcmp
(
str1
,
str2
);
}
int
rtt_menu_bubblesort
(
rtt_t_menu
*
menulist
)
{
/* Get the size of the menu */
menu_ptr
=
menulist
;
size
=
0
;
rtt_t_menu
*
menu_ptr
=
menulist
;
int
size
=
0
;
while
(
menu_ptr
->
text
[
0
]
!=
0
)
{
menu_ptr
++
;
size
++
;
}
for
(
i
=
size
-
1
;
i
>
0
;
i
--
)
{
menu_ptr
=
menulist
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
str1
=
menu_ptr
->
text
;
str2
=
(
menu_ptr
+
1
)
->
text
;
if
(
*
str2
==
0
)
break
;
if
(
strcmp
(
str1
,
str2
)
>
0
)
{
memcpy
(
&
dum
,
menu_ptr
+
1
,
sizeof
(
rtt_t_menu
));
memcpy
(
menu_ptr
+
1
,
menu_ptr
,
sizeof
(
rtt_t_menu
));
memcpy
(
menu_ptr
,
&
dum
,
sizeof
(
rtt_t_menu
));
}
menu_ptr
++
;
}
}
qsort
(
menulist
,
size
,
sizeof
(
rtt_t_menu
),
rtt_menu_cmp
);
return
RTT__SUCCESS
;
}
...
...
@@ -6186,35 +6175,25 @@ int rtt_menu_bubblesort(rtt_t_menu* menulist)
*
**************************************************************************/
int
rtt_menu_upd_bubblesort
(
rtt_t_menu_upd
*
menulist
)
static
int
rtt_menu_upd_cmp
(
const
void
*
p1
,
const
void
*
p2
)
{
int
i
,
j
,
size
;
char
*
str1
,
*
str2
;
rtt_t_menu_upd
dum
;
rtt_t_menu_upd
*
menu_ptr
;
char
*
str1
=
((
rtt_t_menu_upd
*
)
p1
)
->
text
;
char
*
str2
=
((
rtt_t_menu_upd
*
)
p2
)
->
text
;
if
(
*
str2
==
0
)
return
0
;
return
strcmp
(
str1
,
str2
);
}
int
rtt_menu_upd_bubblesort
(
rtt_t_menu_upd
*
menulist
)
{
/* Get the size of the menu */
menu_ptr
=
menulist
;
size
=
0
;
rtt_t_menu_upd
*
menu_ptr
=
menulist
;
int
size
=
0
;
while
(
menu_ptr
->
text
[
0
]
!=
0
)
{
menu_ptr
++
;
size
++
;
}
for
(
i
=
size
-
1
;
i
>
0
;
i
--
)
{
menu_ptr
=
menulist
;
for
(
j
=
0
;
j
<
i
;
j
++
)
{
str1
=
menu_ptr
->
text
;
str2
=
(
menu_ptr
+
1
)
->
text
;
if
(
*
str2
==
0
)
break
;
if
(
strcmp
(
str1
,
str2
)
>
0
)
{
memcpy
(
&
dum
,
menu_ptr
+
1
,
sizeof
(
rtt_t_menu_upd
));
memcpy
(
menu_ptr
+
1
,
menu_ptr
,
sizeof
(
rtt_t_menu_upd
));
memcpy
(
menu_ptr
,
&
dum
,
sizeof
(
rtt_t_menu_upd
));
}
menu_ptr
++
;
}
}
qsort
(
menulist
,
size
,
sizeof
(
rtt_t_menu_upd
),
rtt_menu_upd_cmp
);
return
RTT__SUCCESS
;
}
...
...
wb/lib/wb/qt/wb_foe_qt.cqt
View file @
1da30fe2
...
...
@@ -994,7 +994,7 @@ pwr_tStatus WFoeQt::create_window(int x_top, int y_top, int width_adb,
"$pwr_exe/foe_redraw.png");
// Feedback connection checkbutton
tools_confeedback = addCheckableToolItem(toplevel, tools, "
Redraw
",
tools_confeedback = addCheckableToolItem(toplevel, tools, "
Feedback connection
",
SLOT(activate_confeedback(bool)), "$pwr_exe/foe_confeedback.png");
// Singlelinetext button
...
...
xtt/exe/rt_xtt/qt/rt_xtt_qt.cqt
View file @
1da30fe2
...
...
@@ -729,6 +729,8 @@ XttQt::XttQt(int argc, char* argv[], int* return_sts)
statusbar->show();
wow = new CoWowQt(toplevel);
xnav = new XNavQt(this, xnav_form, "Plant", &brow_widget,
(xnav_sStartMenu*)root_menu, opplace_str, op_close_button, &sts);
xnav->message_cb = &xtt_message_cb;
...
...
xtt/lib/cow/gtk/cow_xhelpnav_gtk.cpp
View file @
1da30fe2
...
...
@@ -44,7 +44,6 @@
#include "cow_xhelpnav_gtk.h"
#include "flow_browwidget_gtk.h"
#include "flow_utils.h"
extern
"C"
{
#include "co_api.h"
...
...
xtt/lib/cow/motif/cow_xhelpnav_motif.cpp
View file @
1da30fe2
...
...
@@ -56,7 +56,6 @@
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "flow_browwidget_motif.h"
#include "flow_utils.h"
#include "cow_xhelpnav_motif.h"
...
...
xtt/lib/cow/src/cow_xhelpnav.cpp
View file @
1da30fe2
...
...
@@ -44,8 +44,6 @@
#include "cow_xhelpnav.h"
#include "flow_utils.h"
#include "xnav_bitmap_morehelp8.h"
#include "xnav_bitmap_morehelp10.h"
#include "xnav_bitmap_morehelp12.h"
...
...
@@ -1399,8 +1397,7 @@ int CoXHelpNav::help_index(
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
flow_qsort
(
&
object_list
[
2
],
object_cnt
-
2
,
sizeof
(
object_list
[
0
]),
help_cmp_items
);
qsort
(
&
object_list
[
2
],
object_cnt
-
2
,
sizeof
(
object_list
[
0
]),
help_cmp_items
);
brow_ResetNodraw
(
brow
->
ctx
);
brow_Redraw
(
brow
->
ctx
,
0
);
...
...
xtt/lib/flow/src/flow_con.cpp
View file @
1da30fe2
...
...
@@ -45,7 +45,6 @@
#include "flow_conpoint.h"
#include "flow_draw.h"
#include "flow_text.h"
#include "flow_utils.h"
#include "flow_msg.h"
#define LINE_TABLE_SIZE 500
...
...
@@ -2033,33 +2032,33 @@ int FlowCon::sort_lines(double dest_x, double dest_y, flow_eDirection dest_dir,
sort_dest
=
dest_node
;
if
(
dest_dir
==
flow_eDirection_Right
&&
src_dir
==
flow_eDirection_Left
&&
src_x
>
dest_x
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
flow_eDirection_Right
&&
src_dir
==
flow_eDirection_Left
&&
src_x
<=
dest_x
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h3
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h3
);
ideal_line_cnt
=
5
;
}
else
if
(
dest_dir
==
flow_eDirection_Left
&&
src_dir
==
flow_eDirection_Right
&&
src_x
<
dest_x
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
flow_eDirection_Left
&&
src_dir
==
flow_eDirection_Right
&&
src_x
>
dest_x
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h2
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h2
);
ideal_line_cnt
=
5
;
}
else
if
(
dest_dir
==
flow_eDirection_Right
&&
src_dir
==
flow_eDirection_Right
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
flow_eDirection_Left
&&
src_dir
==
flow_eDirection_Left
)
{
flow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
flow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
...
...
xtt/lib/flow/src/flow_utils.c
deleted
100644 → 0
View file @
1006a60b
/**
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include <stdlib.h>
#include "flow_utils.h"
static
void
qsort_swp
(
int
,
char
*
,
char
*
);
void
flow_qsort
(
void
*
basearg
,
size_t
nel
,
size_t
width
,
int
(
*
compar
)(
const
void
*
,
const
void
*
))
{
int
gap
,
ngap
,
i
,
j
;
int
t1
,
t2
;
char
*
jd
;
char
*
base
=
basearg
;
t1
=
nel
*
width
;
for
(
ngap
=
nel
/
2
;
ngap
>
0
;
ngap
=
ngap
/
2
)
{
gap
=
ngap
*
width
;
t2
=
gap
+
width
;
jd
=
base
+
gap
;
for
(
i
=
t2
;
i
<=
t1
;
i
+=
width
)
for
(
j
=
i
-
t2
;
j
>=
0
;
j
-=
gap
)
{
if
((
*
compar
)(
base
+
j
,
jd
+
j
)
<=
0
)
break
;
qsort_swp
(
width
,
base
+
j
,
jd
+
j
);
}
}
}
static
void
qsort_swp
(
int
w
,
char
*
a
,
char
*
b
)
{
char
tmp
;
while
(
w
--
)
{
tmp
=
*
a
;
*
a
++
=
*
b
;
*
b
++
=
tmp
;
}
}
xtt/lib/flow/src/flow_utils.h
deleted
100644 → 0
View file @
1006a60b
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef flow_utils_h
#define flow_utils_h
#if defined __cplusplus
extern
"C"
{
#endif
void
flow_qsort
(
void
*
basearg
,
size_t
nel
,
size_t
width
,
int
(
*
compar
)(
const
void
*
,
const
void
*
));
#if defined __cplusplus
}
#endif
#endif
xtt/lib/ge/src/ge_subpalette.cpp
View file @
1da30fe2
...
...
@@ -36,6 +36,8 @@
#include <stdlib.h>
#include <algorithm>
#include "pwr_baseclasses.h"
#include "co_cdh.h"
...
...
@@ -309,17 +311,9 @@ public:
pwr_tFileName
name
;
};
void
subpalette_sort
(
std
::
vector
<
LocalFile
>&
fvect
)
int
subpalette_cmp
(
LocalFile
p1
,
LocalFile
p2
)
{
for
(
int
i
=
fvect
.
size
()
-
1
;
i
>
0
;
i
--
)
{
for
(
int
j
=
0
;
j
<
i
;
j
++
)
{
if
(
strcmp
(
fvect
[
i
].
name
,
fvect
[
j
].
name
)
<
0
)
{
LocalFile
tmp
=
fvect
[
i
];
fvect
[
i
]
=
fvect
[
j
];
fvect
[
j
]
=
tmp
;
}
}
}
return
strcmp
(
p1
.
name
,
p2
.
name
);
}
//
...
...
@@ -1386,7 +1380,7 @@ int ItemLocalSubGraphs::open_children(
dcli_search_file
(
fname
,
found_file
,
DCLI_DIR_SEARCH_END
);
}
s
ubpalette_sort
(
fvect
);
s
td
::
sort
(
fvect
.
begin
(),
fvect
.
end
(),
subpalette_cmp
);
for
(
i
=
0
;
i
<
(
int
)
fvect
.
size
();
i
++
)
{
dcli_parse_filename
(
fvect
[
i
].
name
,
dev
,
dir
,
file
,
type
,
&
version
);
...
...
xtt/lib/glow/src/glow_con.cpp
View file @
1da30fe2
...
...
@@ -44,7 +44,6 @@
#include "glow_conpoint.h"
#include "glow_draw.h"
#include "glow_text.h"
#include "glow_utils.h"
#include "glow_growgroup.h"
#include "glow_growconglue.h"
#include "glow_msg.h"
...
...
@@ -119,12 +118,12 @@ GlowCon::GlowCon( GrowCtx *glow_ctx, const char *name, GlowConClass *con_class,
GlowNode *source, GlowNode *dest, int source_cp, int dest_cp) :
ctx(glow_ctx), cc(con_class),
source_node(source), dest_node(dest), source_conpoint(source_cp),
dest_conpoint(dest_cp), p_num(0), l_num(0), a_num(0), line_a(10,10),
dest_conpoint(dest_cp), p_num(0), l_num(0), a_num(0), line_a(10,10),
arc_a(10,10), hot(0), highlight(0), arrow_num(0), arrow_a(1,1),
ref_num(0), ref_a(4,4), temporary_ref(0), trace_p(NULL), border(0), shadow(0)
{
double x1, y1, x2, y2;
GlowLine *l1;
GlowLine *l1;
if ( !cc)
return;
...
...
@@ -2078,33 +2077,33 @@ int GlowCon::sort_lines(double dest_x, double dest_y, glow_eDirection dest_dir,
sort_dest
=
dest_node
;
if
(
dest_dir
==
glow_eDirection_Right
&&
src_dir
==
glow_eDirection_Left
&&
src_x
>
dest_x
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
glow_eDirection_Right
&&
src_dir
==
glow_eDirection_Left
&&
src_x
<=
dest_x
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h3
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h3
);
ideal_line_cnt
=
5
;
}
else
if
(
dest_dir
==
glow_eDirection_Left
&&
src_dir
==
glow_eDirection_Right
&&
src_x
<
dest_x
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
glow_eDirection_Left
&&
src_dir
==
glow_eDirection_Right
&&
src_x
>
dest_x
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h2
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h2
);
ideal_line_cnt
=
5
;
}
else
if
(
dest_dir
==
glow_eDirection_Right
&&
src_dir
==
glow_eDirection_Right
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v1
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
else
if
(
dest_dir
==
glow_eDirection_Left
&&
src_dir
==
glow_eDirection_Left
)
{
glow_
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
glow_
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
qsort
(
vert_line
,
vert_line_cnt
,
sizeof
(
vert_line
[
0
]),
con_cmp_v2
);
qsort
(
horiz_line
,
horiz_line_cnt
,
sizeof
(
horiz_line
[
0
]),
con_cmp_h1
);
ideal_line_cnt
=
3
;
}
...
...
xtt/lib/glow/src/glow_utils.c
deleted
100644 → 0
View file @
1006a60b
/**
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#include <stdlib.h>
#include "glow_utils.h"
static
void
qsort_swp
(
int
,
char
*
,
char
*
);
void
glow_qsort
(
void
*
basearg
,
size_t
nel
,
size_t
width
,
int
(
*
compar
)(
const
void
*
,
const
void
*
))
{
int
gap
,
ngap
,
i
,
j
;
int
t1
,
t2
;
char
*
jd
;
char
*
base
=
basearg
;
t1
=
nel
*
width
;
for
(
ngap
=
nel
/
2
;
ngap
>
0
;
ngap
=
ngap
/
2
)
{
gap
=
ngap
*
width
;
t2
=
gap
+
width
;
jd
=
base
+
gap
;
for
(
i
=
t2
;
i
<=
t1
;
i
+=
width
)
for
(
j
=
i
-
t2
;
j
>=
0
;
j
-=
gap
)
{
if
((
*
compar
)(
base
+
j
,
jd
+
j
)
<=
0
)
break
;
qsort_swp
(
width
,
base
+
j
,
jd
+
j
);
}
}
}
static
void
qsort_swp
(
int
w
,
char
*
a
,
char
*
b
)
{
char
tmp
;
while
(
w
--
)
{
tmp
=
*
a
;
*
a
++
=
*
b
;
*
b
++
=
tmp
;
}
}
xtt/lib/glow/src/glow_utils.h
deleted
100644 → 0
View file @
1006a60b
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef glow_utils_h
#define glow_utils_h
#if defined __cplusplus
extern
"C"
{
#endif
void
glow_qsort
(
void
*
basearg
,
size_t
nel
,
size_t
width
,
int
(
*
compar
)(
const
void
*
,
const
void
*
));
#if defined __cplusplus
}
#endif
#endif
xtt/lib/xtt/src/xtt_xnav_help.cpp
View file @
1da30fe2
...
...
@@ -47,8 +47,6 @@
#include "co_dcli_msg.h"
#include "co_string.h"
#include "flow_utils.h"
#include "xtt_item.h"
#include "xtt_trace.h"
#include "xtt_xnav_crr.h"
...
...
@@ -182,7 +180,7 @@ int XNav::help_index(navh_eHelpFile file_type, char* file_name, int pop)
sts
=
navhelp
->
help_index
(
file_type
,
file_name
);
brow_GetObjectList
(
brow
->
ctx
,
&
object_list
,
&
object_cnt
);
flow_
qsort
(
qsort
(
&
object_list
[
2
],
object_cnt
-
2
,
sizeof
(
object_list
[
0
]),
help_cmp_items
);
brow_ResetNodraw
(
brow
->
ctx
);
...
...
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