Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
arcs.js
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2021-08-24 11:59:09 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e54a145f9edfb1063b19b10b9facd352c52a0dbc
e54a145f
1 parent
00351ab9
fixes in order to pass the loop test
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
41 additions
and
25 deletions
build/arcs.js
components/console.js
components/loop.js
src/application.js
src/arcs_browser.js
src/component.js
src/connection.js
src/context.js
src/eventlogicparser.js
src/exports.js
src/invocation.js
src/sheet.js
src/statemachine.js
src/tokenevent.js
src/transitionnetwork.js
tests/loop/arcsapp.json
webpack.config.js
build/arcs.js
View file @
e54a145
This diff is collapsed. Click to expand it.
components/console.js
View file @
e54a145
/* ugly hack in order to display data in web page instead of console */
import
ARCS
from
'../build/arcs.js'
;
var
Console
;
let
Console
;
/**
* @class Console
* @classdesc Redirects console messages to a given HTML element in the page.
...
...
@@ -44,3 +44,4 @@ Console = ARCS.Component.create(
export
default
{
Console
:
Console
};
//export default {};
...
...
components/loop.js
View file @
e54a145
...
...
@@ -6,7 +6,6 @@
*/
import
ARCS
from
'../build/arcs.js'
;
/**
* @class Loop
* @classdesc loop component creation using a compact style.
...
...
src/application.js
View file @
e54a145
...
...
@@ -217,4 +217,4 @@ Component.create(Application);
Application
.
slot
(
"setSheet"
);
Application
.
slot
(
"finish"
);
export
default
{
Application
:
Application
}
;
export
default
Application
;
...
...
src/arcs_browser.js
View file @
e54a145
import
ARCS
from
'./arcs.js'
;
/**
* Bootstrap for the ARCS engine in a browser environment.
...
...
@@ -9,7 +7,7 @@ import ARCS from './arcs.js';
"use strict"
;
// basically, here we start by importing the module ARCS
import
ARCS
from
'./
arc
s.js'
;
import
ARCS
from
'./
export
s.js'
;
console
.
log
(
"[ARCS] Bootstrapping..."
);
...
...
src/component.js
View file @
e54a145
...
...
@@ -189,4 +189,4 @@ var Component = {
}
};
export
default
{
Component
:
Component
}
;
export
default
Component
;
...
...
src/connection.js
View file @
e54a145
...
...
@@ -57,4 +57,4 @@ Connection.cast = function (obj, context) {
};
export
default
{
Connection
:
Connection
}
;
export
default
Connection
;
...
...
src/context.js
View file @
e54a145
...
...
@@ -20,7 +20,7 @@ let Context = function( ctx ) {
var
instanciateComponents
;
factories
.
StateMachine
=
State
m
achine
;
factories
.
StateMachine
=
State
M
achine
;
if
(
ctx
!==
undefined
)
{
...
...
@@ -140,6 +140,7 @@ let Context = function( ctx ) {
// TODO promisify call to cbFunction
return
import
(
/* webpackIgnore: true */
libUrl
).
then
(
function
(
module
)
{
// TODO insert here component factories
for
(
p
in
module
.
default
)
{
if
(
module
.
default
.
hasOwnProperty
(
p
))
{
Context
.
currentContext
.
setFactory
(
p
,
module
.
default
[
p
]);
...
...
@@ -149,7 +150,7 @@ let Context = function( ctx ) {
if
(
cbFunction
!==
undefined
)
{
cbFunction
();
}
}).
catch
(
function
(
msg
)
{
console
.
error
(
"[ARCS] Trouble loading '"
,
libUrl
,
"' with reason -"
,
msg
)
});
}).
catch
(
function
(
msg
)
{
console
.
error
(
"[ARCS] Trouble loading '"
,
libUrl
,
"' with reason -"
,
{
msg
}
)
});
};
/**
...
...
@@ -314,5 +315,5 @@ let Context = function( ctx ) {
/** pseudo-singleton to current context being used */
Context
.
currentContext
=
null
;
export
default
{
Context
:
Context
}
;
export
default
Context
;
...
...
src/eventlogicparser.js
View file @
e54a145
...
...
@@ -662,4 +662,4 @@ let EventLogicParser = (function() {
};
})();
export
default
{
EventLogicParser
:
EventLogicParser
}
;
export
default
EventLogicParser
;
...
...
src/exports.js
View file @
e54a145
...
...
@@ -9,7 +9,7 @@ import Connection from './connection.js';
import
Sheet
from
'./sheet.js'
;
import
Application
from
'./application.js'
;
export
default
{
let
ARCS
=
{
Component
:
Component
,
isInNode
:
isInNode
,
StateMachine
:
StateMachine
,
...
...
@@ -19,3 +19,5 @@ export default {
Sheet
:
Sheet
,
Application
:
Application
};
export
default
ARCS
;
...
...
src/invocation.js
View file @
e54a145
...
...
@@ -66,4 +66,4 @@ Invocation.PRE_CONNECTION = 0;
Invocation
.
POST_CONNECTION
=
1
;
Invocation
.
CLEAN_UP
=
2
;
export
default
{
Invocation
:
Invocation
}
;
export
default
Invocation
;
...
...
src/sheet.js
View file @
e54a145
...
...
@@ -272,4 +272,4 @@ let Sheet = function (ctx /*context*/) {
context
.
setParent
(
ctx
);
};
export
default
{
Sheet
:
Sheet
}
;
export
default
Sheet
;
...
...
src/statemachine.js
View file @
e54a145
...
...
@@ -11,7 +11,8 @@ import EventLogicParser from './eventlogicparser.js';
* @param obj {object} an object describing a state machine. If obj is empty then the statemachine is empty
* @class
*/
let
Statemachine
=
new
Component
.
create
(
function
(
obj
)
{
let
StateMachine
=
Component
.
create
(
function
(
obj
)
{
// dynamic construction: properties are initial state that have properties
// that are tokens and value that are the final state
var
initial
=
""
,
final
=
""
,
transitions
=
{},
currentState
=
""
,
self
=
this
;
...
...
@@ -20,7 +21,7 @@ let Statemachine = new Component.create(function (obj) {
var
network
=
{};
var
addToken
=
function
(
t
)
{
var
addToken
=
function
(
t
)
{
if
(
self
.
slots
.
indexOf
(
t
)
<
0
)
{
self
.
slots
.
push
(
t
);
self
[
t
]
=
function
(
s
)
{
...
...
@@ -88,7 +89,7 @@ let Statemachine = new Component.create(function (obj) {
var
t
,
tsd
,
ts
,
tsc
;
try
{
var
tsd
=
ARCS
.
EventLogicParser
.
parse
(
token
);
var
tsd
=
EventLogicParser
.
parse
(
token
);
if
(
typeof
tsd
===
"string"
)
{
addToken
(
tsd
);
}
else
{
...
...
@@ -151,7 +152,7 @@ let Statemachine = new Component.create(function (obj) {
* the initial state (by default, it is the departure of the first transition
*/
this
.
start
=
function
()
{
console
.
log
(
"statemachine"
,
this
,
initial
,
obj
);
//
console.log("statemachine", this, initial,obj);
setSheet
(
initial
);
};
...
...
@@ -169,4 +170,4 @@ let Statemachine = new Component.create(function (obj) {
[
'requestSheet'
,
'requestTermination'
]
);
export
default
{
StateMachine
:
StateMachine
}
;
export
default
StateMachine
;
...
...
src/tokenevent.js
View file @
e54a145
...
...
@@ -19,4 +19,4 @@ let TokenEvent = function() {
};
};
export
default
{
TokenEvent
:
TokenEvent
}
;
export
default
TokenEvent
;
...
...
src/transitionnetwork.js
View file @
e54a145
...
...
@@ -56,4 +56,4 @@ TransitionNetwork.build = function(tree, tokenEvents) {
return
res
;
};
export
default
{
TransitionNetwork
:
TransitionNetwork
}
;
export
default
TransitionNetwork
;
...
...
tests/loop/arcsapp.json
View file @
e54a145
...
...
@@ -42,4 +42,4 @@
}
}
}
\ No newline at end of file
...
...
webpack.config.js
View file @
e54a145
const
path
=
require
(
'path'
);
module
.
exports
=
{
entry
:
'./src/exports.js'
,
experiments
:
{
outputModule
:
true
},
entry
:
{
'arcs'
:
{
import
:
'./src/exports.js'
,
},
'arcs_browser'
:
{
import
:
'./src/arcs_browser.js'
//dependOn : ['arcs']
}
},
mode
:
'none'
,
output
:
{
filename
:
'
arcs
.js'
,
filename
:
'
[name]
.js'
,
path
:
path
.
resolve
(
__dirname
,
'build'
),
library
:
{
type
:
'module'
,
}
},
module
:
{
parser
:
{
...
...
Please
register
or
login
to post a comment