[2269] | 1 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 2 | //
|
---|
| 3 | // ## ######
|
---|
| 4 | // ###### ###
|
---|
| 5 | // ## ############### Shark 3D Engine (www.shark3d.com)
|
---|
| 6 | // ########## # # #
|
---|
| 7 | // ######## Copyright (c) 1996-2006 Spinor GmbH.
|
---|
| 8 | // ######### # # # All rights reserved.
|
---|
| 9 | // ## ##########
|
---|
| 10 | // ##
|
---|
| 11 | //
|
---|
| 12 | ///////////////////////////////////////////////////////////////////////////////
|
---|
| 13 |
|
---|
| 14 | // Definition of the CAS (component access shell).
|
---|
| 15 | // The CAS allows to interactively inspect and modify the actors at runtime
|
---|
| 16 | // via a TCP port.
|
---|
| 17 |
|
---|
| 18 | // Encapsulate all actors defining the CAS in an own namespace:
|
---|
| 19 | actor_ident "kit_base.capsule"
|
---|
| 20 | actor_param
|
---|
| 21 | {
|
---|
| 22 | active 1
|
---|
| 23 | scope "cas"
|
---|
| 24 | local_name "capsule"
|
---|
| 25 | deleg_target ""
|
---|
| 26 | child_ident "kit_base.group"
|
---|
| 27 | child_param
|
---|
| 28 | {
|
---|
| 29 | // Delegate action calls to the children.
|
---|
| 30 | active 1
|
---|
| 31 | child_array
|
---|
| 32 | {
|
---|
| 33 | // Producer for CAS objects:
|
---|
| 34 | ident "kit_base.producer"
|
---|
| 35 | param
|
---|
| 36 | {
|
---|
| 37 | active 1
|
---|
| 38 | name "connection_producer"
|
---|
| 39 | deleg_name "connectionset"
|
---|
| 40 | ident "kit_base.capsule"
|
---|
| 41 | param
|
---|
| 42 | {
|
---|
| 43 | active 1
|
---|
| 44 | scope "cas_connection"
|
---|
| 45 | local_name "capsule"
|
---|
| 46 | deleg_target "dispatch_export"
|
---|
| 47 | child_ident "kit_base.group"
|
---|
| 48 | child_param
|
---|
| 49 | {
|
---|
| 50 | // Delegate action calls to the children.
|
---|
| 51 | active 1
|
---|
| 52 | child_array
|
---|
| 53 | {
|
---|
| 54 | // Dispatcher for commands from outside
|
---|
| 55 | // the capsule:
|
---|
| 56 | ident "kit_base.dispatch"
|
---|
| 57 | param
|
---|
| 58 | {
|
---|
| 59 | name "dispatch_export"
|
---|
| 60 | entry_array
|
---|
| 61 | {
|
---|
| 62 | // Assign the socket object.
|
---|
| 63 | cmds "set_tcpstream"
|
---|
| 64 | targets "tcpinput"
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 | }
|
---|
| 68 | {
|
---|
| 69 | // Dispatcher within the CAS capsule.
|
---|
| 70 | ident "kit_base.dispatch"
|
---|
| 71 | param
|
---|
| 72 | {
|
---|
| 73 | name "dispatch"
|
---|
| 74 | entry_array
|
---|
| 75 | {
|
---|
| 76 | // If the connection is lost or closed,
|
---|
| 77 | // destroy the CAS object.
|
---|
| 78 | cmds "notify_lost" "notify_closed"
|
---|
| 79 | targets "capsule"
|
---|
| 80 | newcmd "destroy"
|
---|
| 81 | }
|
---|
| 82 | }
|
---|
| 83 | }
|
---|
| 84 | {
|
---|
| 85 | // The CAS shell evaluating commands.
|
---|
| 86 | ident "kit_com.shell"
|
---|
| 87 | param
|
---|
| 88 | {
|
---|
| 89 | name "shell"
|
---|
| 90 | write_line_cmd "write_line"
|
---|
| 91 | quit_cmd "close"
|
---|
| 92 | start_actor "^^root"
|
---|
| 93 | }
|
---|
| 94 | }
|
---|
| 95 | {
|
---|
| 96 | // CAS socket and line parser:
|
---|
| 97 | ident "kit_com.tcpinput"
|
---|
| 98 | param
|
---|
| 99 | {
|
---|
| 100 | active 1
|
---|
| 101 | name "tcpinput"
|
---|
| 102 | extcfg_actor "^^cfg"
|
---|
| 103 | extcfg_entry_addrport ""
|
---|
| 104 | extcfg_entry_echo "cas.echo"
|
---|
| 105 | extcfg_entry_telnet "cas.telnet"
|
---|
| 106 | interpreter "shell"
|
---|
| 107 | welcome
|
---|
| 108 | "Welcome to the Shark 3D "
|
---|
| 109 | & "component access shell (CAS)."
|
---|
| 110 | "Type 'help' for help."
|
---|
| 111 | prompt "Shark3D-CAS> "
|
---|
| 112 | notify "dispatch"
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | }
|
---|
| 119 | {
|
---|
| 120 | // Listen socket waiting for incoming connections:
|
---|
| 121 | ident "kit_com.tcplisten"
|
---|
| 122 | param
|
---|
| 123 | {
|
---|
| 124 | active 1
|
---|
| 125 | ignore_socket_errors 1
|
---|
| 126 | extcfg_actor "^cfg"
|
---|
| 127 | extcfg_entry_addrport "cas.addrport"
|
---|
| 128 | producer "connection_producer"
|
---|
| 129 | }
|
---|
| 130 | }
|
---|
| 131 | }
|
---|
| 132 | }
|
---|