mule-base / lib-src / fakelisp.c

#include "fakelisp.h"

void *Lisp_Object_Table[4096];
int Lisp_Object_Index = 0;

Lisp_Object
make_vector(len)
     int len;
{
  Lisp_Object val = Lisp_Object_Index++;

  Lisp_Object_Table[val] = (char *) malloc (sizeof (struct Lisp_Vector));
  XVECTOR (val)->size = len;
  XVECTOR (val)->contents =
    (Lisp_Object *) malloc ((sizeof (Lisp_Object)) * len);
  return (val | (Lisp_Vector << VALBITS));
}

Lisp_Object
make_string(str)
     char *str;
{
  Lisp_Object val = Lisp_Object_Index++;
  int len = strlen (str);

  Lisp_Object_Table[val] = (char *) malloc (sizeof (struct Lisp_String));
  XSTRING (val)->size = len;
  XSTRING (val)->data = (unsigned char *) malloc (len + 1);
  memcpy (XSTRING (val)->data, str, len + 1);
  return (val | (Lisp_String << VALBITS));
}

Lisp_Object
make_symbol(name)
     char *name;
{
  Lisp_Object val = Lisp_Object_Index++;
  int len = strlen (name);

  Lisp_Object_Table[val] = (char *) malloc (sizeof (struct Lisp_Symbol));
  XSYMBOL (val)->name = (unsigned char *) malloc (len + 1);
  memcpy (XSYMBOL (val)->name, name, len + 1);
  XSYMBOL (val)->value = Qnil;
  return (val | (Lisp_String << VALBITS));
}

Lisp_Object
Fsymbol_value(obj)
     Lisp_Object obj;
{
  return XSYMBOL (obj)->value;
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.