diff --git a/src/facetgroup.cmod b/src/facetgroup.cmod index 102a8da91302c28fd466654b03fdcd020735eadf..9f1646e1b5d06b4ecae30209cc60de42d02929c6 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 1e16a8aa633916bd6e2923276d77262636ea0802..fc443284971709ac77d152512a642c7a34a3f9dc 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 cbf515f62f175bb0af2c02834bc7c838a9e7a7b8..67fb26af4e241819f056a525e94ca6dbf021463a 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 61c4427904108268368acb91f626f90305b8e0d5..b1a7bd950175e1f137ad33bbdf95d5e69b5bc99b 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 d390a4027be5d46a1376f83f22e026cb942e1e28..26a4a23bec0e7a4345d32c7ced63e11e4e23253b 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