1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-31 15:43:01 +00:00

Many updates to the sqlite module.

This commit is contained in:
Calvin Rose
2018-06-23 19:19:26 -04:00
parent 363a17ff8c
commit 4e6fc341dc
7 changed files with 411 additions and 221 deletions

View File

@@ -1093,7 +1093,7 @@ returned from compiling and running the file."
(def cache @{})
(def loading @{})
(fn [path args]
(fn require [path args]
(when (get loading path)
(error (string "circular dependency: module " path " is loading")))
(def {

View File

@@ -127,7 +127,7 @@ extern "C" {
/* What to do when out of memory */
#ifndef DST_OUT_OF_MEMORY
#include <stdio.h>
#define DST_OUT_OF_MEMORY do { printf("out of memory\n"); exit(1); } while (0)
#define DST_OUT_OF_MEMORY do { printf("dst out of memory\n"); exit(1); } while (0)
#endif
/* Helper for debugging */

View File

@@ -1,141 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>Dst</title>
<style type="text/css" media="screen">
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#prompt {
white-space: nowrap;
width: calc(100% - 14px);
overflow: hidden;
font-family: monospace;
border: solid 2px black;
padding: 5px;
}
#prompt br {
display:none;
}
#prompt * {
display:inline;
white-space:nowrap;
}
#console {
border: solid 2px black;
width: calc(100% - 4px);
min-height: 200px;
font-family: monospace;
}
</style>
</head>
<body>
<pre id="console"></pre>
<div contenteditable="true" id="prompt"></div>
<script>
var con = document.getElementById('console');
var Module = {
preRun: function() {
var input = "";
var i = 0;
function stdin() {
if (input === "") {
input = prompt('Input:');
}
if (i < input.length) {
var code = input.charCodeAt(i);
++i;
return code;
} else {
return null;
}
}
function appendChunk(chunk) {
con.innerText += chunk + '\n';
}
var outbuf = "";
function stdout(asciiCode) {
if (asciiCode === 10) {
appendChunk(outbuf);
outbuf = '';
} else if (asciiCode === null) {
appendChunk(outbuf);
outbuf = ' ... ';
} else {
outbuf += String.fromCharCode(asciiCode);
}
}
var errbuf = "";
function stderr(asciiCode) {
if (asciiCode == 10) {
appendChunk(errbuf);
errbuf = '';
} else if (asciiCode === null) {
appendChunk(errbuf);
errbuf = ' ... ';
} else {
errbuf += String.fromCharCode(asciiCode);
}
}
FS.init(stdin, stdout, stderr);
}
};
</script>
<script src="dst.js"></script>
</body>
</html>

View File

@@ -1,26 +0,0 @@
/*
* Copyright (c) 2018 Calvin Rose
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include <dst/dst.h>
#include <dst/dstcompile.h>
// emscripten client code to go here