1 
 2 ### FuncOpViewer and CodeModelFormatter
 3 ----
 4 
 5 * [Contents](hat-00.md)
 6 * House Keeping
 7     * [Project Layout](hat-01-01-project-layout.md)
 8     * [Building Babylon](hat-01-02-building-babylon.md)
 9     * [Building HAT](hat-01-03-building-hat.md)
10 * Programming Model
11     * [Programming Model](hat-03-programming-model.md)
12 * Interface Mapping
13     * [Interface Mapping Overview](hat-04-01-interface-mapping.md)
14     * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md)
15 * Implementation Detail
16     * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
17     * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md)
18 
19 ----
20 
21 
22 We have a few 'tools' in [hat/tools/src/main/java/hat/tools](https://github.com/openjdk/babylon/blob/code-reflection/hat/tools)
23 which might be useful to others
24 
25 Two in particular
26 
27 #### FuncOpViewer
28 This is a swing app which takes a text file containing text form of a CodeModel (as dumped by the OopWriter)
29 
30 
31 We can generate text for kernels using
32 ```
33 HAT=SHOW_KERNEL_MODEL java @hat/run ffi-opencl mandel
34 ```
35 
36 From the standard out copy the text satrting with `func @loc....1` to the closing `}` and paste it into a file (say mandel.cr)
37 
38 Then
39 
40 ```
41 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.ui.FuncOpViewer mandle.cr
42 ```
43 
44 ### CodeModelFormatter
45 
46 Is a terminal based tool (useful if you are accessing a machine via ssh - and can't launch ui)
47 
48 With it you can dump to the terminal a colorized version of the code model, slightly prettied up with java source for each line inserted as a comment.
49 
50 ```
51 java -cp build/hat-tools-1.0.jar hat.tools.textmodel.terminal.CodeModelFormatter code.cr
52 ```
53