Esempio n. 1
0
object weak_binding(object value) {
    object p;
    gc_tmp1 = value;
    p = make_heap_object(WEAK_TYPE,sizeof(struct pair_heap_structure));
    WEAK_BOUND(p) = true_object;
    WEAK_VALUE(p) = gc_tmp1;
    return p;
}
Esempio n. 2
0
object make_closure(object proc, object env) {
	object result;
	gc_tmp1 = proc;
	gc_tmp2 = env;
	result = make_heap_object(CLOSURE_TYPE,
							  sizeof(struct closure_heap_structure));
	CLOSURE_ENV(result) = gc_tmp2;
	CLOSURE_PROC(result) = gc_tmp1;
	return result;
}
Esempio n. 3
0
void define_primop(char *name, primop_proc proc,long argc0, long argcN) {
	object result;
	result = make_heap_object(PRIMOP_TYPE,
							  sizeof(struct primop_heap_structure));
	PRIMOP_PROC(result) = proc;
	PRIMOP_ARGC_MIN(result) = argc0;
	PRIMOP_ARGC_MAX(result) = argcN;
	PRIMOP_INLINE_OP(result) = -1;
	PRIMOP_NAME(result) = name;
	define(name,result);
}
Esempio n. 4
0
object make_string_of_size(long length, int zero) {
	long i;
	object s = make_heap_object(STRING_TYPE,
								sizeof(struct string_heap_structure) +
								length + 1);
	STRING_LENGTH(s) = length;
	if (zero)
		for (i=0; i<=length; i++) STRING_VALUE(s)[i] = '\0';
	else
		STRING_VALUE(s)[length] = '\0';
	return s;
}
Esempio n. 5
0
File: table.c Progetto: Archs/scheme
object make_table(long capacity) {
  object bindings = make_vector(capacity*2, false_object);
  long size = sizeof(struct table_heap_structure);
  object *ve, v;
  PUSH_GC_PROTECT(bindings);
  v = make_heap_object(TABLE_TYPE,size);
  TABLE_COUNT(v) = 0;
  VECTOR_TAG(bindings) = false_object;
  /* FIX ME */
  TABLE_BINDINGS(v) = bindings;
  POP_GC_PROTECT(1);
  return v;
}
Esempio n. 6
0
object make_procedure(object opbuffer, object name, long argc) {
	long op_size = BUFFER_LENGTH(opbuffer);
	object result;
	gc_tmp2 = name;
	gc_tmp3 = opbuffer;
	result = make_heap_object(PROCEDURE_TYPE,
							  sizeof(struct proc_heap_structure));
	PROC_OPS(result) = (long *)allocate_code_space(op_size);
	memcpy(PROC_OPS(result),BUFFER_DATA(gc_tmp3),op_size);
	PROC_MODULE(result) = gc_tmp2;
	PROC_ARGC(result) = argc;
	return result;
}
Esempio n. 7
0
object make_continuation(object the_frame, long* pc, object* sp_) {
	object result;
	long size = stack_top - sp_;
	long i = size * sizeof(object);
	gc_tmp1 = the_frame;
	result = make_heap_object(CONTINUATION_TYPE,
							  sizeof(struct continuation_heap_structure) + i);
	CONTINUATION_FRAME(result) = gc_tmp1;
	CONTINUATION_PC(result) = pc;
	if ((CONTINUATION_STACKSIZE(result) = size) != 0) {
		memcpy(CONTINUATION_STACK(result), sp_, i);
	}
	return result;
}
Esempio n. 8
0
object make_buffer(long capacity) {
    long size = sizeof(struct buffer_heap_structure) + capacity;
    object result = make_heap_object(BUFFER_TYPE,size);
    BUFFER_LENGTH(result) = 0;
    return result;
}