Skip to content

Commit

Permalink
sample, web updates
Browse files Browse the repository at this point in the history
  • Loading branch information
thradams committed Apr 28, 2024
1 parent 58c3f22 commit 34cec2a
Show file tree
Hide file tree
Showing 5 changed files with 1,582 additions and 1,623 deletions.
4 changes: 2 additions & 2 deletions src/flow_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ static void checked_empty_core(struct flow_visit_ctx* ctx,
compiler_diagnostic_message(W_FLOW_MISSING_DTOR,
ctx->ctx,
position_token,
"object '%s' may be not empty or it does not exist",
"object '%s' may be not empty",
previous_names);
}
}
Expand Down Expand Up @@ -2448,7 +2448,7 @@ void checked_read_object_core(struct flow_visit_ctx* ctx,
compiler_diagnostic_message(W_FLOW_NULL_DEREFERENCE,
ctx->ctx,
position_token,
"object '%s', (non-optional) may be null",
"non-nullable pointer '%s' may be null",
previous_names);
}

Expand Down
7 changes: 2 additions & 5 deletions src/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -11418,9 +11418,6 @@ struct report
};





struct parser_ctx
{
struct options options;
Expand Down Expand Up @@ -22578,7 +22575,7 @@ static void checked_empty_core(struct flow_visit_ctx* ctx,
compiler_diagnostic_message(W_FLOW_MISSING_DTOR,
ctx->ctx,
position_token,
"object '%s' may be not empty or it does not exist",
"object '%s' may be not empty",
previous_names);
}
}
Expand Down Expand Up @@ -23426,7 +23423,7 @@ void checked_read_object_core(struct flow_visit_ctx* ctx,
compiler_diagnostic_message(W_FLOW_NULL_DEREFERENCE,
ctx->ctx,
position_token,
"object '%s', (non-optional) may be null",
"non-nullable pointer '%s' may be null",
previous_names);
}

Expand Down
2,968 changes: 1,484 additions & 1,484 deletions src/web/cake.js

Large diffs are not rendered by default.

88 changes: 28 additions & 60 deletions src/web/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,37 @@
width: 100%;
margin: auto;
}
.outputstyle{
margin-top:0px;
overflow-y: scroll;
height:100%;
line-height:1.5;
border: 1px solid #d2d3d4;
font-weight: bolder;
background-color:#f5f5f5;
color:#007bfd;
width: 100%;
font-size;12px;
font: Consolas,Liberation Mono,Courier,monospace;
padding-left:16px;
padding-right:16px;
padding-top:3px;
padding-bottom:0px;
}
</style>

<link rel="stylesheet" data-name="min/vs/editor/editor.main" href="min/vs/editor/editor.main.css" />

</head>

<body>
<script src="splitterbar.js"></script>
<script>
var require = { paths: { vs: 'min/vs' } };
</script>
<script src="min/vs/loader.js"></script>
<script src="min/vs/editor/editor.main.nls.js"></script>
<script src="min/vs/editor/editor.main.js"></script>

<div style="background-color: rgb(244,244,244); padding-top: 2px; padding-bottom: 2px">

Expand All @@ -52,10 +76,8 @@
<option >Select...</option>
</select>


<button onclick="OnCompileButton()">Compile To</button>


<select id="outtype" style="margin-left:auto;margin-right: 10px; ">
<option value="-1">C89 (ANSI C)</option>
<option value="1">C99</option>
Expand All @@ -68,8 +90,6 @@

<label>Options</label><input type="text" id="options" />



<button onclick="Share()">Share</button>
<input type="text" id="sharelink" style="width:100%;display:none" />
</div>
Expand All @@ -89,32 +109,15 @@
</div>

<div id="div2" class="bottomSide">
<pre id="output"
style=" overflow-y: scroll; height:100%;line-height:1.5;border: 1px solid #d2d3d4; font-weight: bolder; background-color:#f5f5f5; color:#007bfd; width: 100%;font-size;14px; font: Consolas,Liberation Mono,Courier,monospace;">
</pre>
<pre id="output" class="outputstyle"></pre>
</div>


</div>



<script src="splitterbar.js"></script>


<script>
var require = { paths: { vs: 'min/vs' } };
</script>
<script src="min/vs/loader.js"></script>
<script src="min/vs/editor/editor.main.nls.js"></script>
<script src="min/vs/editor/editor.main.js"></script>


<script>

//monta a lista com exemplos
var se = document.getElementById("samples");
//var se2 = document.getElementById("sample");

for (var area in sample) {
var o = document.createElement('option');
o.textContent = area;
Expand All @@ -134,7 +137,6 @@
const splitterBar2 = new SplitterBar(containerOne, div11, div22, false);



var inputEditor = monaco.editor.create(document.getElementById('in'), {
language: 'c',
automaticLayout: true,
Expand All @@ -147,21 +149,8 @@
minimap: { enabled: false }
});

div1.onresize = function () {
inputEditor.layout();
outputEditor.layout();
};

div2.onresize = function () {
inputEditor.layout();
outputEditor.layout();
};



const urlParams = new URLSearchParams(window.location.search);


var to = urlParams.get('to');
if (to) {
try {
Expand All @@ -179,20 +168,13 @@
} catch { }
}


var code = urlParams.get('code');
if (code) {
code = atob(decodeURIComponent(code));


inputEditor.setValue(code);


}

function Share() {


var source = inputEditor.getValue();
var to = document.getElementById("outtype").value;
var options = document.getElementById("options").value;
Expand All @@ -201,11 +183,9 @@
"&to=" + encodeURI(to) +
"&options=" + encodeURI(options);


document.getElementById("sharelink").value = link;
document.getElementById("sharelink").style.display = "block";
document.getElementById("sharelink").select();

}

function OnSwap() {
Expand All @@ -222,26 +202,15 @@
var text = http.response;
if (text.length == 0)
text = "coliru compilation ok";
//document.getElementById("output").value = s;
text = "\x1b[37m" + text;

var element = document.getElementById('output');
var convert = new Filter();
text = convert.toHtml(text);
//console.log(convert.toHtml('\x1b[30mblack\x1b[37mwhite'));

if (arguments.length > 1) text = Array.prototype.slice.call(arguments).join(' ');
// These replacements are necessary if you render to raw HTML
//text = text.replace(/&/g, "&amp;");
//text = text.replace(/</g, "&lt;");
//text = text.replace(/>/g, "&gt;");
//text = text.replace('\n', '<br>', 'g');
//console.log(text);
if (element) {
element.innerHTML = text + "\n";
element.scrollTop = element.scrollHeight; // focus on bottom
}

}


Expand All @@ -250,7 +219,6 @@
outputEditor.setValue("");
var outputLanguage = document.getElementById("outtype").value;


var options = document.getElementById("options").value;

if (outputLanguage == 0)
Expand All @@ -276,11 +244,11 @@

function OnChangeSelectionSample(index) {
var area = document.getElementById("samples").value;

var source = sample[area][index];
inputEditor.setValue(source, -1);
outputEditor.setValue("");
}

function OnChangeSelection(index) {
var samples = sample[index];
var se2 = document.getElementById("sample");
Expand All @@ -298,4 +266,4 @@
</script>
</body>

</html>
</html>
Loading

0 comments on commit 34cec2a

Please sign in to comment.