Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Blomdell
LabComm
Commits
11902762
Commit
11902762
authored
May 13, 2013
by
Anders Blomdell
Browse files
Various small tweaks.
parent
5fde48f3
Changes
6
Hide whitespace changes
Inline
Side-by-side
lib/Makefile
0 → 100644
View file @
11902762
all
:
cd
c
;
make
cd
csharp
;
make
cd
java
;
make
clean
:
cd
c
;
make clean
cd
csharp
;
make clean
cd
java
;
make clean
lib/c/Makefile
View file @
11902762
...
...
@@ -7,8 +7,8 @@ LDFLAGS = -L.
LDLIBS_TEST
=
-Tlabcomm
.linkscript
-lcunit
-llabcomm
OBJS
=
labcomm.o labcomm_dynamic_buffer_writer.o labcomm_fd_reader.o labcomm_fd_writer.o labcomm_mem_reader.o labcomm_mem_writer.o
LABCOMM
C_PATH
=
../../compiler
LABCOMM
C_JAR
=
$(LABCOMMC_PATH)
/labComm.jar
LABCOMM
_JAR
=
../../compiler
/labComm.jar
LABCOMM
=
java
-jar
$(LABCOMM_JAR)
TESTS
=
test_labcomm_basic_type_encoding test_labcomm_generated_encoding test_labcomm
#FIXME: test_labcomm_errors
...
...
@@ -33,7 +33,7 @@ endif
.PHONY
:
all run-test clean distclean
all
:
liblabcomm.a
test/test_labcomm_errors
all
:
liblabcomm.a
liblabcomm.a
:
$(OBJS)
ar
-r
liblabcomm.a
$^
...
...
@@ -68,19 +68,19 @@ $(TEST_DIR)/gen:
mkdir
-p
$@
$(TEST_DIR)/gen/%.c $(TEST_DIR)/gen/%.h
:
$(TEST_DIR)/%.lc | $(TEST_DIR)/gen
java
-jar
$(LABCOMM
C_JAR
)
\
$(LABCOMM)
\
--c
=
$(TEST_DIR)
/gen/
$*
.c
\
--h
=
$(TEST_DIR)
/gen/
$*
.h
\
$<
$(TEST_GEN_DIR)/%.c $(TEST_GEN_DIR)/%.h
:
$(TESTDATA_DIR)/%.lc
\
$(LABCOMM
C
_JAR) | $(TEST_GEN_DIR)
java
-jar
$(LABCOMM
C_JAR
)
\
$(LABCOMM_JAR) | $(TEST_GEN_DIR)
$(LABCOMM)
\
--c
=
$(
patsubst
%.h,%.c,
$@
)
--h
=
$(
patsubst
%.c,%.h,
$@
)
$<
$(LABCOMM
C
_JAR)
:
$(LABCOMM_JAR)
:
@
echo
"======Building LabComm compiler======"
cd
$(LABCOMM
C_PATH
)
;
ant jar
cd
$(
shell
dirname
$(LABCOMM
_JAR)
)
;
ant jar
@
echo
"======End building LabComm compiler======"
%.o
:
%.c %.h
...
...
lib/c/labcomm_fd_reader.c
View file @
11902762
...
...
@@ -16,6 +16,7 @@ int labcomm_fd_reader(
switch
(
action
)
{
case
labcomm_reader_alloc
:
{
#ifndef LABCOMM_FD_OMIT_VERSION
va_list
ap
;
va_start
(
ap
,
action
);
char
*
version
=
va_arg
(
ap
,
char
*
);
...
...
@@ -23,7 +24,7 @@ int labcomm_fd_reader(
read
(
*
fd
,
tmp
,
strlen
(
version
));
free
(
tmp
);
#endif
r
->
data
=
malloc
(
BUFFER_SIZE
);
if
(
r
->
data
)
{
r
->
data_size
=
BUFFER_SIZE
;
...
...
@@ -34,7 +35,9 @@ int labcomm_fd_reader(
}
r
->
count
=
0
;
r
->
pos
=
0
;
va_end
(
ap
);
#ifndef LABCOMM_FD_OMIT_VERSION
va_end
(
ap
);
#endif
}
break
;
case
labcomm_reader_start
:
case
labcomm_reader_continue
:
{
...
...
lib/c/labcomm_fd_writer.c
View file @
11902762
...
...
@@ -17,11 +17,13 @@ int labcomm_fd_writer(
switch
(
action
)
{
case
labcomm_writer_alloc
:
{
#ifndef LABCOMM_FD_OMIT_VERSION
va_list
ap
;
va_start
(
ap
,
action
);
char
*
version
=
va_arg
(
ap
,
char
*
);
write
(
*
fd
,
version
,
strlen
(
version
));
#endif
w
->
data
=
malloc
(
BUFFER_SIZE
);
if
(
!
w
->
data
)
{
result
=
-
ENOMEM
;
...
...
@@ -33,7 +35,9 @@ int labcomm_fd_writer(
w
->
count
=
BUFFER_SIZE
;
w
->
pos
=
0
;
}
#ifndef LABCOMM_FD_OMIT_VERSION
va_end
(
ap
);
#endif
}
break
;
case
labcomm_writer_free
:
{
free
(
w
->
data
);
...
...
lib/c/test/generated_encoding.lc
View file @
11902762
...
...
@@ -3,3 +3,5 @@ sample byte B;
sample struct {
int i;
} S1;
sample int I[_];
sample struct { int i; } P[_];
lib/java/Makefile
0 → 100644
View file @
11902762
MODULES
=
LabCommDispatcher
\
LabCommDecoderRegistry
\
LabComm
\
LabCommSample
\
LabCommHandler
\
LabCommEncoderRegistry
\
LabCommDecoder
\
LabCommType
\
LabCommEncoderChannel
\
LabCommEncoder
\
LabCommDecoderChannel
\
all
:
labcomm.jar
labcomm.jar
:
gen/JAVAC
echo
$@
cd
gen
;
jar cf ../
$@
se/lth/control/labcomm/
*
.class
gen
:
mkdir
gen
gen/JAVAC
:
$(MODULES:%=se/lth/control/labcomm/%.java) Makefile | gen
javac
-d
gen
$(
filter
%.java,
$^
)
touch
$@
clean
:
rm
-rf
labcomm.jar gen
Write
Preview
Supports
Markdown
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