<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.stridewiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.167.121.110</id>
	<title>STRIDE Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.stridewiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.167.121.110"/>
	<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Special:Contributions/70.167.121.110"/>
	<updated>2026-04-28T08:03:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.10</generator>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Test_Units_Overview&amp;diff=1933</id>
		<title>Test Units Overview</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Test_Units_Overview&amp;diff=1933"/>
		<updated>2007-06-20T23:12:00Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;p&lt;br /&gt;
==Introduction==&lt;br /&gt;
&lt;br /&gt;
STRIDE enables testing of C++ code through the use of xUnit style test classes. Test classes can be written by engineers, captured using an SCL pragma, and executed from the host. STRIDE facilitates the execution of some or all of the test classes by automatically creating entry points for the execution of test classes on the target.&lt;br /&gt;
&lt;br /&gt;
==Using C++ test classes==&lt;br /&gt;
&lt;br /&gt;
===Prerequisites===&lt;br /&gt;
&lt;br /&gt;
The C++ test class support described here only works in the 2.0.0802 version of STRIDE or later.  The host PC must also have a recent distribution of ActiveState perl installed.&lt;br /&gt;
&lt;br /&gt;
===How to get started===&lt;br /&gt;
&lt;br /&gt;
The following is an outline of the required steps to get started with writing C++ test classes.&lt;br /&gt;
&lt;br /&gt;
* Create a new Studio workspace (or open an existing one).&lt;br /&gt;
* Set the workspace to cpp mode (for compilation).&lt;br /&gt;
* Add &#039;&#039;&#039;%STRIDE_DIR%&#039;&#039;&#039;\inc\srtest.h to the Source Files folder of your workspace.&lt;br /&gt;
* Add &#039;&#039;&#039;%STRIDE_DIR%&#039;&#039;&#039;\scripts\TestClasses\TestClass_Preprocess.pl (or .js) to your Script Files folder.  This script is a preprocessor and code generator.  It searches all source files in the current workspace and looks for test classes that have been captured via the &#039;&#039;scl_test_class&#039;&#039; pragma. It then generates c-linkage wrapper functions that instantiate and execute each test class.  By default, this generated source file has a name of the form {WORKSPACE_NAME}TCR.cpp and will be located in the workspace directory. If you need to change the name and/or location of this generated file, simply set the &#039;&#039;&#039;outFile&#039;&#039;&#039; property of the &#039;&#039;&#039;&#039;&#039;STRIDE.testclass_codegen&#039;&#039;&#039;&#039;&#039; object prior to calling the generate method.  If you will be adding a script to compile the workspace (see next step), this preprocessing script must always &#039;&#039;&#039;preceed&#039;&#039;&#039; the compilation step.&lt;br /&gt;
* Add a script to compile the workspace.  In it&#039;s simplest form, this script can simple be something like:&lt;br /&gt;
  #perl syntax&lt;br /&gt;
  Win32::OLE-&amp;gt;Option(Warn =&amp;gt; 3);&lt;br /&gt;
  $main::studio-&amp;gt;Workspace-&amp;gt;Compile();&lt;br /&gt;
&lt;br /&gt;
  // jscript syntax&lt;br /&gt;
  studio.Workspace.Compile();&lt;br /&gt;
