From 2c660c841e9f654473ce39aa3a93f4ba3d6c4626 Mon Sep 17 00:00:00 2001 From: Martin Nilsson <mani@lysator.liu.se> Date: Sat, 31 Dec 2005 04:36:44 +0100 Subject: [PATCH] Facet init and exit needs more work. Disable them for now. Rev: src/facetgroup.cmod:1.6 Rev: src/language.yacc:1.361 Rev: src/module.c:1.36 Rev: src/program.c:1.598 Rev: src/program.h:1.221 --- src/facetgroup.cmod | 9 +++++++-- src/language.yacc | 18 ++++++++++-------- src/module.c | 10 +++++++++- src/program.c | 10 +++++++++- src/program.h | 4 +++- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/facetgroup.cmod b/src/facetgroup.cmod index 102a8da913..9f1646e1b5 100644 --- a/src/facetgroup.cmod +++ b/src/facetgroup.cmod @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: facetgroup.cmod,v 1.5 2004/11/06 07:06:14 nilsson Exp $ +|| $Id: facetgroup.cmod,v 1.6 2005/12/31 03:36:44 nilsson Exp $ */ #include "global.h" @@ -33,6 +33,8 @@ DECLARATIONS +#ifdef WITH_FACETS + /*! @class FacetGroup *! *! This class is used to handle facets in the system. All facets @@ -287,5 +289,8 @@ void exit_facetgroup(void) { EXIT } -/*! @endclass + +/*! @endclass */ + +#endif diff --git a/src/language.yacc b/src/language.yacc index 1e16a8aa63..fc44328497 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: language.yacc,v 1.360 2005/10/14 08:43:04 grubba Exp $ +|| $Id: language.yacc,v 1.361 2005/12/31 03:35:45 nilsson Exp $ */ %pure_parser @@ -434,6 +434,7 @@ program_ref: low_program_ref facet: TOK_FACET TOK_IDENTIFIER ':' idents ';' { +#ifdef WITH_FACETS struct object *o; if (Pike_compiler->compiler_pass == 1) { if (Pike_compiler->new_program->facet_class == PROGRAM_IS_FACET_CLASS) { @@ -447,8 +448,7 @@ facet: TOK_FACET TOK_IDENTIFIER ':' idents ';' ref_push_string($2->u.sval.u.string); push_int(Pike_compiler->new_program->id); push_int(Pike_compiler->new_program->facet_class); - safe_apply_low3(o, find_identifier("add_facet_class",o->prog), 3, - "Failed to add facet class to system."); + safe_apply_low2(o, find_identifier("add_facet_class",o->prog), 3, 0); if (Pike_sp[-1].type == T_INT && Pike_sp[-1].u.integer >= 0) { Pike_compiler->new_program->facet_class = PROGRAM_IS_FACET_CLASS; @@ -466,10 +466,12 @@ facet: TOK_FACET TOK_IDENTIFIER ':' idents ';' } free_node($2); free_node($4); +#else + yyerror("No support for facets."); +#endif } ; - inherit_ref: { SET_FORCE_RESOLVE($<number>$); @@ -493,6 +495,7 @@ inheritance: modifiers TOK_INHERIT inherit_ref optional_rename_inherit ';' compiler_do_inherit($3,$1,s); } +#ifdef WITH_FACETS /* If this is a product class, check that all product classes in its * facet-group inherit from all facets */ if($3 && Pike_compiler->compiler_pass == 2) { @@ -505,18 +508,17 @@ inheritance: modifiers TOK_INHERIT inherit_ref optional_rename_inherit ';' if (Pike_sp[-1].type == T_INT && Pike_sp[-1].u.integer == 0) { pop_stack(); - safe_apply_low3(Pike_compiler->new_program->facet_group, + safe_apply_low2(Pike_compiler->new_program->facet_group, find_identifier ("check_product_classes", Pike_compiler->new_program->facet_group->prog), - 0, - "Error in some product classes"); + 0, o); } pop_stack(); } } } - +#endif if($4) free_node($4); pop_stack(); if ($3) free_node($3); diff --git a/src/module.c b/src/module.c index cbf515f62f..67fb26af4e 100644 --- a/src/module.c +++ b/src/module.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: module.c,v 1.35 2005/03/28 21:56:03 nilsson Exp $ +|| $Id: module.c,v 1.36 2005/12/31 03:36:26 nilsson Exp $ */ #include "global.h" @@ -47,7 +47,9 @@ static void init_builtin_modules(void) { void init_iterators(void); +#ifdef WITH_FACETS void init_facetgroup(void); +#endif init_cpp(); init_backend(); @@ -63,14 +65,18 @@ static void init_builtin_modules(void) init_builtin_efuns(); init_signals(); init_dynamic_load(); +#ifdef WITH_FACETS init_facetgroup(); +#endif } static void exit_builtin_modules(void) { #ifdef DO_PIKE_CLEANUP void exit_iterators(void); +#ifdef WITH_FACETS void exit_facetgroup(void); +#endif /* Clear various global references. */ @@ -87,7 +93,9 @@ static void exit_builtin_modules(void) cleanup_module_support(); exit_operators(); exit_iterators(); +#ifdef WITH_FACETS exit_facetgroup(); +#endif cleanup_program(); cleanup_compiler(); cleanup_error(); diff --git a/src/program.c b/src/program.c index 61c4427904..b1a7bd9501 100644 --- a/src/program.c +++ b/src/program.c @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: program.c,v 1.597 2005/11/06 21:42:54 grubba Exp $ +|| $Id: program.c,v 1.598 2005/12/31 03:35:58 nilsson Exp $ */ #include "global.h" @@ -2148,11 +2148,13 @@ void low_start_new_program(struct program *p, int id=0; struct svalue tmp; +#ifdef WITH_FACETS if(Pike_compiler->compiler_pass == 1 && p) { p->facet_class = 0; p->facet_index = -1; p->facet_group = NULL; } +#endif #if 0 #ifdef SHARED_NODES @@ -2507,10 +2509,12 @@ static void exit_program_struct(struct program *p) DOUBLEUNLINK(first_program, p); +#ifdef WITH_FACETS if(p->facet_group) { free_object(p->facet_group); } +#endif #if defined(PIKE_USE_MACHINE_CODE) && defined(VALGRIND_DISCARD_TRANSLATIONS) if(p->program) { @@ -3746,6 +3750,7 @@ static int find_depth(struct program_state *state, } #endif +#ifdef WITH_FACETS void check_for_facet_inherit(struct program *p) { /* If the inherit statement comes before the facet keyword in the @@ -3794,6 +3799,7 @@ void check_for_facet_inherit(struct program *p) } } } +#endif /* @@ -3830,8 +3836,10 @@ void low_inherit(struct program *p, return; } +#ifdef WITH_FACETS /* Check if inherit is a facet inherit. */ check_for_facet_inherit(p); +#endif if (p == placeholder_program) { yyerror("Trying to inherit placeholder program (resolver problem)."); diff --git a/src/program.h b/src/program.h index d390a4027b..26a4a23bec 100644 --- a/src/program.h +++ b/src/program.h @@ -2,7 +2,7 @@ || This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information. -|| $Id: program.h,v 1.220 2005/11/21 11:44:07 grubba Exp $ +|| $Id: program.h,v 1.221 2005/12/31 03:36:07 nilsson Exp $ */ #ifndef PROGRAM_H @@ -549,10 +549,12 @@ struct program INT16 lfuns[NUM_LFUNS]; +#ifdef WITH_FACETS /* Facet related stuff */ INT16 facet_class; /* PROGRAM_IS_X_CLASS (X=FACET/PRODUCT) */ INT32 facet_index; /* Index to the facet this facet class belongs to */ struct object *facet_group; +#endif }; #if 0 -- GitLab