-
Notifications
You must be signed in to change notification settings - Fork 1
/
xpost.rkt
105 lines (102 loc) · 3.29 KB
/
xpost.rkt
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#lang racket
(require "xio.rkt"
"xcgr.rkt"
"xar.rkt"
"xcgr.rkt"
"xensg.rkt"
"xcgr.rkt"
"xar.rkt"
"xensg.rkt")
(define (upost:switch action)
(define (run-post)
(newline)
(let* ((src (uio:request-file-name "Mixwell program file name" "" "MW"))
(dst (uio:request-file-name "Scheme program file name" src "SCM"))
(program #f))
(let ((pgm (uio:cut-off-ext src)))
(newline)
(display "Post-processing:")
(newline)
(display " post( ")
(display src)
(display " ) -> ")
(display dst)
(newline)
(set! program (uio:file->list src))
(set! program (ucgr:main pgm pgm program))
(set! program (uar:main pgm pgm program))
(set! program (ucgr:main pgm pgm program))
(set! program (uensg:main pgm pgm program))
(uio:list->pp-target-file dst program 79)
(newline)
(display "Target program has been written into ")
(display dst)
(newline))))
(define (run-cgr)
(newline)
(let* ((src (uio:request-file-name
"Source Mixwell program file name"
""
"MW"))
(dst (uio:request-file-name
"Target Mixwell program file name"
src
"CGR"))
(prog (uio:file->list src)))
(set! prog (ucgr:main src dst prog))
(uio:list->pp-target-file dst prog 79)
(newline)
(display "Target program has been written into ")
(display dst)
(newline)))
(define (run-ar)
(newline)
(let* ((src (uio:request-file-name
"Source Mixwell program file name"
""
"MW"))
(dst (uio:request-file-name
"Target Mixwell program file name"
src
"AR"))
(prog (uio:file->list src)))
(set! prog (uar:main src dst prog))
(uio:list->pp-target-file dst prog 79)
(newline)
(display "Target program has been written into ")
(display dst)
(newline)))
(define (run-ensugar)
(newline)
(let* ((src (uio:request-file-name
"Source Mixwell program file name"
""
"MW"))
(dst (uio:request-file-name
"Target Scheme program file name"
src
"SCE"))
(prog (uio:file->list src)))
(set! prog (uensg:main src dst prog))
(uio:list->pp-file dst prog 79)
(newline)
(display "Ensugared program has been written into ")
(display dst)
(newline)))
(define (run-form)
(newline)
(let* ((src (uio:request-file-name "Source program file name" "" "S"))
(dst (uio:request-file-name "Target program file name" src "SCF"))
(prog (uio:file->list src)))
(uio:list->pp-file dst prog 79)
(newline)
(display "Formatted program has been written into ")
(display dst)
(newline)))
(case action
((post) (run-post))
((cgr) (run-cgr))
((ar) (run-ar))
((ensugar) (run-ensugar))
((form) (run-form))))
(provide (all-defined-out))