Symbian3/SDK/Source/GUID-3C2E0C1A-DC7A-55F7-8005-39CEE71CD0A0.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-3C2E0C1A-DC7A-55F7-8005-39CEE71CD0A0" xml:lang="en"><title>Emulating
       
    13 stdin/stdout/stderr in STDLIB</title><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>This section briefly describes the process of emulating in STDLIB. </p>
       
    15 <section><title>Simple Mode - CCLocalSystemInterface</title><p>The following
       
    16 are the steps to emulate in simple mode: </p> <ol id="GUID-726C67E0-2339-5E20-9F44-3A2C821CFD7F">
       
    17 <li id="GUID-2E5FBA33-8E7B-5B08-A3AE-B22BE011C95D"><p>Create a single <codeph>CTtyDesc</codeph> object
       
    18 per thread and an instance of the basic console object. </p> </li>
       
    19 <li id="GUID-C4A3FBCF-2595-5E2C-8B30-BAC50502CCC0"><p>Attach the <codeph>CTtyDesc</codeph> object
       
    20 to <codeph>stdin</codeph>, <codeph>stdout</codeph> and <codeph>stderr</codeph>. </p> </li>
       
    21 <li id="GUID-09A00AD2-D349-531E-98FF-108CBE2C84B2"><p>Pass the Requests made
       
    22 on <codeph>stdin</codeph>, <codeph>stdout</codeph> and <codeph>stderr</codeph> to <codeph>CTtyDesc</codeph>. </p> </li>
       
    23 </ol> <p>There is a separate console per thread. Therefore, output is spread
       
    24 over a number of different consoles. </p> </section>
       
    25 <section><title>Complex Mode - CProcessSystemInterface</title><p>The following
       
    26 are the steps to emulate in complex mode: </p> <ol id="GUID-1515247F-07E1-53E9-9479-1B2F1D4C0F61">
       
    27 <li id="GUID-4803D30B-CB4D-5153-85CB-C7EE0CDA074D"><p>Start the POSIX server
       
    28 in the <codeph>crt0</codeph> glue code. </p> </li>
       
    29 <li id="GUID-A5F9DB72-C223-52F6-B24F-C3923CE801EF"><p>Create either a single
       
    30 instance of <codeph>CW32StreamDesc</codeph> or <codeph>CReDirDesc</codeph> in
       
    31 the POSIX server. </p> </li>
       
    32 <li id="GUID-F2D23AC7-A08C-5A1A-A4F0-410D8D14ABBE"><p>Attach it to <codeph>stdin</codeph>, <codeph>stdout</codeph> and <codeph>stderr</codeph>,
       
    33 which is used by all threads. </p> <p>Requests made on <codeph>stdin</codeph>, <codeph>stdout</codeph> and <codeph>stderr</codeph> are
       
    34 passed to the attached descriptor object. </p> </li>
       
    35 <li id="GUID-AAEC5A86-21D6-56DA-A834-A2C1743881E7"><p>Use <codeph>CW32StreamDesc</codeph> for
       
    36 the emulator only if the <codeph>RWin32Stream</codeph> server was started
       
    37 in the <codeph>crt0</codeph> glue code. </p> <p>If <codeph>CW32StreamDesc</codeph> cannot
       
    38 be used or code is compiled for hardware, then use<codeph>CRedirDesc</codeph> instead. </p> </li>
       
    39 <li id="GUID-31BC5DCD-4F01-5116-A139-123DBC4E217F"><p> <codeph>CReDirDesc</codeph> connects
       
    40 and passes the request to a redirection server. If connection fails the output
       
    41 to <codeph>stdout</codeph> and <codeph>stderr</codeph> is lost. Nothing is
       
    42 read from <codeph>stdin</codeph>. </p> </li>
       
    43 <li id="GUID-1A43C2BC-04D7-5DCF-84E6-CDC53F657564"><p>The client application
       
    44 (for example, Java RT or the Test application) starts the redirection server.
       
    45 The client also provides an implementation of <codeph>CStreamFactoryBase2</codeph>.
       
    46 This implementation deals with standard I/O data in a customised way. </p> </li>
       
    47 </ol> <p><b> Stdin/stdout on emulator in complex mode</b> </p> <p>A text EXE
       
    48 running on the emulator can either use the <codeph>wcrt0.lib</codeph> or <codeph>wwcrt0.lib</codeph> crt0
       
    49 libraries. These automatically start the <codeph>RWin32Stream</codeph> server
       
    50 to redirect <codeph>stdin</codeph>, <codeph>stdout</codeph> and <codeph>stderr</codeph> to
       
    51 the Win32 console. </p> <p><b>Stdin/stdout on hardware in complex mode</b> </p> <p>A
       
    52 test EXE running on target hardware has no default console. The test application
       
    53 requires application/client specific C++ code to be written to create a new
       
    54 thread and call <codeph>CRedirServer2::NewL()</codeph> to start the redirection
       
    55 server along with client specific derived classes to plumb the I/O to wherever
       
    56 it is required. The POSIX server will then connect to this server when stdXXX
       
    57 streams are used. </p></section>
       
    58 </conbody></concept>