|
75 | 75 | <script src="bustub-wasm-shell.js"></script>
|
76 | 76 |
|
77 | 77 | <script type="text/javascript">
|
78 |
| - const BUSTUB_PUBLIC_VERSION_VAR = "957b347" |
79 |
| - const BUSTUB_PRIVATE_VERSION_VAR = "44fd44a" |
80 |
| - const BUSTUB_BUILD_TIME_VAR = "20231029" |
<
10000
tr class="diff-line-row">
| 78 | + const BUSTUB_PUBLIC_VERSION_VAR = "ab79c88" |
| 79 | + const BUSTUB_PRIVATE_VERSION_VAR = "fff202bb" |
| 80 | + const BUSTUB_BUILD_TIME_VAR = "20231112" |
81 | 81 | let is_ready = false
|
82 | 82 |
|
83 | 83 | Module['onRuntimeInitialized'] = function () {
|
84 |
| - const executeQuery = Module.cwrap('BustubExecuteQuery', 'number', ['string', 'number', 'number']) |
| 84 | + const executeQuery = Module.cwrap('BustubExecuteQuery', 'number', ['string', 'number', 'number', 'number']) |
85 | 85 | const initialize = Module.cwrap('BustubInit', 'number', [])
|
86 | 86 | window.executeQuery = (x) => {
|
87 | 87 | const bufferSize = 64 * 1024
|
88 | 88 | let output = "\0".repeat(bufferSize)
|
89 | 89 | let ptrOutput = Module.allocateUTF8(output)
|
90 |
| - const retCode = executeQuery(x, ptrOutput, bufferSize) |
| 90 | + let output2 = "\0".repeat(bufferSize) |
| 91 | + let ptrOutput2 = Module.allocateUTF8(output2) |
| 92 | + const retCode = executeQuery(x, ptrOutput2, ptrOutput, bufferSize) |
91 | 93 | output = Module.UTF8ToString(ptrOutput)
|
| 94 | + output2 = Module.UTF8ToString(ptrOutput2) |
92 | 95 | Module._free(ptrOutput)
|
93 |
| - return [retCode, output] |
| 96 | + Module._free(ptrOutput2) |
| 97 | + return [retCode, output2, output] |
94 | 98 | }
|
95 | 99 | initialize()
|
96 | 100 | is_ready = true
|
|
105 | 109 | command: true
|
106 | 110 | }
|
107 | 111 | let line = ""
|
| 112 | + let bustub_prompt = "" |
108 | 113 | var term = $('body').terminal(function (command) {
|
109 | 114 | if (!is_ready) {
|
110 | 115 | this.echo("BusTub shell is still initializing, please wait.")
|
|
115 | 120 | if (line == "\\clear") {
|
116 | 121 | this.clear()
|
117 | 122 | } else {
|
118 |
| - const [retCode, result] = executeQuery(line) |
| 123 | + const [retCode, new_prompt, result] = executeQuery(line) |
| 124 | + bustub_prompt = new_prompt |
| 125 | + console.log(bustub_prompt) |
119 | 126 | this.echo(result, { raw: true })
|
120 | 127 | if (retCode == 1) {
|
121 | 128 | this.echo("Table truncated due to output limit.")
|
|
126 | 133 | }
|
127 | 134 | }, {
|
128 | 135 | greetings: `[[@;;;;bustub.svg]]`,
|
129 |
| - prompt: () => line.length == 0 ? "[[b;;]bustub> ]" : "[[b;;]... ]" |
| 136 | + prompt: () => line.length == 0 ? "[[b;;]" + (bustub_prompt.length == 0 ? "bustub" : bustub_prompt) + "> ]" : "[[b;;]... ]" |
130 | 137 | })
|
131 | 138 | term.echo(`<hr><h1>Live Database Shell</h1>`, { raw: true })
|
132 | 139 |
|
|
0 commit comments