Remove unused private modules
This commit is contained in:
@@ -11,11 +11,8 @@ evolved under supervision of the author using ChatGPT as AI agent.
|
||||
js-maker/
|
||||
main.rkt public macro module
|
||||
info.rkt package metadata and package test entry
|
||||
private/
|
||||
syntax-helpers.rkt compatibility/helper material
|
||||
utils.rkt compatibility/helper material
|
||||
scrbl/
|
||||
jsmaker.scrbl Scribble documentation
|
||||
js-maker.scrbl Scribble documentation
|
||||
testing/
|
||||
jsmaker-executors.rkt JavaScript engine discovery/execution
|
||||
jsmaker-test-framework.rkt JS regression framework
|
||||
@@ -29,18 +26,6 @@ js-maker/
|
||||
show-optimized.rkt
|
||||
```
|
||||
|
||||
## Notes on private helpers
|
||||
|
||||
Static analysis of this package layout shows that `main.rkt`, the test
|
||||
infrastructure, the regression tests, demos and Scribble documentation do not
|
||||
require `private/utils.rkt` or `private/syntax-helpers.rkt`. Those files are
|
||||
retained as compatibility material from the source project and are omitted from
|
||||
compilation and the package test entry point in `info.rkt`.
|
||||
|
||||
The current public module has no dependency on Gregor or the old helper
|
||||
modules. Gregor-style date/time forms are translated syntactically by
|
||||
`main.rkt` into a small JavaScript-side representation.
|
||||
|
||||
## Added language support
|
||||
|
||||
This package includes conservative support for:
|
||||
@@ -98,7 +83,6 @@ Belangrijk:
|
||||
voorkom versieverwarring door alles in die buildmap te kopiëren/patchen.
|
||||
- Houd de package-structuur stabiel:
|
||||
- main.rkt voor de publieke module;
|
||||
- private/ voor helpers en utils;
|
||||
- testing/ voor test-infrastructuur en regressietests;
|
||||
- demo/ voor demonstratiebestanden;
|
||||
- info.rkt voor package metadata en test entry points.
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
;; These files are supporting/reference files in this package layout and are
|
||||
;; not part of the package test entry point.
|
||||
(define test-omit-paths
|
||||
'("private/utils.rkt"
|
||||
"private/syntax-helpers.rkt"
|
||||
"demo/show-jsmaker-output.rkt"
|
||||
'("demo/show-jsmaker-output.rkt"
|
||||
"demo/show-optimized.rkt"
|
||||
"testing/jsmaker-executors.rkt"
|
||||
"testing/jsmaker-test-framework.rkt"
|
||||
@@ -34,10 +32,3 @@
|
||||
"testing/jsmaker-usecases.rkt"
|
||||
"testing/jsmaker-list-regression.rkt"
|
||||
"testing/jsmaker-hash-regression.rkt"))
|
||||
|
||||
;; The private files are compatibility/support material and have project-local
|
||||
;; dependencies in downstream copies. The public module and tests do not
|
||||
;; depend on them.
|
||||
(define compile-omit-paths
|
||||
'("private/utils.rkt"
|
||||
"private/syntax-helpers.rkt"))
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
#lang racket/base
|
||||
|
||||
(require racket/string
|
||||
"utils.rkt"
|
||||
)
|
||||
(provide symbol??
|
||||
symstr
|
||||
symstr-eval
|
||||
is-if?)
|
||||
|
||||
|
||||
(define (symbol?? a)
|
||||
(let ((r (symbol? a)))
|
||||
r))
|
||||
|
||||
(define (symstr x)
|
||||
(cond
|
||||
((list? x)
|
||||
(string-append "[ "
|
||||
(string-join (map symstr-eval x) ", ")
|
||||
" ]"))
|
||||
((vector? x)
|
||||
(symstr (vector->list x)))
|
||||
(else
|
||||
(let ((r (format "~a" x)))
|
||||
(let ((r* (if (string-prefix? r "(quote")
|
||||
(let ((s (substring r 7)))
|
||||
(substring s 0 (- (string-length s) 1)))
|
||||
r)))
|
||||
r*)))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define (symstr-eval x)
|
||||
(cond
|
||||
((string? x) (format "\"~a\"" (esc-double-quote x)))
|
||||
(else (symstr x))))
|
||||
|
||||
(define (is-if? x)
|
||||
(displayln x)
|
||||
(eq? x 'if))
|
||||
@@ -1,209 +0,0 @@
|
||||
#lang racket/base
|
||||
|
||||
(require racket/string
|
||||
racket/port
|
||||
racket/contract
|
||||
json
|
||||
(prefix-in g: gregor)
|
||||
(prefix-in g: gregor/time)
|
||||
gregor-utils
|
||||
racket-sprintf
|
||||
simple-log
|
||||
)
|
||||
|
||||
(provide while
|
||||
until
|
||||
get-lib-path
|
||||
do-for
|
||||
esc-quote
|
||||
esc-double-quote
|
||||
fromJson
|
||||
mk-js-array
|
||||
js-code
|
||||
kv-1
|
||||
kv-2
|
||||
make-kv
|
||||
kv?
|
||||
list-of-kv?
|
||||
list-of-symbol?
|
||||
list-of?
|
||||
string->time
|
||||
time->string
|
||||
string->date
|
||||
date->string
|
||||
string->datetime
|
||||
datetime->string
|
||||
|
||||
dbg-webview
|
||||
err-webview
|
||||
info-webview
|
||||
warn-webview
|
||||
fatal-webview
|
||||
sync-log-webview
|
||||
|
||||
)
|
||||
|
||||
|
||||
(sl-def-log webview)
|
||||
|
||||
(define-syntax while
|
||||
(syntax-rules ()
|
||||
((_ cond body ...)
|
||||
(letrec ((while-f (lambda (last-result)
|
||||
(if cond
|
||||
(let ((last-result (begin
|
||||
body
|
||||
...)))
|
||||
(while-f last-result))
|
||||
last-result))))
|
||||
(while-f #f))
|
||||
)
|
||||
))
|
||||
|
||||
(define-syntax until
|
||||
(syntax-rules ()
|
||||
((_ cond body ...)
|
||||
(letrec ((until-f (lambda (last-result)
|
||||
(if cond
|
||||
last-result
|
||||
(let ((last-reult (begin
|
||||
body
|
||||
...)))
|
||||
(until-f last-result))))))
|
||||
(until-f #f)))))
|
||||
|
||||
(define-syntax do-for
|
||||
(syntax-rules ()
|
||||
((_ (init cond next) body ...)
|
||||
(begin
|
||||
init
|
||||
(letrec ((do-for-f (lamba ()
|
||||
(if cond
|
||||
(begin
|
||||
(begin
|
||||
body
|
||||
...)
|
||||
next
|
||||
(do-for-f))))))
|
||||
(do-for-f))))))
|
||||
|
||||
(define (get-lib-path lib)
|
||||
(let ((platform (system-type)))
|
||||
(cond
|
||||
[(eq? platform 'windows)
|
||||
(let ((try1 (build-path (current-directory) ".." "lib" "dll" lib))
|
||||
(try2 (build-path (current-directory) "lib" "dll" lib)))
|
||||
(if (file-exists? try1)
|
||||
try1
|
||||
try2)
|
||||
)]
|
||||
[else
|
||||
(error (format "Install the shared library: ~a" lib))]
|
||||
)))
|
||||
|
||||
(define (esc-quote str)
|
||||
(string-replace (string-replace str "\\" "\\\\") "'" "\\'"))
|
||||
|
||||
(define (esc-double-quote str)
|
||||
(string-replace (string-replace str "\\" "\\\\") "\"" "\\\""))
|
||||
|
||||
(define (fromJson str)
|
||||
(with-input-from-string str read-json))
|
||||
|
||||
(define (mk-js-array l)
|
||||
(if (list-of-kv? l)
|
||||
(string-append "[ " (string-join (map (λ (e) (mk-js-array e)) l) ", ") " ]")
|
||||
(if (list? l)
|
||||
(string-append "[ " (string-join (map (λ (e) (format "'~a'"
|
||||
(esc-quote (format "~a" e)))) l) ", ") " ]")
|
||||
(if (pair? l)
|
||||
(format "[ '~a', '~a' ]" (car l) (cdr l))
|
||||
(format "[ '~a' ]" (esc-quote (format "~a" l)))))))
|
||||
|
||||
(define (js-code . a)
|
||||
(define (code* l)
|
||||
(if (null? l)
|
||||
""
|
||||
(string-append (car l) "\n" (code* (cdr l)))
|
||||
)
|
||||
)
|
||||
(code* a))
|
||||
|
||||
(define (kv? e)
|
||||
(or
|
||||
(and (list? e) (= (length e) 2) (symbol? (car e)))
|
||||
(and (pair? e) (symbol? (car e)))))
|
||||
|
||||
(define/contract (kv-1 e)
|
||||
(-> kv? symbol?)
|
||||
(car e))
|
||||
|
||||
(define/contract (kv-2 e)
|
||||
(-> kv? any/c)
|
||||
(if (list? e)
|
||||
(cadr e)
|
||||
(cdr e)))
|
||||
|
||||
(define/contract (make-kv k v)
|
||||
(-> symbol? any/c kv?)
|
||||
(if (list? v)
|
||||
(list k v)
|
||||
(cons k v)))
|
||||
|
||||
(define (list-of? pred? l)
|
||||
(define (all-pred? l)
|
||||
(if (null? l)
|
||||
#t
|
||||
(if (pred? (car l))
|
||||
(all-pred? (cdr l))
|
||||
#f)))
|
||||
(if (list? l)
|
||||
(all-pred? l)
|
||||
#f))
|
||||
|
||||
(define (list-of-kv? l)
|
||||
(list-of? kv? l))
|
||||
|
||||
(define (list-of-symbol? l)
|
||||
(list-of? symbol? l))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Date / Time conversion
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (string->time s)
|
||||
(with-handlers ([exn:fail?
|
||||
(λ (e) (g:parse-time s "HH:mm"))])
|
||||
(g:parse-time s "HH:mm:ss")))
|
||||
|
||||
(define (time->string t)
|
||||
(unless (or (g:time? t) (g:datetime? t) (g:moment? t))
|
||||
(error "set! - gregor time?, moment? or datetime? expected"))
|
||||
(sprintf "%02d:%02d:%02d" (g:->hours t) (g:->minutes t) (g:->seconds t)))
|
||||
|
||||
(define (string->datetime s)
|
||||
(with-handlers ([exn:fail?
|
||||
(λ (e) (g:parse-moment s "yyyy-MM-dd'T'HH:mm:ss"))])
|
||||
(g:parse-moment s "yyyy-MM-dd'T'HH:mm")))
|
||||
|
||||
(define (datetime->string dt)
|
||||
(when (racket-date? dt)
|
||||
(datetime->string date->moment dt))
|
||||
(unless (or (g:datetime? dt) (g:moment? dt) (g:date? dt) (g:time? dt))
|
||||
(error "set! - gregor time? , date?, datetime? or moment? expected"))
|
||||
(sprintf "%04d:%02d:%02dT%02d:%02d:%02d"
|
||||
(g:->year dt) (g:->month dt) (g:->day dt)
|
||||
(g:->hours dt) (g:->minutes dt) (g:->seconds dt))
|
||||
)
|
||||
|
||||
(define (string->date d)
|
||||
(g:parse-date d "yyyy-MM-dd"))
|
||||
|
||||
(define (date->string d)
|
||||
(when (racket-date? d)
|
||||
(date->string (date->moment d)))
|
||||
(unless (or (g:date? d) (g:moment? d) (g:datetime? d))
|
||||
(error "set! - gregor date expected"))
|
||||
(sprintf "%04d-%02d-%02d" (g:->year d) (g:->month d) (g:->day d)))
|
||||
|
||||
|
||||
@@ -719,7 +719,6 @@ The package uses this layout:
|
||||
js-maker/
|
||||
main.rkt
|
||||
info.rkt
|
||||
private/
|
||||
testing/
|
||||
demo/
|
||||
scrbl/
|
||||
@@ -728,10 +727,6 @@ js-maker/
|
||||
@filepath{main.rkt} is the public module. @filepath{testing/} contains the
|
||||
executor and regression framework. @filepath{demo/} contains generated-code
|
||||
examples. @filepath{scrbl/} contains this reference and the use-case document.
|
||||
The @filepath{private/} directory contains compatibility/helper material from
|
||||
the source project. The current public module and tests do not depend on those
|
||||
private files; they are kept for downstream compatibility and are omitted from
|
||||
compilation and the package test entry point in @filepath{info.rkt}.
|
||||
|
||||
@section{Limitations and non-goals}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user