Eli   Documents

General Information

 o Eli: Translator Construction Made Easy
 o Global Index
 o Frequently Asked Questions
 o Typical Eli Usage Errors

Tutorials

 o Quick Reference Card
 o Guide For new Eli Users
 o Release Notes of Eli
 o Tutorial on Name Analysis
 o Tutorial on Scope Graphs
 o Tutorial on Type Analysis
 o Typical Eli Usage Errors

Reference Manuals

 o User Interface
 o Eli products and parameters
 o LIDO Reference Manual
 o Typical Eli Usage Errors

Libraries

 o Eli library routines
 o Specification Module Library

Translation Tasks

 o Lexical analysis specification
 o Syntactic Analysis Manual
 o Computation in Trees

Tools

 o LIGA Control Language
 o Debugging Information for LIDO
 o Graphical ORder TOol

 o FunnelWeb User's Manual

 o Pattern-based Text Generator
 o Property Definition Language
 o Operator Identification Language
 o Tree Grammar Specification Language
 o Command Line Processing
 o COLA Options Reference Manual

 o Generating Unparsing Code

 o Monitoring a Processor's Execution

Administration

 o System Administration Guide

Mail Home

Abstract data types to be used in specifications

Previous Chapter Next Chapter Table of Contents


Dynamic Storage Allocation

This module provides functions for dynamic storage allocation. Its operations are significantly faster than the C function malloc, since storage is allocated within larger chunks which are less frequently requested from the system. The module is implemented on top of a more general storage allocation module obstack, which may be used directly if more elaborate allocation mechanisms are needed.

The use of the module requires an initializing call of the function InitDynSpace.

void* InitDynSpace ()
initializes a storage area for subsequent allocations. The result should be assigned to a variable used in subsequent allocation calls.

The module does not have generic parameters. It is used by writing

   $/Adt/DynSpace.fw
in a .specs file.

All entities exported by this module can be used in specifications of type .lido, .init, .finl, and .con. They can also be used in C modules if the interface file DynSpace.h is imported there.

The module exports the following functions:

void* InitDynSpace (void)
Initializes a dynamic storage area and returns a pointer to it. it has to be used in any subsequent call of DynAlloc.

void* DynAlloc (void *space, int size)
Allocates storage of the given size in the area pointed to by space.

void DynClear (void *space)
Deallocates the complete storage area pointed to by space.

The functions can be used in a C module in the following way:

   #include "DynSpace.h"
   void *MySpace;
   /* ... */
   MySpace = InitDynSpace ();
   /* ... */
   p = (TypeX*) DynAlloc (MySpace, sizeof (TypeX));
   /* ... */
   DynClear (MySpace);
   /* ... */

Note: Neither the cast nor the call of sizeof can be part of a LIDO computation, since type identifiers are not allowed in computations. Hence the calls of this module must reside in a C module (that implements the type of the allocated objects).


Previous Chapter Next Chapter Table of Contents