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

Go to the source code of this file.

Functions

struct cons_pointer lisp_print (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 Function; print one complete lisp expression and return NIL.
 
struct cons_pointer lisp_println (struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
 (prinln out-stream): Print a new line character to out-stream, if it is specified and is an output stream, else to *out*.
 
struct cons_pointer print (URL_FILE *output, struct cons_pointer pointer)
 Print the cons-space object indicated by pointer to the stream indicated by output.
 
void print_128bit (URL_FILE *output, __int128_t n)
 stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc
 
void print_list (URL_FILE *output, struct cons_pointer pointer)
 
void print_list_contents (URL_FILE *output, struct cons_pointer pointer, bool initial_space)
 Print a single list cell (cons cell) indicated by pointer to the stream indicated by output.
 
void print_map (URL_FILE *output, struct cons_pointer map)
 
void print_string (URL_FILE *output, struct cons_pointer pointer)
 print all the characters in the string indicated by pointer onto the stream at this output, prepending and appending double quote characters.
 
void print_string_contents (URL_FILE *output, struct cons_pointer pointer)
 print all the characters in the symbol or string indicated by pointer onto this output; if pointer does not indicate a string or symbol, don't print anything but just return.
 
void print_vso (URL_FILE *output, struct cons_pointer pointer)
 
void println (URL_FILE *output)
 

Function Documentation

◆ lisp_print()

struct cons_pointer lisp_print ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

Function; print one complete lisp expression and return NIL.

If write-stream is specified and is a write stream, then print to that stream, else the stream which is the value of *out* in the environment.

  • (print expr)
  • (print expr write-stream)
Parameters
framemy stack_frame.
frame_pointera pointer to my stack_frame.
envmy environment (from which the stream may be extracted).
Returns
NIL.

Definition at line 295 of file print.c.

References debug_dump_object(), DEBUG_IO, debug_print(), dec_ref(), file_to_url_file(), get_default_stream(), inc_ref(), NIL, pointer2cell, print(), and writep.

Referenced by main().

◆ lisp_println()

struct cons_pointer lisp_println ( struct stack_frame frame,
struct cons_pointer  frame_pointer,
struct cons_pointer  env 
)

(prinln out-stream): Print a new line character to out-stream, if it is specified and is an output stream, else to *out*.

Parameters
frame
frame_pointer
env
Returns
nil

Definition at line 343 of file print.c.

References dec_ref(), file_to_url_file(), get_default_stream(), inc_ref(), NIL, pointer2cell, println(), and writep.

◆ print()

◆ print_128bit()

void print_128bit ( URL_FILE output,
__int128_t  n 
)

◆ print_list()

void print_list ( URL_FILE output,
struct cons_pointer  pointer 
)

Definition at line 87 of file print.c.

References print_list_contents(), and url_fputws.

Referenced by print().

◆ print_list_contents()

void print_list_contents ( URL_FILE output,
struct cons_pointer  pointer,
bool  initial_space 
)

Print a single list cell (cons cell) indicated by pointer to the stream indicated by output.

if initial_space is true, prepend a space character.

Definition at line 66 of file print.c.

References CONSTV, NILTV, cons_space_object::payload, pointer2cell, print(), print_list_contents(), cons_space_object::tag, url_fputwc, and url_fwprintf.

Referenced by print_list(), and print_list_contents().

◆ print_map()

void print_map ( URL_FILE output,
struct cons_pointer  map 
)

Definition at line 93 of file print.c.

References c_car(), c_cdr(), hashmap_get(), hashmap_keys(), hashmapp, nilp, pointer_to_vso, print(), url_fputwc, and url_fputws.

Referenced by print_vso().

◆ print_string()

void print_string ( URL_FILE output,
struct cons_pointer  pointer 
)

print all the characters in the string indicated by pointer onto the stream at this output, prepending and appending double quote characters.

Definition at line 54 of file print.c.

References print_string_contents(), and url_fputwc.

Referenced by print().

◆ print_string_contents()

void print_string_contents ( URL_FILE output,
struct cons_pointer  pointer 
)

print all the characters in the symbol or string indicated by pointer onto this output; if pointer does not indicate a string or symbol, don't print anything but just return.

Definition at line 37 of file print.c.

References keywordp, cons_space_object::payload, pointer2cell, stringp, symbolp, and url_fputwc.

Referenced by print(), and print_string().

◆ print_vso()

void print_vso ( URL_FILE output,
struct cons_pointer  pointer 
)

◆ println()

void println ( URL_FILE output)

Definition at line 329 of file print.c.

References url_fputws.

Referenced by lisp_println(), and lisp_repl().