Well, I really made a mess with the last commit; this one sorts it out.
This commit is contained in:
parent
1196b3eb1d
commit
a302663b32
16 changed files with 3671 additions and 0 deletions
45
archive/c/ops/meta.c
Normal file
45
archive/c/ops/meta.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* meta.c
|
||||
*
|
||||
* Get metadata from a cell which has it.
|
||||
*
|
||||
* (c) 2019 Simon Brooke <simon@journeyman.cc>
|
||||
* Licensed under GPL version 2.0, or, at your option, any later version.
|
||||
*/
|
||||
|
||||
#include "memory/conspage.h"
|
||||
#include "debug.h"
|
||||
|
||||
/**
|
||||
* Function: get metadata describing my first argument.
|
||||
*
|
||||
* * (metadata any)
|
||||
*
|
||||
* @return a pointer to the metadata of my first argument, or nil if none.
|
||||
*/
|
||||
struct cons_pointer lisp_metadata( struct stack_frame *frame,
|
||||
struct cons_pointer frame_pointer,
|
||||
struct cons_pointer env ) {
|
||||
debug_print( L"lisp_metadata: entered\n", DEBUG_EVAL );
|
||||
debug_dump_object( frame->arg[0], DEBUG_EVAL );
|
||||
struct cons_pointer result = NIL;
|
||||
struct cons_space_object cell = pointer2cell( frame->arg[0] );
|
||||
|
||||
switch ( cell.tag.value ) {
|
||||
case FUNCTIONTV:
|
||||
result = cell.payload.function.meta;
|
||||
break;
|
||||
case SPECIALTV:
|
||||
result = cell.payload.special.meta;
|
||||
break;
|
||||
case READTV:
|
||||
case WRITETV:
|
||||
result = cell.payload.stream.meta;
|
||||
break;
|
||||
}
|
||||
|
||||
return make_cons( make_cons( c_string_to_lisp_keyword( L"type" ),
|
||||
c_type( frame->arg[0] ) ), result );
|
||||
|
||||
// return result;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue