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
a2280b1e
Commit
a2280b1e
authored
Feb 27, 2019
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed dependency on flex.
parent
a7b6f740
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
245 additions
and
467 deletions
+245
-467
build-howto.md
build-howto.md
+1
-1
src/tools/bld/src/rules.mk
src/tools/bld/src/rules.mk
+0
-4
src/tools/bld/src/variables.mk
src/tools/bld/src/variables.mk
+0
-3
src/tools/exe/tools_cmsg2c/src/cmsg2c.h
src/tools/exe/tools_cmsg2c/src/cmsg2c.h
+0
-43
src/tools/exe/tools_cmsg2c/src/cmsg2c.l
src/tools/exe/tools_cmsg2c/src/cmsg2c.l
+0
-40
src/tools/exe/tools_cmsg2c/src/link_rule.mk
src/tools/exe/tools_cmsg2c/src/link_rule.mk
+1
-1
src/tools/exe/tools_cmsg2c/src/tools_cmsg2c.c
src/tools/exe/tools_cmsg2c/src/tools_cmsg2c.c
+87
-91
src/tools/exe/tools_msg2cmsg/src/link_rule.mk
src/tools/exe/tools_msg2cmsg/src/link_rule.mk
+1
-1
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.h
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.h
+0
-48
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.l
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.l
+0
-69
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
+152
-150
src/tools/pwre/src/pwre_configure.sh
src/tools/pwre/src/pwre_configure.sh
+0
-1
src/tools/wireshark/qcom/Makefile
src/tools/wireshark/qcom/Makefile
+3
-6
src/tools/wireshark/qcom/Makefile.in
src/tools/wireshark/qcom/Makefile.in
+0
-3
src/tools/wireshark/redcom/Makefile
src/tools/wireshark/redcom/Makefile
+0
-3
src/tools/wireshark/redcom/Makefile.in
src/tools/wireshark/redcom/Makefile.in
+0
-3
No files found.
build-howto.md
View file @
a2280b1e
...
...
@@ -8,7 +8,7 @@ Install the following packages
Mandatory:
> apt-get install doxygen
flex
gcc g++ make libasound2-dev libdb5.3-dev libdb5.3++-dev
> apt-get install doxygen gcc g++ make libasound2-dev libdb5.3-dev libdb5.3++-dev
Optional:
...
...
src/tools/bld/src/rules.mk
View file @
a2280b1e
...
...
@@ -27,10 +27,6 @@ $(obj_dir)/%.o : $(obj_dir)/%.cmsg
@
$(tools_cmsg2c)
-b
$(comp_name)
$(source)
$(tmp_dir)
/
$(sname)
.c
@
$(cc)
$(cflags)
$(csetos)
$(cinc)
$(cobj)
$(tmp_dir)
/
$(sname)
.c
$(bld_dir)/%.c
:
%.l
@
$(log_l_obj)
@
$(lex)
-o
$(bld_dir)
/
$(sname)
.c
$(source)
%.o
:
%.c
@
echo
"Warning, rule shall normally not be used: %.o : %.c"
ifeq
($(nodep),)
...
...
src/tools/bld/src/variables.mk
View file @
a2280b1e
...
...
@@ -98,7 +98,6 @@ cp := cp
cpflags
:=
arflags
:=
r
obj
:=
-c
-o
$(target)
lex
:=
flex
javac
:=
javac
ifdef
pwre_ar
ar
:=
$(pwre_ar)
...
...
@@ -160,8 +159,6 @@ domap = -Xlinker -Map -Xlinker $(map)
log_h_h
=
echo
"Exporting
$<
"
log_x_h
=
echo
"Exporting
$<
to
$(
notdir
$@
)
"
log_l_obj
=
echo
"Compiling
$<
"
log_l_lib
=
echo
"Compiling
$(
notdir
$(
basename
$@
))
(
$<
)"
#log_c_d = echo "Updating dependencies $<"
log_c_obj
=
echo
"Compiling
$<
"
log_c_lib
=
echo
"Compiling
$(
notdir
$(
basename
$@
))
(
$<
)"
...
...
src/tools/exe/tools_cmsg2c/src/cmsg2c.h
deleted
100644 → 0
View file @
a7b6f740
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 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 cmsg2c_h
#define cmsg2c_h
void
lex_FacName
(
char
*
FacName
);
void
lex_FacNum
(
int
FacNum
);
#endif
src/tools/exe/tools_cmsg2c/src/cmsg2c.l
deleted
100644 → 0
View file @
a7b6f740
%{
#include <stdio.h>
#include <stdlib.h>
#include "pwr_msg.h"
#include "cmsg2c.h"
int lineno = 0;
#undef ECHO
#define ECHO
%}
ws [ \t]+
nl \n
comment !.*
%option nounput
%option noinput
%x facnam facnum
%%
{ws} ;
{comment} ;
{nl} lineno++;
msg_sFacility {BEGIN(facnam);}
<facnam>[A-Z0-9$_]+facility {BEGIN(facnum); lex_FacName((char *)yytext);}
<facnum>[0-9]+ {BEGIN(0); lex_FacNum(atoi((char *)yytext));}
%%
src/tools/exe/tools_cmsg2c/src/link_rule.mk
View file @
a2280b1e
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ld)
$(linkflags)
$(domap)
-o
$(export_exe)
$(export_obj)
$(objects)
$(pwre_conf_libdir)
$(pwre_conf_lib)
-lfl
link
=
$(ld)
$(linkflags)
$(domap)
-o
$(export_exe)
$(export_obj)
$(objects)
$(pwre_conf_libdir)
$(pwre_conf_lib)
endif
src/tools/exe/tools_cmsg2c/src/tools_cmsg2c.c
View file @
a2280b1e
...
...
@@ -35,22 +35,12 @@
*/
/*
* Filename:
* tools_cmsg2c.c
*
* Revision history:
* Rev Edit Date Who Comment
* ------- ---- ---------- ---- -------
* X0.1 1 1996-10-01 ML Created
*
* Description: Creates a .c-file from a file which contains all c_msg-files
* for which messages should be generated.
* The c_msg-file should contain all
*
* The -b branch flag must be set if you wan't to generate messages
* for PROVIEW.
*/
* Creates a .c-file from a .cmsg file
*
* The -b branch flag must be set if you want to generate messages for PROVIEW.
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
...
...
@@ -58,9 +48,7 @@
#include "pwr_lst.h"
#include "pwr_msg.h"
#include "cmsg2c.h"
#define MSG_NEW_STRING(str) strcpy(malloc(strlen(str) + 1), str)
#define MSG_NEW_STRING(str) strncpy(malloc(strlen(str) + 1), str, strlen(str) + 1)
typedef
struct
s_FacilityCB
sFacilityCB
;
...
...
@@ -70,83 +58,17 @@ struct s_FacilityCB {
int
facnum
;
};
extern
int
lineno
;
static
int
SyntaxError
;
static
char
*
inFile
;
static
struct
LstHead
lFacH
;
static
sFacilityCB
*
CurrFac
=
NULL
;
static
void
CopyFile
(
FILE
*
ifp
,
FILE
*
ofp
);
static
void
WriteFacility
(
FILE
*
cfp
,
char
*
branch
);
static
void
WriteIncludes
(
FILE
*
cfp
);
static
void
usage
()
{
printf
(
"Usage: tools_cmsg2c [-b branch] input_file output_file
\n
"
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
extern
FILE
*
yyin
;
extern
int
yylex
();
FILE
*
cfp
=
NULL
;
int
bmsg
=
0
;
char
*
branch
=
NULL
;
int
inFile
;
int
outFile
;
if
(
argc
<
3
)
usage
();
if
(
argv
[
1
][
0
]
==
'-'
)
{
if
(
argv
[
1
][
1
]
==
'b'
)
{
branch
=
argv
[
2
];
bmsg
=
1
;
}
else
usage
();
if
(
argc
!=
5
)
usage
();
}
else
if
(
argc
!=
3
)
usage
();
inFile
=
bmsg
?
3
:
1
;
outFile
=
inFile
+
1
;
if
(
!
(
yyin
=
fopen
(
argv
[
inFile
],
"r"
)))
{
printf
(
"Can't open input file: %s"
,
argv
[
inFile
]);
exit
(
1
);
}
LstInit
(
&
lFacH
);
SyntaxError
=
0
;
lineno
=
1
;
yylex
();
if
(
!
SyntaxError
)
{
if
(
!
(
cfp
=
fopen
(
argv
[
outFile
],
"w+"
)))
{
printf
(
"Can't open output file: %s"
,
argv
[
outFile
]);
exit
(
1
);
}
rewind
(
yyin
);
WriteIncludes
(
cfp
);
CopyFile
(
yyin
,
cfp
);
WriteFacility
(
cfp
,
branch
);
}
fclose
(
yyin
);
fclose
(
cfp
);
exit
(
EXIT_SUCCESS
);
}
/*
* Routines called by lex
*/
void
lex_FacName
(
char
*
facnam
)
{
sFacilityCB
*
facp
=
(
sFacilityCB
*
)
calloc
(
1
,
sizeof
(
sFacilityCB
));
...
...
@@ -176,14 +98,42 @@ void lex_FacNum(int facnum)
CurrFac
=
NULL
;
}
/*
* Local routines
*/
static
void
lex
(
FILE
*
fp
)
{
char
buffer
[
500
];
int
next_is_facnum
=
0
;
int
lineno
=
1
;
while
(
fgets
(
buffer
,
500
,
fp
)
!=
NULL
)
{
if
(
strstr
(
buffer
,
"msg_sFacility"
))
{
char
*
facnam
=
strstr
(
buffer
,
"msg_sFacility"
)
+
14
;
// "MYfacility[] = "
facnam
[
strchr
(
facnam
,
'['
)
-
facnam
]
=
'\0'
;
// "MYfacility"
if
(
!
strstr
(
facnam
,
"facility"
))
{
fprintf
(
stderr
,
"Syntax error in file %s line %d
\n
"
,
inFile
,
lineno
);
exit
(
1
);
}
lex_FacName
(
facnam
);
next_is_facnum
=
1
;
}
else
if
(
next_is_facnum
)
{
char
*
line
=
buffer
;
while
(
!
isdigit
(
line
[
0
]))
{
line
++
;
// "1337,"
}
line
[
strchr
(
line
,
','
)
-
line
]
=
'\0'
;
char
*
end
;
int
facnum
=
strtol
(
line
,
&
end
,
10
);
if
(
!
facnum
)
{
fprintf
(
stderr
,
"Syntax error in file %s line %d
\n
"
,
inFile
,
lineno
);
exit
(
1
);
}
lex_FacNum
(
facnum
);
next_is_facnum
=
0
;
}
lineno
++
;
}
}
static
void
CopyFile
(
FILE
*
ifp
,
FILE
*
ofp
)
{
int
c
;
while
((
c
=
getc
(
ifp
))
!=
EOF
)
putc
(
c
,
ofp
);
}
...
...
@@ -210,7 +160,53 @@ static void WriteFacility(FILE* cfp, char* branch)
branch
?
branch
:
"pwrp"
);
}
static
void
WriteIncludes
(
FILE
*
cfp
)
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
in
;
FILE
*
cfp
=
NULL
;
int
bmsg
=
0
;
char
*
branch
=
NULL
;
char
*
outFile
;
if
(
argc
<
3
)
usage
();
if
(
argv
[
1
][
0
]
==
'-'
)
{
if
(
argv
[
1
][
1
]
==
'b'
)
{
branch
=
argv
[
2
];
bmsg
=
1
;
}
else
usage
();
if
(
argc
!=
5
)
usage
();
}
else
if
(
argc
!=
3
)
usage
();
inFile
=
bmsg
?
argv
[
3
]
:
argv
[
1
];
outFile
=
bmsg
?
argv
[
4
]
:
argv
[
2
];
if
(
!
(
in
=
fopen
(
inFile
,
"r"
)))
{
printf
(
"Can't open input file: %s"
,
inFile
);
exit
(
1
);
}
LstInit
(
&
lFacH
);
lex
(
in
);
if
(
!
(
cfp
=
fopen
(
outFile
,
"w+"
)))
{
printf
(
"Can't open output file: %s"
,
outFile
);
fclose
(
in
);
exit
(
1
);
}
rewind
(
in
);
fprintf
(
cfp
,
"#include
\"
pwr_msg.h
\"\n\n
"
);
}
CopyFile
(
in
,
cfp
);
WriteFacility
(
cfp
,
branch
);
fclose
(
in
);
fclose
(
cfp
);
return
0
;
}
\ No newline at end of file
src/tools/exe/tools_msg2cmsg/src/link_rule.mk
View file @
a2280b1e
ifndef
link_rule_mk
link_rule_mk
:=
1
link
=
$(ld)
$(linkflags)
$(domap)
-o
$(export_exe)
$(export_obj)
$(objects)
$(pwre_conf_libdir)
$(pwre_conf_lib)
-lfl
link
=
$(ld)
$(linkflags)
$(domap)
-o
$(export_exe)
$(export_obj)
$(objects)
$(pwre_conf_libdir)
$(pwre_conf_lib)
endif
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.h
deleted
100644 → 0
View file @
a7b6f740
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 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 co_msg2cmsg_h
#define co_msg2cmsg_h
void
lex_FacName
(
const
char
*
Facnam
);
void
lex_FacNum
(
int
Facnum
);
void
lex_FacPrefix
(
const
char
*
Prefix
);
void
lex_MsgName
(
const
char
*
Name
);
void
lex_MsgText
(
const
char
*
Text
);
void
lex_MsgSeverity
(
msg_eSeverity
Severity
);
void
lex_LexError
(
int
Lineno
,
char
*
Str
);
#endif
src/tools/exe/tools_msg2cmsg/src/msg2cmsg.l
deleted
100644 → 0
View file @
a7b6f740
%{
#include <stdio.h>
#include <stdlib.h>
#include "pwr_msg.h"
#include "msg2cmsg.h"
int lineno = 0;
#undef ECHO
#define ECHO
%}
ws [ \t]+
nl \n
comment !.*
%option nounput
%option noinput
%x facnam faccom facnum prefix prefixstr prefixstr_nl msgnam msgtxt msgsev
%%
{ws} ;
{comment} ;
{nl} lineno++;
\.facility {BEGIN(facnam);}
<facnam>{comment} ;
<facnam>[A-Z0-9$_]+ {BEGIN(faccom); lex_FacName((char *)yytext);};
<facnam>{nl} {printf("No facility name given!\n"); exit(1);}
<faccom>[ \t]*,[ \t]* {BEGIN(facnum);}
<faccom>{nl} {printf("No facility number given!\n"); exit(1);}
<facnum>[0-9]+ {BEGIN(prefix); lex_FacNum(atoi((char *)yytext));}
<facnum>{nl} {printf("No facility number given!\n"); exit(1);}
<prefix>{comment} {BEGIN(msgnam); printf("Default prefix\n");}
<prefix>{nl} {BEGIN(msgnam); printf("Default prefix\n");}
<prefix>\/prefix[ \t]*=[ \t]* {BEGIN(prefixstr);}
<prefixstr>{comment} ;
<prefixstr>[A-Z0-9$_]+ {BEGIN(prefixstr_nl); lex_FacPrefix((char *)yytext);}
<prefixstr>{nl} {printf("No prefix string given!\n"); exit(1);}
<prefixstr_nl>\n {BEGIN(msgnam);}
<msgnam>{comment} ;
<msgnam>[A-Za-z0-9$_]+ {BEGIN(msgtxt); lex_MsgName((char *)yytext);}
<msgnam>\.facility {BEGIN(facnam);}
<msgnam>\.end {BEGIN(0);}
<msgtxt>\<.*\> {BEGIN(msgsev); lex_MsgText((char *)yytext);}
<msgsev>{comment} {printf("Comment: no severity given"); exit(1);}
<msgsev>\n {printf("New line: no severity given"); exit(1);}
<msgsev>\/w.*\n {BEGIN(msgnam); lineno++; lex_MsgSeverity(msg_eSeverity_Warning);}
<msgsev>\/s.*\n {BEGIN(msgnam); lineno++; lex_MsgSeverity(msg_eSeverity_Success);}
<msgsev>\/e.*\n {BEGIN(msgnam); lineno++; lex_MsgSeverity(msg_eSeverity_Error);}
<msgsev>\/i.*\n {BEGIN(msgnam); lineno++; lex_MsgSeverity(msg_eSeverity_Info);}
<msgsev>\/f.*\n {BEGIN(msgnam); lineno++; lex_MsgSeverity(msg_eSeverity_Fatal);}
%%
src/tools/exe/tools_msg2cmsg/src/tools_msg2cmsg.c
View file @
a2280b1e
...
...
@@ -35,16 +35,8 @@
*/
/*
* Filename:
* tools_msg2cmsg.c
*
* Revision history:
* Rev Edit Date Who Comment
* ------- ---- ---------- ---- -------
* X0.1 1 1996-10-01 ML Created
*
* Description: Creates a .c_msg-file and a .h-file from a .msg-file
*/
* Creates a .cmsg file and a .h file from a .msg-file
*/
#include <ctype.h>
#include <stdio.h>
...
...
@@ -53,10 +45,8 @@
#include "pwr_lst.h"
#include "pwr_msg.h"
#include "msg2cmsg.h"
#define MSG_NEW_STRING(str) \
strncpy(malloc(strlen(str) + 1), str, strlen(str) + 1)
#define MSG_NEW_STRING(str) strncpy(malloc(strlen(str) + 1), str, strlen(str) + 1)
typedef
struct
s_FacilityCB
sFacilityCB
;
typedef
struct
s_MsgCB
sMsgCB
;
...
...
@@ -73,86 +63,10 @@ struct s_FacilityCB {
msg_sFacility
f
;
};
/* defined by lexyy.c */
extern
int
lineno
;
static
int
SyntaxError
;
static
char
*
inFile
;
static
struct
LstHead
lFacH
;
/*
* Local functions
*/
static
void
WriteFiles
(
char
*
fname
,
FILE
*
cfp
,
FILE
*
hfp
);
static
void
TranslateFormatSpec
(
const
char
*
msgstr
,
char
**
transstr
);
/*
* Main
*/
int
main
(
int
argc
,
char
**
argv
)
{
extern
FILE
*
yyin
;
extern
int
yylex
();
FILE
*
cfp
=
NULL
;
FILE
*
hfp
=
NULL
;
if
(
argc
!=
4
)
{
printf
(
"Usage: co_msg2cmsg msg-file c_msg-file h_file
\n
"
);
exit
(
2
);
}
if
(
!
(
yyin
=
fopen
(
argv
[
1
],
"r"
)))
{
printf
(
"Can't open input file: %s
\n
"
,
argv
[
1
]);
exit
(
2
);
}
if
(
!
(
cfp
=
fopen
(
argv
[
2
],
"w"
)))
{
printf
(
"Can't open c_msg-output file: %s
\n
"
,
argv
[
2
]);
fclose
(
yyin
);
exit
(
2
);
}
if
(
!
(
hfp
=
fopen
(
argv
[
3
],
"w"
)))
{
printf
(
"Can't open h-output file: %s
\n
"
,
argv
[
3
]);
fclose
(
yyin
);
fclose
(
cfp
);
exit
(
2
);
}
LstInit
(
&
lFacH
);
SyntaxError
=
0
;
lineno
=
1
;
yylex
();
if
(
!
SyntaxError
)
{
char
fname
[
256
];
char
*
p
;
if
((
p
=
strrchr
(
argv
[
2
],
'/'
)))
strncpy
(
fname
,
p
+
1
,
sizeof
(
fname
));
else
strncpy
(
fname
,
argv
[
2
],
sizeof
(
fname
));
if
((
p
=
strchr
(
fname
,
'.'
)))
*
p
=
'\0'
;
WriteFiles
(
fname
,
cfp
,
hfp
);
}
fclose
(
yyin
);
fclose
(
cfp
);
fclose
(
hfp
);
exit
(
EXIT_SUCCESS
);
}
/*
* Routines which are called by lexyy.c
*/
void
lex_FacName
(
const
char
*
FacName
)
{
sFacilityCB
*
facp
=
(
sFacilityCB
*
)
calloc
(
1
,
sizeof
(
sFacilityCB
));
...
...
@@ -170,16 +84,18 @@ void lex_FacNum(int FacNum)
void
lex_FacPrefix
(
const
char
*
Prefix
)
{
LstEntry
(
lFacH
.
prev
,
sFacilityCB
,
FacL
)
->
f
.
Prefix
=
MSG_NEW_STRING
(
Prefix
);
char
*
str
=
strncpy
(
malloc
(
strlen
(
Prefix
)
+
3
),
Prefix
,
strlen
(
Prefix
)
+
1
);
strcat
(
str
,
"__
\0
"
);
LstEntry
(
lFacH
.
prev
,
sFacilityCB
,
FacL
)
->
f
.
Prefix
=
str
;
}
void
lex_MsgName
(
const
char
*
MsgName
)
{
sMsgCB
*
msgp
=
(
sMsgCB
*
)
calloc
(
1
,
sizeof
(
sMsgCB
));
int
i
;
int
len
=
strlen
(
MsgName
);
msgp
->
m
.
MsgName
=
malloc
(
len
+
1
);
int
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
msgp
->
m
.
MsgName
[
i
]
=
toupper
(
MsgName
[
i
]);
msgp
->
m
.
MsgName
[
i
]
=
'\0'
;
...
...
@@ -187,6 +103,37 @@ void lex_MsgName(const char* MsgName)
LstInsert
(
&
LstEntry
(
lFacH
.
prev
,
sFacilityCB
,
FacL
)
->
MsgH
,
&
msgp
->
MsgL
);
}
static
void
TranslateFormatSpec
(
const
char
*
msgstr
,
char
**
transstr
)
{
char
*
l
;
const
char
*
m
=
msgstr
;
int
extra
=
0
;
int
len
=
0
;
/* '"' will be substituted with '\"', allocate space for it */
while
(
*
m
)
{
if
(
*
m
==
'"'
)
extra
++
;
m
++
;
len
++
;
}
*
transstr
=
(
char
*
)
malloc
(
len
+
extra
+
1
);
l
=
*
transstr
;
m
=
msgstr
;
while
(
*
m
!=
'\0'
)
{
if
(
*
m
==
'"'
)
{
*
l
++
=
'\\'
;
*
l
++
=
'"'
;
}
else
{
*
l
++
=
*
m
;
}
m
++
;
}
*
l
=
'\0'
;
}
void
lex_MsgText
(
const
char
*
Text
)
{
struct
LstHead
*
ml
=
LstEntry
(
lFacH
.
prev
,
sFacilityCB
,
FacL
)
->
MsgH
.
prev
;
...
...
@@ -201,15 +148,77 @@ void lex_MsgSeverity(msg_eSeverity Severity)
LstEntry
(
ml
,
sMsgCB
,
MsgL
)
->
Severity
=
Severity
;
}
void
lex_LexError
(
int
Lineno
,
char
*
Str
)
{
printf
(
"LexError: line %d, '%s'
\n
"
,
Lineno
,
Str
);
SyntaxError
=
1
;
static
void
lex
(
FILE
*
fp
)
{
char
buffer
[
500
];
int
lineno
=
1
;
while
(
fgets
(
buffer
,
500
,
fp
)
!=
NULL
)
{
if
(
strstr
(
buffer
,
".facility"
))
{
char
*
line
=
strstr
(
buffer
,
".facility"
)
+
10
;
while
(
isspace
(
line
[
0
]))
{
line
++
;
}
char
*
facnam
=
line
;
// "ASD,123 "
char
*
facnum0
=
strchr
(
line
,
','
)
+
1
;
// "123 "
facnam
[
strchr
(
facnam
,
','
)
-
facnam
]
=
'\0'
;
// "ASD"
char
*
tmp
=
facnum0
;
while
(
isdigit
(
tmp
[
0
]))
{
tmp
++
;
}
facnum0
[
tmp
-
facnum0
]
=
'\0'
;
tmp
=
NULL
;
int
facnum
=
strtol
(
facnum0
,
&
tmp
,
10
);
if
(
!
facnum
)
{
fprintf
(
stderr
,
"Syntax error in file %s line %d
\n
"
,
inFile
,
lineno
);
exit
(
1
);
}
lex_FacName
(
facnam
);
lex_FacNum
(
facnum
);
lex_FacPrefix
(
facnam
);
}
else
if
(
isalnum
(
buffer
[
0
]))
{
// "mymsg <my message text> /error"
char
*
msgname
=
buffer
;
// msgname = "mymsg <my message text> /error"
char
*
tmp
=
msgname
;
while
(
isalnum
(
tmp
[
0
])
||
tmp
[
0
]
==
'_'
)
{
tmp
++
;
}
tmp
[
0
]
=
'\0'
;
// msgname = "mymsg"
tmp
++
;
while
(
tmp
[
0
]
!=
'<'
)
{
tmp
++
;
}
tmp
++
;
char
*
msgtxt
=
tmp
;
// msgtxt = "my message text> /error"
while
(
tmp
[
0
]
!=
'>'
)
{
tmp
++
;
}
tmp
[
0
]
=
'\0'
;
// msgtxt = "my message text"
tmp
++
;
char
*
msgseverity
=
tmp
;
// " /error"
while
(
isspace
(
msgseverity
[
0
]))
{
msgseverity
++
;
// "/error"
}
lex_MsgName
(
msgname
);
lex_MsgText
(
msgtxt
);
if
(
msgseverity
[
1
]
==
'w'
)
{
lex_MsgSeverity
(
msg_eSeverity_Warning
);
}
else
if
(
msgseverity
[
1
]
==
's'
)
{
lex_MsgSeverity
(
msg_eSeverity_Success
);
}
else
if
(
msgseverity
[
1
]
==
'e'
)
{
lex_MsgSeverity
(
msg_eSeverity_Error
);
}
else
if
(
msgseverity
[
1
]
==
'i'
)
{
lex_MsgSeverity
(
msg_eSeverity_Info
);
}
else
if
(
msgseverity
[
1
]
==
'f'
)
{
lex_MsgSeverity
(
msg_eSeverity_Fatal
);
}
else
{
fprintf
(
stderr
,
"Syntax error in file %s line %d
\n
"
,
inFile
,
lineno
);
exit
(
1
);
}
}
lineno
++
;
}
}
/*
* Local routines
*/
static
void
WriteFiles
(
char
*
fname
,
FILE
*
cfp
,
FILE
*
hfp
)
{
struct
LstHead
*
fl
;
...
...
@@ -262,61 +271,54 @@ static void WriteFiles(char* fname, FILE* cfp, FILE* hfp)
fprintf
(
hfp
,
"
\n
#endif
\n
"
);
}
/*
* TranslateFormatSpec
*
* search the msgstr and replace any occurance of VMS-like specifiers
* (!AF !UL !XL, are replaced by %s %u %x)
*
*/
static
void
TranslateFormatSpec
(
const
char
*
msgstr
,
char
**
transstr
)
int
main
(
int
argc
,
char
**
argv
)
{
char
*
l
;
const
char
*
m
=
msgstr
+
1
;
/* Skip '<' */
int
extra
=
0
;
int
len
=
0
;
FILE
*
cfp
=
NULL
;
FILE
*
hfp
=
NULL
;
FILE
*
in
=
NULL
;
/* '"' will be substituted with '\"', allocate space for it */
while
(
*
m
)
{
if
(
*
m
==
'"'
)
extra
++
;
m
++
;
len
++
;
if
(
argc
!=
4
)
{
printf
(
"Usage: co_msg2cmsg msg-file c_msg-file h_file
\n
"
);
exit
(
2
);
}
*
transstr
=
(
char
*
)
malloc
(
len
+
extra
+
1
);
l
=
*
transstr
;
m
=
msgstr
+
1
;
/* Skip '<' */
inFile
=
argv
[
1
];
if
(
!
(
in
=
fopen
(
inFile
,
"r"
)))
{
printf
(
"Can't open input file: %s
\n
"
,
inFile
);
exit
(
2
);
}
while
(
*
m
!=
'\0'
)
{
if
(
*
m
==
'"'
)
{
*
l
++
=
'\\'
;
*
l
++
=
'"'
;
m
++
;
}
else
if
(
*
m
++
==
'!'
)
{
/*
* could be a format spec, if so we also skip '!'
*/
if
(
*
m
==
'A'
&&
*
(
m
+
1
)
==
'F'
)
{
*
l
++
=
'%'
;
m
++
;
*
l
++
=
's'
;
m
++
;
}
else
if
(
*
m
==
'U'
&&
*
(
m
+
1
)
==
'L'
)
{
*
l
++
=
'%'
;
m
++
;
*
l
++
=
'u'
;
m
++
;
}
else
if
(
*
m
==
'X'
&&
*
(
m
+
1
)
==
'L'
)
{
*
l
++
=
'%'
;
m
++
;
*
l
++
=
'x'
;
m
++
;
}
else
*
l
++
=
'!'
;
/* nope, put back the '!' */
}
else
/* just copy */
*
l
++
=
*
(
m
-
1
);
if
(
!
(
cfp
=
fopen
(
argv
[
2
],
"w"
)))
{
printf
(
"Can't open c_msg-output file: %s
\n
"
,
argv
[
2
]);
fclose
(
in
);
exit
(
2
);
}
if
(
!
(
hfp
=
fopen
(
argv
[
3
],
"w"
)))
{
printf
(
"Can't open h-output file: %s
\n
"
,
argv
[
3
]);
fclose
(
in
);
fclose
(
cfp
);
exit
(
2
);
}
*
(
l
-
1
)
=
'\0'
;
/* Skip '>' */
LstInit
(
&
lFacH
);
lex
(
in
);
char
fname
[
256
];
char
*
p
=
NULL
;
if
((
p
=
strrchr
(
argv
[
2
],
'/'
)))
strncpy
(
fname
,
p
+
1
,
sizeof
(
fname
));
else
strncpy
(
fname
,
argv
[
2
],
sizeof
(
fname
));
if
((
p
=
strchr
(
fname
,
'.'
)))
*
p
=
'\0'
;
WriteFiles
(
fname
,
cfp
,
hfp
);
fclose
(
in
);
fclose
(
cfp
);
fclose
(
hfp
);
return
0
;
}
src/tools/pwre/src/pwre_configure.sh
View file @
a2280b1e
...
...
@@ -421,7 +421,6 @@ else
pwre_config_check_lib libz LIBZ lib lib 0
"/usr/lib/libz.so:/usr/lib/libz.a:/usr/lib/
$hwpl
-linux-
$gnu
/libz.so"
pwre_config_check_lib libcrypt LIBCRYPT lib lib 0
"/usr/lib/libcrypt.so:/usr/lib/libcrypt.a:/usr/lib/
$hwpl
-linux-
$gnu
/libcrypt.so"
pwre_config_check_lib librt LIBRT lib lib 0
"/usr/lib/librt.so:/usr/lib/librt.a:/usr/lib/
$hwpl
-linux-
$gnu
/librt.so"
pwre_config_check_lib libfl LIBFL lib lib 0
"/usr/lib/libfl.so:/usr/lib/libfl.a:/usr/lib/
$hwpl
-linux-
$gnu
/libfl.so"
pwre_config_check_lib libX11 LIBX11 lib lib 0
"/usr/lib/libX11.so:/usr/lib/
$hwpl
-linux-
$gnu
/libX11.so"
pwre_config_check_include alsa ALSA 1
"/usr/include/alsa/asoundlib.h"
...
...
src/tools/wireshark/qcom/Makefile
View file @
a2280b1e
...
...
@@ -247,12 +247,9 @@ KRB5_LIBS =
LAUNCHSERVICES_FRAMEWORKS
=
LD
=
/usr/bin/ld
LDFLAGS
=
-Wl
,--as-needed
-L
/usr/local/lib
-L
/usr/local/lib
-L
/usr/local/lib
-L
/usr/local/lib
-L
/usr/local/lib
LDFLAGS_SHAREDLIB
=
LEX
=
/usr/bin/flex
LEXLIB
=
-lfl
LEX_OUTPUT_ROOT
=
lex.yy
LIBCAP_LIBS
=
LIBGCRYPT_CFLAGS
=
LDFLAGS_SHAREDLIB
=
LIBCAP_LIBS
=
LIBGCRYPT_CFLAGS
=
LIBGCRYPT_CONFIG
=
no
LIBGCRYPT_LIBS
=
LIBGNUTLS_CFLAGS
=
...
...
src/tools/wireshark/qcom/Makefile.in
View file @
a2280b1e
...
...
@@ -248,9 +248,6 @@ LAUNCHSERVICES_FRAMEWORKS = @LAUNCHSERVICES_FRAMEWORKS@
LD
=
@LD@
LDFLAGS
=
@LDFLAGS@
LDFLAGS_SHAREDLIB
=
@LDFLAGS_SHAREDLIB@
LEX
=
@LEX@
LEXLIB
=
@LEXLIB@
LEX_OUTPUT_ROOT
=
@LEX_OUTPUT_ROOT@
LIBCAP_LIBS
=
@LIBCAP_LIBS@
LIBGCRYPT_CFLAGS
=
@LIBGCRYPT_CFLAGS@
LIBGCRYPT_CONFIG
=
@LIBGCRYPT_CONFIG@
...
...
src/tools/wireshark/redcom/Makefile
View file @
a2280b1e
...
...
@@ -248,9 +248,6 @@ LAUNCHSERVICES_FRAMEWORKS =
LD
=
/usr/bin/ld
LDFLAGS
=
-Wl
,--as-needed
-L
/usr/lib
-L
/usr/local/lib
-L
/usr/local/lib
-L
/usr/local/lib
-L
/usr/local/lib
LDFLAGS_SHAREDLIB
=
LEX
=
/usr/bin/flex
LEXLIB
=
-lfl
LEX_OUTPUT_ROOT
=
lex.yy
LIBCAP_LIBS
=
-lcap
LIBGCRYPT_CFLAGS
=
LIBGCRYPT_CONFIG
=
/usr/bin/libgcrypt-config
...
...
src/tools/wireshark/redcom/Makefile.in
View file @
a2280b1e
...
...
@@ -248,9 +248,6 @@ LAUNCHSERVICES_FRAMEWORKS = @LAUNCHSERVICES_FRAMEWORKS@
LD
=
@LD@
LDFLAGS
=
@LDFLAGS@
LDFLAGS_SHAREDLIB
=
@LDFLAGS_SHAREDLIB@
LEX
=
@LEX@
LEXLIB
=
@LEXLIB@
LEX_OUTPUT_ROOT
=
@LEX_OUTPUT_ROOT@
LIBCAP_LIBS
=
@LIBCAP_LIBS@
LIBGCRYPT_CFLAGS
=
@LIBGCRYPT_CFLAGS@
LIBGCRYPT_CONFIG
=
@LIBGCRYPT_CONFIG@
...
...
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