9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] ape port
  2002-07-03  9:16 [9fans] ape port Peter A. Cejchan
@ 2002-07-03  9:13 ` Lucio De Re
  2002-07-03  9:15 ` Boyd Roberts
  1 sibling, 0 replies; 3+ messages in thread
From: Lucio De Re @ 2002-07-03  9:13 UTC (permalink / raw)
  To: 9fans

On Wed, Jul 03, 2002 at 11:16:07AM +0200, Peter A. Cejchan wrote:
> 
> mk install (w/APE):
> 
> /usr/pac/wrk/engine/source/./builtins.h:89[stdin:629] name not declared: free
> 
Aren't you just missing a header file?  <stdlib.h> comes to mind...

++L


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] ape port
  2002-07-03  9:16 [9fans] ape port Peter A. Cejchan
  2002-07-03  9:13 ` Lucio De Re
@ 2002-07-03  9:15 ` Boyd Roberts
  1 sibling, 0 replies; 3+ messages in thread
From: Boyd Roberts @ 2002-07-03  9:15 UTC (permalink / raw)
  To: 9fans

"Peter A. Cejchan" wrote:
>   { "sin",    calc_sin,    free, NULL, R_REAL }, /* Sine function        */

You'll need <stdlib.h> for free()


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [9fans] ape port
@ 2002-07-03  9:16 Peter A. Cejchan
  2002-07-03  9:13 ` Lucio De Re
  2002-07-03  9:15 ` Boyd Roberts
  0 siblings, 2 replies; 3+ messages in thread
From: Peter A. Cejchan @ 2002-07-03  9:16 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

mk install (w/APE):

/usr/pac/wrk/engine/source/./builtins.h:89[stdin:629] name not declared: free

/*
 * Common functions, with no fancy init or dispose phases.
 */
// line 89:
  { "sin",    calc_sin,    free, NULL, R_REAL }, /* Sine function        */

see builtins.h appended
Hand on heart, I don't understand how this table works... :-(
Sorry.

-- 
++pac.

Peter A. Cejchan
Paleobiology Lab, GLU Acad. Sci. CZ
<pac@next.gli.cas.cz>
[http | ftp]://next.gli.cas.cz

