| 1 |
<html> |
| 2 |
<head><title>Soros IDE 1.0 – Integrated developing environment of the Soros programming language</title> |
| 3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
| 4 |
</head> |
| 5 |
<body> |
| 6 |
<style type="text/css"> |
| 7 |
@import "css/numbertext.css"; |
| 8 |
</style> |
| 9 |
<div class='title'> |
| 10 |
<table width="100%" style='border-style: solid; border-width: 0px 0px 1px 0px;'><tr><td><span>••• NUMBERTEXT.org ••• |
| 11 |
IDE of Soros programming language (<a href="https://github.com/Numbertext/libnumbertext/blob/master/doc/sorosspec.pdf">specification</a>) </span></td><td align='right'> |
| 12 |
<span class='nowrap'> |
| 13 |
<!--<a class="menu2" href="IDE.html">IDE</a>--> |
| 14 |
<a class="menu2" href="index.html#about">Back</a> |
| 15 |
</span></td></tr></table></div> |
| 16 |
|
| 17 |
<script type="text/javascript" language="javascript1.3"> |
| 18 |
MAXLIST=1000 |
| 19 |
<!-- **************************************************************************************************** --> |
| 20 |
<!--!cat ../src/Soros.js--> |
| 21 |
<!-- **************************************************************************************************** --> |
| 22 |
function convert() { |
| 23 |
var s = document.getElementById('number').value; |
| 24 |
var prefix = document.getElementById('prefix').value; |
| 25 |
if (prefix != "") |
| 26 |
prefix = prefix + " "; |
| 27 |
var ranges = s.split(";") |
| 28 |
var res = "" |
| 29 |
if ( ranges.length > 1 || s.match(/\d[-]/) ) { |
| 30 |
for (var j = 0; j < ranges.length; j++) { |
| 31 |
if (ranges[j].match(/\d-/)) { |
| 32 |
var nums = ranges[j].split("-") |
| 33 |
var nums2 = nums[1].split("~") |
| 34 |
var maxi = parseInt(nums2[0]) |
| 35 |
var begin = parseInt(nums[0]) |
| 36 |
if (maxi < begin) maxi = begin + 111; |
| 37 |
var steps = nums2.length == 1 ? 1 : parseInt(nums2[1]) |
| 38 |
if (maxi - begin > MAXLIST) maxi = begin + MAXLIST |
| 39 |
for (var i = begin; i <= maxi; i=i+steps) |
| 40 |
res = res + i + "\t" + mySoros.run(prefix + i + "") + "\n"; |
| 41 |
} else { |
| 42 |
res = res + ranges[j] + "\t" + mySoros.run(prefix + ranges[j]) + "\n"; |
| 43 |
} |
| 44 |
} |
| 45 |
document.getElementById('numbers').value = res; |
| 46 |
document.getElementById('result').value = ""; |
| 47 |
} else { |
| 48 |
document.getElementById('result').value = mySoros.run(prefix + s); |
| 49 |
document.getElementById('numbers').value = ""; |
| 50 |
} |
| 51 |
} |
| 52 |
function comp() { |
| 53 |
var lang = document.getElementById('select').value + "-" + document.getElementById('country').value; |
| 54 |
mySoros = new Soros(document.getElementById('def').value, lang); |
| 55 |
} |
| 56 |
function load_prg() { |
| 57 |
var modulename = document.getElementById('select').value; |
| 58 |
var workspace = document.getElementById('def'); |
| 59 |
var tutorial = (modulename.indexOf("Tutorial") > -1); |
| 60 |
workspace.spellcheck = tutorial ? false : true; |
| 61 |
workspace.style.fontSize = tutorial ? "120%" : "100%"; |
| 62 |
var tutorial4 = tutorial && (modulename.indexOf("4") > -1); |
| 63 |
var tutorial5 = tutorial && (modulename.indexOf("5") > -1); |
| 64 |
document.getElementById('number').value = tutorial5 ? "-1;-0;0-19;20-29~2;30-40~3;60-79~5;90-120~5;ordinal 0;ordinal 1;ordinal 2;ordinal 3;ordinal 100;ordinal 101" : (tutorial4 ? "1;10;100;1000;10000;1000000;1234567;10000000;12345678;100000000;123456789;1000000000;1234567890" : "0-120"); |
| 65 |
workspace.value = document.getElementById(modulename).value; |
| 66 |
} |
| 67 |
function set_cursor() { |
| 68 |
var input = document.getElementById('def'); |
| 69 |
if (input.setSelectionRange) { |
| 70 |
input.focus(); |
| 71 |
input.setSelectionRange(0, 0); |
| 72 |
} |
| 73 |
else if (input.createTextRange) { |
| 74 |
var range = input.createTextRange(); |
| 75 |
range.collapse(true); |
| 76 |
range.moveEnd('character', 0); |
| 77 |
range.moveStart('character', 0); |
| 78 |
range.select(); |
| 79 |
} |
| 80 |
} |
| 81 |
function copy_result() { |
| 82 |
document.getElementById('number').value = document.getElementById('result').value; |
| 83 |
} |
| 84 |
</script> |
| 85 |
<table width="100%"> |
| 86 |
<tr> |
| 87 |
<td> |
| 88 |
<div class='row'> |
| 89 |
<label for="country" accesskey="c"><u>C</u>ountry:</label> |
| 90 |
<input type="text" title="Country (for example, “GB” for “en”)" style="width: 3em;" id="country" onkeyup="comp();convert()" value="" /> |
| 91 |
<label for="prefix" accesskey="p"><u>P</u>refix:</label> |
| 92 |
<input type="text" title="Prefix (for example, “ordinal”)" style="width: 10em;" id="prefix" onkeyup="convert();" value="" /> |
| 93 |
<label for="number" accesskey="i"><u>I</u>nput:</label> |
| 94 |
<input type="text" title="Number (eg. 1234) or number range (1-100) or number with currency (USD 15)" id="number" onkeyup="convert();" style="width: 10em;" value="0-120" /> |
| 95 |
|
| 96 |
Output: <input type="button" id="result" onclick="copy_result();js();" /> |
| 97 |
</div> |
| 98 |
<tr> |
| 99 |
<td> |
| 100 |
<div class='row' id='header'> |
| 101 |
<label for="def" accesskey="e">Program <u>e</u>ditor</label> |
| 102 |
<label for="select" accesskey="l"><u>L</u>oad:</label> |
| 103 |
<select id="select" onchange="load_prg(); comp(); convert(); set_cursor();"> |
| 104 |
<option value="xx">New module</option> |
| 105 |
<!-- **************************************************************************************************** --> |
| 106 |
<!--!cd ../doc;for i in *.sor; do name=`basename $i .sor | sed "s/_/ – Part /"`; echo "<option value='$name'>$name</option>"; done--> |
| 107 |
<!--!cd ../data;for i in ??.sor ???*.sor; do name=`basename $i .sor | tr "_" " "`; echo "<option value='$name'>$name</option>"; done--> |
| 108 |
<!-- **************************************************************************************************** --> |
| 109 |
</select> |
| 110 |
</div> |
| 111 |
</table> |
| 112 |
<table> |
| 113 |
<td valign="top"> |
| 114 |
<textarea title="Program" id="def" onkeyup="comp();convert();"></textarea> |
| 115 |
<td valign="top" align="left"> |
| 116 |
<textarea id="numbers" title="list" readonly></textarea> |
| 117 |
</table> |
| 118 |
<!-- **************************************************************************************************** --> |
| 119 |
<!--!cd ../doc;for i in *.sor; do echo "<textarea id='`basename $i .sor | sed "s/_/ – Part /"`' class='hidden'>"; cat $i; echo "</textarea>"; done--> |
| 120 |
<!--!cd ../data;for i in ??.sor ???*.sor; do echo "<textarea id='`basename $i .sor | tr "_" " "`' class='hidden'>"; cat $i; echo "</textarea>"; done--> |
| 121 |
<!-- **************************************************************************************************** --> |
| 122 |
<textarea id="xx" class="hidden"></textarea> |
| 123 |
<script type="text/javascript" language="javascript1.3"> |
| 124 |
if (navigator.appName.indexOf("Microsoft")!=-1) { |
| 125 |
x = document.body.clientWidth |
| 126 |
y = document.body.clientHeight |
| 127 |
}else{ |
| 128 |
x = window.innerWidth |
| 129 |
y = window.innerHeight |
| 130 |
} |
| 131 |
var area1 = document.getElementById('def') |
| 132 |
var area2 = document.getElementById('numbers') |
| 133 |
x = Math.round(x / 2 - x / 90) |
| 134 |
y = Math.round(y - y / 7) |
| 135 |
area1.style.width= x + "px" |
| 136 |
area1.style.height= y + "px" |
| 137 |
area2.style.width= x + "px" |
| 138 |
area2.style.height= y + "px" |
| 139 |
|
| 140 |
document.getElementById('select').value = "Tutorial – Part 1"; |
| 141 |
load_prg(); comp(); convert(); |
| 142 |
</script> |
| 143 |
</html> |