File: li_std_string_runme.scm

package info (click to toggle)
swig 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 34,980 kB
  • ctags: 16,742
  • sloc: cpp: 54,566; ansic: 26,563; java: 9,485; python: 7,204; cs: 6,106; makefile: 5,709; yacc: 5,571; sh: 4,988; ruby: 3,742; perl: 3,224; lisp: 1,825; php: 1,670; tcl: 968; ml: 747; xml: 115
file content (32 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; The SWIG modules have "passive" Linkage, i.e., they don't generate
;; Guile modules (namespaces) but simply put all the bindings into the
;; current module.  That's enough for such a simple test.
(dynamic-call "scm_init_li_std_string_module" (dynamic-link "./libli_std_string"))
; Note: when working with non-ascii strings in guile 2
;       Guile doesn't handle non-ascii characters in the default C locale
;       The locale must be set explicitly
;       The setlocale call below takes care of that
;       The locale needs to be a UTF-8 locale to handle the non-ASCII characters
;       But they are named differently on different systems so we try a few until one works

(define (try-set-locale name)
;  (display "testing ")
;  (display name)
;  (display "\n")
  (catch #t
    (lambda ()
      (setlocale LC_ALL name)
      #t
    )
    (lambda (key . parameters)
      #f
    ))
)

(if (not (try-set-locale "C.UTF-8"))     ; Linux
(if (not (try-set-locale "en_US.utf8"))  ; Linux
(if (not (try-set-locale "en_US.UTF-8")) ; Mac OSX
(error "Failed to set any UTF-8 locale")
)))

(load "../schemerunme/li_std_string.scm")