mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
binpac: Remove already-applied binpac-* patches
This commit is contained in:
parent
6034744a0c
commit
090ac0a6e0
7 changed files with 0 additions and 394 deletions
|
@ -1,31 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/pac_expr.cc bro-1.2.1-ssl-binpac/src/pac_expr.cc
|
||||
--- bro-1.2.1-orig/src/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700
|
||||
@@ -776,2 +776,2 @@
|
||||
}
|
||||
break;
|
||||
|
||||
+ case EXPR_CALLARGS:
|
||||
+ {
|
||||
+ mhs = 0;
|
||||
+ if ( args_ )
|
||||
+ for ( uint i = 0; i < args_->size(); ++i )
|
||||
+ mhs = mhs_max(mhs, args_->at(i)->MinimalHeaderSize(env));
|
||||
+ }
|
||||
+ break;
|
||||
+ case EXPR_CASE:
|
||||
+ {
|
||||
+ mhs = operand_[0]->MinimalHeaderSize(env);
|
||||
+ for ( uint i = 0; i < cases_->size(); ++i )
|
||||
+ {
|
||||
+ CaseExpr * ce = cases_->at(i);
|
||||
+ if ( ce->index() )
|
||||
+ for ( uint j = 0; j < ce->index()->size(); ++j )
|
||||
+ mhs = mhs_max(mhs, ce->index()->at(j)->MinimalHeaderSize(env));
|
||||
+ mhs = mhs_max(mhs, ce->value()->MinimalHeaderSize(env));
|
||||
+ }
|
||||
+ }
|
||||
+ break;
|
||||
default:
|
||||
// Evaluate every operand by default
|
||||
mhs = 0;
|
|
@ -1,97 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/pac_expr.cc bro-1.2.1-ssl-binpac/src/pac_expr.cc
|
||||
--- bro-1.2.1-orig/src/pac_expr.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_expr.cc 2007-05-04 14:31:11.728494000 -0700
|
||||
@@ -245,6 +245,12 @@
|
||||
out_cc->println("%s %s;",
|
||||
val_type->DataTypeStr().c_str(),
|
||||
env->LValue(val_var));
|
||||
+
|
||||
+ // force evaluation of IDs appearing in case stmt
|
||||
+ operand_[0]->ForceIDEval(out_cc, env);
|
||||
+ foreach(i, CaseExprList, cases_)
|
||||
+ (*i)->value()->ForceIDEval(out_cc, env);
|
||||
+
|
||||
out_cc->println("switch ( %s )", operand_[0]->EvalExpr(out_cc, env));
|
||||
|
||||
out_cc->inc_indent();
|
||||
@@ -386,6 +392,49 @@
|
||||
}
|
||||
}
|
||||
|
||||
+void Expr::ForceIDEval(Output* out_cc, Env* env)
|
||||
+ {
|
||||
+ switch ( expr_type_ )
|
||||
+ {
|
||||
+ case EXPR_NUM:
|
||||
+ case EXPR_SIZEOF:
|
||||
+ case EXPR_OFFSETOF:
|
||||
+ break;
|
||||
+
|
||||
+ case EXPR_ID:
|
||||
+ if ( ! env->Evaluated(id_) )
|
||||
+ env->Evaluate(out_cc, id_);
|
||||
+ break;
|
||||
+
|
||||
+ case EXPR_MEMBER:
|
||||
+ operand_[0]->ForceIDEval(out_cc, env);
|
||||
+ break;
|
||||
+
|
||||
+ case EXPR_CALLARGS:
|
||||
+ {
|
||||
+ foreach(i, ExprList, args_)
|
||||
+ (*i)->ForceIDEval(out_cc, env);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ case EXPR_CASE:
|
||||
+ {
|
||||
+ operand_[0]->ForceIDEval(out_cc, env);
|
||||
+ foreach(i, CaseExprList, cases_)
|
||||
+ (*i)->value()->ForceIDEval(out_cc, env);
|
||||
+ }
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ // Evaluate every operand by default
|
||||
+ for ( int i = 0; i < 3; ++i )
|
||||
+ if ( operand_[i] )
|
||||
+ operand_[i]->ForceIDEval(out_cc, env);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+
|
||||
const char* Expr::EvalExpr(Output* out_cc, Env* env)
|
||||
{
|
||||
GenEval(out_cc, env);
|
||||
diff -urN bro-1.2.1-orig/src/pac_expr.h bro-1.2.1-ssl-binpac/src/pac_expr.h
|
||||
--- bro-1.2.1-orig/src/pac_expr.h 2006-07-26 15:02:39.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_expr.h 2007-05-04 14:16:31.624287000 -0700
|
||||
@@ -56,6 +56,11 @@
|
||||
//
|
||||
const char *EvalExpr(Output *out, Env *env);
|
||||
|
||||
+ // force evaulation of IDs contained in this expression;
|
||||
+ // necessary with case expr and conditional let fields (&if)
|
||||
+ // for correct parsing of fields
|
||||
+ void ForceIDEval(Output *out_cc, Env *env);
|
||||
+
|
||||
// Returns the set_* function of the expression.
|
||||
// The expression must be of form ID or x.ID.
|
||||
string SetFunc(Output *out, Env *env);
|
||||
diff -urN bro-1.2.1-orig/src/pac_let.cc bro-1.2.1-ssl-binpac/src/pac_let.cc
|
||||
--- bro-1.2.1-orig/src/pac_let.cc 2006-07-26 15:02:39.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_let.cc 2007-05-04 15:32:09.695568000 -0700
|
||||
@@ -80,7 +80,12 @@
|
||||
if ( type_->attr_if_expr() )
|
||||
{
|
||||
// A conditional field
|
||||
+
|
||||
env->Evaluate(out_cc, type_->has_value_var());
|
||||
+
|
||||
+ // force evaluation of IDs contained in this expr
|
||||
+ expr()->ForceIDEval(out_cc, env);
|
||||
+
|
||||
out_cc->println("if ( %s )",
|
||||
env->RValue(type_->has_value_var()));
|
||||
out_cc->inc_indent();
|
|
@ -1,37 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/pac_let.cc bro-1.2.1-ssl-binpac/src/pac_let.cc
|
||||
--- bro-1.2.1-orig/src/pac_let.cc 2006-07-26 15:02:39.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_let.cc 2007-05-04 15:32:09.695568000 -0700
|
||||
@@ -108,11 +108,6 @@
|
||||
void LetField::GenEval(Output* out_cc, Env* env)
|
||||
{
|
||||
GenParseCode(out_cc, env);
|
||||
- if ( type_->attr_if_expr() )
|
||||
- {
|
||||
- out_cc->println("BINPAC_ASSERT(%s);",
|
||||
- env->RValue(type_->has_value_var()));
|
||||
- }
|
||||
}
|
||||
|
||||
LetDecl::LetDecl(ID *id, Type *type, Expr *expr)
|
||||
diff -urN bro-1.2.1-orig/src/pac_type.cc bro-1.2.1-ssl-binpac/src/pac_type.cc
|
||||
--- bro-1.2.1-orig/src/pac_type.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_type.cc 2007-05-24 10:56:42.140658000 -0700
|
||||
@@ -316,9 +316,15 @@
|
||||
{
|
||||
if ( DefineValueVar() )
|
||||
{
|
||||
- out_h->println("%s %s const { return %s; }",
|
||||
- DataTypeConstRefStr().c_str(),
|
||||
- env->RValue(value_var()), lvalue());
|
||||
+ if ( attr_if_expr_ )
|
||||
+ out_h->println("%s %s const { BINPAC_ASSERT(%s); return %s; }",
|
||||
+ DataTypeConstRefStr().c_str(),
|
||||
+ env->RValue(value_var()),
|
||||
+ env->RValue(has_value_var()), lvalue());
|
||||
+ else
|
||||
+ out_h->println("%s %s const { return %s; }",
|
||||
+ DataTypeConstRefStr().c_str(),
|
||||
+ env->RValue(value_var()), lvalue());
|
||||
}
|
||||
|
||||
foreach (i, FieldList, fields_)
|
|
@ -1,12 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/pac_record.cc bro-1.2.1-ssl-binpac/src/pac_record.cc
|
||||
--- bro-1.2.1-orig/src/pac_record.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_record.cc 2007-05-08 16:13:33.373850000 -0700
|
||||
@@ -123,5 +123,5 @@
|
||||
void RecordType::DoGenParseCode(Output* out_cc, Env* env,
|
||||
const DataPtr& data, int flags)
|
||||
{
|
||||
- if ( StaticSize(env) >= 0 )
|
||||
+ if ( !incremental_input() && StaticSize(env) >= 0 )
|
||||
GenBoundaryCheck(out_cc, env, data);
|
||||
|
||||
if ( incremental_parsing() )
|
|
@ -1,27 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/lib/binpac_buffer.h bro-1.2.1-ssl-binpac/src/lib/binpac_buffer.h
|
||||
--- bro-1.2.1-orig/src/lib/binpac_buffer.h 2006-07-26 15:02:38.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/lib/binpac_buffer.h 2007-05-09 16:14:54.501656000 -0700
|
||||
@@ -59,6 +59,11 @@
|
||||
return frame_length_;
|
||||
}
|
||||
|
||||
+ inline bool data_available() const
|
||||
+ {
|
||||
+ return buffer_n_ > 0 || orig_data_end_ > orig_data_begin_;
|
||||
+ }
|
||||
+
|
||||
void NewLine();
|
||||
// A negative frame_length represents a frame till EOF
|
||||
void NewFrame(int frame_length, bool chunked_);
|
||||
diff -urN bro-1.2.1-orig/src/pac_flow.cc bro-1.2.1-ssl-binpac/src/pac_flow.cc
|
||||
--- bro-1.2.1-orig/src/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700
|
||||
@@ -272,7 +272,8 @@
|
||||
env_->RValue(begin_of_data),
|
||||
env_->RValue(end_of_data));
|
||||
|
||||
- out_cc->println("while ( true )");
|
||||
+ out_cc->println("while ( %s->data_available() )",
|
||||
+ env_->LValue(flow_buffer_id));
|
||||
out_cc->inc_indent();
|
||||
out_cc->println("{");
|
|
@ -1,190 +0,0 @@
|
|||
diff -urN bro-1.2.1-orig/src/pac_analyzer.cc bro-1.2.1-ssl-binpac/src/pac_analyzer.cc
|
||||
--- bro-1.2.1-orig/src/pac_analyzer.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_analyzer.cc 2007-05-22 17:00:10.091531000 -0700
|
||||
@@ -26,8 +26,9 @@
|
||||
helpers_ = new AnalyzerHelperList();
|
||||
functions_ = new FunctionList();
|
||||
|
||||
- constructor_helper_ = 0;
|
||||
- destructor_helper_ = 0;
|
||||
+ constructor_helpers_ = new AnalyzerHelperList();
|
||||
+ destructor_helpers_ = new AnalyzerHelperList();
|
||||
+ eof_helpers_ = new AnalyzerHelperList();
|
||||
|
||||
SetAnalyzerContext();
|
||||
|
||||
@@ -41,6 +42,9 @@
|
||||
delete_list(AnalyzerHelperList, helpers_);
|
||||
delete_list(FunctionList, functions_);
|
||||
delete_list(ParamList, params_);
|
||||
+ delete_list(AnalyzerHelperList, constructor_helpers_);
|
||||
+ delete_list(AnalyzerHelperList, destructor_helpers_);
|
||||
+ delete_list(AnalyzerHelperList, eof_helpers_);
|
||||
}
|
||||
|
||||
void AnalyzerDecl::AddElements(AnalyzerElementList *elemlist)
|
||||
@@ -75,28 +79,20 @@
|
||||
AnalyzerHelper *helper_elem =
|
||||
(AnalyzerHelper *) elem;
|
||||
|
||||
- if ( helper_elem->helper_type() ==
|
||||
- AnalyzerHelper::INIT_CODE)
|
||||
- {
|
||||
- if ( constructor_helper_ )
|
||||
- {
|
||||
- throw Exception(elem,
|
||||
- "Repeated definition of %init code");
|
||||
- }
|
||||
- constructor_helper_ = helper_elem;
|
||||
+ switch ( helper_elem->helper_type() )
|
||||
+ {
|
||||
+ case AnalyzerHelper::INIT_CODE:
|
||||
+ constructor_helpers_->push_back(helper_elem);
|
||||
+ break;
|
||||
+ case AnalyzerHelper::CLEANUP_CODE:
|
||||
+ destructor_helpers_->push_back(helper_elem);
|
||||
+ break;
|
||||
+ case AnalyzerHelper::EOF_CODE:
|
||||
+ eof_helpers_->push_back(helper_elem);
|
||||
+ break;
|
||||
+ default:
|
||||
+ helpers_->push_back(helper_elem);
|
||||
}
|
||||
- else if ( helper_elem->helper_type() ==
|
||||
- AnalyzerHelper::CLEANUP_CODE)
|
||||
- {
|
||||
- if ( destructor_helper_ )
|
||||
- {
|
||||
- throw Exception(elem,
|
||||
- "Repeated definition of %cleanup code");
|
||||
- }
|
||||
- destructor_helper_ = helper_elem;
|
||||
- }
|
||||
- else
|
||||
- helpers_->push_back(helper_elem);
|
||||
}
|
||||
break;
|
||||
case AnalyzerElement::FUNCTION:
|
||||
@@ -217,15 +213,19 @@
|
||||
void AnalyzerDecl::GenInitCode(Output *out_cc)
|
||||
{
|
||||
TypeDecl::GenInitCode(out_cc);
|
||||
- if ( constructor_helper_ )
|
||||
- constructor_helper_->GenCode(0, out_cc, this);
|
||||
+ foreach(i, AnalyzerHelperList, constructor_helpers_)
|
||||
+ {
|
||||
+ (*i)->GenCode(0, out_cc, this);
|
||||
+ }
|
||||
}
|
||||
|
||||
void AnalyzerDecl::GenCleanUpCode(Output *out_cc)
|
||||
{
|
||||
TypeDecl::GenCleanUpCode(out_cc);
|
||||
- if ( destructor_helper_ )
|
||||
- destructor_helper_->GenCode(0, out_cc, this);
|
||||
+ foreach(i, AnalyzerHelperList, destructor_helpers_)
|
||||
+ {
|
||||
+ (*i)->GenCode(0, out_cc, this);
|
||||
+ }
|
||||
}
|
||||
|
||||
void AnalyzerDecl::GenStateVarDecls(Output *out_h)
|
||||
@@ -295,6 +295,7 @@
|
||||
break;
|
||||
case INIT_CODE:
|
||||
case CLEANUP_CODE:
|
||||
+ case EOF_CODE:
|
||||
out = out_cc;
|
||||
break;
|
||||
}
|
||||
diff -urN bro-1.2.1-orig/src/pac_analyzer.h bro-1.2.1-ssl-binpac/src/pac_analyzer.h
|
||||
--- bro-1.2.1-orig/src/pac_analyzer.h 2006-07-26 15:02:39.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_analyzer.h 2007-05-22 16:32:08.397926000 -0700
|
||||
@@ -76,8 +76,9 @@
|
||||
AnalyzerHelperList *helpers_;
|
||||
FunctionList *functions_;
|
||||
|
||||
- AnalyzerHelper *constructor_helper_;
|
||||
- AnalyzerHelper *destructor_helper_;
|
||||
+ AnalyzerHelperList *constructor_helpers_;
|
||||
+ AnalyzerHelperList *destructor_helpers_;
|
||||
+ AnalyzerHelperList *eof_helpers_;
|
||||
};
|
||||
|
||||
class AnalyzerElement : public Object
|
||||
@@ -117,6 +118,7 @@
|
||||
MEMBER_DECLS,
|
||||
INIT_CODE,
|
||||
CLEANUP_CODE,
|
||||
+ EOF_CODE,
|
||||
};
|
||||
AnalyzerHelper(Type helper_type, EmbeddedCode *code)
|
||||
: AnalyzerElement(HELPER),
|
||||
diff -urN bro-1.2.1-orig/src/pac_conn.cc bro-1.2.1-ssl-binpac/src/pac_conn.cc
|
||||
--- bro-1.2.1-orig/src/pac_conn.cc 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_conn.cc 2007-05-22 16:42:35.406135000 -0700
|
||||
@@ -97,6 +97,12 @@
|
||||
out_cc->println("%s->%s();",
|
||||
env_->LValue(downflow_id),
|
||||
kFlowEOF);
|
||||
+
|
||||
+ foreach(i, AnalyzerHelperList, eof_helpers_)
|
||||
+ {
|
||||
+ (*i)->GenCode(0, out_cc, this);
|
||||
+ }
|
||||
+
|
||||
out_cc->dec_indent();
|
||||
|
||||
out_cc->println("}");
|
||||
diff -urN bro-1.2.1-orig/src/pac_flow.cc bro-1.2.1-ssl-binpac/src/pac_flow.cc
|
||||
--- bro-1.2.1-orig/src/pac_flow.cc 2006-10-12 14:13:12.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_flow.cc 2007-05-22 16:43:55.997562000 -0700
|
||||
@@ -151,6 +151,11 @@
|
||||
out_cc->inc_indent();
|
||||
out_cc->println("{");
|
||||
|
||||
+ foreach(i, AnalyzerHelperList, eof_helpers_)
|
||||
+ {
|
||||
+ (*i)->GenCode(0, out_cc, this);
|
||||
+ }
|
||||
+
|
||||
if ( dataunit_->type() == AnalyzerDataUnit::FLOWUNIT )
|
||||
{
|
||||
out_cc->println("%s->set_eof();",
|
||||
diff -urN bro-1.2.1-orig/src/pac_parse.yy bro-1.2.1-ssl-binpac/src/pac_parse.yy
|
||||
--- bro-1.2.1-orig/src/pac_parse.yy 2006-10-12 14:13:12.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_parse.yy 2007-05-22 16:56:09.280526000 -0700
|
||||
@@ -22,7 +22,7 @@
|
||||
%token TOK_STATE TOK_ACTION TOK_WHEN TOK_HELPER
|
||||
%token TOK_DATAUNIT TOK_FLOWDIR TOK_WITHCONTEXT
|
||||
%token TOK_LPB_EXTERN TOK_LPB_HEADER TOK_LPB_CODE
|
||||
-%token TOK_LPB_MEMBER TOK_LPB_INIT TOK_LPB_CLEANUP
|
||||
+%token TOK_LPB_MEMBER TOK_LPB_INIT TOK_LPB_CLEANUP TOK_LPB_EOF
|
||||
%token TOK_LPB TOK_RPB
|
||||
%token TOK_EMBEDDED_ATOM TOK_EMBEDDED_STRING
|
||||
%token TOK_PAC_VAL TOK_PAC_SET TOK_PAC_TYPE TOK_PAC_TYPEOF TOK_PAC_CONST_DEF
|
||||
@@ -795,6 +795,10 @@
|
||||
{
|
||||
$$ = new AnalyzerHelper(AnalyzerHelper::CLEANUP_CODE, $2);
|
||||
}
|
||||
+ | TOK_LPB_EOF embedded_code TOK_RPB
|
||||
+ {
|
||||
+ $$ = new AnalyzerHelper(AnalyzerHelper::EOF_CODE, $2);
|
||||
+ }
|
||||
| TOK_FLOWDIR '=' tok_id optargs ';'
|
||||
{
|
||||
$$ = new AnalyzerFlow((AnalyzerFlow::Direction) $1, $3, $4);
|
||||
diff -urN bro-1.2.1-orig/src/pac_scan.ll bro-1.2.1-ssl-binpac/src/pac_scan.ll
|
||||
--- bro-1.2.1-orig/src/pac_scan.ll 2006-07-26 15:02:40.000000000 -0700
|
||||
+++ bro-1.2.1-ssl-binpac/src/pac_scan.ll 2007-05-22 16:55:19.349644000 -0700
|
||||
@@ -96,6 +96,10 @@
|
||||
BEGIN(EC);
|
||||
return TOK_LPB_MEMBER;
|
||||
}
|
||||
+<INITIAL>"%eof{" {
|
||||
+ BEGIN(EC);
|
||||
+ return TOK_LPB_EOF;
|
||||
+ }
|
||||
<INITIAL>"%{" {
|
||||
BEGIN(EC);
|
||||
return TOK_LPB;
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue