sys:load   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define sys:load
  (lambda (path . quiet?)
    (let ((file-string (or (sys:slurp-file path)
                           (sys:slurp-file (string-append (sys:share-dir) "/" path))))
          (cnt 0))
      (if (not file-string)
          (if (or (null? quiet?) (not (car quiet?)))
              (begin (print-with-colors 'red 'default #t (print "File Error"))
                     (print " couldn't find file ")
                     (print-with-colors 'blue 'default #f (print path "\n"))
                     #f)
              #f)
          (let ((input (open-input-string file-string))
                (msg (call/cc
                      (lambda (k)
                        (set! *sys:load-escape-stack* (cons k *sys:load-escape-stack*))
                        ""))))
            (if (string=? msg "")
                (begin
                  (let loop ((sexpr (read input)))
                    (if (not (eof-object? sexpr))
                        (begin
                          (set! *global-sysload-evals* (cons sexpr *global-sysload-evals*))
                          (set! *global-sysload-evals* (list-head *global-sysload-evals* 10))
                          (eval (car *global-sysload-evals*) (interaction-environment))
                          (loop (read input)))))
                  (close-input-port input)
                  (set! *sys:load-escape-stack* (cdr *sys:load-escape-stack*))
                  #t)
                (let ((words (regex:split msg " ")))
                  (if (or (null? quiet?) (not (car quiet?)))
                      (begin (print-with-colors 'yellow 'default #t (print "sys:load notification "))
                             (for-each (lambda (w) (print w "")) words)
                             (println)))
                  (close-port input)
                  #f)))))))


Back to Index

Similar Entries

  • ai_load_ogl_texture    xtlang
  • ai_load_ogl_texture_from_buffer    xtlang
  • analogue-load-preset    scheme
  • analogue-load-state    scheme
  • assimp_load_model    xtlang
  • assimp_load_model    xtlang
  • assimp_load_model    scheme
  • cerberus-load-preset    scheme
  • cerberus-load-state    scheme
  • db_load    xtlang
  • dsp_load    xtlang
  • get_download_handler    xtlang
  • get_load_handler    xtlang
  • gl_load_image    xtlang
  • gl_load_image_rect    xtlang
  • gl_load_movie_textures    xtlang
  • gl_load_movie_textures    xtlang
  • gl_load_tex    xtlang
  • gl_load_tex_bgr    xtlang
  • gl_load_tex_ext    xtlang
  • gl_load_tex_ext_bgr    xtlang
  • gl_load_tex_rect    xtlang
  • impc:aot:insert-load-dylib-details    scheme
  • impc:compiler:print-dylib-loading-details-to-log    scheme
  • ipc:load    scheme
  • is_loading    xtlang
  • lilv_load_plugin    xtlang
  • load-sample    scheme
  • load-sampler    scheme
  • load-tex    xtlang
  • load-tex    xtlang
  • load_assim_material_texture    xtlang
  • load_blep_tables_from_blob    unknown
  • load_cube_data    xtlang
  • load_data    xtlang
  • load_vg_fonts    xtlang
  • nvg_load_opensans_fonts    xtlang
  • print-load    scheme
  • reload    xtlang
  • reload_ignore_cache    xtlang
  • stop_load    xtlang
  • sys:load-escape    scheme
  • sys:load-preload-check    scheme
  • sys:load-then-quit    scheme
  • xtm_load_vgimage    xtlang
  • xtm_projection_texture_load    xtlang