Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeongho Nam committed Jul 28, 2016
1 parent 7ac148a commit 7640557
Show file tree
Hide file tree
Showing 11 changed files with 2,493 additions and 2,412 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ wiki

*.bat
*.*ignore
*.d.ts
3 changes: 3 additions & 0 deletions lib/typescript-stl.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11741,6 +11741,9 @@ declare namespace std.base {
declare namespace std.example {
function test_all(): void;
}
declare namespace std.example {
function test_anything(): void;
}
declare namespace std.example {
function test_bind(): void;
}
Expand Down
53 changes: 39 additions & 14 deletions lib/typescript-stl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6573,8 +6573,8 @@ var std;
prev.set_next(last);
last.set_prev(prev);
this.size_ -= size;
if (this.size_ == 0)
this.begin_ = this.end_;
if (first == this.begin_)
this.begin_ = last;
return last;
};
List.prototype.unique = function (binary_pred) {
Expand Down Expand Up @@ -10907,23 +10907,46 @@ var std;
var example;
(function (example) {
function test_all() {
//for (let key in std.example)
// if (key != "test_all" && std.example[key] instanceof Function)
// std.example[key]();
var vec1 = new std.Vector();
var vec2 = new std.Vector();
var fn1 = vec1.insert.bind(vec1);
var fn2 = vec1.insert.bind(vec1);
var fn3 = vec2.insert.bind(vec2);
console.log(fn1["__get_m_iUID"](), fn1["__get_m_iUID"]());
console.log(fn2["__get_m_iUID"]());
console.log(fn3["__get_m_iUID"]());
for (var key in std.example)
if (key != "test_all" && std.example[key] instanceof Function)
std.example[key]();
}
example.test_all = test_all;
})(example = std.example || (std.example = {}));
})(std || (std = {}));
/// <reference path="../API.ts" />
var std;
(function (std) {
var example;
(function (example) {
function test_anything() {
var map = new std.HashMap();
map.insert(["samchon", 1]);
map.insert(["FireFox", 2]);
console.log(map.has("samchon"), "#" + map.size());
for (var it = map.begin(); !it.equal_to(map.end()); it = it.next())
console.log(it.first);
map.erase("samchon");
console.log(map.has("samchon"), "#" + map.size());
for (var it = map.begin(); !it.equal_to(map.end()); it = it.next())
console.log(it.first);
console.log("first item", map.begin().first);
console.log("last item", map.rbegin().first);
/* --------------------------------------------------------- */
//let list: std.List<string> = new std.List<string>();
//list.push_back("samchon");
//list.push_back("FireFox");
//console.log("#" + list.size());
//list.erase(list.begin());
//console.log("#" + list.size());
//for (let it = list.begin(); !it.equal_to(list.end()); it = it.next())
// console.log(it.value);
}
example.test_anything = test_anything;
})(example = std.example || (std.example = {}));
})(std || (std = {}));
/// <reference path="../API.ts" />
var std;
(function (std) {
var example;
(function (example) {
Expand Down Expand Up @@ -11141,5 +11164,7 @@ var std;
/// <reference path="../../std/SystemError.ts" />
/// <reference path="../../std/Utility.ts" />
/// <reference path="../../std/example/test_all.ts" />
if (std.is_node() == true)
try {
module.exports = std;
}
catch (exception) { }
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
"email": "[email protected]",
"url": "http://samchon.org"
},
"version": "1.0.0-rc.5",
"version": "1.0.0-rc.6",

"main": "./lib/typescript-stl.js",
"typings": "./lib/typescript-stl.d.ts",
"homepage": "https://github.com/samchon/typescript-stl",
"repository": {
"type": "git",
Expand Down
4,777 changes: 2,401 additions & 2,376 deletions ts/include/typescript-stl.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ts/include/typescript-stl.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script src="include/typescript-stl.js"></script>
</head>

<body onload="std.example.test_all()">
<body onload="std.example.test_anything()">
</body>

</html>
4 changes: 2 additions & 2 deletions ts/src/std/List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ namespace std
last.set_prev(prev);

this.size_ -= size;
if (this.size_ == 0)
this.begin_ = this.end_;
if (first == this.begin_)
this.begin_ = last;

return last;
}
Expand Down
17 changes: 3 additions & 14 deletions ts/src/std/example/test_all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,8 @@ namespace std.example
{
export function test_all(): void
{
//for (let key in std.example)
// if (key != "test_all" && std.example[key] instanceof Function)
// std.example[key]();

let vec1: Vector<number> = new Vector<number>();
let vec2: Vector<number> = new Vector<number>();

let fn1 = vec1.insert.bind(vec1);
let fn2 = vec1.insert.bind(vec1);
let fn3 = vec2.insert.bind(vec2);

console.log(fn1["__get_m_iUID"](), fn1["__get_m_iUID"]());
console.log(fn2["__get_m_iUID"]());
console.log(fn3["__get_m_iUID"]());
for (let key in std.example)
if (key != "test_all" && std.example[key] instanceof Function)
std.example[key]();
}
}
37 changes: 37 additions & 0 deletions ts/src/std/example/test_anything.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference path="../API.ts" />

namespace std.example
{
export function test_anything(): void
{
let map: std.HashMap<string, number> = new std.HashMap<string, number>();
map.insert(["samchon", 1]);
map.insert(["FireFox", 2]);

console.log(map.has("samchon"), "#" + map.size());
for (let it = map.begin(); !it.equal_to(map.end()); it = it.next())
console.log(it.first);

map.erase("samchon");
console.log(map.has("samchon"), "#" + map.size());
for (let it = map.begin(); !it.equal_to(map.end()); it = it.next())
console.log(it.first);

console.log("first item", map.begin().first);
console.log("last item", map.rbegin().first);

/* --------------------------------------------------------- */

//let list: std.List<string> = new std.List<string>();
//list.push_back("samchon");
//list.push_back("FireFox");

//console.log("#" + list.size());

//list.erase(list.begin());
//console.log("#" + list.size());

//for (let it = list.begin(); !it.equal_to(list.end()); it = it.next())
// console.log(it.value);
}
}
6 changes: 4 additions & 2 deletions ts/src/std/miscellaneous/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@

/// <reference path="../../std/example/test_all.ts" />

if (std.is_node() == true)
module.exports = std;
try
{
module.exports = std;
} catch (exception) { }

0 comments on commit 7640557

Please sign in to comment.