|
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-0D619063-F2DB-53FC-A5E6-BC09AD915FA4" xml:lang="en"><title>Resource |
|
13 member initialisation overview</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>The resource initialiser has different forms depending on whether a single, |
|
15 simple, member is being initialised, or whether a struct or an array is being |
|
16 initialised:</p> |
|
17 <codeblock xml:space="preserve"><resource-initialiser> |
|
18 <b>resource-initialiser ::</b>= |
|
19 <member-name> [ (<length-limit>) ] = <initialiser><initialiser> |
|
20 <b>initialiser :</b>:= |
|
21 <simple-initialiser> | <struct-initialiser> | <array-initialiser></codeblock> |
|
22 <p>Resource members may be initialised by default (in the struct definition) |
|
23 or explicitly initialised (in the resource definition).</p> |
|
24 <p>In general,</p> |
|
25 <ul> |
|
26 <li id="GUID-E712BF25-9F6A-5E9E-8F85-7ACBF010F7C1"><p>If a member is initialised |
|
27 in a <codeph>RESOURCE</codeph> statement, then that is its value.</p> </li> |
|
28 <li id="GUID-FF416E99-A21F-5525-B01C-BEA51B216E25"><p>If a member is initialised |
|
29 in a <codeph>STRUCT</codeph> statement, then that is its value for all resources |
|
30 which do not explicitly initialise it.</p> </li> |
|
31 <li id="GUID-CA918017-F0C1-5E1F-8D8A-893653C2D94E"><p>If a member is <i>neither</i> initialised |
|
32 in a <codeph>RESOURCE</codeph> statement <i>nor</i> a <codeph>STRUCT</codeph> statement, |
|
33 then: <codeph>BYTE</codeph>, <codeph>WORD</codeph> and <codeph>DOUBLE</codeph> members |
|
34 contain zero; <codeph>TEXT</codeph>, <codeph>LTEXT</codeph> and <codeph>BUF</codeph> members |
|
35 contain an empty string.</p> </li> |
|
36 <li id="GUID-590BD79C-AB1B-537C-9A23-3F0902539B3A"><p>It is an error for <codeph>LINK</codeph> and <codeph>LLINK</codeph> members |
|
37 to have no explicit value, so they must be initialised, either by default |
|
38 (in the <codeph>STRUCT</codeph> statement) or explicitly (in the <codeph>RESOURCE</codeph> statement).</p> </li> |
|
39 <li id="GUID-F0C0C9CB-625B-5307-81EF-F78AC284CB0B"><p><codeph>SRLINK</codeph> members |
|
40 may not be initialised (either in the <codeph>STRUCT</codeph> statement or |
|
41 a <codeph>RESOURCE</codeph> statement) since they are automatically assigned |
|
42 the resource id of the resource in which they appear.</p> </li> |
|
43 <li id="GUID-23FBAA84-2826-5972-9D75-AEB2082A01D7"><p>Members which are themselves <codeph>STRUCT</codeph> s |
|
44 may not be default initialised. They can only be initialised in the <codeph>RESOURCE</codeph> definition. |
|
45 If they are not explicitly initialised, they will take up zero bytes in the |
|
46 resource file. For example, given the following <codeph>STRUCT</codeph> definition:</p> <codeblock id="GUID-82D529DD-EF78-56B6-96CC-D245C0C5C046" xml:space="preserve">STRUCT TEST2 |
|
47 { |
|
48 WORD value; |
|
49 STRUCT tester; |
|
50 }</codeblock> <p>The following <codeph>RESOURCE</codeph> statement only generates |
|
51 the two bytes <codeph>0xFF 0x00</codeph>.</p> <codeblock id="GUID-B97A619C-8299-5FC9-AD49-658F21568E2F" xml:space="preserve">RESOURCE TEST2 item |
|
52 { |
|
53 value=255; |
|
54 }</codeblock> </li> |
|
55 </ul> |
|
56 </conbody></concept> |