diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..497baeb --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,49 @@ +name: Documentation + +on: + push: + branches: [main] + paths: + - 'addons/**' + - 'NaturalDocs.Project/**' + - '.github/workflows/docs.yml' + +permissions: + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install Natural Docs + run: dotnet tool install --global Natural_Docs --version 2.3.1 + + - name: Generate documentation + run: NaturalDocs NaturalDocs.Project --rebuild + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs-output + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index c6a5a45..6771533 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ hemtt.exe .hemttprivatekey *.biprivatekey + +docs-output/ diff --git a/NaturalDocs.Project/Languages.txt b/NaturalDocs.Project/Languages.txt new file mode 100644 index 0000000..5b7699d --- /dev/null +++ b/NaturalDocs.Project/Languages.txt @@ -0,0 +1,6 @@ +Language: SQF + + Extensions: sqf hpp + + Line Comments: // + Block Comments: /* */ diff --git a/NaturalDocs.Project/Project.txt b/NaturalDocs.Project/Project.txt new file mode 100644 index 0000000..3c73607 --- /dev/null +++ b/NaturalDocs.Project/Project.txt @@ -0,0 +1,6 @@ +Title: OCAP2 +Subtitle: Operations Capture and Playback + +Source Folder: ../addons + +HTML Output Folder: ../docs-output diff --git a/docs/files/extension/fnc_sendData-sqf.html b/docs/files/extension/fnc_sendData-sqf.html deleted file mode 100644 index 9e29049..0000000 --- a/docs/files/extension/fnc_sendData-sqf.html +++ /dev/null @@ -1,43 +0,0 @@ - - -
| fnc_sendData.sqf | |
| Functions | |
| OCAP_extension_fnc_sendData | Manages raw extension calls and returns values / logs errors where relevant. |
Manages raw extension calls and returns values / logs errors where relevant.
| _command | The extension command to call [String] |
| _args | The arguments to send [Array] |
Depends
[":VERSION", []] call EFUNC(extension,sendData);
No
Dell, Zealot
#define COMPONENT extension
#define COMPONENT_BEAUTIFIED Extension
| CBA Settings | |
| Core | |
| CBA Settings | |
| OCAP_enabled | Turns on or off most recording functionality. |
| OCAP_isDebug | Enables increased logging of addon actions. |
| OCAP_administratorList | An array or server-visible variable referencing one that is a list of playerUIDs. |
| CBA Settings | |
| OCAP_enabled | Turns on or off most recording functionality. |
| OCAP_isDebug | Enables increased logging of addon actions. |
| OCAP_administratorList | An array or server-visible variable referencing one that is a list of playerUIDs. |
An array or server-visible variable referencing one that is a list of playerUIDs. Additional briefing diary or UI elements may be available for more accessible control over OCAP’s features. Takes effect on player server connection. Format: [] OR myAdminPUIDs | Default: []
Administrators
Stringified Array
"['76561198000000000', '76561198000000001']"
#define COMPONENT main
#define COMPONENT_BEAUTIFIED Main
Defines macros imported to other functions
| script_macros.hpp | Defines macros imported to other functions |
| Macros | |
| PREFIX | |
| COMPONENT_NAME | |
| ADDON | PREFIX_COMPONENT |
| VERSION | |
| VERSION_STR | |
| VERSION_AR | |
| VERSION_REQUIRED | |
| LOG | Used for logging messages to the extension (ocap-ext log file). |
| SYSCHAT | Used for debug purposes to send a string to all clients with interfaces. |
| SHOULDSAVEEVENTS | Used to determine if events should currently be saved based on OCAP_recorder_recording and <OCAP_recorder_startTime>. |
| BOOL | Forces a true/false return of input. |
| ARR2 | Resolves arguments to array, used for entries to LOG that requires array input. |
#define SHOULDSAVEEVENTS ( (missionNamespace getVariable [QGVAR(recording), false]) && missionNamespace getVariable [QGVAR(startTime), -1] > -1 )
Used to determine if events should currently be saved based on OCAP_recorder_recording and <OCAP_recorder_startTime>.
#define ARR2( _arg1, _arg2 ) [_arg1, _arg2]
Resolves arguments to array, used for entries to LOG that requires array input.
#define PREFIX OCAP
#define COMPONENT_NAME QUOTE( PREFIX - COMPONENT_BEAUTIFIED )
#define COMPONENT main
#define VERSION 2.0
#define VERSION_STR 2.0.0
#define VERSION_AR 2,0,0
#define VERSION_REQUIRED 2.10
Used for logging messages to the extension (ocap-ext log file).
#define OCAPEXTLOG( _args ) [":LOG:", _args] call EFUNC(extension,sendData)
Used for debug purposes to send a string to all clients with interfaces.
#define SYSCHAT remoteExec ["systemChat", [0, -2] select isDedicated]
Used to determine if events should currently be saved based on OCAP_recorder_recording and OCAP_recorder_startTime.
#define SHOULDSAVEEVENTS ( (missionNamespace getVariable [QGVAR(recording), false]) && missionNamespace getVariable [QGVAR(startTime), -1] > -1 )
Forces a true/false return of input.
#define BOOL( _cond ) ([0,1] select (_cond))
Resolves arguments to array, used for entries to LOG that requires array input.
#define ARR2( _arg1, _arg2 ) [_arg1, _arg2]
| CBA Settings | |
| Auto-Start Settings | |
| CBA Settings | |
| OCAP_settings_autoStart | Automatically start OCAP recordings at session start. |
| OCAP_settings_minPlayerCount | Auto-start will begin once this player count is reached. |
| Core | |
| CBA Settings | |
| OCAP_settings_frameCaptureDelay | Positioning, medical status, and crew states of units and vehicles will be captured every X amount of seconds. |
| OCAP_settings_preferACEUnconscious | If true, will check ACE3 medical status on units. |
| Exclusions | |
| CBA Settings | |
| OCAP_settings_excludeClassFromRecord | Array of object classnames that should be excluded from recording. |
| OCAP_settings_excludeKindFromRecord | Array of classnames which, along with all child classes, should be excluded from recording. |
| OCAP_settings_excludeMarkerFromRecord | Array of prefixes. |
| Extra Tracking | |
| CBA Settings | |
| OCAP_settings_trackTickets | Will track respawn ticket counts for missionNamespace and each playable faction every 30th frame. |
| OCAP_settings_trackTimes | Will continuously track in-game world time during a mission. |
| OCAP_settings_trackTimeInterval | If OCAP_settings_trackTimes is enabled, it will be checked every X capture frames. |
| Save/ | |
| CBA Settings | |
| OCAP_settings_saveTag | If not overriden by the OCAP_exportData CBA event or if a mission is auto-saved, this will be used to categorize and filter the recording in the database and web list of missions. |
| OCAP_settings_saveMissionEnded | If true, automatically save and export the mission when the MPEnded event fires. |
| OCAP_settings_saveOnEmpty | Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minimum save duration setting. |
| OCAP_settings_minMissionTime | A recording must be at least this long (in minutes) to auto-save. |
| CBA Settings | |
| OCAP_settings_autoStart | Automatically start OCAP recordings at session start. |
| OCAP_settings_minPlayerCount | Auto-start will begin once this player count is reached. |
| CBA Settings | |
| OCAP_settings_frameCaptureDelay | Positioning, medical status, and crew states of units and vehicles will be captured every X amount of seconds. |
| OCAP_settings_preferACEUnconscious | If true, will check ACE3 medical status on units. |
| CBA Settings | |
| OCAP_settings_excludeClassFromRecord | Array of object classnames that should be excluded from recording. |
| OCAP_settings_excludeKindFromRecord | Array of classnames which, along with all child classes, should be excluded from recording. |
| OCAP_settings_excludeMarkerFromRecord | Array of prefixes. |
| CBA Settings | |
| OCAP_settings_trackTickets | Will track respawn ticket counts for missionNamespace and each playable faction every 30th frame. |
| OCAP_settings_trackTimes | Will continuously track in-game world time during a mission. |
| OCAP_settings_trackTimeInterval | If OCAP_settings_trackTimes is enabled, it will be checked every X capture frames. |
If OCAP_settings_trackTimes is enabled, it will be checked every X capture frames. Default: 10
Mission Time Tracking Interval
Number
| CBA Settings | |
| OCAP_settings_saveTag | If not overriden by the OCAP_exportData CBA event or if a mission is auto-saved, this will be used to categorize and filter the recording in the database and web list of missions. |
| OCAP_settings_saveMissionEnded | If true, automatically save and export the mission when the MPEnded event fires. |
| OCAP_settings_saveOnEmpty | Will automatically save recording when there are 0 players on the server and existing data accounts for more time than the minimum save duration setting. |
| OCAP_settings_minMissionTime | A recording must be at least this long (in minutes) to auto-save. |
If not overriden by the OCAP_exportData CBA event or if a mission is auto-saved, this will be used to categorize and filter the recording in the database and web list of missions.
Mission Type Tag
String
A recording must be at least this long (in minutes) to auto-save. Calling an OCAP_exportData CBA server event will override this restriction. Default: 20
Required Duration to Sav
Boolean
| fnc_aceExplosives.sqf | |
| Functions | |
| OCAP_recorder_fnc_aceExplosives | Adds marker on the mine’s position to the recording timeline. |
Adds marker on the mine’s position to the recording timeline. Then waits until the explosive is null (exploded) and indicates it with a 10-frame long red X before removing the marker.
Called by ace_explosives_place CBA listener.
None
Nothing
call FUNC(aceExplosives);
Example of emitting event from ACE3 code:
[QGVAR(place), [_explosive, _dir, _pitch, _unit]] call CBA_fnc_globalEvent;
No
IndigoFox
Event listener for ACE3 global event indicating a mine has been placed and armed.
EGVAR( listener, aceExplosives ) = ["ace_explosives_place", { call FUNC(aceExplosives); }] call CBA_fnc_addEventHandler
| fnc_addEventMission.sqf | |
| Functions | |
| OCAP_recorder_fnc_addEventMission | Used for applying mission event handlers. |
| Event Handlers | |
| Event Handlers | |
| OCAP_EH_HandleDisconnect | Fired when a player leaves the mission by returning to lobby or disconnecting. |
| OCAP_EH_PlayerConnected | Handle for the “PlayerConnected” mission event handler. |
| OCAP_EH_OnUserAdminStateChanged | Handle for the “OnUserAdminStateChange” mission event handler. |
| OCAP_EH_EntityKilled | Handle for the “EntityKilled” mission event handler. |
| OCAP_EH_EntityRespawned | Handle for the “EntityRespawned” mission event handler. |
| OCAP_EH_MPEnded | Handle for the “MPEnded” mission event handler. |
| OCAP_EH_Ended | Handle for the “Ended” mission event handler. |
| CBA Events | |
| Variables | |
| CBA Listener Handles | |
| CBA Events | |
| ace_advanced_throwing_throwFiredXEH | Fired when a throwable is primed. |
| ace_explosives_place | Event listener for ACE3 global event indicating a mine has been placed and armed. |
| OCAP_customEvent | Event listener for custom event text to be added to the timeline. |
| OCAP_counterInit | Meant for use in custom tracking of points or score between two sides. |
| OCAP_counterEvent | Meant for use in custom tracking of points or score between two sides. |
| OCAP_record | Used to start or resume recording. |
| OCAP_pause | Used to pause recording. |
| OCAP_exportData | Used to stop recording & signal the extension to save and upload it to the web component. |
Used for applying mission event handlers. Applied during initialization of OCAP in OCAP_recorder_fnc_init.
None
Nothing
call FUNC(addEventMission);
No
IndigoFox, Dell
| Event Handlers | |
| OCAP_EH_HandleDisconnect | Fired when a player leaves the mission by returning to lobby or disconnecting. |
| OCAP_EH_PlayerConnected | Handle for the “PlayerConnected” mission event handler. |
| OCAP_EH_OnUserAdminStateChanged | Handle for the “OnUserAdminStateChange” mission event handler. |
| OCAP_EH_EntityKilled | Handle for the “EntityKilled” mission event handler. |
| OCAP_EH_EntityRespawned | Handle for the “EntityRespawned” mission event handler. |
| OCAP_EH_MPEnded | Handle for the “MPEnded” mission event handler. |
| OCAP_EH_Ended | Handle for the “Ended” mission event handler. |
Fired when a player leaves the mission by returning to lobby or disconnecting. Calls OCAP_recorder_fnc_eh_disconnected.
Handle for the “PlayerConnected” mission event handler. Fired when a player joins the mission from lobby and appears in the world. Calls OCAP_recorder_fnc_eh_connected.
Handle for the “OnUserAdminStateChange” mission event handler. Fired when a player’s admin status changes. Calls OCAP_recorder_fnc_eh_onUserAdminStateChanged.
Handle for the “EntityKilled” mission event handler. Fired when an entity is killed. Calls OCAP_recorder_fnc_eh_killed.
Handle for the “EntityRespawned” mission event handler. Fired when an entity is respawned. Sets new body to not-killed and calls OCAP_recorder_fnc_addUnitEventHandlers on it. Then excludes corpse from further capture.
Handle for the “MPEnded” mission event handler. Fired on the MPEnded mission event. This is used to automatically save and export if OCAP_settings_saveMissionEnded is true and OCAP_settings_minMissionTime was reached.
Handle for the “Ended” mission event handler. Fired on the singleplayer Ended mission event. This is used to automatically save and export if OCAP_settings_saveMissionEnded is true and OCAP_settings_minMissionTime was reached. Kept in just in case this event triggers.
| Variables | |
| CBA Listener Handles | |
| CBA Events | |
| ace_advanced_throwing_throwFiredXEH | Fired when a throwable is primed. |
| ace_explosives_place | Event listener for ACE3 global event indicating a mine has been placed and armed. |
| OCAP_customEvent | Event listener for custom event text to be added to the timeline. |
| OCAP_counterInit | Meant for use in custom tracking of points or score between two sides. |
| OCAP_counterEvent | Meant for use in custom tracking of points or score between two sides. |
| OCAP_record | Used to start or resume recording. |
| OCAP_pause | Used to pause recording. |
| OCAP_exportData | Used to stop recording & signal the extension to save and upload it to the web component. |
| OCAP_listener_aceThrowing | Handle for ace_advanced_throwing_throwFiredXEH listener. |
| OCAP_listener_aceExplosives | Handle for ace_explosives_place listener. |
| OCAP_listener_customEvent | Handle for OCAP_customEvent listener. |
| OCAP_listener_counterInit | Handle for OCAP_counterInit listener. |
| OCAP_listener_counterEvent | Handle for OCAP_counterEvent listener. |
| OCAP_counter_sides | Sides that are tracked by the custom counter system. [Array] |
| OCAP_listener_record | Handle for OCAP_record listener. |
| OCAP_listener_pause | Handle for OCAP_pause listener. |
| OCAP_listener_exportData | Handle for OCAP_exportData listener. |
EGVAR( listener, aceThrowing ) = ["ace_advanced_throwing_throwFiredXEH", { _this call FUNC(eh_firedMan) }] call CBA_fnc_addEventHandler
Fired when a throwable is primed. This is a global event the server will handle and forward to OCAP_recorder_fnc_eh_firedMan. Created only if PBO “ace_advanced_throwing” is loaded.
EGVAR( listener, aceExplosives ) = ["ace_explosives_place", { call FUNC(aceExplosives); }] call CBA_fnc_addEventHandler
Event listener for ACE3 global event indicating a mine has been placed and armed. Calls OCAP_recorder_fnc_aceExplosives when triggered. Created only if PBO “ace_explosives” is loaded.
Event listener for custom event text to be added to the timeline. Calls OCAP_recorder_fnc_handleCustomEvent when triggered.
| 0 | Event name [String] |
| 1 | Event data [Array] |
| 1.0 | Always “generalEvent” [String] |
| 1.1 | Custom event text [String] |
["OCAP_customEvent", ["generalEvent", "The warehouse has been secured!"]] call CBA_fnc_serverEvent; -[QGVARMAIN(customEvent), ["generalEvent", "The warehouse has been secured!"]] call CBA_fnc_serverEvent;
Meant for use in custom tracking of points or score between two sides. Separate from BIS_fnc_respawnTickets. Initializes the system. Calls <OCAP_recorder_fnc_counterInit> when triggered.
| 0 | Event name [String] |
| 1 | Key/value for one or more sides [Array] |
| 1.0 | Pair [Array] |
| 1.0.0 | Side <SIDE> |
| 1.0.1 | Initial value [Number] |
["OCAP_counterInit", [ - [west, 0], - [east, 0] -]] call CBA_fnc_serverEvent; - -[QGVARMAIN(counterInit), [ - [west, 0], - [east, 0] -]] call CBA_fnc_serverEvent;
Meant for use in custom tracking of points or score between two sides. Separate from BIS_fnc_respawnTickets. Updates the system. Calls <OCAP_recorder_fnc_counterEvent> when triggered.
| 0 | Event name [String] |
| 1 | Event data [Array] |
| 1.0 | Side <SIDE> |
| 1.1 | Value to set [Number] |
["OCAP_counterEvent", [west, 1]] call CBA_fnc_serverEvent;
Used to start or resume recording. Calls OCAP_recorder_fnc_startRecording when triggered.
["OCAP_record"] call CBA_fnc_serverEvent;
Used to pause recording. Calls OCAP_recorder_fnc_stopRecording when triggered.
["OCAP_pause"] call CBA_fnc_serverEvent;
Used to stop recording & signal the extension to save and upload it to the web component. Calls OCAP_recorder_fnc_exportData when triggered.
Will always bypass OCAP_settings_minMissionTime.
| 0 | Event name [String] |
| 1 | Event data [Array] |
| 1.0 | (optional) Winning side <SIDE> |
| 1.1 | (optional) Message describing mission end [String] |
| 1.2 | (optional) Custom save tag (overrides OCAP_settings_saveTag) [String] |
Fired when a throwable is primed.
EGVAR( listener, aceThrowing ) = ["ace_advanced_throwing_throwFiredXEH", { _this call FUNC(eh_firedMan) }] call CBA_fnc_addEventHandler
Event listener for ACE3 global event indicating a mine has been placed and armed.
EGVAR( listener, aceExplosives ) = ["ace_explosives_place", { call FUNC(aceExplosives); }] call CBA_fnc_addEventHandler
| fnc_addUnitEventHandlers.sqf | |
| Functions | |
| OCAP_recorder_fnc_addUnitEventHandlers | Used for applying unit-specific event handlers to units during initialization. |
Used for applying unit-specific event handlers to units during initialization. These event handlers will trigger on the server.
Applied during initialization of a unit in OCAP_recorder_fnc_captureLoop.
Note: Hit tracking moved to projectile EHs in OCAP_recorder_fnc_eh_firedMan
| _entity | Object to apply event handlers to. [Object] |
| _respawn | Determines if unit is initialized for the first time, or has respawned and does not need certain handlers reapplied. [[Bool], default: false] |
Nothing
[_unit] spawn FUNC(addUnitEventHandlers);
No
IndigoFox, Fank
| fnc_adminUIControl.sqf | |
| Functions | |
| OCAP_recorder_fnc_adminUIControl | Runs checks to determine if a player should have the administrative diary entry added or removed upon joining the mission or logging in/out as admin. |
| Variables | |
| OCAP_hasAdminControls | Applied on units processed in OCAP_recorder_fnc_adminUIControl. |
Runs checks to determine if a player should have the administrative diary entry added or removed upon joining the mission or logging in/out as admin.
| _PID | PlayerID indicating unique network client on the server [String] |
| _event | Event that triggered this call [[String], one of: “connect”, “login”, “logout”] |
Nothing
["1234567890", "connect"] call FUNC(adminUIControl);
No
IndigoFox
Applied on units processed in OCAP_recorder_fnc_adminUIControl. Indicates whether or not they have the administrative diary entry available. Server missionNamespace only.
| fnc_captureLoop.sqf | |
| Functions | |
| OCAP_recorder_fnc_captureLoop | This function is run unscheduled and creates a CBA PerFrameHandler object, a logic object which executes code every specified interval (OCAP_settings_frameCaptureDelay) while a condition (SHOULDSAVEEVENTS) is true. |
| Variables | |
| OCAP_PFHObject | The CBA PerFrameHandler object that is created and used to run the capture loop. |
This function is run unscheduled and creates a CBA PerFrameHandler object, a logic object which executes code every specified interval (OCAP_settings_frameCaptureDelay) while a condition (SHOULDSAVEEVENTS) is true.
Iterates through units and vehicles, declares they exist, and conditionally sends their information to the extension to populate recording data.
This is the core processing loop that determines when new units enter the world, all the details about them, classifies which to exclude, and determines their health/life status. It has both unit and vehicle tracking.
None
Nothing
call FUNC(captureLoop);
No
Dell, Zealot, IndigoFox, Fank
Used to determine if events should currently be saved based on OCAP_recorder_recording and OCAP_recorder_startTime.
#define SHOULDSAVEEVENTS ( (missionNamespace getVariable [QGVAR(recording), false]) && missionNamespace getVariable [QGVAR(startTime), -1] > -1 )
| fnc_eh_connected.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_connected | This function uses the <OCAP_EH_Connected> event handler to log “connected” events to the timeline. |
This function uses the <OCAP_EH_Connected> event handler to log “connected” events to the timeline.
It also calls OCAP_recorder_fnc_adminUIControl to apply the admin UI if the player is in OCAP_administratorList.
See the wiki for details. https://community.bistudio.com
Nothing
call FUNC(eh_connected);
No
IndigoFox
| fnc_eh_disconnected.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_disconnected | This function uses the OCAP_EH_HandleDisconnect event handler to log “disconnected” events to the timeline. |
This function uses the OCAP_EH_HandleDisconnect event handler to log “disconnected” events to the timeline. It will exclude any body left over from further recording.
See the wiki for details. https://community.bistudio.com
False [Bool]
call FUNC(eh_disconnected);
No
IndigoFox
| fnc_eh_firedMan.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_firedMan | Tracks bullet and non-bullet projectiles. |
| Variables | |
| OCAP_lastFired | Indicates a formatted string of the last weapon and magazine type fired by the unit. |
| Event Handlers | |
| Projectiles (Bullets) | |
| Projectiles (Non-Bullets) | |
| CBA Events | |
| Projectiles |
Tracks bullet and non-bullet projectiles. This is the code triggered when a unit firing is detected by the “FiredMan” Event Handler applied to units during OCAP_recorder_fnc_addUnitEventHandlers.
| _firer | Unit the event handler is assigned to (the instigator) [Object] |
| _weapon | Fired weapon [String] |
| _muzzle | Muzzle that was used [String] |
| _mode | Current mode of the fired weapon [String] |
| _ammo | Classname of ammo used [String] |
| _magazine | Classname of magazine used [String] |
| _projectile | Object of the projectile that was shot out [Object] |
| _vehicle | if weapon is vehicle weapon, otherwise objNull [Object] |
Nothing
[_firer, _weapon, _muzzle, _mode, _ammo, _magazine, _projectile, _vehicle] call FUNC(eh_firedMan);
No
IndigoFox, Dell
| Deleted | Makes extension call to draw a fire-line between the firer and the final destination. |
| Explode | Makes extension call to draw a fire-line between the firer and the final destination. |
| HitPart | Triggered when a projectile hits a part of a unit. Calls OCAP_recorder_fnc_eh_projectileHit. |
| HitExplosion | Triggered when a projectile explodes and damages a part of a unit. Calls OCAP_recorder_fnc_eh_projectileHit. |
| Deleted | Triggered when a non-bullet projectile is deleted. Updates marker position, then removes it 3 frames later. |
| Explode | Triggered when a non-bullet projectile explodes. Updates marker position, then removes it 3 frames later. |
| HitPart | Triggered when a projectile hits a part of a unit. Calls OCAP_recorder_fnc_eh_projectileHit. |
| HitExplosion | Triggered when a projectile explodes and damages a part of a unit. Calls OCAP_recorder_fnc_eh_projectileHit. |
| fnc_eh_killed.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_killed | Tracks when a unit is killed. |
Tracks when a unit is killed. This is the code triggered by the OCAP_EH_EntityKilled mission event handler.
| _unit | Object the event handler is assigned to. [Object] |
| _killer | Object that killed the unit. [Object] |
| _instigator | Person who pulled the trigger. [Object] |
| _useEffects | same as useEffects in setDamage alt syntax. [Bool] |
Nothing
call FUNC(eh_killed);
No
Dell, IndigoFox, Fank
| fnc_eh_onUserAdminStateChanged.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_onUserAdminStateChanged | Uses OCAP_EH_OnUserAdminStateChanged to detect when someone is has logged in or out of the server and calls OCAP_recorder_fnc_adminUIControl to update the admin UI. |
Uses OCAP_EH_OnUserAdminStateChanged to detect when someone is has logged in or out of the server and calls OCAP_recorder_fnc_adminUIControl to update the admin UI.
| _networkId | The network ID of the player who has logged in or out of the server [String] |
| _loggedIn | Whether the player has logged in or out as admin [Boolean] |
| _votedIn | Whether the player has been voted in or out of admin [Boolean] |
Nothing
call FUNC(eh_onUserAdminStateChanged);
No
IndigoFox
| fnc_eh_projectileHit.sqf | |
| Functions | |
| OCAP_recorder_fnc_eh_projectileHit | Tracks when a unit is hit/takes damage and saves to the timeline. |
Tracks when a unit is hit/takes damage and saves to the timeline. This is called by projectile event handlers in OCAP_recorder_fnc_eh_firedMan.
| _unit | Object that took damage [Object] |
| _shooter | Object that caused the damage [Object] |
Nothing
[_hitEntity, _projectileOwner] call FUNC(eh_projectileHit);
No
IndigoFox, Fank
| fnc_entityMonitors.sqf | |
| Functions | |
| OCAP_recorder_fnc_entityMonitors | While debug mode is enabled, this function will render 2D icons and text representing all entities that have been initialized by OCAP and are not being excluded from the recording. |
| Variables | |
| OCAP_entityMonitorsInitialized | This variable on the server indicates whether or not the entity monitors have been initialized for all clients + JIP. |
While debug mode is enabled, this function will render 2D icons and text representing all entities that have been initialized by OCAP and are not being excluded from the recording.
This is useful for debugging and verifying that the correct entities are being recorded (see OCAP_settings_excludeClassFromRecord and OCAP_settings_excludeKindFromRecord.
None
Nothing
[_hitEntity, _projectileOwner] call FUNC(eh_projectileHit);
No
IndigoFox
| fnc_exportData.sqf | |
| Functions | |
| OCAP_recorder_fnc_exportData | This function facilitates the actual endMission and save events in the extension, prompting it to pack the mission and upload it to the web component. |
This function facilitates the actual endMission and save events in the extension, prompting it to pack the mission and upload it to the web component.
Called directly, it is subject to the OCAP_settings_minMissionTime setting, and will not export if the mission is not long enough. It can also be called using OCAP_listener_exportData to bypass this check.
When OCAP_settings_saveMissionEnded is true, this function will be called automatically when the mission ends.
When OCAP_settings_saveOnEmpty is true, this function will execute when the last player leaves the mission (to lobby or when disconnecting).
OCAP_settings_saveTag is used to tag the mission with a custom string, which can be used to identify the mission in the web component.
| _side | The winning side [optional, Side] |
| _message | A custom description of how the victory was achieved [optional, String] |
| _tag | A custom tag to override that which is defined in userconfig.hpp that will make it filterable in web [optional, String] |
Nothing
// "Mission ended" -[] call FUNC(exportData); - -// "BLUFOR Win." -[west] call FUNC(exportData); - -// "OPFOR Win. OPFOR controlled all sectors! -[east, "OPFOR controlled all sectors!"] call FUNC(exportData); - -// "Independent Win. INDFOR stole the intel!" -// Mission is saved under filterable "SnatchAndGrab" tag on web -[independent, "INDFOR stole the intel!", "SnatchAndGrab"] call FUNC(exportData); - -["OCAP_exportData", west] call CBA_fnc_serverEvent;
No
Dell, Zealot, IndigoFox, TyroneMF
| fnc_getAmmoMarkerData.sqf | |
| Functions | |
| OCAP_recorder_fnc_getAmmoMarkerData | This function will intake information from <OCAP_EH_FiredMan> and return data used to format a marker for entry into the timeline. |
This function will intake information from <OCAP_EH_FiredMan> and return data used to format a marker for entry into the timeline.
| _weapon | The weapon used [String] |
| _muzzle | The muzzle used [String] |
| _ammo | The ammo used [String] |
| _magazine | The magazine used [String] |
| _projectile | The projectile object [Object] |
| _vehicle | The vehicle the weapon is mounted on, if any [Object] |
| _ammoSimType | The ammo simulation type [String] |
| [_markTextLocal,_markName,_markColor,_markerType] | The marker data [Array] |
([_weapon, _muzzle, _ammo, _magazine, _projectile, _vehicle, _ammoSimType] call FUNC(getAmmoMarkerData)) params ["_markTextLocal","_markName","_markColor","_markerType"];
No
IndigoFox
| fnc_getClass.sqf | |
| Functions | |
| OCAP_recorder_fnc_getClass | Determines what type of vehicle is being recorded to match with the more limited icon set preloaded in the OCAP playback UI. |
Determines what type of vehicle is being recorded to match with the more limited icon set preloaded in the OCAP playback UI.
| _this | The vehicle being queried [Object] |
| [String] | The icon name that should be used to represent the vehicle in the playback UI |
_class = _vehType call FUNC(getClass);
No
Zealot, Dell
| fnc_getEventWeaponText.sqf | |
| Functions | |
| OCAP_recorder_fnc_getEventWeaponText | Used to identify the current weapon a unit is using that has injured or killed another. |
Used to identify the current weapon a unit is using that has injured or killed another. Will determine the handheld weapon or vehicle weapon they’re using.
Attempts to reference OCAP_lastFired but will fall back to current value if not available.
Called during <OCAP_recorder_fnc_projectileHit> and OCAP_recorder_fnc_eh_killed.
| _instigator | The unit to evaluate [Object] |
The description of weapon or vehicle > weapon. [String]
[_shooter] call FUNC(getEventWeaponText)
No
IndigoFox
| fnc_getInstigator.sqf | |
| Functions | |
| OCAP_recorder_fnc_getInstigator | Attempts to identify who truly pulled the trigger on a kill event. |
Attempts to identify who truly pulled the trigger on a kill event.
Called in OCAP_recorder_fnc_eh_killed.
| _victim | Who was killed. [Object] |
| _killer | What caused the damage. [Object, default objNull] |
| _instigator | Who pulled the trigger, as reported by Arma. [Object, default objNull] |
The true killer. [Object]
[_victim, _killer] call FUNC(getInstigator);
No
Dell
| fnc_getUnitType.sqf | |
| Functions | |
| OCAP_recorder_fnc_getUnitType | Identifies the role of a unit using similar methodology to Arma 3’s. |
| fnc_getWeaponDisplayData.sqf | |
| Functions | |
| OCAP_recorder_fnc_getWeaponDisplayData | Used to populate OCAP_lastFired on units in OCAP_recorder_fnc_eh_firedMan. |
Used to populate OCAP_lastFired on units in OCAP_recorder_fnc_eh_firedMan.
| _weapon | Weapon class name [String] |
| _muzzle | Muzzle class name [String] |
| _magazine | Magazine class name [String] |
| _ammo | Ammo class name [String] |
[Array]
| 0 | Muzzle display name [String] |
| 1 | Magazine display name [String] |
([_weapon, _muzzle, _magazine, _ammo] call FUNC(getWeaponDisplayData)) params ["_muzzleDisp", "_magDisp"];
No
IndigoFox
| fnc_handleCustomEvent.sqf | |
| Functions | |
| OCAP_recorder_fnc_handleCustomEvent | Sends custom event data to the extension to save it to the timeline. |
Sends custom event data to the extension to save it to the timeline. This custom event data is later read by Javascript in the web component to determine how it should be displayed.
Applied during initialization of OCAP in OCAP_recorder_fnc_init.
| _type | classifier for the type of event. used to determine text & icon [[String], one of: “flag”, “generalEvent”] |
| _unit | name of the unit that performed the action [String] |
| _unitColor | (optional) color for the unit’s name shown in Events list and for the pulse on the map [[String], Hex RGB, defaults “” and will show as white] |
| _objectiveColor | (optional) color representing the icon in Events list [[String], Hex RGB, defaults “” and will show as white] |
| _position | (optional) the location to pulse on the map [<PositionATL>, default nil] |
Nothing
["ocap_handleCustomEvent", ["eventType", "eventMessage"]] call CBA_fnc_serverEvent; - -// saves a general event to the timeline -["ocap_handleCustomEvent", ["generalEvent", "eventText"]] call CBA_fnc_serverEvent; - -// indicates a flag has been captured -["ocap_handleCustomEvent", ["captured", [ - "flag", - name _unit, - str side group _unit, - "#FF0000", - getPosAtl _flag -]]] call call CBA_fnc_serverEvent; - - -// Not yet implemented -["ocap_handleCustomEvent", ["captured", [ - "sector", - name _unit, - str side group _unit, - "#FF0000", - getPosAtl _sectorObject -]]] call call CBA_fnc_serverEvent;
Yes
Fank, Zealot
| fnc_handleMarkers.sqf | |
| Functions | |
| OCAP_recorder_fnc_handleMarkers | Used for tracking all markers in the vanilla Arma 3 system. |
| Variables | |
| OCAP_recorder_trackedMarkers | Persistent global variable on server that defines unique marker names currently being tracked. |
| OCAP_listener_markers | Contains handle for OCAP_handleMarker CBA event handler. |
| CBA Events | |
| OCAP_handleMarker | Handles marker creation, modification, and deletion events. |
| Event Handlers | |
| MarkerCreated | Tracks marker creations. |
| MarkerUpdated | Tracks marker updates (moves). |
| MarkerDeleted | Tracks marker deletions. |
Used for tracking all markers in the vanilla Arma 3 system.
This function creates a server-side CBA listener as well as local Event Handlers on the server and all clients. It facilitates marker creation, modification, and deletion that occurs across any machine or on the server.
Delays are integrated into the system to allow for multi-line scripted marker creations during a mission to reflect correctly in the created marker during playback. These delays are accounted for so that playback reflects the true creation time.
Due to the nature of locality and single-view playback, markers of the same name which exist in different states on different clients may display odd behavior during playback.
Marker exclusions as configured in OCAP_settings_excludeMarkerFromRecord are handled client-side to avoid unnecessary network traffic.
This will also wait until the mission proceeds past the briefing screen, then gather all existing markers and send them to the server for entry onto the Editor/Briefing Markers layer during playback.
Applied during mission event handler application in OCAP_recorder_fnc_addEventMission.
None
Nothing
call FUNC(handleMarkers);
No
IndigoFox, Fank
Contains handle for OCAP_handleMarker CBA event handler.
Tracks marker creations. Present on server and all clients. Ignores remotely-owned markers.
References OCAP_settings_excludeMarkerFromRecord on each local machine to determine if a marker should be recorded.
If so, sends marker data to OCAP_handleMarker on the server for processing.
Tracks marker updates (moves). Present on server and all clients. Ignores remotely-owned markers.
References OCAP_settings_excludeMarkerFromRecord on each local machine to determine if a marker should be recorded.
If so, sends marker data to OCAP_handleMarker on the server for processing.
Tracks marker deletions. Present on server and all clients. Ignores remotely-owned markers.
References OCAP_settings_excludeMarkerFromRecord on each local machine to determine if a marker should be recorded.
If so, sends marker data to OCAP_handleMarker on the server for processing.
| fnc_init.sqf | |
| Functions | |
| OCAP_recorder_fnc_init | Initializes event listeners, event handlers, gathers OCAP_version and OCAP_extension_version, and kicks off waiters for the auto-start conditions if settings are configured to enable it. |
| Variables | |
| OCAP_recorder_recording | Global variable that represents whether or not recording is active [Bool] |
| OCAP_recorder_captureFrameNo | Global variable that represents the current frame number [Number] |
| OCAP_recorder_nextId | Global variable that represents the next available id to assign to a unit or vehicle [Number] |
| OCAP_recorder_frameCaptureDelay | Global variable that represents the delay between frame captures in seconds. |
| OCAP_recorder_autoStart | Global variable that represents whether or not recording should automatically start. |
| OCAP_recorder_minMissionTime | Global variable that represents the minimum mission time in seconds to qualify for saving. |
| OCAP_version | Global variable that represents the version of OCAP addon being used [String] |
| OCAP_extension_version | Global variable that represents the version of OCAP extension being used [String] |
Initializes event listeners, event handlers, gathers OCAP_version and OCAP_extension_version, and kicks off waiters for the auto-start conditions if settings are configured to enable it.
None
Nothing
call OCAP_recorder_fnc_init
No
Dell, Zealot, IndigoFox
| fnc_isKindOfApc.sqf | |
| Functions | |
| OCAP_recorder_fnc_isKindOfApc | Helper function for OCAP_recorder_fnc_getClass to prevent APCs from being classified as Cars or Trucks. |
Helper function for OCAP_recorder_fnc_getClass to prevent APCs from being classified as Cars or Trucks.
| _this | The vehicle to check [Object] |
| [Bool] | True if the vehicle is an APC, false otherwise |
if (_this call FUNC(isKindOfApc)) exitWith {"apc"};No
Dell, Zealot
| fnc_projectileMonitors.sqf | |
| Functions | |
| OCAP_recorder_fnc_projectileMonitors | This initializes projectile monitoring for the purposes of moving non-bullet projectile markers across the map during playback as well as to display them on the in-game map while OCAP_isDebug is true. |
| Variables | |
| OCAP_recorder_liveDebugBullets | Used by clients to draw bullet lines. |
| OCAP_recorder_liveDebugMagIcons | Used by clients to draw magazine icons of non-bullet projectiles. |
This initializes projectile monitoring for the purposes of moving non-bullet projectile markers across the map during playback as well as to display them on the in-game map while OCAP_isDebug is true.
On clients, it will create a “Draw” UI event handler to display both fire-lines representing bullets and markers representing non-bullet projectiles. It will also create an event handler used by the server in OCAP_recorder_fnc_eh_firedMan to integrate new projectiles to the array being procesed by the “Draw” handler.
On the server, it will initialize <OCAP_recorder_liveMissiles> and <OCAP_recorder_liveGrenades>. These are watch arrays that are used to track the position of non-bullet projectiles and update the extension with their positions as they travel. This causes the effect of a ‘moving marker’ during playback.
None
Nothing
call FUNC(projectileMonitors);
No
IndigoFox
Used by clients to draw bullet lines. Entered via OCAP_recorder_fnc_eh_firedMan and managed in ??
Used by clients to draw magazine icons of non-bullet projectiles. Entered via OCAP_recorder_fnc_eh_firedMan and managed in ??
| fnc_startRecording.sqf | |
| Functions | |
| OCAP_recorder_fnc_startRecording | Begins recording the current mission. |
Begins recording the current mission.
Called via OCAP_record via direct CBA event or the administrative diary entry, or by a waiter in OCAP_recorder_fnc_init (see OCAP_settings_autoStart).
Will not start recording if OCAP_recorder_recording is true and will notify players.
None
Nothing
call FUNC(startRecording);
No
Dell, Zealot, IndigoFox
| fnc_stopRecording.sqf | |
| Functions | |
| OCAP_recorder_fnc_stopRecording | Stops recording the current mission. |
Stops recording the current mission. Can be used to pause the recording for later resumption. Also called automatically as part of OCAP_recorder_fnc_exportData.
Called via OCAP_pause via direct CBA event or the administrative diary entry.
None
Nothing
call FUNC(stopRecording);
No
Dell, Zealot, IndigoFox
| fnc_updateTime.sqf | |
| Functions | |
| OCAP_recorder_fnc_updateTime | Sends server’s system time, mission environment date/time, time multiplier setting, and time since mission start (post-briefing) to the extension. |
Sends server’s system time, mission environment date/time, time multiplier setting, and time since mission start (post-briefing) to the extension. Will run on a recurring basis as part of <FUNC(captureLoop)> if the setting in userconfig.hpp is configured to do so. This is required in missions that utilize time acceleration or have time skips as part of mission flow.
| _date | A manual in-game time to check. [optional, Array] |
Nothing
[] call FUNC(updateTime);
No
Fank
#define COMPONENT recorder
#define COMPONENT_BEAUTIFIED Recorder
| A | |
| ace_advanced_throwing_throwFiredXEH | |
| ace_explosives_place | |
| OCAP_recorder_ | addDebugBullet |
| OCAP_recorder_ | addDebugMagIcon |
| C | |
| OCAP_ | counterEvent |
| OCAP_ | counterInit |
| OCAP_ | customEvent |
| E | |
| OCAP_ | exportData |
| H | |
| OCAP_ | handleMarker |
| P | |
| OCAP_ | pause |
| Projectiles | |
| R | |
| OCAP_ | record |
Fired when a throwable is primed.
EGVAR( listener, aceThrowing ) = ["ace_advanced_throwing_throwFiredXEH", { _this call FUNC(eh_firedMan) }] call CBA_fnc_addEventHandler
Event listener for ACE3 global event indicating a mine has been placed and armed.
EGVAR( listener, aceExplosives ) = ["ace_explosives_place", { call FUNC(aceExplosives); }] call CBA_fnc_addEventHandler
| A | |
| OCAP_ | administratorList |
| OCAP_settings_ | autoStart |
| E | |
| OCAP_ | enabled |
| OCAP_settings_ | excludeClassFromRecord |
| OCAP_settings_ | excludeKindFromRecord |
| OCAP_settings_ | excludeMarkerFromRecord |
| F | |
| OCAP_settings_ | frameCaptureDelay |
| I | |
| OCAP_ | isDebug |
| M | |
| OCAP_settings_ | minMissionTime |
| OCAP_settings_ | minPlayerCount |
| P | |
| OCAP_settings_ | preferACEUnconscious |
| S | |
| OCAP_settings_ | saveMissionEnded |
| OCAP_settings_ | saveOnEmpty |
| OCAP_settings_ | saveTag |
| T | |
| OCAP_settings_ | trackTickets |
| OCAP_settings_ | trackTimeInterval |
| OCAP_settings_ | trackTimes |
| D | |
| Deleted | |
| E | |
| OCAP_EH_ | Ended |
| OCAP_EH_ | EntityKilled |
| OCAP_EH_ | EntityRespawned |
| Explode | |
| H | |
| OCAP_EH_ | HandleDisconnect |
| HitExplosion | |
| HitPart | |
| M | |
| MarkerCreated | |
| MarkerDeleted | |
| MarkerUpdated | |
| OCAP_EH_ | MPEnded |
| O | |
| OCAP_EH_ | OnUserAdminStateChanged |
| P | |
| OCAP_EH_ | PlayerConnected |
| Projectiles(Bullets) | |
| Projectiles(Non-Bullets) |
| A | |
| OCAP_recorder_fnc_ | aceExplosives |
| OCAP_recorder_fnc_ | addEventMission |
| OCAP_recorder_fnc_ | addUnitEventHandlers |
| OCAP_recorder_fnc_ | adminUIControl |
| C | |
| OCAP_recorder_fnc_ | captureLoop |
| E | |
| OCAP_recorder_fnc_ | eh_connected |
| OCAP_recorder_fnc_ | eh_disconnected |
| OCAP_recorder_fnc_ | eh_firedMan |
| OCAP_recorder_fnc_ | eh_killed |
| OCAP_recorder_fnc_ | eh_onUserAdminStateChanged |
| OCAP_recorder_fnc_ | eh_projectileHit |
| OCAP_recorder_fnc_ | entityMonitors |
| OCAP_recorder_fnc_ | exportData |
| G | |
| OCAP_recorder_fnc_ | getAmmoMarkerData |
| OCAP_recorder_fnc_ | getClass |
| OCAP_recorder_fnc_ | getEventWeaponText |
| OCAP_recorder_fnc_ | getInstigator |
| OCAP_recorder_fnc_ | getUnitType |
| OCAP_recorder_fnc_ | getWeaponDisplayData |
| H | |
| OCAP_recorder_fnc_ | handleCustomEvent |
| OCAP_recorder_fnc_ | handleMarkers |
| I | |
| OCAP_recorder_fnc_ | init |
| OCAP_recorder_fnc_ | isKindOfApc |
| P | |
| OCAP_recorder_fnc_ | projectileMonitors |
| S | |
| OCAP_extension_fnc_ | sendData |
| OCAP_recorder_fnc_ | startRecording |
| OCAP_recorder_fnc_ | stopRecording |
| U | |
| OCAP_recorder_fnc_ | updateTime |
Fired when a throwable is primed.
EGVAR( listener, aceThrowing ) = ["ace_advanced_throwing_throwFiredXEH", { _this call FUNC(eh_firedMan) }] call CBA_fnc_addEventHandler
Event listener for ACE3 global event indicating a mine has been placed and armed.
EGVAR( listener, aceExplosives ) = ["ace_explosives_place", { call FUNC(aceExplosives); }] call CBA_fnc_addEventHandler
Resolves arguments to array, used for entries to LOG that requires array input.
#define ARR2( _arg1, _arg2 ) [_arg1, _arg2]
Forces a true/false return of input.
#define BOOL( _cond ) ([0,1] select (_cond))
#define COMPONENT extension
#define COMPONENT_BEAUTIFIED Extension
#define COMPONENT_NAME QUOTE( PREFIX - COMPONENT_BEAUTIFIED )
Used for logging messages to the extension (ocap-ext log file).
#define OCAPEXTLOG( _args ) [":LOG:", _args] call EFUNC(extension,sendData)
| P | |
| OCAP_ | pause |
| OCAP_ | PFHObject |
| OCAP_EH_ | PlayerConnected |
| OCAP_settings_ | preferACEUnconscious |
| PREFIX | |
| OCAP_recorder_fnc_ | projectileMonitors |
| Projectiles | |
| Projectiles(Bullets) | |
| Projectiles(Non-Bullets) | |
| R | |
| OCAP_ | record |
| OCAP_recorder_ | recording |
| S | |
| Save/ | |
| OCAP_settings_ | saveMissionEnded |
| OCAP_settings_ | saveOnEmpty |
| OCAP_settings_ | saveTag |
| script_component.hpp | |
| script_macros.hpp | |
| OCAP_extension_fnc_ | sendData |
| SHOULDSAVEEVENTS | |
| OCAP_recorder_fnc_ | startRecording |
| OCAP_recorder_fnc_ | stopRecording |
| SYSCHAT | |
| T | |
| OCAP_recorder_ | trackedMarkers |
| OCAP_settings_ | trackTickets |
| OCAP_settings_ | trackTimeInterval |
| OCAP_settings_ | trackTimes |
| U | |
| OCAP_recorder_fnc_ | updateTime |
| V | |
| Variables | |
| OCAP_ | version |
| OCAP_extension_ | version |
| VERSION | |
| VERSION_AR | |
| VERSION_REQUIRED | |
| VERSION_STR |
#define PREFIX OCAP
Used to determine if events should currently be saved based on OCAP_recorder_recording and OCAP_recorder_startTime.
#define SHOULDSAVEEVENTS ( (missionNamespace getVariable [QGVAR(recording), false]) && missionNamespace getVariable [QGVAR(startTime), -1] > -1 )
Used for debug purposes to send a string to all clients with interfaces.
#define SYSCHAT remoteExec ["systemChat", [0, -2] select isDedicated]
#define VERSION 2.0
#define VERSION_AR 2,0,0
#define VERSION_REQUIRED 2.10
#define VERSION_STR 2.0.0
| A | |
| ADDON | |
| ARR2 | |
| B | |
| BOOL | |
| C | |
| COMPONENT | |
| COMPONENT_BEAUTIFIED | |
| COMPONENT_NAME | |
| L | |
| LOG | |
| P | |
| PREFIX | |
| S | |
| SHOULDSAVEEVENTS | |
| SYSCHAT | |
| V | |
| VERSION | |
| VERSION_AR | |
| VERSION_REQUIRED | |
| VERSION_STR |
Resolves arguments to array, used for entries to LOG that requires array input.
#define ARR2( _arg1, _arg2 ) [_arg1, _arg2]
Forces a true/false return of input.
#define BOOL( _cond ) ([0,1] select (_cond))
#define COMPONENT extension
#define COMPONENT_BEAUTIFIED Extension
#define COMPONENT_NAME QUOTE( PREFIX - COMPONENT_BEAUTIFIED )
Used for logging messages to the extension (ocap-ext log file).
#define OCAPEXTLOG( _args ) [":LOG:", _args] call EFUNC(extension,sendData)
#define PREFIX OCAP
Used to determine if events should currently be saved based on OCAP_recorder_recording and OCAP_recorder_startTime.
#define SHOULDSAVEEVENTS ( (missionNamespace getVariable [QGVAR(recording), false]) && missionNamespace getVariable [QGVAR(startTime), -1] > -1 )
Used for debug purposes to send a string to all clients with interfaces.
#define SYSCHAT remoteExec ["systemChat", [0, -2] select isDedicated]
#define VERSION 2.0
#define VERSION_AR 2,0,0
#define VERSION_REQUIRED 2.10
#define VERSION_STR 2.0.0
| A | |
| OCAP_recorder_ | autoStart |
| C | |
| OCAP_recorder_ | captureFrameNo |
| CBA Listener Handles | |
| OCAP_ | counter_sides |
| E | |
| OCAP_ | entityMonitorsInitialized |
| F | |
| OCAP_recorder_ | frameCaptureDelay |
| H | |
| OCAP_ | hasAdminControls |
| L | |
| OCAP_ | lastFired |
| OCAP_ | listener_aceExplosives |
| OCAP_ | listener_aceThrowing |
| OCAP_ | listener_counterEvent |
| OCAP_ | listener_counterInit |
| OCAP_ | listener_customEvent |
| OCAP_ | listener_exportData |
| OCAP_ | listener_markers |
| OCAP_ | listener_pause |
| OCAP_ | listener_record |
| OCAP_recorder_ | liveDebugBullets |
| OCAP_recorder_ | liveDebugMagIcons |
| M | |
| OCAP_recorder_ | minMissionTime |
| N | |
| OCAP_recorder_ | nextId |
| P | |
| OCAP_ | PFHObject |
| R | |
| OCAP_recorder_ | recording |
| T | |
| OCAP_recorder_ | trackedMarkers |
| V | |
| OCAP_ | version |
| OCAP_extension_ | version |
- * - * For a fairly comprehensive set of languages see the - * README - * file that came with this source. At a minimum, the lexer should work on a - * number of languages including C and friends, Java, Python, Bash, SQL, HTML, - * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk - * and a subset of Perl, but, because of commenting conventions, doesn't work on - * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class. - *
- * Usage:
} and {@code } tags in your source with
- * {@code class=prettyprint.}
- * You can also use the (html deprecated) {@code } tag, but the pretty
- * printer needs to do more substantial DOM manipulations to support that, so
- * some css styles may not be preserved.
- * } or {@code } element to specify the
- * language, as in {@code }. Any class that
- * starts with "lang-" followed by a file extension, specifies the file type.
- * See the "lang-*.js" files in this directory for code that implements
- * per-language file handlers.
- *
- * Change log:
- * cbeust, 2006/08/22
- *
- * Java annotations (start with "@") are now captured as literals ("lit")
- *
- * @requires console
- * @overrides window
- */
-
-// JSLint declarations
-/*global console, document, navigator, setTimeout, window */
-
-/**
- * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
- * UI events.
- * If set to {@code false}, {@code prettyPrint()} is synchronous.
- */
-window['PR_SHOULD_USE_CONTINUATION'] = true;
-
-/** the number of characters between tab columns */
-window['PR_TAB_WIDTH'] = 8;
-
-/** Walks the DOM returning a properly escaped version of innerHTML.
- * @param {Node} node
- * @param {Array.} out output buffer that receives chunks of HTML.
- */
-window['PR_normalizedHtml']
-
-/** Contains functions for creating and registering new language handlers.
- * @type {Object}
- */
- = window['PR']
-
-/** Pretty print a chunk of code.
- *
- * @param {string} sourceCodeHtml code as html
- * @return {string} code as html, but prettier
- */
- = window['prettyPrintOne']
-/** Find all the {@code } and {@code } tags in the DOM with
- * {@code class=prettyprint} and prettify them.
- * @param {Function?} opt_whenDone if specified, called when the last entry
- * has been finished.
- */
- = window['prettyPrint'] = void 0;
-
-/** browser detection. @extern @returns false if not IE, otherwise the major version. */
-window['_pr_isIE6'] = function () {
- var ieVersion = navigator && navigator.userAgent &&
- navigator.userAgent.match(/\bMSIE ([678])\./);
- ieVersion = ieVersion ? +ieVersion[1] : false;
- window['_pr_isIE6'] = function () { return ieVersion; };
- return ieVersion;
-};
-
-
-(function () {
- // Keyword lists for various languages.
- var FLOW_CONTROL_KEYWORDS =
- "break continue do else for if return while ";
- var C_KEYWORDS = FLOW_CONTROL_KEYWORDS + "auto case char const default " +
- "double enum extern float goto int long register short signed sizeof " +
- "static struct switch typedef union unsigned void volatile ";
- var COMMON_KEYWORDS = C_KEYWORDS + "catch class delete false import " +
- "new operator private protected public this throw true try typeof ";
- var CPP_KEYWORDS = COMMON_KEYWORDS + "alignof align_union asm axiom bool " +
- "concept concept_map const_cast constexpr decltype " +
- "dynamic_cast explicit export friend inline late_check " +
- "mutable namespace nullptr reinterpret_cast static_assert static_cast " +
- "template typeid typename using virtual wchar_t where ";
- var JAVA_KEYWORDS = COMMON_KEYWORDS +
- "abstract boolean byte extends final finally implements import " +
- "instanceof null native package strictfp super synchronized throws " +
- "transient ";
- var CSHARP_KEYWORDS = JAVA_KEYWORDS +
- "as base by checked decimal delegate descending event " +
- "fixed foreach from group implicit in interface internal into is lock " +
- "object out override orderby params partial readonly ref sbyte sealed " +
- "stackalloc string select uint ulong unchecked unsafe ushort var ";
- var JSCRIPT_KEYWORDS = COMMON_KEYWORDS +
- "debugger eval export function get null set undefined var with " +
- "Infinity NaN ";
- var PERL_KEYWORDS = "caller delete die do dump elsif eval exit foreach for " +
- "goto if import last local my next no our print package redo require " +
- "sub undef unless until use wantarray while BEGIN END ";
- var PYTHON_KEYWORDS = FLOW_CONTROL_KEYWORDS + "and as assert class def del " +
- "elif except exec finally from global import in is lambda " +
- "nonlocal not or pass print raise try with yield " +
- "False True None ";
- var RUBY_KEYWORDS = FLOW_CONTROL_KEYWORDS + "alias and begin case class def" +
- " defined elsif end ensure false in module next nil not or redo rescue " +
- "retry self super then true undef unless until when yield BEGIN END ";
- var SH_KEYWORDS = FLOW_CONTROL_KEYWORDS + "case done elif esac eval fi " +
- "function in local set then until ";
- var ALL_KEYWORDS = (
- CPP_KEYWORDS + CSHARP_KEYWORDS + JSCRIPT_KEYWORDS + PERL_KEYWORDS +
- PYTHON_KEYWORDS + RUBY_KEYWORDS + SH_KEYWORDS);
-
- // token style names. correspond to css classes
- /** token style for a string literal */
- var PR_STRING = 'str';
- /** token style for a keyword */
- var PR_KEYWORD = 'kwd';
- /** token style for a comment */
- var PR_COMMENT = 'com';
- /** token style for a type */
- var PR_TYPE = 'typ';
- /** token style for a literal value. e.g. 1, null, true. */
- var PR_LITERAL = 'lit';
- /** token style for a punctuation string. */
- var PR_PUNCTUATION = 'pun';
- /** token style for a punctuation string. */
- var PR_PLAIN = 'pln';
-
- /** token style for an sgml tag. */
- var PR_TAG = 'tag';
- /** token style for a markup declaration such as a DOCTYPE. */
- var PR_DECLARATION = 'dec';
- /** token style for embedded source. */
- var PR_SOURCE = 'src';
- /** token style for an sgml attribute name. */
- var PR_ATTRIB_NAME = 'atn';
- /** token style for an sgml attribute value. */
- var PR_ATTRIB_VALUE = 'atv';
-
- /**
- * A class that indicates a section of markup that is not code, e.g. to allow
- * embedding of line numbers within code listings.
- */
- var PR_NOCODE = 'nocode';
-
- /** A set of tokens that can precede a regular expression literal in
- * javascript.
- * http://www.mozilla.org/js/language/js20/rationale/syntax.html has the full
- * list, but I've removed ones that might be problematic when seen in
- * languages that don't support regular expression literals.
- *
- * Specifically, I've removed any keywords that can't precede a regexp
- * literal in a syntactically legal javascript program, and I've removed the
- * "in" keyword since it's not a keyword in many languages, and might be used
- * as a count of inches.
- *
- *
The link a above does not accurately describe EcmaScript rules since
- * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
- * very well in practice.
- *
- * @private
- */
- var REGEXP_PRECEDER_PATTERN = function () {
- var preceders = [
- "!", "!=", "!==", "#", "%", "%=", "&", "&&", "&&=",
- "&=", "(", "*", "*=", /* "+", */ "+=", ",", /* "-", */ "-=",
- "->", /*".", "..", "...", handled below */ "/", "/=", ":", "::", ";",
- "<", "<<", "<<=", "<=", "=", "==", "===", ">",
- ">=", ">>", ">>=", ">>>", ">>>=", "?", "@", "[",
- "^", "^=", "^^", "^^=", "{", "|", "|=", "||",
- "||=", "~" /* handles =~ and !~ */,
- "break", "case", "continue", "delete",
- "do", "else", "finally", "instanceof",
- "return", "throw", "try", "typeof"
- ];
- var pattern = '(?:^^|[+-]';
- for (var i = 0; i < preceders.length; ++i) {
- pattern += '|' + preceders[i].replace(/([^=<>:&a-z])/g, '\\$1');
- }
- pattern += ')\\s*'; // matches at end, and matches empty string
- return pattern;
- // CAVEAT: this does not properly handle the case where a regular
- // expression immediately follows another since a regular expression may
- // have flags for case-sensitivity and the like. Having regexp tokens
- // adjacent is not valid in any language I'm aware of, so I'm punting.
- // TODO: maybe style special characters inside a regexp as punctuation.
- }();
-
- // Define regexps here so that the interpreter doesn't have to create an
- // object each time the function containing them is called.
- // The language spec requires a new object created even if you don't access
- // the $1 members.
- var pr_amp = /&/g;
- var pr_lt = //g;
- var pr_quot = /\"/g;
- /** like textToHtml but escapes double quotes to be attribute safe. */
- function attribToHtml(str) {
- return str.replace(pr_amp, '&')
- .replace(pr_lt, '<')
- .replace(pr_gt, '>')
- .replace(pr_quot, '"');
- }
-
- /** escapest html special characters to html. */
- function textToHtml(str) {
- return str.replace(pr_amp, '&')
- .replace(pr_lt, '<')
- .replace(pr_gt, '>');
- }
-
-
- var pr_ltEnt = /</g;
- var pr_gtEnt = />/g;
- var pr_aposEnt = /'/g;
- var pr_quotEnt = /"/g;
- var pr_ampEnt = /&/g;
- var pr_nbspEnt = / /g;
- /** unescapes html to plain text. */
- function htmlToText(html) {
- var pos = html.indexOf('&');
- if (pos < 0) { return html; }
- // Handle numeric entities specially. We can't use functional substitution
- // since that doesn't work in older versions of Safari.
- // These should be rare since most browsers convert them to normal chars.
- for (--pos; (pos = html.indexOf('', pos + 1)) >= 0;) {
- var end = html.indexOf(';', pos);
- if (end >= 0) {
- var num = html.substring(pos + 3, end);
- var radix = 10;
- if (num && num.charAt(0) === 'x') {
- num = num.substring(1);
- radix = 16;
- }
- var codePoint = parseInt(num, radix);
- if (!isNaN(codePoint)) {
- html = (html.substring(0, pos) + String.fromCharCode(codePoint) +
- html.substring(end + 1));
- }
- }
- }
-
- return html.replace(pr_ltEnt, '<')
- .replace(pr_gtEnt, '>')
- .replace(pr_aposEnt, "'")
- .replace(pr_quotEnt, '"')
- .replace(pr_nbspEnt, ' ')
- .replace(pr_ampEnt, '&');
- }
-
- /** is the given node's innerHTML normally unescaped? */
- function isRawContent(node) {
- return 'XMP' === node.tagName;
- }
-
- var newlineRe = /[\r\n]/g;
- /**
- * Are newlines and adjacent spaces significant in the given node's innerHTML?
- */
- function isPreformatted(node, content) {
- // PRE means preformatted, and is a very common case, so don't create
- // unnecessary computed style objects.
- if ('PRE' === node.tagName) { return true; }
- if (!newlineRe.test(content)) { return true; } // Don't care
- var whitespace = '';
- // For disconnected nodes, IE has no currentStyle.
- if (node.currentStyle) {
- whitespace = node.currentStyle.whiteSpace;
- } else if (window.getComputedStyle) {
- // Firefox makes a best guess if node is disconnected whereas Safari
- // returns the empty string.
- whitespace = window.getComputedStyle(node, null).whiteSpace;
- }
- return !whitespace || whitespace === 'pre';
- }
-
- function normalizedHtml(node, out) {
- switch (node.nodeType) {
- case 1: // an element
- var name = node.tagName.toLowerCase();
- out.push('<', name);
- for (var i = 0; i < node.attributes.length; ++i) {
- var attr = node.attributes[i];
- if (!attr.specified) { continue; }
- out.push(' ');
- normalizedHtml(attr, out);
- }
- out.push('>');
- for (var child = node.firstChild; child; child = child.nextSibling) {
- normalizedHtml(child, out);
- }
- if (node.firstChild || !/^(?:br|link|img)$/.test(name)) {
- out.push('<\/', name, '>');
- }
- break;
- case 2: // an attribute
- out.push(node.name.toLowerCase(), '="', attribToHtml(node.value), '"');
- break;
- case 3: case 4: // text
- out.push(textToHtml(node.nodeValue));
- break;
- }
- }
-
- /**
- * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
- * matches the union o the sets o strings matched d by the input RegExp.
- * Since it matches globally, if the input strings have a start-of-input
- * anchor (/^.../), it is ignored for the purposes of unioning.
- * @param {Array.} regexs non multiline, non-global regexs.
- * @return {RegExp} a global regex.
- */
- function combinePrefixPatterns(regexs) {
- var capturedGroupIndex = 0;
-
- var needToFoldCase = false;
- var ignoreCase = false;
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.ignoreCase) {
- ignoreCase = true;
- } else if (/[a-z]/i.test(regex.source.replace(
- /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
- needToFoldCase = true;
- ignoreCase = false;
- break;
- }
- }
-
- function decodeEscape(charsetPart) {
- if (charsetPart.charAt(0) !== '\\') { return charsetPart.charCodeAt(0); }
- switch (charsetPart.charAt(1)) {
- case 'b': return 8;
- case 't': return 9;
- case 'n': return 0xa;
- case 'v': return 0xb;
- case 'f': return 0xc;
- case 'r': return 0xd;
- case 'u': case 'x':
- return parseInt(charsetPart.substring(2), 16)
- || charsetPart.charCodeAt(1);
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7':
- return parseInt(charsetPart.substring(1), 8);
- default: return charsetPart.charCodeAt(1);
- }
- }
-
- function encodeEscape(charCode) {
- if (charCode < 0x20) {
- return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
- }
- var ch = String.fromCharCode(charCode);
- if (ch === '\\' || ch === '-' || ch === '[' || ch === ']') {
- ch = '\\' + ch;
- }
- return ch;
- }
-
- function caseFoldCharset(charSet) {
- var charsetParts = charSet.substring(1, charSet.length - 1).match(
- new RegExp(
- '\\\\u[0-9A-Fa-f]{4}'
- + '|\\\\x[0-9A-Fa-f]{2}'
- + '|\\\\[0-3][0-7]{0,2}'
- + '|\\\\[0-7]{1,2}'
- + '|\\\\[\\s\\S]'
- + '|-'
- + '|[^-\\\\]',
- 'g'));
- var groups = [];
- var ranges = [];
- var inverse = charsetParts[0] === '^';
- for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
- var p = charsetParts[i];
- switch (p) {
- case '\\B': case '\\b':
- case '\\D': case '\\d':
- case '\\S': case '\\s':
- case '\\W': case '\\w':
- groups.push(p);
- continue;
- }
- var start = decodeEscape(p);
- var end;
- if (i + 2 < n && '-' === charsetParts[i + 1]) {
- end = decodeEscape(charsetParts[i + 2]);
- i += 2;
- } else {
- end = start;
- }
- ranges.push([start, end]);
- // If the range might intersect letters, then expand it.
- if (!(end < 65 || start > 122)) {
- if (!(end < 65 || start > 90)) {
- ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
- }
- if (!(end < 97 || start > 122)) {
- ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
- }
- }
- }
-
- // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
- // -> [[1, 12], [14, 14], [16, 17]]
- ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
- var consolidatedRanges = [];
- var lastRange = [NaN, NaN];
- for (var i = 0; i < ranges.length; ++i) {
- var range = ranges[i];
- if (range[0] <= lastRange[1] + 1) {
- lastRange[1] = Math.max(lastRange[1], range[1]);
- } else {
- consolidatedRanges.push(lastRange = range);
- }
- }
-
- var out = ['['];
- if (inverse) { out.push('^'); }
- out.push.apply(out, groups);
- for (var i = 0; i < consolidatedRanges.length; ++i) {
- var range = consolidatedRanges[i];
- out.push(encodeEscape(range[0]));
- if (range[1] > range[0]) {
- if (range[1] + 1 > range[0]) { out.push('-'); }
- out.push(encodeEscape(range[1]));
- }
- }
- out.push(']');
- return out.join('');
- }
-
- function allowAnywhereFoldCaseAndRenumberGroups(regex) {
- // Split into character sets, escape sequences, punctuation strings
- // like ('(', '(?:', ')', '^'), and runs of characters that do not
- // include any of the above.
- var parts = regex.source.match(
- new RegExp(
- '(?:'
- + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
- + '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
- + '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
- + '|\\\\[0-9]+' // a back-reference or octal escape
- + '|\\\\[^ux0-9]' // other escape sequence
- + '|\\(\\?[:!=]' // start of a non-capturing group
- + '|[\\(\\)\\^]' // start/emd of a group, or line start
- + '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
- + ')',
- 'g'));
- var n = parts.length;
-
- // Maps captured group numbers to the number they will occupy in
- // the output or to -1 if that has not been determined, or to
- // undefined if they need not be capturing in the output.
- var capturedGroups = [];
-
- // Walk over and identify back references to build the capturedGroups
- // mapping.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- // groups are 1-indexed, so max group index is count of '('
- ++groupIndex;
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- capturedGroups[decimalValue] = -1;
- }
- }
- }
-
- // Renumber groups and reduce capturing groups to non-capturing groups
- // where possible.
- for (var i = 1; i < capturedGroups.length; ++i) {
- if (-1 === capturedGroups[i]) {
- capturedGroups[i] = ++capturedGroupIndex;
- }
- }
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- var p = parts[i];
- if (p === '(') {
- ++groupIndex;
- if (capturedGroups[groupIndex] === undefined) {
- parts[i] = '(?:';
- }
- } else if ('\\' === p.charAt(0)) {
- var decimalValue = +p.substring(1);
- if (decimalValue && decimalValue <= groupIndex) {
- parts[i] = '\\' + capturedGroups[groupIndex];
- }
- }
- }
-
- // Remove any prefix anchors so that the output will match anywhere.
- // ^^ really does mean an anchored match though.
- for (var i = 0, groupIndex = 0; i < n; ++i) {
- if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
- }
-
- // Expand letters to groupts to handle mixing of case-sensitive and
- // case-insensitive patterns if necessary.
- if (regex.ignoreCase && needToFoldCase) {
- for (var i = 0; i < n; ++i) {
- var p = parts[i];
- var ch0 = p.charAt(0);
- if (p.length >= 2 && ch0 === '[') {
- parts[i] = caseFoldCharset(p);
- } else if (ch0 !== '\\') {
- // TODO: handle letters in numeric escapes.
- parts[i] = p.replace(
- /[a-zA-Z]/g,
- function (ch) {
- var cc = ch.charCodeAt(0);
- return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
- });
- }
- }
- }
-
- return parts.join('');
- }
-
- var rewritten = [];
- for (var i = 0, n = regexs.length; i < n; ++i) {
- var regex = regexs[i];
- if (regex.global || regex.multiline) { throw new Error('' + regex); }
- rewritten.push(
- '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
- }
-
- return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
- }
-
- var PR_innerHtmlWorks = null;
- function getInnerHtml(node) {
- // inner html is hopelessly broken in Safari 2.0.4 when the content is
- // an html description of well formed XML and the containing tag is a PRE
- // tag, so we detect that case and emulate innerHTML.
- if (null === PR_innerHtmlWorks) {
- var testNode = document.createElement('PRE');
- testNode.appendChild(
- document.createTextNode('\n '));
- PR_innerHtmlWorks = !/)[\r\n]+/g, '$1')
- .replace(/(?:[\r\n]+[ \t]*)+/g, ' ');
- }
- return content;
- }
-
- var out = [];
- for (var child = node.firstChild; child; child = child.nextSibling) {
- normalizedHtml(child, out);
- }
- return out.join('');
- }
-
- /** returns a function that expand tabs to spaces. This function can be fed
- * successive chunks of text, and will maintain its own internal state to
- * keep track of how tabs are expanded.
- * @return {function (string) : string} a function that takes
- * plain text and return the text with tabs expanded.
- * @private
- */
- function makeTabExpander(tabWidth) {
- var SPACES = ' ';
- var charInLine = 0;
-
- return function (plainText) {
- // walk over each character looking for tabs and newlines.
- // On tabs, expand them. On newlines, reset charInLine.
- // Otherwise increment charInLine
- var out = null;
- var pos = 0;
- for (var i = 0, n = plainText.length; i < n; ++i) {
- var ch = plainText.charAt(i);
-
- switch (ch) {
- case '\t':
- if (!out) { out = []; }
- out.push(plainText.substring(pos, i));
- // calculate how much space we need in front of this part
- // nSpaces is the amount of padding -- the number of spaces needed
- // to move us to the next column, where columns occur at factors of
- // tabWidth.
- var nSpaces = tabWidth - (charInLine % tabWidth);
- charInLine += nSpaces;
- for (; nSpaces >= 0; nSpaces -= SPACES.length) {
- out.push(SPACES.substring(0, nSpaces));
- }
- pos = i + 1;
- break;
- case '\n':
- charInLine = 0;
- break;
- default:
- ++charInLine;
- }
- }
- if (!out) { return plainText; }
- out.push(plainText.substring(pos));
- return out.join('');
- };
- }
-
- var pr_chunkPattern = new RegExp(
- '[^<]+' // A run of characters other than '<'
- + '|<\!--[\\s\\S]*?--\>' // an HTML comment
- + '|' // a CDATA section
- // a probable tag that should not be highlighted
- + '|<\/?[a-zA-Z](?:[^>\"\']|\'[^\']*\'|\"[^\"]*\")*>'
- + '|<', // A '<' that does not begin a larger chunk
- 'g');
- var pr_commentPrefix = /^<\!--/;
- var pr_cdataPrefix = /^) into their textual equivalent.
- *
- * @param {string} s html where whitespace is considered significant.
- * @return {Object} source code and extracted tags.
- * @private
- */
- function extractTags(s) {
- // since the pattern has the 'g' modifier and defines no capturing groups,
- // this will return a list of all chunks which we then classify and wrap as
- // PR_Tokens
- var matches = s.match(pr_chunkPattern);
- var sourceBuf = [];
- var sourceBufLen = 0;
- var extractedTags = [];
- if (matches) {
- for (var i = 0, n = matches.length; i < n; ++i) {
- var match = matches[i];
- if (match.length > 1 && match.charAt(0) === '<') {
- if (pr_commentPrefix.test(match)) { continue; }
- if (pr_cdataPrefix.test(match)) {
- // strip CDATA prefix and suffix. Don't unescape since it's CDATA
- sourceBuf.push(match.substring(9, match.length - 3));
- sourceBufLen += match.length - 12;
- } else if (pr_brPrefix.test(match)) {
- //
tags are lexically significant so convert them to text.
- // This is undone later.
- sourceBuf.push('\n');
- ++sourceBufLen;
- } else {
- if (match.indexOf(PR_NOCODE) >= 0 && isNoCodeTag(match)) {
- // A will start a section that should be
- // ignored. Continue walking the list until we see a matching end
- // tag.
- var name = match.match(pr_tagNameRe)[2];
- var depth = 1;
- var j;
- end_tag_loop:
- for (j = i + 1; j < n; ++j) {
- var name2 = matches[j].match(pr_tagNameRe);
- if (name2 && name2[2] === name) {
- if (name2[1] === '/') {
- if (--depth === 0) { break end_tag_loop; }
- } else {
- ++depth;
- }
- }
- }
- if (j < n) {
- extractedTags.push(
- sourceBufLen, matches.slice(i, j + 1).join(''));
- i = j;
- } else { // Ignore unclosed sections.
- extractedTags.push(sourceBufLen, match);
- }
- } else {
- extractedTags.push(sourceBufLen, match);
- }
- }
- } else {
- var literalText = htmlToText(match);
- sourceBuf.push(literalText);
- sourceBufLen += literalText.length;
- }
- }
- }
- return { source: sourceBuf.join(''), tags: extractedTags };
- }
-
- /** True if the given tag contains a class attribute with the nocode class. */
- function isNoCodeTag(tag) {
- return !!tag
- // First canonicalize the representation of attributes
- .replace(/\s(\w+)\s*=\s*(?:\"([^\"]*)\"|'([^\']*)'|(\S+))/g,
- ' $1="$2$3$4"')
- // Then look for the attribute we want.
- .match(/[cC][lL][aA][sS][sS]=\"[^\"]*\bnocode\b/);
- }
-
- /**
- * Apply the given language handler to sourceCode and add the resulting
- * decorations to out.
- * @param {number} basePos the index of sourceCode within the chunk of source
- * whose decorations are already present on out.
- */
- function appendDecorations(basePos, sourceCode, langHandler, out) {
- if (!sourceCode) { return; }
- var job = {
- source: sourceCode,
- basePos: basePos
- };
- langHandler(job);
- out.push.apply(out, job.decorations);
- }
-
- /** Given triples of [style, pattern, context] returns a lexing function,
- * The lexing function interprets the patterns to find token boundaries and
- * returns a decoration list of the form
- * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
- * where index_n is an index into the sourceCode, and style_n is a style
- * constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
- * all characters in sourceCode[index_n-1:index_n].
- *
- * The stylePatterns is a list whose elements have the form
- * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
- *
- * Style is a style constant like PR_PLAIN, or can be a string of the
- * form 'lang-FOO', where FOO is a language extension describing the
- * language of the portion of the token in $1 after pattern executes.
- * E.g., if style is 'lang-lisp', and group 1 contains the text
- * '(hello (world))', then that portion of the token will be passed to the
- * registered lisp handler for formatting.
- * The text before and after group 1 will be restyled using this decorator
- * so decorators should take care that this doesn't result in infinite
- * recursion. For example, the HTML lexer rule for SCRIPT elements looks
- * something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
- * '
-
-
-
-
-
-
-
-
-
-