* Add a script to generate the Intercept Module(IM).  For the simple STUB generation required for C++ test class execution, you can use &#039;&#039;&#039;%STRIDE_DIR%&#039;&#039;&#039;\scripts\TestClasses\TestClass_Preprocess.pl (or .js) for this purpose.&lt;br /&gt;
* Add scripts to build and execute your application.  If you are using a host based simulator, we examples available of both. If you are using actual devices, the steps required for building and starting the application are specific to the target environment.&lt;br /&gt;
* Create one or more test classes to implement your C++ test logic.  See below for more information on creating test classes.&lt;br /&gt;
* Ensure that the Studio workspace include path has the location to all of your test class declaration (header) files.&lt;br /&gt;
* Once you have created one or more test classes, save the workspace and run the scripts, starting with the TestClass_Preprocess script, followed by compile, IM generation, and application building.&lt;br /&gt;
* [&#039;&#039;Optional&#039;&#039;] If your application is running, you can test execute individual test classes interactively using the Studio interface view.  Open the user interface view corresponding to the test class you would like to execute and call it.  The return values will indicate how many tests produced each of 4 result types.  Furthermore, the input to the entry point will allow you to select all methods or execution (the default) or individual methods -- this is done via a dropdown list of enumerated values.&lt;br /&gt;
* Once you are confident that the test classes are behaving as expected, you can generate one or more execution scripts using the Script Wizard.  Sample templates for executing test class entry points are provided in the &#039;&#039;&#039;%STRIDE_DIR%&#039;&#039;&#039;\templates\Script Wizard directory.&lt;br /&gt;
* for integration with larger regression test workspaces, we recommend that engineers check-in their test class code and, optionally, the template generated scripts that can be used to execute their test classes.&lt;br /&gt;
&lt;br /&gt;
==CPP test class requirements==&lt;br /&gt;
&lt;br /&gt;
We support several variations on typical xUnit-style test classes.  Some of the additional features that we support are:&lt;br /&gt;
* test status can be set using STRIDE Runtime APIs &#039;&#039;or&#039;&#039; by specifying simple return types for test methods.&lt;br /&gt;
* test writers can create additional child suites and tests at runtime by using Runtime APIs.&lt;br /&gt;
* we do not rely on exceptions for reporting of status.&lt;br /&gt;
&lt;br /&gt;
The STRIDE test class framework requires the following of each test class:&lt;br /&gt;
* The test class must have a suitable default (no-argument) constructor.&lt;br /&gt;
* The test class must have one or more public methods suitable as test methods.  Allowable test methods always take no arguments (void) and return either void or simple integer types (int, short, long, char or bool).  At this time, we do not allow typedef types or macros for the return values specification.&lt;br /&gt;
* the scl_test_class pragma must be applied to the class.&lt;br /&gt;
&lt;br /&gt;
===Simple example using return values for status===&lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  class Simple {&lt;br /&gt;
  public:&lt;br /&gt;
    int tc_Int_ExpectPass(void) {return 0;}&lt;br /&gt;
    int tc_Int_ExpectFail(void) {return -1;}&lt;br /&gt;
    bool tc_Bool_ExpectPass(void) {return true;}&lt;br /&gt;
    bool tc_Bool_ExpectFail(void) {return false;}&lt;br /&gt;
  };&lt;br /&gt;
  #ifdef _SCL&lt;br /&gt;
  #pragma scl_test_class(Simple)&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
===Simple example using runtime test service APIs=== &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  class RuntimeServices_basic {&lt;br /&gt;
  public: &lt;br /&gt;
    void tc_ExpectPass(void) &lt;br /&gt;
    {&lt;br /&gt;
        srTestCaseAddComment(srTEST_CASE_DEFAULT, &amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
        srTestCaseSetStatus(srTEST_CASE_DEFAULT, srTEST_PASS, 0); &lt;br /&gt;
    }&lt;br /&gt;
    void tc_ExpectFail(void) &lt;br /&gt;
    {&lt;br /&gt;
        srTestCaseAddComment(srTEST_CASE_DEFAULT, &amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
        srTestCaseSetStatus(srTEST_CASE_DEFAULT, srTEST_FAIL, 0); &lt;br /&gt;
    }&lt;br /&gt;
    void tc_ExpectInProgress(void) &lt;br /&gt;
    {&lt;br /&gt;
        srTestCaseAddComment(srTEST_CASE_DEFAULT, &amp;quot;this test should be in progress&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
  #ifdef _SCL&lt;br /&gt;
  #pragma scl_test_class(RuntimeServices_basic)&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
===Simple example using srTest base class===  &lt;br /&gt;
&lt;br /&gt;
  #include &amp;lt;srtest.h&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  class MyTest : public stride::srTest {&lt;br /&gt;
  public:&lt;br /&gt;
    void tc_ExpectPass(void) &lt;br /&gt;
    {&lt;br /&gt;
        testCase.AddComment(&amp;quot;this test should pass&amp;quot;);&lt;br /&gt;
        testCase.SetStatus(srTEST_PASS, 0); &lt;br /&gt;
    }&lt;br /&gt;
    void tc_ExpectFail(void) &lt;br /&gt;
    {&lt;br /&gt;
        testCase.AddComment(&amp;quot;this test should fail&amp;quot;);&lt;br /&gt;
        testCase.SetStatus(srTEST_FAIL, 0); &lt;br /&gt;
    }&lt;br /&gt;
    void tc_ExpectInProgress(void) &lt;br /&gt;
    {&lt;br /&gt;
        testCase.AddComment(&amp;quot;this test should be in progress&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
    int tc_ChangeMyName(void) &lt;br /&gt;
    {&lt;br /&gt;
        testCase.AddComment(&amp;quot;this test should have name = MyChangedName&amp;quot;);&lt;br /&gt;
        testCase.SetName(&amp;quot;MyChangedName&amp;quot;);&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
    int tc_ChangeMyDescription(void) &lt;br /&gt;
    {&lt;br /&gt;
        testCase.AddComment(&amp;quot;this test should have a description set&amp;quot;);&lt;br /&gt;
        testCase.SetDescription(&amp;quot;this is my new description&amp;quot;);&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
  };&lt;br /&gt;
  #ifdef _SCL&lt;br /&gt;
  #pragma scl_test_class(MyClass)&lt;br /&gt;
  #endif&lt;br /&gt;
&lt;br /&gt;
==Libraries/Components==&lt;br /&gt;
&lt;br /&gt;
===STRIDE.testclass===&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;&#039;&#039;STRIDE.testclass&#039;&#039;&#039;&#039;&#039; component is used for executing test classes.  It handles the underlying communication with the runtime and creates results in a specified reporter suite.  This object supports the following properties and methods:&lt;br /&gt;
* &#039;&#039;ascript&#039;&#039; : Input only.  This is the ascript instance for the current execution environment.  This is &#039;&#039;&#039;required&#039;&#039;&#039; prior to calling the run method.  In most cases, you can simply pass the global ascript instance from your script that executes in your workspace.&lt;br /&gt;
* &#039;&#039;parentSuite&#039;&#039; : Input only.  This is a reporter suite object into which results for the test class should be added.  A sub-suite corresponding the the test class will be created in the given parent suite and all test method results will be added to this new child suite.  This is &#039;&#039;&#039;required&#039;&#039;&#039; prior to calling the run method.&lt;br /&gt;
* &#039;&#039;dataFile&#039;&#039; : Input only.  This specifies the name/location of the test class meta-data file (generated by the preprocessing step).  This is &#039;&#039;&#039;required&#039;&#039;&#039; prior to calling the run method.&lt;br /&gt;
* &#039;&#039;&#039;run&#039;&#039;&#039; : Method.  This initiates the running of the specified test class object.  This method requires a single argument - the name of the test class entry point function that was generated by the preprocessing step. &lt;br /&gt;
&lt;br /&gt;
===STRIDE.testclass_codegen===&lt;br /&gt;
&lt;br /&gt;
The TestClass_Preprocess.pl/js script demonstrates how to invoke the functionality exposed in the &#039;&#039;&#039;&#039;&#039;STRIDE.testclass_codegen&#039;&#039;&#039;&#039;&#039; object.  This object exposes the following properties and methods:&lt;br /&gt;
* &#039;&#039;exceptions&#039;&#039; : Input only. Indicates whether or not to generate exception handling code in the test class entry point functions.  If you do not have exceptions enabled on your target, set this to 0 -- otherwise we recommend you set it to 1 to enable exception handling code in the test class entry point.&lt;br /&gt;
* &#039;&#039;outFile&#039;&#039; : Input only. The name/location of the generated file.  This will default to a file named {WORKSPACE}TCR.cpp (where {WORKSPACE} is the name of the current workspace) and will be located in the workspace directory.&lt;br /&gt;
* &#039;&#039;dataFile&#039;&#039; : Input only. The name/location of the meta-data file generated by the preprocessor.  This meta-data is used by the STRIDE.testclass library to determine the name of test classes and methods as they execute.  the default name for this file is {WORKSPACE}.tcrd located in the workspace directory.  If  you override this property, be sure to override the same property in &#039;&#039;&#039;&#039;&#039;STRIDE.testclass&#039;&#039;&#039;&#039;&#039; wherever it is called.&lt;br /&gt;
* &#039;&#039;studio&#039;&#039; : Input only. This is the automation object interface to the current execution environment.  In most cases, you can simply pass the current global studio object from the script in your workspace.  This is &#039;&#039;&#039;required&#039;&#039;&#039; prior to calling generate.&lt;br /&gt;
* &#039;&#039;&#039;generate&#039;&#039;&#039; : Method.  Call this method when you are ready to generate the test class entry points. &lt;br /&gt;
&lt;br /&gt;
[[Category:Testing Strategies]]&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Platform_Abstraction_Layer&amp;diff=1867</id>
		<title>Platform Abstraction Layer</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Platform_Abstraction_Layer&amp;diff=1867"/>
		<updated>2007-06-19T21:58:24Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== PAL Concepts ==&lt;br /&gt;
This section describes the basic concepts of the PAL and the system services it must provide.&lt;br /&gt;
&lt;br /&gt;
=== Function Registration ===&lt;br /&gt;
Typically, the STRIDE Runtime calls PAL functions; however, there are some functions&lt;br /&gt;
in the STRIDE Runtime that need to be called by the PAL. To eliminate PAL&lt;br /&gt;
dependencies on the STRIDE Runtime, these functions are accessed through a function&lt;br /&gt;
registration process initiated by the STRIDE Runtime at startup. You write the&lt;br /&gt;
registration routine called by the Runtime. This registration routine passes in the address&lt;br /&gt;
of the STRIDE Runtime function to be registered as the input parameter, and stores the&lt;br /&gt;
address of the STRIDE Runtime function in your own function variable, which is actually&lt;br /&gt;
a pointer to a function. You can then call the registered function using your function&lt;br /&gt;
pointer variable.&lt;br /&gt;
&lt;br /&gt;
The registered STRIDE Runtime functions allow you to complete such tasks as&lt;br /&gt;
delivering a received I-block to the Runtime, checking the number of I-blocks the&lt;br /&gt;
Runtime has ready to send out, or signalling the Runtime that your transport is ready for&lt;br /&gt;
the next I-block. It is not necessary for the PAL to know the details of these Runtime&lt;br /&gt;
functions.&lt;br /&gt;
&lt;br /&gt;
=== Event Notification ===&lt;br /&gt;
Unique information is required by an operating system to notify a thread of a pending&lt;br /&gt;
event. This information can be a simple index into a table, an address to a thread control&lt;br /&gt;
block, the address of a semaphore or one of a number of other implementations. Although&lt;br /&gt;
each implementation may be different, a unique notifier is necessary for each thread. The&lt;br /&gt;
STRIDE Runtime calls this unique information a Notification Identifier (NID). A thread&lt;br /&gt;
uses a NID when waiting for a STRIDE event, and the STRIDE Runtime uses the same&lt;br /&gt;
NID to notify the thread of a pending STRIDE event.&lt;br /&gt;
&lt;br /&gt;
An additional piece of information included with the notify routine is a box ID, which is&lt;br /&gt;
the ID of the mailbox where the message is delivered.&lt;br /&gt;
&lt;br /&gt;
=== Critical Data Protection ===&lt;br /&gt;
The STRIDE Runtime needs to protect critical data structures from multiple,&lt;br /&gt;
simultaneous accesses. The specific method of protection is not dictated to the PAL. The&lt;br /&gt;
PAL requires that when one thread calls a STRIDE function which in turn calls&lt;br /&gt;
palProtect(), and another thread calls a STRIDE function which also calls palProtect();&lt;br /&gt;
the second thread is preempted until the first thread’s STRIDE function calls&lt;br /&gt;
palUnprotect(). Once palUnprotect() is called, the second thread can be rescheduled&lt;br /&gt;
and continue. In addition, the STRIDE Runtime guarantees that calls to palProtect() will&lt;br /&gt;
not be nested.&lt;br /&gt;
&lt;br /&gt;
=== Timer Administration ===&lt;br /&gt;
The STRIDE Runtime requires that at least one timer be available. When a timer is&lt;br /&gt;
created, a callback is registered so that the STRIDE Runtime can be notified of timer&lt;br /&gt;
expirations. A user parameter, provided when the timer is created, is passed to the&lt;br /&gt;
callback when it gets called. If several timers share a callback routine, this user parameter&lt;br /&gt;
can be used to identify which timer expired. The STRIDE Runtime can also stop, start&lt;br /&gt;
and delete timers.&lt;br /&gt;
&lt;br /&gt;
Because the STRIDE Runtime also has the need to timestamp trace log data, a routine&lt;br /&gt;
that returns the system time, PalGetTime(), is also part of the PAL. This routine is not&lt;br /&gt;
associated with timers.&lt;br /&gt;
&lt;br /&gt;
=== Memory Allocation ===&lt;br /&gt;
The STRIDE Runtime dynamically allocates memory for messages and trace log storage.&lt;br /&gt;
The Runtime uses palMemAlloc() and palMemFree() to allocate memory dynamically&lt;br /&gt;
and then return it to the system.&lt;br /&gt;
&lt;br /&gt;
=== Transport Services ===&lt;br /&gt;
The PAL transport routines are needed to transfer I-blocks (STRIDE data packets) into&lt;br /&gt;
and out of the STRIDE Runtime on your target platform. These routines handle the&lt;br /&gt;
buffering and transferring of data to and from your transport mechanism. The PAL also&lt;br /&gt;
contains registration routines that allow for STRIDE Runtime routines to be called by the&lt;br /&gt;
PAL.&lt;br /&gt;
&lt;br /&gt;
The palOut() routine enables the STRIDE Runtime to transfer I-blocks to your transport.&lt;br /&gt;
The STRIDE Runtime calls the palOut() routine whenever it needs to send out an Iblock.&lt;br /&gt;
Your transport calls the routine registered with the palOutRdyReg() routine when the&lt;br /&gt;
transport is ready for the next I-block to be transmitted. The STRIDE Runtime will not&lt;br /&gt;
call the palOut() routine until you call the registered function. In this way, you can&lt;br /&gt;
control the flow of transmitted I-blocks.&lt;br /&gt;
&lt;br /&gt;
When a complete I-block has been received by your transport, the routine registered with&lt;br /&gt;
the palInReg() routine should be calle to put the received I-block into the STRIDE&lt;br /&gt;
Runtime.&lt;br /&gt;
&lt;br /&gt;
In some cases it is useful to know when the transmit path is not being requested. Your&lt;br /&gt;
transport mechanism can check the number of I-blocks the STRIDE Runtime has ready&lt;br /&gt;
for transmission by calling the routine registered with the palOutPndReg() routine.&lt;br /&gt;
&lt;br /&gt;
=== Host Services ===&lt;br /&gt;
The PAL also provides a way for the STRIDE Runtime to support your transport protocol&lt;br /&gt;
on the desktop. A Windows® DLL linked to the STRIDE Panel enables these host&lt;br /&gt;
services. The DLL allows your data to be received and transmitted using your transport&lt;br /&gt;
&lt;br /&gt;
== PAL Organization ==&lt;br /&gt;
&lt;br /&gt;
This section explains the two categories of PAL services that support the STRIDE Runtime, as&lt;br /&gt;
well as the files used to implement these services on your target.&lt;br /&gt;
&lt;br /&gt;
=== PAL Services ===&lt;br /&gt;
The PAL services include the following:&lt;br /&gt;
* Operating System (OS) Services&lt;br /&gt;
* Input/Output (IO) Services&lt;br /&gt;
&lt;br /&gt;
=== PAL Operating System Services ===&lt;br /&gt;
The PAL Operating System (OS) Services are the routines that enable the STRIDE&lt;br /&gt;
Runtime to work with the operating system on your target platform. In order to write your&lt;br /&gt;
PAL OS services you must have detailed knowledge of how your operating system&lt;br /&gt;
handles thread synchronization, timers, critical sections, dynamic memory, and&lt;br /&gt;
notification. The PAL OS services make the features of your operating system available&lt;br /&gt;
to the STRIDE Runtime.  All of the functions described here must be fully implemented in your PAL.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;2&amp;quot; style=&amp;quot;margin:1em auto 1em&amp;quot; &lt;br /&gt;
! Function Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Synchronization&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| palCreateNID || Create a Notification Identifier (NID) &lt;br /&gt;
|-&lt;br /&gt;
| palDeleteNID || Delete a Notification Identifier (NID) &lt;br /&gt;
|-&lt;br /&gt;
| palCreateRFCProxyNID || Create the RFC Proxy Notification Identifier (NID) &lt;br /&gt;
|-&lt;br /&gt;
| palDeleteRFCProxyNID || Delete the RFC Proxy Notification Identifier (NID) &lt;br /&gt;
|-&lt;br /&gt;
| palWait || Wait for an event &lt;br /&gt;
|-&lt;br /&gt;
| palNotify || Signal a thread that an event is pending &lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Timers&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| palTimerCreate || Create a timer &lt;br /&gt;
|-&lt;br /&gt;
| palTimerDelete || Delete a timer &lt;br /&gt;
|-&lt;br /&gt;
| palTimerStart || Start a timer &lt;br /&gt;
|-&lt;br /&gt;
| palTimerStop || Stop a timer &lt;br /&gt;
|-&lt;br /&gt;
| palGetTime || Return system time (e.g., tick count) &lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Critical Section&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| palProtect || Begin critical section &lt;br /&gt;
|-&lt;br /&gt;
| palUnprotect || End critical section &lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Memory&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| palMemAlloc || Allocate a block of dynamic memory &lt;br /&gt;
|-&lt;br /&gt;
| palMemFree || Free a block of dynamic memory &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== PAL Input/Output Services ===&lt;br /&gt;
The PAL Input/Output (IO) Services are the routines that enable the STRIDE Runtime to&lt;br /&gt;
work with different data transport mechanisms. These routines enable your transport to&lt;br /&gt;
send and receive data between the host and the target.&lt;br /&gt;
&lt;br /&gt;
The IO services have also been defined to allow the target platform to control how&lt;br /&gt;
memory is managed and the rate of data exchange. See Appendix A beginning on page&lt;br /&gt;
121 for definitions of the header file functions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; border=&amp;quot;2&amp;quot; style=&amp;quot;margin:1em auto 1em&amp;quot; &lt;br /&gt;
! Function Name !! Description&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Transmit&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| PalOutPndReg || Query the current output queue of the Runtime&lt;br /&gt;
|-&lt;br /&gt;
| PalOutRdyReg || Identify the transport as ready to receive data &lt;br /&gt;
|-&lt;br /&gt;
| PalOut || Send data to the host platform&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot; | &#039;&#039;&#039;Receive&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
| PalInReg || Data extracted from the transport and identified for the STRIDE Runtime&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:Deploying STRIDE]]&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:Integrating_the_Intercept_Module_(IM)&amp;diff=1851</id>
		<title>Studio:Integrating the Intercept Module (IM)</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:Integrating_the_Intercept_Module_(IM)&amp;diff=1851"/>
		<updated>2007-06-19T21:33:55Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== IM Files and how they are used ==&lt;br /&gt;
=== Naming conventions ===&lt;br /&gt;
=== The Intercept Module source file (IM.c / IM.cpp) ===&lt;br /&gt;
=== The IM.h file ===&lt;br /&gt;
=== The IMEntry.h file ===&lt;br /&gt;
== Adding the IM files to the build ==&lt;br /&gt;
== IM Resource Requirements ==&lt;br /&gt;
* Stack size&lt;br /&gt;
* Threads&lt;br /&gt;
== Starting the IMStubRead thread ==&lt;br /&gt;
&lt;br /&gt;
[[Category:Deploying STRIDE]]&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:Integrating_the_Intercept_Module_(IM)&amp;diff=1846</id>
		<title>Studio:Integrating the Intercept Module (IM)</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:Integrating_the_Intercept_Module_(IM)&amp;diff=1846"/>
		<updated>2007-06-19T21:28:21Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== IM Files and how they are used ==&lt;br /&gt;
=== Naming conventions ===&lt;br /&gt;
=== The Intercept Module source file (IM.c / IM.cpp) ===&lt;br /&gt;
=== The IM.h file ===&lt;br /&gt;
=== The IMEntry.h file ===&lt;br /&gt;
== Adding the IM files to the build ==&lt;br /&gt;
== IM Resource Requirements ==&lt;br /&gt;
* Stack size&lt;br /&gt;
* Threads&lt;br /&gt;
== Starting the IMStubRead thread ==&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:Advantages_and_disadvantages_of_%22default%22_candidates&amp;diff=1661</id>
		<title>Studio:Advantages and disadvantages of &quot;default&quot; candidates</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:Advantages_and_disadvantages_of_%22default%22_candidates&amp;diff=1661"/>
		<updated>2007-06-12T19:50:26Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The following table describes the advantages and disadvantages associated with the &amp;quot;default&amp;quot; candidate method vs. the candidate method.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;, cellpadding=&amp;quot;5&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
! &lt;br /&gt;
&lt;br /&gt;
! &#039;&#039;&#039;&amp;quot;Default&amp;quot; candidate method&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
! &#039;&#039;&#039;Candidate method&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;Define and pragmatize each function prototype&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
| Not needed.&lt;br /&gt;
&lt;br /&gt;
| Cumbersome if there are hundreds of candidate functions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;Code footprint of the generated code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
| Only the proxy/stub of the &amp;quot;default&amp;quot; candidate is generated; thus, the code footprint is much smaller. &lt;br /&gt;
&lt;br /&gt;
| The code footprint is dependent upon how many candidates are defined using the scl_ptr_flist() pragma, since a proxy/stub is generated for each candidate defined in the list.&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039;Capturing of function callback command/response payloads via the trace module&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
| Any function callback command/response payloads with the identical signature can be captured.  &lt;br /&gt;
&lt;br /&gt;
| Only those candidate functions defined in the scl_ptr_flist() pragma can be captured.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| &#039;&#039;&#039; Visibility of function callbacks via the trace module&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
| The function callback being called is unknown. All of the function callbacks with the identical signature will be displayed with the &amp;quot;default&amp;quot; candidate name and SMID. &lt;br /&gt;
&lt;br /&gt;
| All of the function callbacks being called are known, as long as the candidate functions were declared in the scl_ptr_flist() pragma.&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
One disadvantage of using the shorthand method to define candidates in scl_ptr_flist(), as shown in Method 3 of the &amp;quot;Working with &amp;quot;default&amp;quot; candidates topic, is that the function pointer prototypes are not defined by the user/customer, but rather by STRIDE. So, for example, if the user wants to create a proxy for foo2() with stub candidate functions C2 and &amp;quot;cand4&amp;quot; on the target, the generated IM code will give &amp;quot;undefined&amp;quot; compiler errors for &amp;quot;cand4&amp;quot;. The following procedure using the header file MyHeader.h (the file containing the SCL pragmas or function prototypes) resolves this issue:&lt;br /&gt;
 &amp;lt;tt&amp;gt;#ifdef srIMON&lt;br /&gt;
     void cand4(int x, char y);&lt;br /&gt;
     #endif &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The use of the srIMON preprocessor directive allows the SDAC to compile the file without any name conflicts for &amp;quot;cand4&amp;quot;, since these are already defined within STRIDE. It also allows the generated IM code to compile successfully.&lt;br /&gt;
&#039;&#039;&#039;MyFunctions.c&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
MyFunctions.c is an example of a user-created file containing the actual code for the candidate &amp;quot;cand4&amp;quot;:&lt;br /&gt;
 &amp;lt;tt&amp;gt;void cand4(int x, char y)&amp;lt;br&amp;gt;&lt;br /&gt;
     { &amp;lt;br&amp;gt;&lt;br /&gt;
     } &amp;lt;br&amp;gt; &amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
MyTest.c&lt;br /&gt;
&lt;br /&gt;
MyTest.c is an example of a user-created file containing a test thread that makes the call to foo2() with the appropriate function pointer callback:&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Help:Editing&amp;diff=1476</id>
		<title>Help:Editing</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Help:Editing&amp;diff=1476"/>
		<updated>2007-03-01T00:53:15Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;http://meta.wikimedia.org/wiki/MediaWiki_User&#039;s_Guide#For_editors&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1475</id>
		<title>Studio:How to synchronize scripts</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1475"/>
		<updated>2007-03-01T00:43:33Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If a test scenario requires multiple scripts synchronization between the scripts is required. For example if testing a component requires to simulate a depend component it is sometimes easier to split it in multiple scripts. One script could be driving the test which launches a separate script non-blocking which simulates the depended component. &lt;br /&gt;
&lt;br /&gt;
The following example shows how communication between two scripts can be achieved using a simple client-server example. The client queries the server for date and time. The server returns a date and time string.&lt;br /&gt;
&lt;br /&gt;
The interface between the client and server is defined in a SCL file. For the example the SCL files has two interfaces, one to request information (in the example the date and time string) and one to shutdown (end) the server script. &lt;br /&gt;
&lt;br /&gt;
SCL File:&lt;br /&gt;
 #define MAX_STRING_SIZE 50&lt;br /&gt;
 int get_time(char* szTime);&lt;br /&gt;
 int shutdown(void);&lt;br /&gt;
 #ifdef _SCL&lt;br /&gt;
 #pragma scl_function(get_time)&lt;br /&gt;
 #pragma scl_ptr(get_time.szTime,  OUT,  PRIVATE)&lt;br /&gt;
 #pragma scl_string(get_time.szTime, MAX_STRING_SIZE)&lt;br /&gt;
 #pragma scl_function(shutdown)&lt;br /&gt;
 #endif /* _SCL */   &lt;br /&gt;
&lt;br /&gt;
The server scripts waits for requests, gets the time and returns requests:&lt;br /&gt;
  ## Used interfaces&lt;br /&gt;
  my $req      = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
  my $shutdown = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
  &lt;br /&gt;
  ## teake ownership of required interfaces&lt;br /&gt;
  $req-&amp;gt;Register();&lt;br /&gt;
  $shutdown-&amp;gt;Register();&lt;br /&gt;
  &lt;br /&gt;
  ## initialize exit variable&lt;br /&gt;
  my $end = 0;&lt;br /&gt;
  &lt;br /&gt;
  ## Wait for requests from clients until exit&lt;br /&gt;
  while ($end == 0)&lt;br /&gt;
  {&lt;br /&gt;
     ## Wait for an event&lt;br /&gt;
     my $event = $main::ascript-&amp;gt;WaitForEvent();&lt;br /&gt;
  &lt;br /&gt;
     ## if the event is a get time request, get the time&lt;br /&gt;
     ## and return&lt;br /&gt;
     if ($event-&amp;gt;Name eq $req-&amp;gt;Name)&lt;br /&gt;
     {&lt;br /&gt;
        $req-&amp;gt;OutPointers-&amp;gt;{szTime} = gmctime();&lt;br /&gt;
        $req-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $req-&amp;gt;Return();&lt;br /&gt;
     }&lt;br /&gt;
  &lt;br /&gt;
     ## Shutdown event. Set the variable to exit the loop&lt;br /&gt;
     if ($event-&amp;gt;Name eq $shutdown-&amp;gt;Name)&lt;br /&gt;
     {&lt;br /&gt;
        $shutdown-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $shutdown-&amp;gt;Return();&lt;br /&gt;
        $end = 1;&lt;br /&gt;
     }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  ## Unregister ownership&lt;br /&gt;
  $req-&amp;gt;Unregister();&lt;br /&gt;
  $shutdown-&amp;gt;Unregister();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The client script queries the server. However it also assures that the server is running. To show how scripts can be launched and terminated the client scripts first checks if the server is running. If not it starts the server and waits until the server is ready to accept requests. This is done by waiting until the server has registered the interfaces for script communication. At the end the client script sends a shutdown request to the server to end the server script.&lt;br /&gt;
&lt;br /&gt;
  ## Check if server is running&lt;br /&gt;
  if (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
  {&lt;br /&gt;
    ## Server not available&lt;br /&gt;
    ## As an option we can start the server here&lt;br /&gt;
    ## This might not be required in all cases but is a good sample&lt;br /&gt;
    ## on how to start another script non-blocking&lt;br /&gt;
    $main::studio-&amp;gt;Workspace-&amp;gt;Files-&amp;gt;Item(&amp;quot;server.pl&amp;quot;)-&amp;gt;RunNonBlocking();&lt;br /&gt;
  &lt;br /&gt;
    ## wait for the server to be up&lt;br /&gt;
    ## An easy way is to wait until the server has taken ownership&lt;br /&gt;
    ## of the supported functions&lt;br /&gt;
    while (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
    {&lt;br /&gt;
         $main::ascript-&amp;gt;Sleep(100);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  ## Get a shortcut to the function&lt;br /&gt;
  my $req = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;User;&lt;br /&gt;
  &lt;br /&gt;
  ## Call te function (blocking request to the server)&lt;br /&gt;
  $req-&amp;gt;Call();&lt;br /&gt;
  &lt;br /&gt;
  ## Check for the return value and display date and time&lt;br /&gt;
  if ($req-&amp;gt;ReturnValue)&lt;br /&gt;
  {&lt;br /&gt;
      $main::ascript-&amp;gt;MessageBox($req-&amp;gt;OutPointers-&amp;gt;szTime, &amp;quot;Current Time&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  else&lt;br /&gt;
  {&lt;br /&gt;
    $main::ascript-&amp;gt;MessageBox(&amp;quot;Server returned Error&amp;quot;, &amp;quot;Error&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  ## Shutdown the server (if required)&lt;br /&gt;
  $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;User-&amp;gt;Call();&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1474</id>
		<title>Studio:How to synchronize scripts</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1474"/>
		<updated>2007-03-01T00:38:02Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;If a test scenario requires multiple scripts synchronization between the scripts is required. For example if testing a component requires to simulate a depend component it is sometimes easier to split it in multiple scripts. One script could be driving the test which launches a separate script non-blocking which simulates the depended component. &lt;br /&gt;
&lt;br /&gt;
The following example shows how communication between two scripts can be achieved using a simple client-server example. The client queries the server for date and time. The server returns a date and time string.&lt;br /&gt;
&lt;br /&gt;
The interface between the client and server is defined in a SCL file. For the example the SCL files has two interfaces, one to request information (in the example the date and time string) and one to shutdown (end) the server script. &lt;br /&gt;
&lt;br /&gt;
SCL File:&lt;br /&gt;
 #define MAX_STRING_SIZE 50&lt;br /&gt;
 int get_time(char* szTime);&lt;br /&gt;
 int shutdown(void);&lt;br /&gt;
 #ifdef _SCL&lt;br /&gt;
 #pragma scl_function(get_time)&lt;br /&gt;
 #pragma scl_ptr(get_time.szTime,  OUT,  PRIVATE)&lt;br /&gt;
 #pragma scl_string(get_time.szTime, MAX_STRING_SIZE)&lt;br /&gt;
 #pragma scl_function(shutdown)&lt;br /&gt;
 #endif /* _SCL */   &lt;br /&gt;
&lt;br /&gt;
The server scripts waits for requests, gets the time and returns requests:&lt;br /&gt;
## Used interfaces&lt;br /&gt;
my $req      = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
my $shutdown = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
&lt;br /&gt;
## teake ownership of required interfaces&lt;br /&gt;
$req-&amp;gt;Register();&lt;br /&gt;
$shutdown-&amp;gt;Register();&lt;br /&gt;
&lt;br /&gt;
## initialize exit variable&lt;br /&gt;
my $end = 0;&lt;br /&gt;
&lt;br /&gt;
## Wait for requests from clients until exit&lt;br /&gt;
while ($end == 0)&lt;br /&gt;
{&lt;br /&gt;
    ## Wait for an event&lt;br /&gt;
    my $event = $main::ascript-&amp;gt;WaitForEvent();&lt;br /&gt;
&lt;br /&gt;
    ## if the event is a get time request, get the time&lt;br /&gt;
    ## and return&lt;br /&gt;
    if ($event-&amp;gt;Name eq $req-&amp;gt;Name)&lt;br /&gt;
    {&lt;br /&gt;
        $req-&amp;gt;OutPointers-&amp;gt;{szTime} = gmctime();&lt;br /&gt;
        $req-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $req-&amp;gt;Return();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ## Shutdown event. Set the variable to exit the loop&lt;br /&gt;
    if ($event-&amp;gt;Name eq $shutdown-&amp;gt;Name)&lt;br /&gt;
    {&lt;br /&gt;
        $shutdown-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $shutdown-&amp;gt;Return();&lt;br /&gt;
        $end = 1;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Unregister ownership&lt;br /&gt;
$req-&amp;gt;Unregister();&lt;br /&gt;
$shutdown-&amp;gt;Unregister();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The client script queries the server. However it also assures that the server is running. To show how scripts can be launched and terminated the client scripts first checks if the server is running. If not it starts the server and waits until the server is ready to accept requests. This is done by waiting until the server has registered the interfaces for script communication. At the end the client script sends a shutdown request to the server to end the server script.&lt;br /&gt;
## Check if server is running&lt;br /&gt;
if (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
{&lt;br /&gt;
    ## Server not available&lt;br /&gt;
    ## As an option we can start the server here&lt;br /&gt;
    ## This might not be required in all cases but is a good sample&lt;br /&gt;
    ## on how to start another script non-blocking&lt;br /&gt;
    $main::studio-&amp;gt;Workspace-&amp;gt;Files-&amp;gt;Item(&amp;quot;server.pl&amp;quot;)-&amp;gt;RunNonBlocking();&lt;br /&gt;
&lt;br /&gt;
    ## wait for the server to be up&lt;br /&gt;
    ## An easy way is to wait until the server has taken ownership&lt;br /&gt;
    ## of the supported functions&lt;br /&gt;
    while (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
    {&lt;br /&gt;
         $main::ascript-&amp;gt;Sleep(100);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Get a shortcut to the function&lt;br /&gt;
my $req = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;User;&lt;br /&gt;
&lt;br /&gt;
## Call te function (blocking request to the server)&lt;br /&gt;
$req-&amp;gt;Call();&lt;br /&gt;
&lt;br /&gt;
## Check for the return value and display date and time&lt;br /&gt;
if ($req-&amp;gt;ReturnValue)&lt;br /&gt;
{&lt;br /&gt;
    $main::ascript-&amp;gt;MessageBox($req-&amp;gt;OutPointers-&amp;gt;szTime, &amp;quot;Current Time&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
   $main::ascript-&amp;gt;MessageBox(&amp;quot;Server returned Error&amp;quot;, &amp;quot;Error&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
## Shutdown the server (if required)&lt;br /&gt;
$main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;User-&amp;gt;Call();&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1473</id>
		<title>Studio:How to synchronize scripts</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:How_to_synchronize_scripts&amp;diff=1473"/>
		<updated>2007-03-01T00:12:17Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;nowiki&amp;gt;If a test scenario requires multiple scripts synchronization between the scripts is required. For example if testing a component requires to simulate a depend component it is sometimes easier to split it in multiple scripts. One script could be driving the test which launches a separate script non-blocking which simulates the depended component. &lt;br /&gt;
&lt;br /&gt;
The following example shows how communication between two scripts can be achieved using a simple client-server example. The client queries the server for date and time. The server returns a date and time string.&lt;br /&gt;
&lt;br /&gt;
The interface between the client and server is defined in a SCL file. For the example the SCL files has two interfaces, one to request information (in the example the date and time string) and one to shutdown (end) the server script. &lt;br /&gt;
&lt;br /&gt;
SCL File:&lt;br /&gt;
 #define MAX_STRING_SIZE 50&lt;br /&gt;
 int get_time(char* szTime);&lt;br /&gt;
 int shutdown(void);&lt;br /&gt;
 #ifdef _SCL&lt;br /&gt;
 #pragma scl_function(get_time)&lt;br /&gt;
 #pragma scl_ptr(get_time.szTime,  OUT,  PRIVATE)&lt;br /&gt;
 #pragma scl_string(get_time.szTime, MAX_STRING_SIZE)&lt;br /&gt;
 #pragma scl_function(shutdown)&lt;br /&gt;
 #endif /* _SCL */   &lt;br /&gt;
&lt;br /&gt;
The server scripts waits for requests, gets the time and returns requests:&lt;br /&gt;
## Used interfaces&lt;br /&gt;
my $req      = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
my $shutdown = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner;&lt;br /&gt;
&lt;br /&gt;
## teake ownership of required interfaces&lt;br /&gt;
$req-&amp;gt;Register();&lt;br /&gt;
$shutdown-&amp;gt;Register();&lt;br /&gt;
&lt;br /&gt;
## initialize exit variable&lt;br /&gt;
my $end = 0;&lt;br /&gt;
&lt;br /&gt;
## Wait for requests from clients until exit&lt;br /&gt;
while ($end == 0)&lt;br /&gt;
{&lt;br /&gt;
    ## Wait for an event&lt;br /&gt;
    my $event = $main::ascript-&amp;gt;WaitForEvent();&lt;br /&gt;
&lt;br /&gt;
    ## if the event is a get time request, get the time&lt;br /&gt;
    ## and return&lt;br /&gt;
    if ($event-&amp;gt;Name eq $req-&amp;gt;Name)&lt;br /&gt;
    {&lt;br /&gt;
        $req-&amp;gt;OutPointers-&amp;gt;{szTime} = gmctime();&lt;br /&gt;
        $req-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $req-&amp;gt;Return();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    ## Shutdown event. Set the variable to exit the loop&lt;br /&gt;
    if ($event-&amp;gt;Name eq $shutdown-&amp;gt;Name)&lt;br /&gt;
    {&lt;br /&gt;
        $shutdown-&amp;gt;{ReturnValue} = 1;&lt;br /&gt;
        $shutdown-&amp;gt;Return();&lt;br /&gt;
        $end = 1;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Unregister ownership&lt;br /&gt;
$req-&amp;gt;Unregister();&lt;br /&gt;
$shutdown-&amp;gt;Unregister();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The client script queries the server. However it also assures that the server is running. To show how scripts can be launched and terminated the client scripts first checks if the server is running. If not it starts the server and waits until the server is ready to accept requests. This is done by waiting until the server has registered the interfaces for script communication. At the end the client script sends a shutdown request to the server to end the server script.&lt;br /&gt;
## Check if server is running&lt;br /&gt;
if (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
{&lt;br /&gt;
    ## Server not available&lt;br /&gt;
    ## As an option we can start the server here&lt;br /&gt;
    ## This might not be required in all cases but is a good sample&lt;br /&gt;
    ## on how to start another script non-blocking&lt;br /&gt;
    $main::studio-&amp;gt;Workspace-&amp;gt;Files-&amp;gt;Item(&amp;quot;server.pl&amp;quot;)-&amp;gt;RunNonBlocking();&lt;br /&gt;
&lt;br /&gt;
    ## wait for the server to be up&lt;br /&gt;
    ## An easy way is to wait until the server has taken ownership&lt;br /&gt;
    ## of the supported functions&lt;br /&gt;
    while (!($main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;Owner-&amp;gt;IsRegistered))&lt;br /&gt;
    {&lt;br /&gt;
         $main::ascript-&amp;gt;Sleep(100);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
## Get a shortcut to the function&lt;br /&gt;
my $req = $main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;get_time&amp;quot;)-&amp;gt;User;&lt;br /&gt;
&lt;br /&gt;
## Call te function (blocking request to the server)&lt;br /&gt;
$req-&amp;gt;Call();&lt;br /&gt;
&lt;br /&gt;
## Check for the return value and display date and time&lt;br /&gt;
if ($req-&amp;gt;ReturnValue)&lt;br /&gt;
{&lt;br /&gt;
    $main::ascript-&amp;gt;MessageBox($req-&amp;gt;OutPointers-&amp;gt;szTime, &amp;quot;Current Time&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&gt;
{&lt;br /&gt;
   $main::ascript-&amp;gt;MessageBox(&amp;quot;Server returned Error&amp;quot;, &amp;quot;Error&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
## Shutdown the server (if required)&lt;br /&gt;
$main::ascript-&amp;gt;Functions-&amp;gt;Item(&amp;quot;shutdown&amp;quot;)-&amp;gt;User-&amp;gt;Call();&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:Applying_pragmas_up_and_down_type_chains&amp;diff=1432</id>
		<title>Studio:Applying pragmas up and down type chains</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:Applying_pragmas_up_and_down_type_chains&amp;diff=1432"/>
		<updated>2007-02-27T21:35:51Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== case 1 ==&lt;br /&gt;
&lt;br /&gt;
this is how we apply pragmas&lt;br /&gt;
&lt;br /&gt;
  void f(void);&lt;br /&gt;
  #pragma scl_function(f)&lt;br /&gt;
  int g(double);&lt;br /&gt;
  #pragma scl_function(g)&lt;br /&gt;
&lt;br /&gt;
== case 2 ==&lt;br /&gt;
&lt;br /&gt;
this is how we apply more pragmas&lt;br /&gt;
&lt;br /&gt;
== case 3 == &lt;br /&gt;
&lt;br /&gt;
  #pragma foo&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
	<entry>
		<id>https://www.stridewiki.com/index.php?title=Studio:Applying_pragmas_up_and_down_type_chains&amp;diff=1431</id>
		<title>Studio:Applying pragmas up and down type chains</title>
		<link rel="alternate" type="text/html" href="https://www.stridewiki.com/index.php?title=Studio:Applying_pragmas_up_and_down_type_chains&amp;diff=1431"/>
		<updated>2007-02-27T21:35:41Z</updated>

		<summary type="html">&lt;p&gt;70.167.121.110: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== case 1 ==&lt;br /&gt;
&lt;br /&gt;
this is how we apply pragmas&lt;br /&gt;
&lt;br /&gt;
  void f(void);&lt;br /&gt;
  #pragma scl_function(f)&lt;br /&gt;
  int g(double);&lt;br /&gt;
  #pragma scl_function(g)&lt;br /&gt;
&lt;br /&gt;
== case 2 ==&lt;br /&gt;
&lt;br /&gt;
this is how we apply more pragmas&lt;br /&gt;
&lt;br /&gt;
== case 3 == &lt;br /&gt;
&lt;br /&gt;
#pragma foo&lt;/div&gt;</summary>
		<author><name>70.167.121.110</name></author>
	</entry>
</feed>