Skip to content

Commit 2446ef8

Browse files
committed
undo changes due to whitespace
1 parent f930f72 commit 2446ef8

File tree

598 files changed

+16997
-16402
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

598 files changed

+16997
-16402
lines changed

scripting-docs/winscript/active-script-debugging-overview.md

Lines changed: 274 additions & 273 deletions
Large diffs are not rendered by default.

scripting-docs/winscript/active-script-profiling-overview.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
title: "Active Script Profiling Overview | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "01/18/2017"
5+
ms.prod: "windows-script-interfaces"
56
ms.reviewer: ""
67
ms.suite: ""
78
ms.tgt_pltfrm: ""
89
ms.topic: "article"
9-
helpviewer_keywords:
10+
helpviewer_keywords:
1011
- "Active Script Profiling"
1112
ms.assetid: eec2f413-6605-4df4-a86f-4919755e9358
1213
caps.latest.revision: 10
@@ -15,27 +16,27 @@ ms.author: "mikejo"
1516
manager: "ghogen"
1617
---
1718
# Active Script Profiling Overview
18-
The [Active Script Profiler Interfaces](../winscript/reference/active-script-profiler-interfaces.md) enable profiling of a scripting engine. Active Script Profiling consists of the following parts:
19-
20-
- Language Engine
21-
22-
- Host
23-
24-
- Profiler
25-
26-
## Language Engine
27-
The language engine executes the script. It provides methods that enable profiling of the script code as it is executed. When profiling is enabled, the language engine takes the class identifier (CLSID) of the profiler COM object as an argument. It creates an instance of the profiler COM object and then calls into the profiler when various events occur.
28-
29-
The language engine implements [IActiveScriptProfilerControl Interface](../winscript/reference/iactivescriptprofilercontrol-interface.md).
30-
19+
The [Active Script Profiler Interfaces](../winscript/reference/active-script-profiler-interfaces.md) enable profiling of a scripting engine. Active Script Profiling consists of the following parts:
20+
21+
- Language Engine
22+
23+
- Host
24+
25+
- Profiler
26+
27+
## Language Engine
28+
The language engine executes the script. It provides methods that enable profiling of the script code as it is executed. When profiling is enabled, the language engine takes the class identifier (CLSID) of the profiler COM object as an argument. It creates an instance of the profiler COM object and then calls into the profiler when various events occur.
29+
30+
The language engine implements [IActiveScriptProfilerControl Interface](../winscript/reference/iactivescriptprofilercontrol-interface.md).
31+
3132
> [!NOTE]
32-
> The [!INCLUDE[javascript](../javascript/includes/javascript-md.md)] language runtime checks the JS_PROFILER environment variable on creation to determine whether profiling should be enabled. If this variable is set to the CLSID of the profiler, the language runtime creates an instance of the profiler COM object, using the value of the variable to determine which profiler to create.
33-
34-
## Host
35-
The host creates the language engine and provides the language engine with scripts to be executed. A smart host also provides the document context that can be used by a debugger or profiler to provide better information when you are debugging or profiling.
36-
37-
## Profiler
38-
The profiler receives the calls from the language engine when various events occur. The profiler must be registered as a COM object and must implement the [IActiveScriptProfilerCallback Interface](../winscript/reference/iactivescriptprofilercallback-interface.md) interface.
39-
40-
## See Also
33+
> The [!INCLUDE[javascript](../javascript/includes/javascript-md.md)] language runtime checks the JS_PROFILER environment variable on creation to determine whether profiling should be enabled. If this variable is set to the CLSID of the profiler, the language runtime creates an instance of the profiler COM object, using the value of the variable to determine which profiler to create.
34+
35+
## Host
36+
The host creates the language engine and provides the language engine with scripts to be executed. A smart host also provides the document context that can be used by a debugger or profiler to provide better information when you are debugging or profiling.
37+
38+
## Profiler
39+
The profiler receives the calls from the language engine when various events occur. The profiler must be registered as a COM object and must implement the [IActiveScriptProfilerCallback Interface](../winscript/reference/iactivescriptprofilercallback-interface.md) interface.
40+
41+
## See Also
4142
[Active Script Profiler Interfaces](../winscript/reference/active-script-profiler-interfaces.md)

scripting-docs/winscript/implementing-smart-host-helper-interfaces.md

Lines changed: 83 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
title: "Implementing Smart Host Helper Interfaces | Microsoft Docs"
33
ms.custom: ""
44
ms.date: "01/18/2017"
5+
ms.prod: "windows-script-interfaces"
56
ms.reviewer: ""
67
ms.suite: ""
78
ms.tgt_pltfrm: ""
89
ms.topic: "article"
9-
helpviewer_keywords:
10+
helpviewer_keywords:
1011
- "Smart Host Helper Interfaces, implementing"
1112
ms.assetid: b9c44246-4d4d-469e-91be-00c8f5796fa5
1213
caps.latest.revision: 8
@@ -15,88 +16,88 @@ ms.author: "mikejo"
1516
manager: "ghogen"
1617
---
1718
# Implementing Smart Host Helper Interfaces
18-
The [IDebugDocumentHelper Interface](../winscript/reference/idebugdocumenthelper-interface.md) interface greatly simplifies the task of creating a smart host for Active Debugging, because it provides implementations for many interfaces necessary for smart hosting.
19-
20-
To be a smart host using `IDebugDocumentHelper`, a host application must do only three things:
21-
22-
1. `CoCreate` the Process Debug Manager, and use the [IProcessDebugManager Interface](../winscript/reference/iprocessdebugmanager-interface.md) interface to add your application to the list of debuggable applications.
23-
24-
2. Create a debug document helper for each script object, using the [IProcessDebugManager::CreateDebugDocumentHelper](../winscript/reference/iprocessdebugmanager-createdebugdocumenthelper.md) method. Make sure that the document name, parent document, text, and script blocks are defined.
25-
26-
3. Implement the [IActiveScriptSiteDebug Interface](../winscript/reference/iactivescriptsitedebug-interface.md) interface on your object that implements the [IActiveScriptSite](../winscript/reference/iactivescriptsite.md) interface (which is needed for Active Scripting). The only non-trivial method on the `IActiveScriptSiteDebug` interface simply delegates to the helper.
27-
28-
Optionally, the host can implement the [IDebugDocumentHost Interface](../winscript/reference/idebugdocumenthost-interface.md) interface if it needs additional control over syntax color, document context creation, and other extended functionality.
29-
30-
The main limitation on the smart host helper is that it can only handle documents whose contents change or shrink after they have been added (although documents can expand). For many smart hosts, however, the functionality it provides is exactly what is needed.
31-
32-
The following sections explain each step in more detail.
33-
34-
## Create an Application Object
35-
Before the smart host helper can be used, it is necessary to create an [IDebugApplication Interface](../winscript/reference/idebugapplication-interface.md) object to represent your application in the debugger.
36-
37-
#### To create an application object
38-
39-
1. Create an instance of the process debug manager using `CoCreateInstance`.
40-
41-
2. Call [IProcessDebugManager::CreateApplication](../winscript/reference/iprocessdebugmanager-createapplication.md).
42-
43-
3. Set the name on the application by using [IDebugApplication::SetName](../winscript/reference/idebugapplication-setname.md).
44-
45-
4. Add the application object to the list of debuggable applications by using [IProcessDebugManager::AddApplication](../winscript/reference/iprocessdebugmanager-addapplication.md).
46-
47-
The code below outlines the process, but it does not include error checking or other robust programming techniques.
48-
19+
The [IDebugDocumentHelper Interface](../winscript/reference/idebugdocumenthelper-interface.md) interface greatly simplifies the task of creating a smart host for Active Debugging, because it provides implementations for many interfaces necessary for smart hosting.
20+
21+
To be a smart host using `IDebugDocumentHelper`, a host application must do only three things:
22+
23+
1. `CoCreate` the Process Debug Manager, and use the [IProcessDebugManager Interface](../winscript/reference/iprocessdebugmanager-interface.md) interface to add your application to the list of debuggable applications.
24+
25+
2. Create a debug document helper for each script object, using the [IProcessDebugManager::CreateDebugDocumentHelper](../winscript/reference/iprocessdebugmanager-createdebugdocumenthelper.md) method. Make sure that the document name, parent document, text, and script blocks are defined.
26+
27+
3. Implement the [IActiveScriptSiteDebug Interface](../winscript/reference/iactivescriptsitedebug-interface.md) interface on your object that implements the [IActiveScriptSite](../winscript/reference/iactivescriptsite.md) interface (which is needed for Active Scripting). The only non-trivial method on the `IActiveScriptSiteDebug` interface simply delegates to the helper.
28+
29+
Optionally, the host can implement the [IDebugDocumentHost Interface](../winscript/reference/idebugdocumenthost-interface.md) interface if it needs additional control over syntax color, document context creation, and other extended functionality.
30+
31+
The main limitation on the smart host helper is that it can only handle documents whose contents change or shrink after they have been added (although documents can expand). For many smart hosts, however, the functionality it provides is exactly what is needed.
32+
33+
The following sections explain each step in more detail.
34+
35+
## Create an Application Object
36+
Before the smart host helper can be used, it is necessary to create an [IDebugApplication Interface](../winscript/reference/idebugapplication-interface.md) object to represent your application in the debugger.
37+
38+
#### To create an application object
39+
40+
1. Create an instance of the process debug manager using `CoCreateInstance`.
41+
42+
2. Call [IProcessDebugManager::CreateApplication](../winscript/reference/iprocessdebugmanager-createapplication.md).
43+
44+
3. Set the name on the application by using [IDebugApplication::SetName](../winscript/reference/idebugapplication-setname.md).
45+
46+
4. Add the application object to the list of debuggable applications by using [IProcessDebugManager::AddApplication](../winscript/reference/iprocessdebugmanager-addapplication.md).
47+
48+
The code below outlines the process, but it does not include error checking or other robust programming techniques.
49+
4950
```cpp
50-
CoCreateInstance(CLSID_ProcessDebugManager, NULL,
51-
CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER
52-
| CLSCTX_LOCAL_SERVER,
53-
IID_IProcessDebugManager, (void **)&g_ppdm);
54-
g_ppdm->CreateApplication(&g_pda);
55-
g_pda->SetName(L"My cool application");
56-
g_ppdm->AddApplication(g_pda, &g_dwAppCookie);
57-
```
58-
59-
## Using IDebugDocumentHelper
60-
61-
#### To use the helper (minimal sequence of steps)
62-
63-
1. For each host document, create a helper using [IProcessDebugManager::CreateDebugDocumentHelper](../winscript/reference/iprocessdebugmanager-createdebugdocumenthelper.md).
64-
65-
2. Call [IDebugDocumentHelper::Init](../winscript/reference/idebugdocumenthelper-init.md) on the helper, giving the name, document attributes, and so on.
66-
67-
3. Call [IDebugDocumentHelper::Attach](../winscript/reference/idebugdocumenthelper-attach.md) with parent helper for the document (or NULL if the document is the root) to define the position of the document in the tree and make it visible to the debugger.
68-
69-
4. Call [IDebugDocumentHelper::AddDBCSText](../winscript/reference/idebugdocumenthelper-adddbcstext.md) or [IDebugDocumentHelper::AddUnicodeText](../winscript/reference/idebugdocumenthelper-addunicodetext.md) to define the text of the document. (These can be called multiple times if document is downloaded incrementally, as in the case of a browser.)
70-
71-
5. Call [IDebugDocumentHelper::DefineScriptBlock](../winscript/reference/idebugdocumenthelper-definescriptblock.md) to define the ranges for each script block and the associated script engines.
72-
73-
## Implementing IActiveScriptSiteDebug
74-
To implement [IActiveScriptSiteDebug::GetDocumentContextFromPosition](../winscript/reference/iactivescriptsitedebug-getdocumentcontextfromposition.md), get the helper corresponding to the given site, and then get the starting document offset for the given source context, as follows:
75-
51+
CoCreateInstance(CLSID_ProcessDebugManager, NULL,
52+
CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER
53+
| CLSCTX_LOCAL_SERVER,
54+
IID_IProcessDebugManager, (void **)&g_ppdm);
55+
g_ppdm->CreateApplication(&g_pda);
56+
g_pda->SetName(L"My cool application");
57+
g_ppdm->AddApplication(g_pda, &g_dwAppCookie);
58+
```
59+
60+
## Using IDebugDocumentHelper
61+
62+
#### To use the helper (minimal sequence of steps)
63+
64+
1. For each host document, create a helper using [IProcessDebugManager::CreateDebugDocumentHelper](../winscript/reference/iprocessdebugmanager-createdebugdocumenthelper.md).
65+
66+
2. Call [IDebugDocumentHelper::Init](../winscript/reference/idebugdocumenthelper-init.md) on the helper, giving the name, document attributes, and so on.
67+
68+
3. Call [IDebugDocumentHelper::Attach](../winscript/reference/idebugdocumenthelper-attach.md) with parent helper for the document (or NULL if the document is the root) to define the position of the document in the tree and make it visible to the debugger.
69+
70+
4. Call [IDebugDocumentHelper::AddDBCSText](../winscript/reference/idebugdocumenthelper-adddbcstext.md) or [IDebugDocumentHelper::AddUnicodeText](../winscript/reference/idebugdocumenthelper-addunicodetext.md) to define the text of the document. (These can be called multiple times if document is downloaded incrementally, as in the case of a browser.)
71+
72+
5. Call [IDebugDocumentHelper::DefineScriptBlock](../winscript/reference/idebugdocumenthelper-definescriptblock.md) to define the ranges for each script block and the associated script engines.
73+
74+
## Implementing IActiveScriptSiteDebug
75+
To implement [IActiveScriptSiteDebug::GetDocumentContextFromPosition](../winscript/reference/iactivescriptsitedebug-getdocumentcontextfromposition.md), get the helper corresponding to the given site, and then get the starting document offset for the given source context, as follows:
76+
7677
```cpp
77-
pddh->GetScriptBlockInfo(dwSourceContext, NULL, &ulStartPos, NULL);
78-
```
79-
80-
Next, use the helper to create a new document context for the given character offset:
81-
78+
pddh->GetScriptBlockInfo(dwSourceContext, NULL, &ulStartPos, NULL);
79+
```
80+
81+
Next, use the helper to create a new document context for the given character offset:
82+
8283
```cpp
83-
pddh->CreateDebugDocumentContext(ulStartPos + uCharacterOffset, cChars, &pddcNew);
84-
```
85-
86-
To implement [IActiveScriptSiteDebug::GetRootApplicationNode](../winscript/reference/iactivescriptsitedebug-getrootapplicationnode.md), simply call `IDebugApplication::GetRootNode` (inherited from [IRemoteDebugApplication::GetRootNode](../winscript/reference/iremotedebugapplication-getrootnode.md)).
87-
88-
To implement [IDebugDocumentHelper::GetDebugApplicationNode](../winscript/reference/idebugdocumenthelper-getdebugapplicationnode.md), simply return the `IDebugApplication` you initially created using the process debug manager.
89-
90-
## The optional IDebugDocumentHost interface
91-
The host can provide an implementation of the [IDebugDocumentHost Interface](../winscript/reference/idebugdocumenthost-interface.md) by using [IDebugDocumentHelper::SetDebugDocumentHost](../winscript/reference/idebugdocumenthelper-setdebugdocumenthost.md) to give it additional control over the helper. Here are some of the key things the host interface allows you to do:
92-
93-
- Add text using [IDebugDocumentHelper::AddDeferredText](../winscript/reference/idebugdocumenthelper-adddeferredtext.md) so that the host does not need to provide the actual characters immediately. When the characters are really needed, the helper will call [IDebugDocumentHost::GetDeferredText](../winscript/reference/idebugdocumenthost-getdeferredtext.md) on the host.
94-
95-
- Override the default syntax coloring provided by the helper. The helper calls [IDebugDocumentHost::GetScriptTextAttributes](../winscript/reference/idebugdocumenthost-getscripttextattributes.md) to determine the coloring for a range of characters, falling back on its default implementation if the host return `E_NOTIMPL`.
96-
97-
- Provide a controlling unknown for document contexts created by the helper by implementing [IDebugDocumentHost::OnCreateDocumentContext](../winscript/reference/idebugdocumenthost-oncreatedocumentcontext.md). This allows the host to override the functionality of the default document context implementation.
98-
99-
- Provide a path name in the file system for the document. Some debugging UIs use this to permit the user to edit and save changes to the document. [IDebugDocumentHost::NotifyChanged](../winscript/reference/idebugdocumenthost-notifychanged.md) is called to notify the host after the document has been saved.
100-
101-
## See Also
84+
pddh->CreateDebugDocumentContext(ulStartPos + uCharacterOffset, cChars, &pddcNew);
85+
```
86+
87+
To implement [IActiveScriptSiteDebug::GetRootApplicationNode](../winscript/reference/iactivescriptsitedebug-getrootapplicationnode.md), simply call `IDebugApplication::GetRootNode` (inherited from [IRemoteDebugApplication::GetRootNode](../winscript/reference/iremotedebugapplication-getrootnode.md)).
88+
89+
To implement [IDebugDocumentHelper::GetDebugApplicationNode](../winscript/reference/idebugdocumenthelper-getdebugapplicationnode.md), simply return the `IDebugApplication` you initially created using the process debug manager.
90+
91+
## The optional IDebugDocumentHost interface
92+
The host can provide an implementation of the [IDebugDocumentHost Interface](../winscript/reference/idebugdocumenthost-interface.md) by using [IDebugDocumentHelper::SetDebugDocumentHost](../winscript/reference/idebugdocumenthelper-setdebugdocumenthost.md) to give it additional control over the helper. Here are some of the key things the host interface allows you to do:
93+
94+
- Add text using [IDebugDocumentHelper::AddDeferredText](../winscript/reference/idebugdocumenthelper-adddeferredtext.md) so that the host does not need to provide the actual characters immediately. When the characters are really needed, the helper will call [IDebugDocumentHost::GetDeferredText](../winscript/reference/idebugdocumenthost-getdeferredtext.md) on the host.
95+
96+
- Override the default syntax coloring provided by the helper. The helper calls [IDebugDocumentHost::GetScriptTextAttributes](../winscript/reference/idebugdocumenthost-getscripttextattributes.md) to determine the coloring for a range of characters, falling back on its default implementation if the host return `E_NOTIMPL`.
97+
98+
- Provide a controlling unknown for document contexts created by the helper by implementing [IDebugDocumentHost::OnCreateDocumentContext](../winscript/reference/idebugdocumenthost-oncreatedocumentcontext.md). This allows the host to override the functionality of the default document context implementation.
99+
100+
- Provide a path name in the file system for the document. Some debugging UIs use this to permit the user to edit and save changes to the document. [IDebugDocumentHost::NotifyChanged](../winscript/reference/idebugdocumenthost-notifychanged.md) is called to notify the host after the document has been saved.
101+
102+
## See Also
102103
[Active Script Debugging Overview](../winscript/active-script-debugging-overview.md)

0 commit comments

Comments
 (0)