Codice dei programmi nella directory:
///File: compilatore.html
<form action = compilatore.php method = POST>
<textarea name = "codice" rows = 10 cols = 50>
#include <stdio.h>
int main(){
printf("Hello World!\n");
return 0;
}
</textarea>
<input type = submit value = compilaEdEsegui>
</form>
///(Fine file: compilatore.html)
///File: test.c
#include <stdio.h>
int main(int argc, char *argv[])
{
int i,n;
printf("Dammi n ->");
scanf("%d",&n);
for(i=1; i <= n; i++)
printf("<hr>%d\n",i);
return 0;
}
///(Fine file: test.c)
///File: prova.c
#include <stdio.h>
int main(){
printf("Hello World!\n");
return 0;
}
///(Fine file: prova.c)
///File: errori.txt
///(Fine file: errori.txt)
///File: ColoraCodice.html
<table border=1>
<th>Programma C/C++</th><th>Input</th><th>Compila/Esegui</th><tr>
<td>
<script language="javascript" type="text/javascript" src="https://dsacco.alwaysdata.net/editarea/edit_area/edit_area_full.js"></script>
<script language="javascript" type="text/javascript">
/** per utilizzare un linguaggio, richiama nell'HTML una textarea come segue (esempio con linguaggio C):
<textarea id="C" name="content" cols="80" rows="15">
int main()
{
printf("Ciao mondo");
return 0;
}
</textarea>
******/
editAreaLoader.init({
id: "vuoto" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "c"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "C" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "c"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "cpp" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "cpp"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "html" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "html"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "js" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "js"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "php" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "php"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
editAreaLoader.init({
id: "sql" // id of the textarea to transform
,start_highlight: true // if start with highlight
,allow_resize: "both"
,allow_toggle: true
,word_wrap: true
,language: "it"
,syntax: "sql"
,toolbar: "search, fullscreen, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help"
,syntax_selection_allow: "css,html,js,php,python,vb,xml,c,cpp,sql,basic,pas"
});
// callback functions
function my_save(id, content){
alert("Here is the content of the EditArea '"+ id +"' as received by the save callback function:\n"+content);
}
function my_load(id){
editAreaLoader.setValue(id, "The content is loaded from the load_callback function into EditArea");
}
function test_setSelectionRange(id){
editAreaLoader.setSelectionRange(id, 100, 150);
}
function test_getSelectionRange(id){
var sel =editAreaLoader.getSelectionRange(id);
alert("start: "+sel["start"]+"\nend: "+sel["end"]);
}
function test_setSelectedText(id){
text= "[REPLACED SELECTION]";
editAreaLoader.setSelectedText(id, text);
}
function test_getSelectedText(id){
alert(editAreaLoader.getSelectedText(id));
}
function editAreaLoaded(id){
if(id=="example_2")
{
open_file1();
open_file2();
}
}
function open_file1()
{
var new_file= {id: "to\\ ? to", text: "$authors= array();\n$news= array();", syntax: 'php', title: 'beautiful title'};
editAreaLoader.openFile('example_2', new_file);
}
function open_file2()
{
var new_file= {id: "Filename", text: "<a href=\"toto\">\n\tbouh\n</a>\n<!-- it's a comment -->", syntax: 'html'};
editAreaLoader.openFile('example_2', new_file);
}
function close_file1()
{
editAreaLoader.closeFile('example_2', "to\\ ? to");
}
function toogle_editable(id)
{
editAreaLoader.execCommand(id, 'set_editable', !editAreaLoader.execCommand(id, 'is_editable'));
}
</script>
<textarea name=codice id="C" rows="20" cols="80"; >#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Ciao mondo\n");
return 0;
}
</textarea></td>
<td valign=top><textarea name=input></textarea></td>
<td valign=top>
<SELECT NAME="azione">
<OPTION VALUE=Compila SELECTED>Compila
<OPTION VALUE=Esegui>Esegui
</SELECT></td valign=top>
<tr>
<td colspan=3>Password<input type=password method=post name=pwd></td>
<td colspan=3><input type=submit value="Procedi"></td>
</table>
///(Fine file: ColoraCodice.html)