dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: treecc/etc c_gc_skel.c,NONE,1.1 c_gc_skel.h,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: treecc/etc c_gc_skel.c,NONE,1.1 c_gc_skel.h,NONE,1.1 cpp_gc_skel.cc,NONE,1.1 cpp_gc_skel.h,NONE,1.1 Makefile.am,1.2,1.3
Date: Fri, 04 Jul 2003 00:53:51 -0400

Update of /cvsroot/dotgnu-pnet/treecc/etc
In directory subversions:/tmp/cvs-serv32530/etc

Modified Files:
        Makefile.am 
Added Files:
        c_gc_skel.c c_gc_skel.h cpp_gc_skel.cc cpp_gc_skel.h 
Log Message:


Add the "gc_allocator" option to treecc, to make the node allocator use libgc.


--- NEW FILE ---
/*
 * treecc node allocation routines for C.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * As a special exception, when this file is copied by treecc into
 * a treecc output file, you may use that output file without restriction.
 */

#include <stdlib.h>
#include <gc.h>

/*
 * Initialize the node allocation pool.
 */
#ifdef YYNODESTATE_REENTRANT
void yynodeinit(state__)
YYNODESTATE *state__;
{
#else
void yynodeinit()
{
#endif
        GC_INIT();
        GC_init();
}

/*
 * Allocate a block of memory.
 */
#ifdef YYNODESTATE_REENTRANT
void *yynodealloc(state__, size__)
YYNODESTATE *state__;
unsigned int size__;
{
#else
void *yynodealloc(size__)
unsigned int size__;
{
#endif
        return (void *)GC_MALLOC((size_t)size__);
}

/*
 * Push the node allocation state.  Not used in the GC version.
 */
#ifdef YYNODESTATE_REENTRANT
int yynodepush(state__)
YYNODESTATE *state__;
{
#else
int yynodepush()
{
#endif
        return 1;
}

/*
 * Pop the node allocation state.  Not used in the GC version.
 */
#ifdef YYNODESTATE_REENTRANT
void yynodepop(state__)
YYNODESTATE *state__;
{
#else
void yynodepop()
{
#endif
}

/*
 * Clear the node allocation pool completely.  Not used in the GC version.
 */
#ifdef YYNODESTATE_REENTRANT
void yynodeclear(state__)
YYNODESTATE *state__;
{
#else
void yynodeclear()
{
#endif
}

--- NEW FILE ---
typedef struct
{
        int dummy__;

} YYNODESTATE;

--- NEW FILE ---
/*
 * treecc node allocation routines for C++.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * 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 this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * As a special exception, when this file is copied by treecc into
 * a treecc output file, you may use that output file without restriction.
 */

#include <gc.h>

/*
 * Initialize the singleton instance.
 */
#ifndef YYNODESTATE_REENTRANT
YYNODESTATE *YYNODESTATE::state__ = 0;
#endif

/*
 * Constructor for YYNODESTATE.
 */
YYNODESTATE::YYNODESTATE()
{
        /* Initialize the garbage collector */
        GC_INIT();
        GC_init();

#ifndef YYNODESTATE_REENTRANT
        /* Register this object as the singleton instance */
        if(!state__)
        {
                state__ = this;
        }
#endif
}

/*
 * Destructor for YYNODESTATE.
 */
YYNODESTATE::~YYNODESTATE()
{
#ifndef YYNODESTATE_REENTRANT
        /* We are no longer the singleton instance */
        if(state__ == this)
        {
                state__ = 0;
        }
#endif
}

#ifdef YYNODESTATE_USE_ALLOCATOR

/*
 * Allocate a block of memory.
 */
void *YYNODESTATE::alloc(size_t size__)
{
        return (void *)GC_MALLOC((size_t)size__);
}

/*
 * Deallocate a block of memory.
 */
void YYNODESTATE::dealloc(void *ptr__, size_t size__)
{
        /* Nothing to do for this type of node allocator */
}

/*
 * Push the node allocation state.
 */
int YYNODESTATE::push()
{
        /* Not used with the garbage collector */
        return 1;
}

/*
 * Pop the node allocation state.
 */
void YYNODESTATE::pop()
{
        /* Not used with the garbage collector */
}

/*
 * Clear the node allocation pool completely.
 */
void YYNODESTATE::clear()
{
        /* Not used with the garbage collector */
}

#endif /* YYNODESTATE_USE_ALLOCATOR */

/*
 * Default implementation of functions which may be overridden.
 */
void YYNODESTATE::failed()
{
}

#ifdef YYNODESTATE_TRACK_LINES

char *YYNODESTATE::currFilename()
{
        return (char *)0;
}

long YYNODESTATE::currLinenum()
{
        return 0;
}

#endif

--- NEW FILE ---


Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/treecc/etc/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Makefile.am 15 Dec 2002 04:03:27 -0000      1.2
--- Makefile.am 4 Jul 2003 04:53:48 -0000       1.3
***************
*** 3,5 ****
  ## the "mkskel-sh" script.  They aren't installed any more.
  
! noinst_DATA = cpp_skel.cc cpp_skel.h c_skel.c c_skel.h
--- 3,6 ----
  ## the "mkskel-sh" script.  They aren't installed any more.
  
! noinst_DATA = cpp_skel.cc cpp_skel.h c_skel.c c_skel.h \
!                         cpp_gc_skel.cc cpp_gc_skel.h c_gc_skel.c c_gc_skel.h





reply via email to

[Prev in Thread] Current Thread [Next in Thread]