Post Scarcity
A prototype for a post scarcity programming environment
Loading...
Searching...
No Matches
vectorspace.c File Reference
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include "memory/conspage.h"
#include "memory/consspaceobject.h"
#include "debug.h"
#include "memory/hashmap.h"
#include "memory/stack.h"
#include "memory/vectorspace.h"
#include "ops/intern.h"
Include dependency graph for vectorspace.c:

Go to the source code of this file.

Functions

void free_vso (struct cons_pointer pointer)
 for vector space pointers, free the actual vector-space object.
 
struct cons_pointer make_vec_pointer (struct vector_space_object *address, uint32_t tag)
 Make a cons_space_object which points to the vector_space_object with this tag at this address.
 
struct cons_pointer make_vso (uint32_t tag, uint64_t payload_size)
 Allocate a vector space object with this payload_size and tag, and return a cons_pointer which points to an object whigh points to it.
 

Function Documentation

◆ free_vso()

void free_vso ( struct cons_pointer  pointer)

for vector space pointers, free the actual vector-space object.

Dangerous!

Definition at line 123 of file vectorspace.c.

References DEBUG_ALLOC, debug_printf(), free_hashmap(), free_stack_frame(), get_stack_frame(), HASHTV, vector_space_object::header, cons_space_object::payload, pointer2cell, STACKFRAMETV, and vector_space_header::tag.

Referenced by free_cell().

◆ make_vec_pointer()

struct cons_pointer make_vec_pointer ( struct vector_space_object address,
uint32_t  tag 
)

Make a cons_space_object which points to the vector_space_object with this tag at this address.

@address the address of the vector_space_object to point to. @tag the vector-space tag of the particular type of vector-space object, NOT VECTORPOINTTV.

Returns
a cons_pointer to the object, or NIL if the object could not be allocated due to memory exhaustion.

Definition at line 42 of file vectorspace.c.

References allocate_cell(), DEBUG_ALLOC, debug_dump_object(), debug_print(), debug_printf(), cons_space_object::payload, pointer2cell, cons_space_object::tag, and VECTORPOINTTV.

Referenced by make_vso().

◆ make_vso()

struct cons_pointer make_vso ( uint32_t  tag,
uint64_t  payload_size 
)

Allocate a vector space object with this payload_size and tag, and return a cons_pointer which points to an object whigh points to it.

@tag the vector-space tag of the particular type of vector-space object, NOT VECTORPOINTTAG. @payload_size the size of the payload required, in bytes.

Returns
a cons_pointer to the object, or NIL if the object could not be allocated due to memory exhaustion.

Definition at line 75 of file vectorspace.c.

References DEBUG_ALLOC, debug_dump_object(), debug_print(), debug_printf(), vector_space_object::header, make_vec_pointer(), NIL, vector_space_object::payload, pointer2cell, vector_space_header::size, vector_space_header::tag, and vector_space_header::vecp.

Referenced by make_empty_frame(), and make_hashmap().