mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 16:57:35 +02:00
Attempting to use Cyc_make_vector instead of make_vector
This commit is contained in:
parent
8e4a21154b
commit
c0e6c7e297
2 changed files with 17 additions and 13 deletions
|
@ -482,7 +482,7 @@
|
||||||
((eq? p 'string->number)"Cyc_string2number")
|
((eq? p 'string->number)"Cyc_string2number")
|
||||||
((eq? p 'list->string) "Cyc_list2string")
|
((eq? p 'list->string) "Cyc_list2string")
|
||||||
((eq? p 'string->list) "string2list")
|
((eq? p 'string->list) "string2list")
|
||||||
((eq? p 'make-vector) "make_vector")
|
((eq? p 'make-vector) "Cyc_make_vector")
|
||||||
((eq? p 'list->vector) "list2vector")
|
((eq? p 'list->vector) "list2vector")
|
||||||
((eq? p 'vector-length) "Cyc_vector_length")
|
((eq? p 'vector-length) "Cyc_vector_length")
|
||||||
((eq? p 'vector-ref) "Cyc_vector_ref")
|
((eq? p 'vector-ref) "Cyc_vector_ref")
|
||||||
|
@ -560,6 +560,7 @@
|
||||||
((eq? p 'substring) "string_type")
|
((eq? p 'substring) "string_type")
|
||||||
((eq? p 'apply) "object")
|
((eq? p 'apply) "object")
|
||||||
((eq? p 'command-line-arguments) "object")
|
((eq? p 'command-line-arguments) "object")
|
||||||
|
((eq? p 'make-vector) "object")
|
||||||
(else #f)))
|
(else #f)))
|
||||||
|
|
||||||
;; Determine if primitive creates a C variable
|
;; Determine if primitive creates a C variable
|
||||||
|
@ -586,12 +587,12 @@
|
||||||
;; Pass continuation as the function's first parameter?
|
;; Pass continuation as the function's first parameter?
|
||||||
(define (prim:cont? exp)
|
(define (prim:cont? exp)
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '(apply command-line-arguments))))
|
(member exp '(apply command-line-arguments make-vector))))
|
||||||
;; TODO: this is a hack, right answer is to include information about
|
;; TODO: this is a hack, right answer is to include information about
|
||||||
;; how many args each primitive is supposed to take
|
;; how many args each primitive is supposed to take
|
||||||
(define (prim:cont-has-args? exp)
|
(define (prim:cont-has-args? exp)
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '(apply))))
|
(member exp '(apply make-vector))))
|
||||||
|
|
||||||
;; Pass an integer arg count as the function's first parameter?
|
;; Pass an integer arg count as the function's first parameter?
|
||||||
(define (prim:arg-count? exp)
|
(define (prim:arg-count? exp)
|
||||||
|
@ -599,9 +600,11 @@
|
||||||
(member exp '(error Cyc-write Cyc-display string-append + - * /))))
|
(member exp '(error Cyc-write Cyc-display string-append + - * /))))
|
||||||
|
|
||||||
;; Does primitive allocate an object?
|
;; Does primitive allocate an object?
|
||||||
|
;; TODO: these are the functions that are defined via macros. This method
|
||||||
|
;; is obsolete and should be replaced by prim:cont? functions over time.
|
||||||
(define (prim:allocates-object? exp)
|
(define (prim:allocates-object? exp)
|
||||||
(and (prim? exp)
|
(and (prim? exp)
|
||||||
(member exp '(string->list make-vector list->vector))))
|
(member exp '(string->list list->vector))))
|
||||||
|
|
||||||
;; c-compile-prim : prim-exp -> string -> string
|
;; c-compile-prim : prim-exp -> string -> string
|
||||||
(define (c-compile-prim p cont)
|
(define (c-compile-prim p cont)
|
||||||
|
|
19
test2.scm
19
test2.scm
|
@ -1,15 +1,16 @@
|
||||||
(import (scheme base)
|
(import (scheme base)
|
||||||
(scheme file)
|
(scheme file)
|
||||||
(scheme write))
|
(scheme write))
|
||||||
|
(write (make-vector 4 #t))
|
||||||
(map
|
;
|
||||||
(lambda (_)
|
;(map
|
||||||
(set! x 1)
|
; (lambda (_)
|
||||||
;(write x)
|
;(set! x 1)
|
||||||
;(write 'Cyc_procedure)
|
;;(write x)
|
||||||
(open-input-file "1.scm")
|
;;(write 'Cyc_procedure)
|
||||||
)
|
;(open-input-file "1.scm")
|
||||||
(list 1))
|
;)
|
||||||
|
;(list 1))
|
||||||
;;; TODO: C macros for funcall1, etc are not being generated even though entries are set
|
;;; TODO: C macros for funcall1, etc are not being generated even though entries are set
|
||||||
;;; in the vector. must be another problem inspecting the vector ???
|
;;; in the vector. must be another problem inspecting the vector ???
|
||||||
;(write 'hello)
|
;(write 'hello)
|
||||||
|
|
Loading…
Add table
Reference in a new issue