projects
/
synfig.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert the accidental removal of mod_libavcodec in r2286.
[synfig.git]
/
ETL
/
trunk
/
test
/
smach.cpp
diff --git
a/ETL/trunk/test/smach.cpp
b/ETL/trunk/test/smach.cpp
index
47915a4
..
bb5f48d
100644
(file)
--- a/
ETL/trunk/test/smach.cpp
+++ b/
ETL/trunk/test/smach.cpp
@@
-1,7
+1,7
@@
/*! ========================================================================
** Extended Template and Library Test Suite
** Angle Class Test
/*! ========================================================================
** Extended Template and Library Test Suite
** Angle Class Test
-** $Id
: smach.cpp,v 1.1.1.1 2005/01/04 01:31:48 darco Exp
$
+** $Id$
**
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
**
**
** Copyright (c) 2002 Robert B. Quattlebaum Jr.
**
@@
-44,7
+44,7
@@
enum EventKey
struct MachineContext
{
smach<MachineContext,EventKey> machine;
struct MachineContext
{
smach<MachineContext,EventKey> machine;
-
+
MachineContext():machine(this)
{
}
MachineContext():machine(this)
{
}
@@
-63,10
+63,10
@@
class DefaultStateContext
{
MachineContext *context;
public:
{
MachineContext *context;
public:
- DefaultStateContext(MachineContext *context):context(context) { printf("Enter
t
ed Default State\n"); }
+ DefaultStateContext(MachineContext *context):context(context) { printf("Entered Default State\n"); }
~DefaultStateContext() { printf("Left Default State\n"); }
~DefaultStateContext() { printf("Left Default State\n"); }
-
- Smach::event_result event1_handler(const Smach::event& x)
+
+ Smach::event_result event1_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("DEFAULT STATE: Received Event 1\n");
return Smach::RESULT_ACCEPT;
{
printf("DEFAULT STATE: Received Event 1\n");
return Smach::RESULT_ACCEPT;
@@
-80,7
+80,7
@@
public:
{
insert(event_def(EVENT_1,&DefaultStateContext::event1_handler));
}
{
insert(event_def(EVENT_1,&DefaultStateContext::event1_handler));
}
-
+
} default_state;
} default_state;
@@
-93,10
+93,10
@@
class State1Context
{
MachineContext *context;
public:
{
MachineContext *context;
public:
- State1Context(MachineContext *context):context(context) { printf("Enter
t
ed State 1\n"); }
+ State1Context(MachineContext *context):context(context) { printf("Entered State 1\n"); }
~State1Context() { printf("Left State 1\n"); }
~State1Context() { printf("Left State 1\n"); }
-
- Smach::event_result event1_handler(const Smach::event& x)
+
+ Smach::event_result event1_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("STATE1: Received Event 1\n");
return Smach::RESULT_OK;
{
printf("STATE1: Received Event 1\n");
return Smach::RESULT_OK;
@@
-113,7
+113,7
@@
public:
insert(event_def(EVENT_1,&State1Context::event1_handler));
insert(event_def(EVENT_3,&State1Context::event3_handler));
}
insert(event_def(EVENT_1,&State1Context::event1_handler));
insert(event_def(EVENT_3,&State1Context::event3_handler));
}
-
+
} state_1;
} state_1;
@@
-121,22
+121,22
@@
class State2Context
{
MachineContext *context;
public:
{
MachineContext *context;
public:
- State2Context(MachineContext *context):context(context) { printf("Enter
t
ed State 2\n"); }
+ State2Context(MachineContext *context):context(context) { printf("Entered State 2\n"); }
~State2Context() { printf("Left State 2\n"); }
~State2Context() { printf("Left State 2\n"); }
-
- Smach::event_result event1_handler(const Smach::event& x)
+
+ Smach::event_result event1_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("STATE2: Received Event 1\n");
return Smach::RESULT_OK;
}
{
printf("STATE2: Received Event 1\n");
return Smach::RESULT_OK;
}
- Smach::event_result event2_handler(const Smach::event& x)
+ Smach::event_result event2_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("STATE2: Received Event 2\n");
return Smach::RESULT_OK;
}
{
printf("STATE2: Received Event 2\n");
return Smach::RESULT_OK;
}
- Smach::event_result event3_handler(const Smach::event& x)
+ Smach::event_result event3_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("STATE2: Received Event 3\n");
return Smach::RESULT_OK;
{
printf("STATE2: Received Event 3\n");
return Smach::RESULT_OK;
@@
-152,14
+152,14
@@
public:
insert(event_def(EVENT_2,&State2Context::event2_handler));
insert(event_def(EVENT_3,&State2Context::event3_handler));
}
insert(event_def(EVENT_2,&State2Context::event2_handler));
insert(event_def(EVENT_3,&State2Context::event3_handler));
}
-
+
} state_2;
Smach::event_result
} state_2;
Smach::event_result
-State1Context::event3_handler(const Smach::event& x)
+State1Context::event3_handler(const Smach::event& x
__attribute__ ((unused))
)
{
printf("STATE1: Received Event 3, throwing state to change to...\n");
{
printf("STATE1: Received Event 3, throwing state to change to...\n");
-
+
throw &state_2;
// context->machine.enter(&state_2);
// return Smach::RESULT_ACCEPT;
throw &state_2;
// context->machine.enter(&state_2);
// return Smach::RESULT_ACCEPT;
@@
-173,7
+173,7
@@
int main()
{
int error=0;
{
int error=0;
- MachineContext context;
+ MachineContext context;
try
{
Smach& state_machine(context.machine);
try
{
Smach& state_machine(context.machine);
@@
-181,7
+181,7
@@
int main()
state_machine.set_default_state(&default_state);
state_machine.enter(&state_1);
state_machine.set_default_state(&default_state);
state_machine.enter(&state_1);
-
+
state_machine.process_event(Event1());
state_machine.process_event(EVENT_1);
state_machine.process_event(EVENT_2);
state_machine.process_event(Event1());
state_machine.process_event(EVENT_1);
state_machine.process_event(EVENT_2);
@@
-202,6
+202,6
@@
int main()
printf("Uncaught exception\n");
error++;
}
printf("Uncaught exception\n");
error++;
}
-
+
return error;
}
return error;
}