Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
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
canghaiwuhen
OpenXG-RAN
Commits
497c64a9
Commit
497c64a9
authored
May 09, 2016
by
Cedric Roux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XY view
parent
8195e42d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
1 deletion
+119
-1
common/utils/T/tracer/view/Makefile
common/utils/T/tracer/view/Makefile
+1
-1
common/utils/T/tracer/view/view.h
common/utils/T/tracer/view/view.h
+2
-0
common/utils/T/tracer/view/xy.c
common/utils/T/tracer/view/xy.c
+116
-0
No files found.
common/utils/T/tracer/view/Makefile
View file @
497c64a9
CC
=
gcc
CFLAGS
=
-Wall
-g
-pthread
-I
..
OBJS
=
stdout.o textlist.o
OBJS
=
stdout.o textlist.o
xy.o
view.a
:
$(OBJS)
ar cr view.a
$(OBJS)
...
...
common/utils/T/tracer/view/view.h
View file @
497c64a9
...
...
@@ -13,5 +13,7 @@ typedef struct view {
view
*
new_view_stdout
(
void
);
view
*
new_view_textlist
(
int
maxsize
,
float
refresh_rate
,
gui
*
g
,
widget
*
w
);
view
*
new_view_xy
(
int
length
,
float
refresh_rate
,
gui
*
g
,
widget
*
w
,
int
color
);
#endif
/* _VIEW_H_ */
common/utils/T/tracer/view/xy.c
0 → 100644
View file @
497c64a9
#include "view.h"
#include "../utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <stdarg.h>
#include <string.h>
struct
xy
{
view
common
;
gui
*
g
;
widget
*
w
;
int
plot
;
float
refresh_rate
;
pthread_mutex_t
lock
;
int
length
;
float
*
x
;
float
*
y
;
int
insert_point
;
};
static
void
*
xy_thread
(
void
*
_this
)
{
struct
xy
*
this
=
_this
;
while
(
1
)
{
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
xy_plot_set_points
(
this
->
g
,
this
->
w
,
this
->
plot
,
this
->
length
,
this
->
x
,
this
->
y
);
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
sleepms
(
1000
/
this
->
refresh_rate
);
}
return
0
;
}
static
void
clear
(
view
*
this
)
{
/* TODO */
}
static
void
append
(
view
*
_this
,
float
*
x
,
float
*
y
,
int
length
)
{
struct
xy
*
this
=
(
struct
xy
*
)
_this
;
int
i
;
int
ip
;
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
ip
=
this
->
insert_point
;
/* TODO: optimize the copy */
for
(
i
=
0
;
i
<
length
;
i
++
)
{
this
->
x
[
ip
]
=
x
[
i
];
this
->
y
[
ip
]
=
y
[
i
];
ip
++
;
if
(
ip
==
this
->
length
)
ip
=
0
;
}
this
->
insert_point
=
ip
;
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
}
static
void
set
(
view
*
_this
,
char
*
name
,
...)
{
struct
xy
*
this
=
(
struct
xy
*
)
_this
;
va_list
ap
;
if
(
!
strcmp
(
name
,
"length"
))
{
if
(
pthread_mutex_lock
(
&
this
->
lock
))
abort
();
va_start
(
ap
,
name
);
free
(
this
->
x
);
free
(
this
->
y
);
this
->
length
=
va_arg
(
ap
,
int
);
this
->
x
=
calloc
(
sizeof
(
float
),
this
->
length
);
if
(
this
->
x
==
NULL
)
abort
();
this
->
y
=
calloc
(
sizeof
(
float
),
this
->
length
);
if
(
this
->
y
==
NULL
)
abort
();
this
->
insert_point
=
0
;
va_end
(
ap
);
if
(
pthread_mutex_unlock
(
&
this
->
lock
))
abort
();
return
;
}
printf
(
"%s:%d: unkown setting '%s'
\n
"
,
__FILE__
,
__LINE__
,
name
);
abort
();
}
view
*
new_view_xy
(
int
length
,
float
refresh_rate
,
gui
*
g
,
widget
*
w
,
int
color
)
{
struct
xy
*
ret
=
calloc
(
1
,
sizeof
(
struct
xy
));
if
(
ret
==
NULL
)
abort
();
ret
->
common
.
clear
=
clear
;
ret
->
common
.
append
=
(
void
(
*
)(
view
*
,
...))
append
;
ret
->
common
.
set
=
set
;
ret
->
refresh_rate
=
refresh_rate
;
ret
->
g
=
g
;
ret
->
w
=
w
;
ret
->
plot
=
xy_plot_new_plot
(
g
,
w
,
color
);
ret
->
length
=
length
;
ret
->
x
=
calloc
(
sizeof
(
float
),
length
);
if
(
ret
->
x
==
NULL
)
abort
();
ret
->
y
=
calloc
(
sizeof
(
float
),
length
);
if
(
ret
->
y
==
NULL
)
abort
();
ret
->
insert_point
=
0
;
if
(
pthread_mutex_init
(
&
ret
->
lock
,
NULL
))
abort
();
new_thread
(
xy_thread
,
ret
);
return
(
view
*
)
ret
;
}
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