OSDN Git Service

* libc/include/sys/types.h: Define useconds_t.
[pf3gnuchains/pf3gnuchains3x.git] / cgen / cgen-stest.scm
1 ; CPU description file generator for the simulator testsuite.
2 ; Copyright (C) 2000 Red Hat, Inc.
3 ; This file is part of CGEN.
4
5 ; This is invoked to build several .s files and a script to run to
6 ; generate the .d files and .exp file.
7 ; This is invoked to build: tmp-build.sh cpu-cpu.exp
8 \f
9 ; Load the various support routines
10 (define (load-files srcdir)
11   ; Fix up Scheme to be what we use (guile is always in flux).
12   (primitive-load-path (string-append srcdir "/fixup.scm"))
13
14   (load (string-append srcdir "/read.scm"))
15   (load (string-append srcdir "/desc.scm"))
16   (load (string-append srcdir "/desc-cpu.scm"))
17   (load (string-append srcdir "/opcodes.scm"))
18   (load (string-append srcdir "/opc-asmdis.scm"))
19   (load (string-append srcdir "/opc-ibld.scm"))
20   (load (string-append srcdir "/opc-itab.scm"))
21   (load (string-append srcdir "/opc-opinst.scm"))
22   (load (string-append srcdir "/sim-test.scm"))
23 )
24
25 (define stest-arguments
26   (list
27    (list '-B "file" "generate build.sh"
28          (lambda (arg) (file-write arg cgen-build.sh)))
29    (list '-E "file" "generate the testsuite .exp"
30          (lambda (arg) (file-write arg cgen-allinsn.exp)))
31    )
32 )
33
34 ; Kept global so it's available to the other .scm files.
35 (define srcdir ".")
36
37 ; Scan argv for -s srcdir.
38 ; We can't process any other args until we find the cgen source dir.
39 ; The result is srcdir.
40 ; We assume "-s" isn't the argument to another option.  Unwise, yes.
41 ; Alternatives are to require it to be the first argument or at least preceed
42 ; any option with a "-s" argument, or to put knowledge of the common argument
43 ; set and common argument parsing code in every top level file.
44
45 (define (find-srcdir argv)
46   (let loop ((argv argv))
47     (if (null? argv)
48         (error "`-s srcdir' not present, can't load cgen"))
49     (if (string=? "-s" (car argv))
50         (begin
51           (if (null? (cdr argv))
52               (error "missing srcdir arg to `-s'"))
53           (cadr argv))
54         (loop (cdr argv))))     
55 )
56
57 ; Main routine, parses options and calls generators.
58
59 (define (cgen-stest argv)
60   (let ()
61
62     ; Find and set srcdir, then load all Scheme code.
63     ; Drop the first argument, it is the script name (i.e. argv[0]).
64     (set! srcdir (find-srcdir (cdr argv)))
65     (set! %load-path (cons srcdir %load-path))
66     (load-files srcdir)
67
68     (display-argv argv)
69
70     (cgen #:argv argv
71           #:app-name "sim-test"
72           #:arg-spec stest-arguments
73           #:init sim-test-init!
74           #:finish sim-test-finish!
75           #:analyze sim-test-analyze!)
76     )
77 )
78
79 (cgen-stest (program-arguments))