Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
8335cd40
Commit
8335cd40
authored
9 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Fix ^A parsing and attribute stuff.
Remove some extra log output along the way.
parent
c8c921fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
exec/dorkit/attribute.js
+4
-4
4 additions, 4 deletions
exec/dorkit/attribute.js
exec/load/dorkit.js
+7
-134
7 additions, 134 deletions
exec/load/dorkit.js
with
11 additions
and
138 deletions
exec/dorkit/attribute.js
+
4
−
4
View file @
8335cd40
function
Attribute
(
value
)
{
if
(
value
===
undefined
)
this
.
value
=
7
;
else
if
(
typeof
(
value
)
==
'
object
'
&&
value
.
constructor
===
Attribute
)
else
if
(
typeof
(
value
)
==
'
object
'
&&
value
.
value
!==
undefined
&&
typeof
(
value
.
value
)
==
'
number
'
)
this
.
value
=
value
.
value
;
else
this
.
value
=
value
;
...
...
@@ -56,18 +56,18 @@ Attribute.prototype = {
},
set
fg
(
val
)
{
this
.
value
&=
0xf8
;
this
.
value
|=
val
&
0x
f8
;
this
.
value
|=
(
val
&
0x
07
)
;
},
ansi
:
function
(
curatr
)
{
var
str
=
""
;
if
(
curatr
!==
undefined
)
if
(
curatr
!==
undefined
&&
curatr
.
value
===
this
.
value
)
return
str
;
// Unchanged
str
=
"
\
x1b[
"
;
if
(
curatr
===
undefined
||
(
!
(
this
.
bright
)
&&
curatr
.
bright
)
||
(
!
(
this
.
blink
)
&&
curatr
.
blink
)
||
atr
==
LIGHTGRAY
)
{
||
(
!
(
this
.
blink
)
&&
curatr
.
blink
)
||
this
.
value
===
7
)
{
str
+=
"
0;
"
;
if
(
curatr
===
undefined
)
curatr
=
new
Attribute
(
7
);
...
...
This diff is collapsed.
Click to expand it.
exec/load/dorkit.js
+
7
−
134
View file @
8335cd40
js
.
load_path_list
.
unshift
(
js
.
exec_dir
+
"
/dorkit/
"
);
if
(
js
.
global
.
system
!==
undefined
)
js
.
load_path_list
.
unshift
(
system
.
exec_dir
+
"
/dorkit/
"
);
log
(
"
Load path:
"
+
js
.
load_path_list
.
join
(
"
,
"
));
load
(
"
attribute.js
"
);
load
(
"
graphic.js
"
);
...
...
@@ -102,7 +101,10 @@ var dk = {
if
(
curr_attr
===
undefined
||
curr_attr
.
value
!=
next_attr
.
value
)
{
ansi_str
=
next_attr
.
ansi
(
curr_attr
);
curr_attr
.
value
=
next_attr
.
value
;
if
(
curr_attr
===
undefined
)
curr_attr
=
new
Attribute
(
next_attr
);
else
curr_attr
.
value
=
next_attr
.
value
;
return
ansi_str
;
}
return
''
;
...
...
@@ -185,139 +187,10 @@ var dk = {
}
}
else
{
ret
+=
attr_str
()
+
txt
.
substr
(
i
,
1
);
}
}
return
ret
;
return
txt
.
replace
(
/
\1([\x
00-
\x
ff
])
/g
,
function
(
unused
,
code
)
{
switch
(
code
)
{
case
'
\
1
'
:
return
'
\
1
'
;
case
'
K
'
:
curr_attr
.
fg
=
Attribute
.
BLACK
;
break
;
}
});
/* ToDo: Expand \1D, \1T, \1<, \1Z */
/* ToDo: "Expand" (ie: remove from string when appropriate) per-level/per-flag stuff */
/* ToDo: Strip ANSI (I betcha @-codes can slap it in there) */
while
(
p
<
txt
.
length
)
{
ch
=
txt
[
p
++
];
switch
(
ch
)
{
case
'
\
1
'
:
/* CTRL-A code */
ch
=
txt
[
p
++
].
toUpperCase
();
switch
(
ch
)
{
case
'
\
1
'
:
/* A "real" ^A code */
this
.
data
[
x
][
y
].
ch
=
ch
;
this
.
data
[
x
][
y
].
attr
=
curattr
;
x
++
;
if
(
x
>=
this
.
width
)
{
x
=
0
;
y
++
;
log
(
"
next char: [
"
+
txt
[
p
]
+
"
]
"
);
if
(
txt
[
p
]
==
'
\r
'
)
p
++
;
if
(
txt
[
p
]
==
'
\n
'
)
p
++
;
}
break
;
case
'
K
'
:
/* Black */
curattr
=
(
curattr
)
&
0xf8
;
break
;
case
'
R
'
:
/* Red */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
RED
;
break
;
case
'
G
'
:
/* Green */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
GREEN
;
break
;
case
'
Y
'
:
/* Yellow */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
BROWN
;
break
;
case
'
B
'
:
/* Blue */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
BLUE
;
break
;
case
'
M
'
:
/* Magenta */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
MAGENTA
;
break
;
case
'
C
'
:
/* Cyan */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
CYAN
;
break
;
case
'
W
'
:
/* White */
curattr
=
((
curattr
)
&
0xf8
)
|
this
.
defs
.
LIGHTGRAY
;
break
;
case
'
0
'
:
/* Black */
curattr
=
(
curattr
)
&
0x8f
;
break
;
case
'
1
'
:
/* Red */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
RED
<<
4
);
break
;
case
'
2
'
:
/* Green */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
GREEN
<<
4
);
break
;
case
'
3
'
:
/* Yellow */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
BROWN
<<
4
);
break
;
case
'
4
'
:
/* Blue */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
BLUE
<<
4
);
break
;
case
'
5
'
:
/* Magenta */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
MAGENTA
<<
4
);
break
;
case
'
6
'
:
/* Cyan */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
CYAN
<<
4
);
break
;
case
'
7
'
:
/* White */
curattr
=
((
curattr
)
&
0x8f
)
|
(
this
.
defs
.
LIGHTGRAY
<<
4
);
break
;
case
'
H
'
:
/* High Intensity */
curattr
|=
this
.
defs
.
HIGH
;
break
;
case
'
I
'
:
/* Blink */
curattr
|=
this
.
defs
.
BLINK
;
break
;
case
'
N
'
:
/* Normal (ToDo: Does this do ESC[0?) */
curattr
=
7
;
break
;
case
'
-
'
:
/* Normal if High, Blink, or BG */
if
(
curattr
&
0xf8
)
curattr
=
7
;
break
;
case
'
_
'
:
/* Normal if blink/background */
if
(
curattr
&
0xf0
)
curattr
=
7
;
break
;
case
'
[
'
:
/* CR */
x
=
0
;
break
;
case
'
]
'
:
/* LF */
y
++
;
break
;
default
:
/* Other stuff... specifically, check for right movement */
if
(
ch
.
charCodeAt
(
0
)
>
127
)
{
x
+=
ch
.
charCodeAt
(
0
)
-
127
;
if
(
x
>=
this
.
width
)
x
=
this
.
width
-
1
;
}
}
break
;
case
'
\
7
'
:
/* Beep */
break
;
case
'
\r
'
:
x
=
0
;
break
;
case
'
\n
'
:
y
++
;
break
;
default
:
this
.
data
[
x
][
y
]
=
new
this
.
Cell
(
ch
,
curattr
);
x
++
;
if
(
x
>=
this
.
width
)
{
x
=
0
;
y
++
;
if
(
txt
[
p
]
==
'
\r
'
)
p
++
;
if
(
txt
[
p
]
==
'
\n
'
)
p
++
;
}
ret
+=
attr_str
()
+
txt
.
substr
(
i
,
1
);
}
}
return
ret
+
attr_str
();
},
/*
...
...
@@ -674,7 +547,7 @@ switch(dk.system.mode) {
load
(
"
jsexec_console.js
"
);
break
;
case
'
jsdoor
'
:
load
(
"
js
door
_console.js
"
);
load
(
"
js
exec
_console.js
"
);
break
;
case
'
socket
'
:
load
(
"
socket_console.js
"
,
dk
.
connection
.
socket
,
dk
.
connection
.
telnet
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment