Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
easea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Arnaud Kress
easea
Commits
0fd78b8f
Commit
0fd78b8f
authored
Feb 07, 2011
by
Frédéric Krüger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correction Makefile et bug serialisation/deserialisation
parent
799c1961
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
37 deletions
+89
-37
EaseaSym.cpp
EaseaSym.cpp
+81
-29
Makefile
Makefile
+8
-8
No files found.
EaseaSym.cpp
View file @
0fd78b8f
...
...
@@ -192,12 +192,25 @@ void CSymbol::print(FILE *fp){
pSymbolList
->
reset
();
while
(
pSym
=
pSymbolList
->
walkToNextItem
()){
if
((
pSym
->
Object
->
pType
->
ObjectType
==
oUserClass
)){
fprintf
(
fpOutputFile
,
"
\t
if(this->%s != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line << this->%s->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
if
(
pSym
->
Object
->
ObjectType
==
oArrayPointer
){
fprintf
(
fp
,
"
\t
for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++){
\n
"
,(
int
)(
pSym
->
Object
->
nSize
/
sizeof
(
char
*
)));
fprintf
(
fpOutputFile
,
"
\t\t
if(this->%s[EASEA_Ndx] != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line << this->%s[EASEA_Ndx]->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"}
\n
"
);
}
else
{
fprintf
(
fpOutputFile
,
"
\t
if(this->%s != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line << this->%s->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
}
}
else
{
if
(
pSym
->
Object
->
ObjectType
==
oObject
){
...
...
@@ -217,13 +230,26 @@ void CSymbol::print(FILE *fp){
pSymbolList
->
reset
();
while
(
pSym
=
pSymbolList
->
walkToNextItem
()){
if
((
pSym
->
Object
->
pType
->
ObjectType
==
oUserClass
)){
fprintf
(
fpOutputFile
,
"
\t
(*EASEA_Line) >> line;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = new %s;
\n
"
,
pSym
->
Object
->
sName
,
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s->deserializer(EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
if
(
pSym
->
Object
->
ObjectType
==
oArrayPointer
){
fprintf
(
fp
,
"
\t
for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++){
\n
"
,(
int
)(
pSym
->
Object
->
nSize
/
sizeof
(
char
*
)));
fprintf
(
fpOutputFile
,
"
\t\t
(*EASEA_Line) >> line;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx] = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx] = new %s;
\n
"
,
pSym
->
Object
->
sName
,
pSym
->
Object
->
pType
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx]->deserializer(EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
}"
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
}
else
{
fprintf
(
fpOutputFile
,
"
\t
(*EASEA_Line) >> line;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = new %s;
\n
"
,
pSym
->
Object
->
sName
,
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s->deserializer(EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
}
}
else
{
if
(
pSym
->
Object
->
ObjectType
==
oObject
){
...
...
@@ -382,13 +408,26 @@ void CSymbol::serializeIndividual(FILE *fp, char* sCompleteName){
strcpy
(
sNewCompleteName
,
sCompleteName
);
while
(
pSym
=
pSymbolList
->
walkToNextItem
()){
if
((
pSym
->
Object
->
pType
->
ObjectType
==
oUserClass
)){
fprintf
(
fpOutputFile
,
"
\t
if(this->%s != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line << this->%s->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
}
if
(
pSym
->
Object
->
ObjectType
==
oArrayPointer
){
fprintf
(
fp
,
"
\t
for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++){
\n
"
,(
int
)(
pSym
->
Object
->
nSize
/
sizeof
(
char
*
)));
fprintf
(
fpOutputFile
,
"
\t\t
if(this->%s[EASEA_Ndx] != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line << this->%s[EASEA_Ndx]->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"}
\n
"
);
}
else
{
fprintf
(
fpOutputFile
,
"
\t
if(this->%s != NULL){
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"\\
a
\"
;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line << this->%s->serializer() <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
else
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
EASEA_Line <<
\"
NULL
\"
<<
\"
\"
;
\n
"
);
}
}
else
{
if
(
pSym
->
Object
->
ObjectType
==
oObject
){
fprintf
(
fpOutputFile
,
"
\t
EASEA_Line << this->%s <<
\"
\"
;
\n
"
,
pSym
->
Object
->
sName
);
...
...
@@ -406,14 +445,27 @@ void CSymbol::deserializeIndividual(FILE *fp, char* sCompleteName){
pSymbolList
->
reset
();
while
(
pSym
=
pSymbolList
->
walkToNextItem
()){
if
((
pSym
->
Object
->
pType
->
ObjectType
==
oUserClass
)){
fprintf
(
fpOutputFile
,
"
\t
EASEA_Line >> line;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = new %s;
\n
"
,
pSym
->
Object
->
sName
,
pSym
->
Object
->
pType
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s->deserializer(&EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
}
if
(
pSym
->
Object
->
ObjectType
==
oArrayPointer
){
fprintf
(
fpOutputFile
,
"
\t
EASEA_Line >> line;
\n
"
);
fprintf
(
fp
,
"
\t
for(int EASEA_Ndx=0; EASEA_Ndx<%d; EASEA_Ndx++){
\n
"
,(
int
)(
pSym
->
Object
->
nSize
/
sizeof
(
char
*
)));
fprintf
(
fpOutputFile
,
"
\t\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx] = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx] = new %s;
\n
"
,
pSym
->
Object
->
sName
,
pSym
->
Object
->
pType
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t\t
this->%s[EASEA_Ndx]->deserializer(&EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
}"
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
}
else
{
fprintf
(
fpOutputFile
,
"
\t
EASEA_Line >> line;
\n
"
);
fprintf
(
fpOutputFile
,
"
\t
if(strcmp(line.c_str(),
\"
NULL
\"
)==0)
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = NULL;
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
else{
\n
"
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s = new %s;
\n
"
,
pSym
->
Object
->
sName
,
pSym
->
Object
->
pType
->
sName
);
fprintf
(
fpOutputFile
,
"
\t\t
this->%s->deserializer(&EASEA_Line);
\n
"
,
pSym
->
Object
->
sName
);
fprintf
(
fpOutputFile
,
"
\t
}"
);
}
}
else
{
if
(
pSym
->
Object
->
ObjectType
==
oObject
){
fprintf
(
fpOutputFile
,
"
\t
EASEA_Line >> this->%s;
\n
"
,
pSym
->
Object
->
sName
);
...
...
@@ -428,7 +480,7 @@ void CSymbol::deserializeIndividual(FILE *fp, char* sCompleteName){
void
CSymbol
::
printAllSymbols
(
FILE
*
fp
,
char
*
sCompleteName
,
EObjectType
FatherType
,
CListItem
<
CSymbol
*>
*
pSym
){
char
sNewCompleteName
[
1
000
],
s
[
20
];
char
sNewCompleteName
[
000
],
s
[
20
];
strcpy
(
sNewCompleteName
,
sCompleteName
);
do
{
if
(
pSym
->
Object
->
pType
->
ObjectType
==
oUserClass
){
...
...
Makefile
View file @
0fd78b8f
...
...
@@ -116,14 +116,14 @@ clean:
#install:$(EXEC)
# sudo cp $< /usr/bin/dev-easea
ifeq
($(UNAME),Linux)
realclean
:
clean
rm
-f
EaseaParse.cpp EaseaParse.h EaseaLex.cpp EaseaLex.h
#
ifeq ($(UNAME),Linux)
#
realclean: clean
#
rm -f EaseaParse.cpp EaseaParse.h EaseaLex.cpp EaseaLex.h
EaseaParse.cpp
:
EaseaParse.y
wine ~/.wine/drive_c/Program
\
Files/Parser
\
Generator/BIN/ayacc.exe
$<
-Tcpp
-d
#
EaseaParse.cpp: EaseaParse.y
#
wine ~/.wine/drive_c/Program\ Files/Parser\ Generator/BIN/ayacc.exe $< -Tcpp -d
EaseaLex.cpp
:
EaseaLex.l
wine ~/.wine/drive_c/Program
\
Files/Parser
\
Generator/BIN/ALex.exe
$<
-Tcpp
-i
endif
#
EaseaLex.cpp: EaseaLex.l
#
wine ~/.wine/drive_c/Program\ Files/Parser\ Generator/BIN/ALex.exe $< -Tcpp -i
#
endif
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