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
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
118 additions
and
99 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
/******/
(()
=>
{
// webpackBootstrap
/******/
"use strict"
;
/******/
var
__webpack_modules__
=
([
/******/
"use strict"
;
/******/
var
__webpack_modules__
=
([
/* 0 */
,
/* 1 */
/***/
((
__unused_webpack_module
,
__webpack_exports__
,
__webpack_require__
)
=>
{
...
...
@@ -200,7 +199,7 @@ var Component = {
}
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Component
:
Component
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Component
);
/***/
}),
...
...
@@ -227,7 +226,8 @@ __webpack_require__.r(__webpack_exports__);
* @param obj {object} an object describing a state machine. If obj is empty then the statemachine is empty
* @class
*/
let
Statemachine
=
new
_component_js__WEBPACK_IMPORTED_MODULE_0__
.
default
.
create
(
function
(
obj
)
{
let
StateMachine
=
_component_js__WEBPACK_IMPORTED_MODULE_0__
.
default
.
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
;
...
...
@@ -236,7 +236,7 @@ let Statemachine = new _component_js__WEBPACK_IMPORTED_MODULE_0__.default.create
var
network
=
{};
var
addToken
=
function
(
t
)
{
var
addToken
=
function
(
t
)
{
if
(
self
.
slots
.
indexOf
(
t
)
<
0
)
{
self
.
slots
.
push
(
t
);
self
[
t
]
=
function
(
s
)
{
...
...
@@ -304,7 +304,7 @@ let Statemachine = new _component_js__WEBPACK_IMPORTED_MODULE_0__.default.create
var
t
,
tsd
,
ts
,
tsc
;
try
{
var
tsd
=
ARCS
.
EventLogicParser
.
parse
(
token
);
var
tsd
=
_eventlogicparser_js__WEBPACK_IMPORTED_MODULE_2__
.
default
.
parse
(
token
);
if
(
typeof
tsd
===
"string"
)
{
addToken
(
tsd
);
}
else
{
...
...
@@ -367,7 +367,7 @@ let Statemachine = new _component_js__WEBPACK_IMPORTED_MODULE_0__.default.create
* 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
);
};
...
...
@@ -385,7 +385,7 @@ let Statemachine = new _component_js__WEBPACK_IMPORTED_MODULE_0__.default.create
[
'requestSheet'
,
'requestTermination'
]
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
StateMachine
:
StateMachine
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
StateMachine
);
/***/
}),
...
...
@@ -455,7 +455,7 @@ TransitionNetwork.build = function(tree, tokenEvents) {
return
res
;
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
TransitionNetwork
:
TransitionNetwork
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
TransitionNetwork
);
/***/
}),
...
...
@@ -487,7 +487,7 @@ let TokenEvent = function() {
};
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
TokenEvent
:
TokenEvent
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
TokenEvent
);
/***/
}),
...
...
@@ -1162,7 +1162,7 @@ let EventLogicParser = (function() {
};
})();
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
EventLogicParser
:
EventLogicParser
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
EventLogicParser
);
/***/
}),
...
...
@@ -1237,7 +1237,7 @@ let Context = function( ctx ) {
var
instanciateComponents
;
factories
.
StateMachine
=
Statemachine
;
factories
.
StateMachine
=
_statemachine_js__WEBPACK_IMPORTED_MODULE_0__
.
default
;
if
(
ctx
!==
undefined
)
{
...
...
@@ -1357,6 +1357,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
]);
...
...
@@ -1366,7 +1367,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
}
)
});
};
/**
...
...
@@ -1531,7 +1532,7 @@ let Context = function( ctx ) {
/** pseudo-singleton to current context being used */
Context
.
currentContext
=
null
;
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Context
:
Context
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Context
);
...
...
@@ -1611,7 +1612,7 @@ Invocation.PRE_CONNECTION = 0;
Invocation
.
POST_CONNECTION
=
1
;
Invocation
.
CLEAN_UP
=
2
;
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Invocation
:
Invocation
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Invocation
);
/***/
}),
...
...
@@ -1682,7 +1683,7 @@ Connection.cast = function (obj, context) {
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Connection
:
Connection
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Connection
);
/***/
}),
...
...
@@ -1970,7 +1971,7 @@ let Sheet = function (ctx /*context*/) {
context
.
setParent
(
ctx
);
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Sheet
:
Sheet
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Sheet
);
/***/
}),
...
...
@@ -2203,65 +2204,65 @@ _component_js__WEBPACK_IMPORTED_MODULE_2__.default.create(Application);
Application
.
slot
(
"setSheet"
);
Application
.
slot
(
"finish"
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
{
Application
:
Application
}
);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
Application
);
/***/
})
/******/
]);
/******/
]);
/************************************************************************/
/******/
// The module cache
/******/
var
__webpack_module_cache__
=
{};
/******/
/******/
// The require function
/******/
function
__webpack_require__
(
moduleId
)
{
/******/
// Check if module is in cache
/******/
var
cachedModule
=
__webpack_module_cache__
[
moduleId
];
/******/
if
(
cachedModule
!==
undefined
)
{
/******/
return
cachedModule
.
exports
;
/******/
}
/******/
// Create a new module (and put it into the cache)
/******/
var
module
=
__webpack_module_cache__
[
moduleId
]
=
{
/******/
// no module.id needed
/******/
// no module.loaded needed
/******/
exports
:
{}
/******/
};
/******/
/******/
// Execute the module function
/******/
__webpack_modules__
[
moduleId
](
module
,
module
.
exports
,
__webpack_require__
);
/******/
/******/
// Return the exports of the module
/******/
return
module
.
exports
;
/******/
// The module cache
/******/
var
__webpack_module_cache__
=
{};
/******/
/******/
// The require function
/******/
function
__webpack_require__
(
moduleId
)
{
/******/
// Check if module is in cache
/******/
var
cachedModule
=
__webpack_module_cache__
[
moduleId
];
/******/
if
(
cachedModule
!==
undefined
)
{
/******/
return
cachedModule
.
exports
;
/******/
}
/******/
/******/
// Create a new module (and put it into the cache)
/******/
var
module
=
__webpack_module_cache__
[
moduleId
]
=
{
/******/
// no module.id needed
/******/
// no module.loaded needed
/******/
exports
:
{}
/******/
};
/******/
/******/
// Execute the module function
/******/
__webpack_modules__
[
moduleId
](
module
,
module
.
exports
,
__webpack_require__
);
/******/
/******/
// Return the exports of the module
/******/
return
module
.
exports
;
/******/
}
/******/
/************************************************************************/
/******/
/* webpack/runtime/define property getters */
/******/
(()
=>
{
/******/
// define getter functions for harmony exports
/******/
__webpack_require__
.
d
=
(
exports
,
definition
)
=>
{
/******/
for
(
var
key
in
definition
)
{
/******/
if
(
__webpack_require__
.
o
(
definition
,
key
)
&&
!
__webpack_require__
.
o
(
exports
,
key
))
{
/******/
Object
.
defineProperty
(
exports
,
key
,
{
enumerable
:
true
,
get
:
definition
[
key
]
});
/******/
}
/******/
}
/******/
};
/******/
})();
/******/
/******/
/* webpack/runtime/hasOwnProperty shorthand */
/******/
(()
=>
{
/******/
__webpack_require__
.
o
=
(
obj
,
prop
)
=>
(
Object
.
prototype
.
hasOwnProperty
.
call
(
obj
,
prop
))
/******/
})();
/******/
/******/
/* webpack/runtime/make namespace object */
/******/
(()
=>
{
/******/
// define __esModule on exports
/******/
__webpack_require__
.
r
=
(
exports
)
=>
{
/******/
if
(
typeof
Symbol
!==
'undefined'
&&
Symbol
.
toStringTag
)
{
/******/
Object
.
defineProperty
(
exports
,
Symbol
.
toStringTag
,
{
value
:
'Module'
});
/******/
/* webpack/runtime/define property getters */
/******/
(()
=>
{
/******/
// define getter functions for harmony exports
/******/
__webpack_require__
.
d
=
(
exports
,
definition
)
=>
{
/******/
for
(
var
key
in
definition
)
{
/******/
if
(
__webpack_require__
.
o
(
definition
,
key
)
&&
!
__webpack_require__
.
o
(
exports
,
key
))
{
/******/
Object
.
defineProperty
(
exports
,
key
,
{
enumerable
:
true
,
get
:
definition
[
key
]
});
/******/
}
/******/
Object
.
defineProperty
(
exports
,
'__esModule'
,
{
value
:
true
});
/******/
};
/******/
})();
/******/
/******/
}
/******/
};
/******/
})();
/******/
/******/
/* webpack/runtime/hasOwnProperty shorthand */
/******/
(()
=>
{
/******/
__webpack_require__
.
o
=
(
obj
,
prop
)
=>
(
Object
.
prototype
.
hasOwnProperty
.
call
(
obj
,
prop
))
/******/
})();
/******/
/******/
/* webpack/runtime/make namespace object */
/******/
(()
=>
{
/******/
// define __esModule on exports
/******/
__webpack_require__
.
r
=
(
exports
)
=>
{
/******/
if
(
typeof
Symbol
!==
'undefined'
&&
Symbol
.
toStringTag
)
{
/******/
Object
.
defineProperty
(
exports
,
Symbol
.
toStringTag
,
{
value
:
'Module'
});
/******/
}
/******/
Object
.
defineProperty
(
exports
,
'__esModule'
,
{
value
:
true
});
/******/
};
/******/
})();
/******/
/************************************************************************/
var
__webpack_exports__
=
{};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
...
...
@@ -2289,7 +2290,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
({
let
ARCS
=
{
Component
:
_component_js__WEBPACK_IMPORTED_MODULE_0__
.
default
,
isInNode
:
_arcs_js__WEBPACK_IMPORTED_MODULE_2__
.
default
,
StateMachine
:
_statemachine_js__WEBPACK_IMPORTED_MODULE_1__
.
default
,
...
...
@@ -2298,9 +2299,11 @@ __webpack_require__.r(__webpack_exports__);
Connection
:
_connection_js__WEBPACK_IMPORTED_MODULE_5__
.
default
,
Sheet
:
_sheet_js__WEBPACK_IMPORTED_MODULE_6__
.
default
,
Application
:
_application_js__WEBPACK_IMPORTED_MODULE_7__
.
default
});
};
/* harmony default export */
const
__WEBPACK_DEFAULT_EXPORT__
=
(
ARCS
);
})();
/******/
})()
;
\ No newline at end of file
var
__webpack_exports__default
=
__webpack_exports__
.
default
;
export
{
__webpack_exports__default
as
default
};
...
...
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