Skip to content

Commit d93cf94

Browse files
committed
initial commit
Signed-off-by: Alex Chi <[email protected]>
0 parents  commit d93cf94

File tree

5 files changed

+337
-0
lines changed

5 files changed

+337
-0
lines changed

.gitignore

+245
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
#==============================================================================#
2+
# This file specifies intentionally untracked files that git should ignore.
3+
#==============================================================================#
4+
5+
#==============================================================================#
6+
# File extensions to be ignored anywhere in the tree.
7+
#==============================================================================#
8+
# Temp files created by most text editors.
9+
*~
10+
# Merge files created by git.
11+
*.orig
12+
# Java bytecode
13+
*.class
14+
# Byte compiled python modules.
15+
*.pyc
16+
# vim swap files
17+
.*.sw?
18+
.sw?
19+
# vscode settings directory
20+
.vscode
21+
#OS X specific files.
22+
.DS_store
23+
# Core files
24+
#core
25+
26+
#==============================================================================#
27+
# Explicit files to ignore (only matches one).
28+
#==============================================================================#
29+
# Various tag programs
30+
/tags
31+
/TAGS
32+
/GPATH
33+
/GRTAGS
34+
/GSYMS
35+
/GTAGS
36+
.gitusers
37+
autom4te.cache
38+
cscope.files
39+
cscope.out
40+
autoconf/aclocal.m4
41+
autoconf/autom4te.cache
42+
/compile_commands.json
43+
44+
#==============================================================================#
45+
# Build artifacts
46+
#==============================================================================#
47+
#m4/
48+
build/
49+
#*.m4
50+
*.o
51+
*.lo
52+
*.la
53+
*~
54+
*.pdf
55+
*.swp
56+
a.out
57+
58+
#==============================================================================#
59+
# Kate Swap Files
60+
#==============================================================================#
61+
*.kate-swp
62+
.#kate-*
63+
64+
#==============================================================================#
65+
# Backup artifacts
66+
#==============================================================================#
67+
~*
68+
*~
69+
tmp/
70+
71+
#==============================================================================#
72+
# KDevelop files
73+
#==============================================================================#
74+
.kdev4
75+
*.kdev4
76+
.dirstamp
77+
.deps
78+
.libs
79+
80+
#==============================================================================#
81+
# Eclipse files
82+
#==============================================================================#
83+
.wtpmodules
84+
.classpath
85+
.project
86+
.cproject
87+
.pydevproject
88+
.settings
89+
.autotools
90+
91+
/Debug/
92+
/misc/
93+
94+
#==============================================================================#
95+
# Intellij files
96+
#==============================================================================#
97+
.idea
98+
*.iml
99+
100+
#==============================================================================#
101+
# Code Coverage files
102+
#==============================================================================#
103+
*.gcno
104+
*.gcda
105+
106+
107+
#==============================================================================#
108+
# Eclipse
109+
#==============================================================================#
110+
111+
.metadata
112+
bin/
113+
tmp/
114+
*.tmp
115+
*.bak
116+
*.swp
117+
*~.nib
118+
local.properties
119+
.settings/
120+
.loadpath
121+
.recommenders
122+
123+
# Eclipse Core
124+
.project
125+
126+
# External tool builders
127+
.externalToolBuilders/
128+
129+
# Locally stored "Eclipse launch configurations"
130+
*.launch
131+
132+
# PyDev specific (Python IDE for Eclipse)
133+
*.pydevproject
134+
135+
# CDT-specific (C/C++ Development Tooling)
136+
.cproject
137+
138+
# JDT-specific (Eclipse Java Development Tools)
139+
.classpath
140+
141+
# Java annotation processor (APT)
142+
.factorypath
143+
144+
# PDT-specific (PHP Development Tools)
145+
.buildpath
146+
147+
# sbteclipse plugin
148+
.target
149+
150+
# Tern plugin
151+
.tern-project
152+
153+
# TeXlipse plugin
154+
.texlipse
155+
156+
# STS (Spring Tool Suite)
157+
.springBeans
158+
159+
# Code Recommenders
160+
.recommenders/
161+
io_file
162+
163+
## General
164+
165+
# Compiled Object files
166+
*.slo
167+
*.lo
168+
*.o
169+
*.cuo
170+
171+
# Compiled Dynamic libraries
172+
*.so
173+
*.dylib
174+
175+
# Compiled Static libraries
176+
*.lai
177+
*.la
178+
*.a
179+
180+
# Compiled python
181+
*.pyc
182+
183+
# Compiled MATLAB
184+
*.mex*
185+
186+
# IPython notebook checkpoints
187+
.ipynb_checkpoints
188+
189+
# Editor temporaries
190+
*.swp
191+
*~
192+
193+
# Sublime Text settings
194+
*.sublime-workspace
195+
*.sublime-project
196+
197+
# Eclipse Project settings
198+
*.*project
199+
.settings
200+
201+
# Visual Studio
202+
.vs
203+
204+
# QtCreator files
205+
*.user
206+
207+
# PyCharm files
208+
.idea
209+
210+
# OSX dir files
211+
.DS_Store
212+
213+
# User's build configuration
214+
Makefile.config
215+
216+
# build, distribute, and bins (+ python proto bindings)
217+
build
218+
.build_debug/*
219+
.build_release/*
220+
distribute/*
221+
*.testbin
222+
*.bin
223+
cmake_build
224+
.cmake_build
225+
cmake-build-*
226+
227+
# Generated documentation
228+
apidoc/doc
229+
docs/_site
230+
docs/gathered
231+
_site
232+
doxygen
233+
docs/dev
234+
235+
# Config files
236+
*.conf
237+
238+
# Vagrant
239+
.vagrant
240+
241+
# Clangd cache index
242+
.cache
243+
244+
# Submission zip files
245+
*.zip

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 CMU Database Group
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

bustub-wasm-shell.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bustub-wasm-shell.wasm

968 KB
Binary file not shown.

index.html

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<html>
2+
3+
<head>
4+
<title>BusTub Shell</title>
5+
<!-- jQuery -->
6+
<script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>
7+
<!-- jQuery Terminal -->
8+
<script src="https://unpkg.com/[email protected]/js/jquery.terminal.min.js"></script>
9+
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/jquery.terminal.min.css" />
10+
<!-- prismjs -->
11+
<link rel="stylesheet" href="https://unpkg.com/[email protected]/themes/prism.min.css" />
12+
<link rel="stylesheet" href="https://unpkg.com/[email protected]/css/prism.css" />
13+
<script src="https://unpkg.com/[email protected]/prism.js"></script>
14+
<script src="https://unpkg.com/[email protected]/components/prism-sql.min.js"></script>
15+
<script src="https://unpkg.com/[email protected]/js/prism.js"></script>
16+
<!-- CJK characters -->
17+
<script src="https://cdn.jsdelivr.net/gh/jcubic/static/js/wcwidth.js"></script>
18+
</head>
19+
20+
<body>
21+
</body>
22+
23+
<style>
24+
.terminal {
25+
--color: black;
26+
--background: white;
27+
--link-color: darkblue;
28+
--size: 1.2;
29+
}
30+
</style>
31+
32+
<script src="./bustub-wasm-shell.js"></script>
33+
34+
<script type="text/javascript">
35+
Module['onRuntimeInitialized'] = function () {
36+
const executeQuery = Module.cwrap('BustubExecuteQuery', 'number', ['string', 'number', 'number'])
37+
const test = Module.cwrap('Test', 'number', [])
38+
window.executeQuery = (x) => {
39+
let output = new Array(65536).join(" ");
40+
let ptrOutput = Module.allocateUTF8(output);
41+
console.log(executeQuery(x, ptrOutput, 65536));
42+
output = Module.UTF8ToString(ptrOutput);
43+
Module._free(ptrOutput);
44+
return output
45+
}
46+
}
47+
$(document).ready(() => {
48+
$.terminal.syntax('sql')
49+
$.terminal.prism_formatters = {
50+
prompt: false,
51+
echo: false,
52+
animation: false,
53+
command: true
54+
}
55+
let line = ""
56+
var term = $('body').terminal(function (command) {
57+
line += command
58+
if (line.endsWith(';') || line.startsWith("\\")) {
59+
const result = executeQuery(line)
60+
this.echo(result)
61+
line = ""
62+
}
63+
}, {
64+
greetings: "Welcome to the BusTub \u{1F6C1} shell!\nType \\help to learn about the usage.\n",
65+
prompt: () => line.length == 0 ? "[[b;;]bustub> ]" : "[[b;;]...> ]"
66+
})
67+
})
68+
</script>
69+
70+
</html>

0 commit comments

Comments
 (0)