[-- Attachment #2.1: Type: text/plain, Size: 277 bytes --]

The following attachment had content that we can't
prove to be harmless.  To avoid possible automatic
execution, we changed the content headers.
The original header was:

	Content-Type: text/x-chdr; charset=us-ascii
	Content-Disposition: attachment; filename="builtins.h"

[-- Attachment #2.2: builtins.h.suspect --]
[-- Type: application/octet-stream, Size: 5030 bytes --]

#ifndef __built_in_h
#define __built_in_h

/*
 * builtins.h: Header file for builtins.c
 *
 * (c) 1994 Luis E. Mu#oz
 *          TRUE Consulting - Caracas - Venezuela
 *
 *
 * 
 * This code can be used for non-commercial uses. Commercial use of either
 * the enclosed code or any material produced with it is not permitted
 * without a consent from the authors. This notice must not be removed.
 *
 *                        lem@usb.ve
 *                        lem@true.net
 */

#include <math.h>
#include <stdio.h>
#include "slist.h"
#include "ptree.h"

/*
 * The associated types that can be returned by
 * each procedure.
 */

#define R_REAL   0		/* Real Number */
#define R_STRING 1		/* A quoted string */
#define R_COMP   2		/* Composite operation */
#define R_FUNC   3		/* Function */
#define R_IDENT  4		/* An Identifier (variable) */
#define R_NEG    5		/* Aritmetic negation */
#define R_MAP    6		/* Mapping */
#define R_NONE   -1		/* No type */

#define MIN_BUF_LEN   64

#define STD_FREE      free	/* what to use to free default data */

typedef struct {
  int NumEntries;		/* How many entries   */
  char **Entry;			/* The actual entries */
} Map_Data;

/* The primitive functions */
void *_plus       (void *, listdesc, int *);
void *_minus      (void *, listdesc, int *);
void *_neg        (void *, listdesc, int *);
void *_times      (void *, listdesc, int *);
void *_div        (void *, listdesc, int *);

/* Built inc functions */
void *calc_sin    (void *, listdesc, int *);
void *calc_cos    (void *, listdesc, int *);
void *calc_ifelse (void *, listdesc, int *);
void *calc_lt     (void *, listdesc, int *);
void *calc_gt     (void *, listdesc, int *);
void *calc_eq     (void *, listdesc, int *);
void *calc_linear (void *, listdesc, int *);
void *calc_pow    (void *, listdesc, int *);
void *calc_abs    (void *, listdesc, int *);
void *calc_accel  (void *, listdesc, int *);
void *calc_bound  (void *, listdesc, int *);
void *calc_smooth (void *, listdesc, int *);
void *calc_mod    (void *, listdesc, int *);
void *calc_map    (Map_Data *, listdesc, int *);

void *map_alloc(listdesc);

typedef struct {
  char *Token;
  void *(*Eval)(void*, listdesc, int *Type);
  void (*Free)(void *, listdesc);
  void *(*Alloc)(listdesc);
  int Type;
} Table_Entry;


#ifdef __BUILTIN_TABLE

Table_Entry BuiltInFuncs[] = 
{
/*
 * Common functions, with no fancy init or dispose phases.
 */
  { "sin",    calc_sin,    free, NULL, R_REAL }, /* Sine function        */
  { "cos",    calc_cos,    free, NULL, R_REAL }, /* cosine function      */
  { "ifelse", calc_ifelse, free, NULL, R_REAL }, /* if...else construct  */
  { "gt",     calc_gt,     free, NULL, R_REAL }, /* greather than        */
  { "lt",     calc_lt,     free, NULL, R_REAL }, /* lower than           */
  { "eq",     calc_eq,     free, NULL, R_REAL }, /* equality             */
  { "linear", calc_linear, free, NULL, R_REAL }, /* linear interpolation */
  { "abs",    calc_abs,    free, NULL, R_REAL }, /* abs val of a number  */
  { "pow",    calc_pow,    free, NULL, R_REAL }, /* power of a number    */
  { "accel",  calc_accel,  free, NULL, R_REAL }, /* acceleration func.   */
  { "bound",  calc_bound,  free, NULL, R_REAL }, /* bound function       */
  { "smooth", calc_smooth, free, NULL, R_REAL }, /* smooth interp        */
  { "mod",    calc_mod,    free, NULL, R_REAL }, /* modulus              */
/*
 * More complicated functions...
 */
  { "map",    calc_map, free, map_alloc, R_STRING }, /* mapping      */
/*
 * End Of Table.
 */
  { NULL,    NULL, NULL, NULL, R_NONE } /* Marks the end of the table!   */
};

#endif /* __BUILTIN_TABLE */

/* Some macros to ease the construction of built in functions
   and evaluators.
*/


#define DECLARES(VarName) \
  double * VarName;\
  int VarName##Type;\
  TreeNode * VarName##Node;\
  void (* VarName##Free)(void *, listdesc)

#define NODE(VarName)        VarName##Node
#define TYPE(VarName)        VarName##Type
#define FREE(VarName)        VarName##Free

#define COPY(Dest, Source) \
  TYPE(Dest) = TYPE(Source);\
  NODE(Dest) = NODE(Source);\
  FREE(Dest) = FREE(Source);\
  Dest = Source;

#define EVALUATE(VarName)  \
  TYPE(VarName) = Eval(NODE(VarName), &VarName, &FREE(VarName))

#define CHECK_TYPE(VarName, MyType, FuncName) \
  if (TYPE(VarName) != MyType) \
    {\
       fprintf(stderr, "Wrong arguments passed to `" FuncName "'.\n");\
       exit(1);\
    }

#define CHECK_TO_FREE(VarName) \
  if (FREE(VarName)) \
     (*FREE(VarName))(VarName, NODE(VarName)->Childs)\

#define SET_RESULTING_TYPE(Pointer, Type) \
  if (Pointer) *(Pointer) = (Type)

#define ALLOC(Pointer, Type, Msg) \
  (Pointer) = malloc(sizeof(Type)); \
  if (!(Pointer)) { \
    fprintf(stderr, "Cannot alloc: %s\n", (Msg)); \
    exit(1); }\

/* The definition of blanks in a `Map File' */

#define MAP_BLANK " \t,:"

#endif /* __built_in_h*/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-03  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-03  9:16 [9fans] ape port Peter A. Cejchan
2002-07-03  9:13 ` Lucio De Re
2002-07-03  9:15 ` Boyd Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).