From c0e6c7e2977394d8075ced8f180231c35776ec45 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Tue, 28 Jul 2015 01:59:08 -0400 Subject: [PATCH] Attempting to use Cyc_make_vector instead of make_vector --- scheme/cyclone/cgen.scm | 11 +++++++---- test2.scm | 19 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/scheme/cyclone/cgen.scm b/scheme/cyclone/cgen.scm index fb12b071..925fd6c5 100644 --- a/scheme/cyclone/cgen.scm +++ b/scheme/cyclone/cgen.scm @@ -482,7 +482,7 @@ ((eq? p 'string->number)"Cyc_string2number") ((eq? p 'list->string) "Cyc_list2string") ((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 'vector-length) "Cyc_vector_length") ((eq? p 'vector-ref) "Cyc_vector_ref") @@ -560,6 +560,7 @@ ((eq? p 'substring) "string_type") ((eq? p 'apply) "object") ((eq? p 'command-line-arguments) "object") + ((eq? p 'make-vector) "object") (else #f))) ;; Determine if primitive creates a C variable @@ -586,12 +587,12 @@ ;; Pass continuation as the function's first parameter? (define (prim:cont? 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 ;; how many args each primitive is supposed to take (define (prim:cont-has-args? exp) (and (prim? exp) - (member exp '(apply)))) + (member exp '(apply make-vector)))) ;; Pass an integer arg count as the function's first parameter? (define (prim:arg-count? exp) @@ -599,9 +600,11 @@ (member exp '(error Cyc-write Cyc-display string-append + - * /)))) ;; 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) (and (prim? exp) - (member exp '(string->list make-vector list->vector)))) + (member exp '(string->list list->vector)))) ;; c-compile-prim : prim-exp -> string -> string (define (c-compile-prim p cont) diff --git a/test2.scm b/test2.scm index 183dfb6f..f54963e7 100644 --- a/test2.scm +++ b/test2.scm @@ -1,15 +1,16 @@ (import (scheme base) (scheme file) (scheme write)) - -(map - (lambda (_) -(set! x 1) -;(write x) -;(write 'Cyc_procedure) -(open-input-file "1.scm") -) -(list 1)) +(write (make-vector 4 #t)) +; +;(map +; (lambda (_) +;(set! x 1) +;;(write x) +;;(write 'Cyc_procedure) +;(open-input-file "1.scm") +;) +;(list 1)) ;;; 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 ??? ;(write 'hello)