Java Doc for C.java in  » Parser » Rats-Parser-Generators » xtc » type » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Parser » Rats Parser Generators » xtc.type 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   xtc.type.C

C
public class C (Code)
Common type operations for the C language.
author:
   Robert Grimm
version:
   $Revision: 1.30 $


Field Summary
final protected  BigIntegerFACTOR_CHAR
     The factor for chars.
final protected  BigIntegerFACTOR_WIDE
     The factor for wide chars.
final public static  IntegerTIMPLICIT
     The canonical implicit int type.
final protected static  NumberT.KindKIND_PTR_DIFF
     The integer kind of the pointer difference type.
final protected static  NumberT.KindKIND_SIZEOF
     The integer kind of the sizeof type.
final protected static  NumberT.KindKIND_WCHAR
     The number kind of the wchar_t type.
final public static  IntegerTPTR_DIFF
     The canonical pointer difference type.
final public static  IntegerTSIZEOF
     The canonical sizeof type.
final public static  IntegerTWCHAR
     The canonical wide char type.

Constructor Summary
public  C()
     Create a new instance.

Method Summary
public  Typecompose(Type t1, Type t2, boolean pedantic)
     Compose the specified types.
protected  Typecompose(Type t1, Type t2, boolean pedantic, boolean recursive)
     Compose the specified types.
Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type.
Parameters:
  pedantic - The flag for pedantic composition.
Parameters:
  recursive - The flag for recursive invocations.
protected  TypecomposeArrays(ArrayT a1, ArrayT a2)
     Compose the specified array types (C99 6.2.7).
Parameters:
  a1 - The first array.
Parameters:
  a2 - The second array.
protected  TypecomposeFunctions(FunctionT f1, FunctionT f2, boolean pedantic)
     Compose the specified function types (C99 6.2.7).
public  Typeconvert(Type t1, Type t2)
     Perform the usual arithmetic conversions.
public  booleanequal(Type t1, Type t2)
     Determine whether the specified types are equal to each other. Calling this method on types t1 and t2 is equivalent to:
 C.hasSameQualifiers(t1, t2) && (! C.compose(t1, t2).isError())
 

Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type.
public  booleanfits(BigInteger number, Type type)
     Determine whether the specified number fits the specified integer type.
Parameters:
  number - The number.
Parameters:
  type - The integer type.
protected  longgetAligned(Type type)
     Get the specified type's alignment.
public  longgetAlignment(Type type)
     Get the specified type's alignment in bytes.
Parameters:
  type - The type.
public  longgetAlignment(Type type, boolean natural)
     Get the specified type's alignment in bytes.
Parameters:
  type - The type.
Parameters:
  natural - The flag for determining the natural alignment.
public  ReferencegetConstRef(Type type)
     Get the specified type's constant reference.
Parameters:
  type - The type.
public  longgetSize(Type type)
     Get the specified type's size in bytes.
Parameters:
  type - The type.
protected  longgetSize(StructT type)
     Get the specified struct's size in bytes.
Parameters:
  type - The struct.
public  longgetWidth(Type number)
     Get the specified number's size in bits.
Parameters:
  number - The number.
public  booleanhasConstRef(Type type)
     Determine whether this type has a constant reference.
public  booleanhasQualifiers(Type type)
     Determine whether the specified type has any qualifiers.
Parameters:
  type - The type.
public  booleanhasQualifiers(Type type, Type template)
     Determine whether the specified type has at least the qualifiers of the specified template.
Parameters:
  type - The type.
Parameters:
  template - The template.
public  booleanhasSameQualifiers(Type type, Type template)
     Determine whether the specified type has the same qualifiers as the specified template.
Parameters:
  type - The type.
Parameters:
  template - The template.
public  booleanhasTrailingArray(Type type)
     Determine whether the specified type has a trailing array.
public  booleanisArithmetic(Type type)
     Determine whether the specified type is arithmetic.
Parameters:
  type - The type.
public  booleanisChar(Type type)
     Determine whether the specified type is a char.
Parameters:
  type - The type.
public  booleanisConstant(Type type)
     Determine whether the specified type is qualified as constant. Consistent with C99 6.3.2.1, this method checks whether the type has a Constants.ATT_CONSTANT attribute and, if it is an array, struct, or union, whether any member or element of the type has that attribute.
Parameters:
  type - The type.
public  booleanisIncomplete(Type type)
     Determine whether the specified type is incomplete.

Per C99 6.2.5, a type is incomplete if it does not contain sufficient information for determining its size.

public  booleanisIntegral(Type type)
     Determine whether the specified type is integral.
Parameters:
  type - The type.
public  booleanisModifiable(Type type)
     Determine whether the specified type represents a modifiable lvalue.
protected  booleanisPacked(Type type)
     Determine whether the specified type has a GCC packed attribute.
Parameters:
  type - The type.
public  booleanisReal(Type type)
     Determine whether the specified type is real.
Parameters:
  type - The type.
public  booleanisScalar(Type type)
     Determine whether the specified type is scalar.
Parameters:
  type - The type.
public  booleanisString(Type type)
     Determine whether the specified type is a string.
Parameters:
  type - The type.
public  booleanisVariablyModified(Type type)
     Determine whether the specified type is variably modified. Consistent with C99 6.7.5-3, this method checks whether the type contains a variable length array type.
Parameters:
  type - The type.
public  booleanisWideChar(Type type)
     Determine whether the specified type is a wide char.
Parameters:
  type - The type.
public  booleanisWideString(Type type)
     Determine whether the specified type is a wide string.
Parameters:
  type - The type.
public  BigIntegermask(BigInteger number, Type type)
     Mask the specified number as a value of this integer type.
Parameters:
  number - The number.
Parameters:
  type - The type.
public  Typepointerize(Type type)
     Pointerize the specified type.
public  Typepromote(Type type)
     Integer promote the specified type.
public  TypepromoteArgument(Type type)
     Argument promote this type.
public  Typequalify(Type type, Type template)
     Qualify the specified type with the qualifiers of the specified template.
public  Typereattribute(Type type, Type template)
     Reattribute the specified type with the specified template's GCC attributes.
Parameters:
  type - The type.
Parameters:
  template - The template.
public  StringtoDesignation(Type type)
     Get the specified type's designation.
Parameters:
  type - The type.
public  TypetoRValue(Type type)
     Convert the specified type to an rvalue.
public  TypetypeCharacter(String literal)
     Type the specified C character literal.
public  TypetypeFloat(String literal)
     Type the specified floating point literal.
public  TypetypeInteger(String literal)
     Type the specified integer literal.

Field Detail
FACTOR_CHAR
final protected BigInteger FACTOR_CHAR(Code)
The factor for chars.



FACTOR_WIDE
final protected BigInteger FACTOR_WIDE(Code)
The factor for wide chars.



IMPLICIT
final public static IntegerT IMPLICIT(Code)
The canonical implicit int type. In K&R C, a missing type specifier is treated as an int. We preserve knowledge about this lack of type specifier through this type, which has a Constants.ATT_IMPLICIT attribute.



KIND_PTR_DIFF
final protected static NumberT.Kind KIND_PTR_DIFF(Code)
The integer kind of the pointer difference type.



KIND_SIZEOF
final protected static NumberT.Kind KIND_SIZEOF(Code)
The integer kind of the sizeof type.



KIND_WCHAR
final protected static NumberT.Kind KIND_WCHAR(Code)
The number kind of the wchar_t type.



PTR_DIFF
final public static IntegerT PTR_DIFF(Code)
The canonical pointer difference type.



SIZEOF
final public static IntegerT SIZEOF(Code)
The canonical sizeof type.



WCHAR
final public static IntegerT WCHAR(Code)
The canonical wide char type.




Constructor Detail
C
public C()(Code)
Create a new instance.




Method Detail
compose
public Type compose(Type t1, Type t2, boolean pedantic)(Code)
Compose the specified types. This method determines whether the two types are compatible while also constructing a composite type as specified in C99 6.2.7. If the types are compatible, the resulting type is wrapped exactly as the first type. If the types are not compatible, the resulting type is ErrorT.TYPE .

Note that if both types are derived types, this method ensures that any referenced types have the same qualifiers. However, it does not ensure that the two types have the same qualifiers. As a result, two types t1 and t2 are compatible if:

 C.hasSameQualfiers(t1, t2) && (! C.compose(t1, t2).isError())
 

Further note that the composed type does not preserve any annotations or wraped types and thus needs to be annotated with the two type's qualifiers etc.
See Also:   C.equal(Type,Type)
Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type.
Parameters:
  pedantic - The flag for pedantic composition. The composed type.




compose
protected Type compose(Type t1, Type t2, boolean pedantic, boolean recursive)(Code)
Compose the specified types.
Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type.
Parameters:
  pedantic - The flag for pedantic composition.
Parameters:
  recursive - The flag for recursive invocations. The composed type.



composeArrays
protected Type composeArrays(ArrayT a1, ArrayT a2)(Code)
Compose the specified array types (C99 6.2.7).
Parameters:
  a1 - The first array.
Parameters:
  a2 - The second array. The composed type.



composeFunctions
protected Type composeFunctions(FunctionT f1, FunctionT f2, boolean pedantic)(Code)
Compose the specified function types (C99 6.2.7). Note that this method ignores any exceptions, which are not part of the C language anyway.
Parameters:
  f1 - The first function.
Parameters:
  f2 - The second function.
Parameters:
  pedantic - The flag for pedantic composition. The composed type.



convert
public Type convert(Type t1, Type t2)(Code)
Perform the usual arithmetic conversions. Per C99 6.3.1.8, this method performs the usual arithmetic conversions for the specified two types and returns the type of the corresponding result.
Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type. The converted type.
throws:
  IllegalArgumentException - Signals that either type isnot arithmetic.



equal
public boolean equal(Type t1, Type t2)(Code)
Determine whether the specified types are equal to each other. Calling this method on types t1 and t2 is equivalent to:
 C.hasSameQualifiers(t1, t2) && (! C.compose(t1, t2).isError())
 

Parameters:
  t1 - The first type.
Parameters:
  t2 - The second type. true if the types are equal.



fits
public boolean fits(BigInteger number, Type type)(Code)
Determine whether the specified number fits the specified integer type.
Parameters:
  number - The number.
Parameters:
  type - The integer type. true if the number fits the type.



getAligned
protected long getAligned(Type type)(Code)
Get the specified type's alignment. If the specified type has a GCC aligned attribute, this method returns the corresponding alignment. Otherwise, it returns -1.
Parameters:
  type - The type. The alignment or -1 if the type does not have an alignedattribute.



getAlignment
public long getAlignment(Type type)(Code)
Get the specified type's alignment in bytes.
Parameters:
  type - The type. The type's alignment.
throws:
  IllegalArgumentException - Signals that the type does nothave a static alignment.



getAlignment
public long getAlignment(Type type, boolean natural)(Code)
Get the specified type's alignment in bytes.
Parameters:
  type - The type.
Parameters:
  natural - The flag for determining the natural alignment. The type's alignment.
throws:
  IllegalArgumentException - Signals that the type does not have a static alignment.



getConstRef
public Reference getConstRef(Type type)(Code)
Get the specified type's constant reference.
Parameters:
  type - The type. The constant reference.
throws:
  IllegalArgumentException - Signals that the type does nothave a constant reference.



getSize
public long getSize(Type type)(Code)
Get the specified type's size in bytes.
Parameters:
  type - The type. The type's size.
throws:
  IllegalArgumentException - Signals that the type does nothave a static size.



getSize
protected long getSize(StructT type)(Code)
Get the specified struct's size in bytes.
Parameters:
  type - The struct. The struct's size.
throws:
  IllegalArgumentException - Signals that the struct does nothave a static size.



getWidth
public long getWidth(Type number)(Code)
Get the specified number's size in bits.
Parameters:
  number - The number. The size in bits.



hasConstRef
public boolean hasConstRef(Type type)(Code)
Determine whether this type has a constant reference. This method takes the pointer decay of arrays and functions into account and returns true either if the specified type has a constant reference or if this type is an array or function and has a constant reference.
Parameters:
  type - The type. true if the type has a constant reference.



hasQualifiers
public boolean hasQualifiers(Type type)(Code)
Determine whether the specified type has any qualifiers.
Parameters:
  type - The type. true if the type has any qualifiers.



hasQualifiers
public boolean hasQualifiers(Type type, Type template)(Code)
Determine whether the specified type has at least the qualifiers of the specified template.
Parameters:
  type - The type.
Parameters:
  template - The template. true if the type has at least the template'squalifiers.



hasSameQualifiers
public boolean hasSameQualifiers(Type type, Type template)(Code)
Determine whether the specified type has the same qualifiers as the specified template.
Parameters:
  type - The type.
Parameters:
  template - The template. true if the type has the same qualifiersas the template.



hasTrailingArray
public boolean hasTrailingArray(Type type)(Code)
Determine whether the specified type has a trailing array. This method checks whether the specified type is either a struct type with an incomplete array as its last member or a union containing such a member.
Parameters:
  type - The type. true if the type has a trailing array.



isArithmetic
public boolean isArithmetic(Type type)(Code)
Determine whether the specified type is arithmetic.
Parameters:
  type - The type. true if the specified type is arithmetic.



isChar
public boolean isChar(Type type)(Code)
Determine whether the specified type is a char.
Parameters:
  type - The type. true if the type is a char.



isConstant
public boolean isConstant(Type type)(Code)
Determine whether the specified type is qualified as constant. Consistent with C99 6.3.2.1, this method checks whether the type has a Constants.ATT_CONSTANT attribute and, if it is an array, struct, or union, whether any member or element of the type has that attribute.
Parameters:
  type - The type. true if the specified type is constantqualified.



isIncomplete
public boolean isIncomplete(Type type)(Code)
Determine whether the specified type is incomplete.

Per C99 6.2.5, a type is incomplete if it does not contain sufficient information for determining its size. However, per C99 6.7.2.1, a struct type with more than one named member may have an incomplete type as its last member, while still being considered complete.
Parameters:
  type - The type. true if the type is incomplete.




isIntegral
public boolean isIntegral(Type type)(Code)
Determine whether the specified type is integral.
Parameters:
  type - The type. true if the specified type is integral.



isModifiable
public boolean isModifiable(Type type)(Code)
Determine whether the specified type represents a modifiable lvalue. Consistent with C99 6.3.2.1, this method checks that the type represents an lvalue, is not incomplete, and is not qualified as constant. For struct and union types, this method also checks that no member is qualified as constant.
Parameters:
  type - The type. true if the type represents a modifiablelvalue.



isPacked
protected boolean isPacked(Type type)(Code)
Determine whether the specified type has a GCC packed attribute.
Parameters:
  type - The type. true if the type has a packed attribute.



isReal
public boolean isReal(Type type)(Code)
Determine whether the specified type is real.
Parameters:
  type - The type. true if the specified type is real.



isScalar
public boolean isScalar(Type type)(Code)
Determine whether the specified type is scalar.
Parameters:
  type - The type. true if the specified type is scalar.



isString
public boolean isString(Type type)(Code)
Determine whether the specified type is a string.
Parameters:
  type - The type. true if the type is a string.



isVariablyModified
public boolean isVariablyModified(Type type)(Code)
Determine whether the specified type is variably modified. Consistent with C99 6.7.5-3, this method checks whether the type contains a variable length array type.
Parameters:
  type - The type. true if the type is variably modified.



isWideChar
public boolean isWideChar(Type type)(Code)
Determine whether the specified type is a wide char.
Parameters:
  type - The type. true if the type is a wide char.



isWideString
public boolean isWideString(Type type)(Code)
Determine whether the specified type is a wide string.
Parameters:
  type - The type. true if the type is a wide string.



mask
public BigInteger mask(BigInteger number, Type type)(Code)
Mask the specified number as a value of this integer type.
Parameters:
  number - The number.
Parameters:
  type - The type. The number masked as a value of this type.



pointerize
public Type pointerize(Type type)(Code)
Pointerize the specified type. This method resolves the type and, if the type is an array or function, then performs C's pointer decay (C99 6.3.2.1).
Parameters:
  type - The type. The pointerized type.



promote
public Type promote(Type type)(Code)
Integer promote the specified type. This method resolves the type and, if the type is integral, then performs C's integer promotion (C99 6.3.1.1). Additionally, it normalizes implicit and signed int types to int types.
Parameters:
  type - The type. The integer promoted type.



promoteArgument
public Type promoteArgument(Type type)(Code)
Argument promote this type. This method resolves the type and, if the type is an integral type or a float, then performs C's default argument promotions (C99 6.5.2.2).
Parameters:
  type - The type. The argument promoted type.



qualify
public Type qualify(Type type, Type template)(Code)
Qualify the specified type with the qualifiers of the specified template. If the template has any qualifiers, this method first Type.annotate annotates the specified type first.
Parameters:
  type - The type.
Parameters:
  template - The template. The qualified type.



reattribute
public Type reattribute(Type type, Type template)(Code)
Reattribute the specified type with the specified template's GCC attributes.
Parameters:
  type - The type.
Parameters:
  template - The template. The reattributed type.



toDesignation
public String toDesignation(Type type)(Code)
Get the specified type's designation.
Parameters:
  type - The type. The designation.



toRValue
public Type toRValue(Type type)(Code)
Convert the specified type to an rvalue. If the specified type has a shape, this method returns the resolved type, annotated with any qualifiers and constant value. Otherwise, it returns the specified type.
Parameters:
  type - The type. The type as an rvalue.



typeCharacter
public Type typeCharacter(String literal)(Code)
Type the specified C character literal. This method determines the type for the specified character literal, which may be a wide character literal, and returns that type. The type is annotated with the literal's constant value, even if the value does not fit the type.
Parameters:
  literal - The literal. The corresponding constant valued type.



typeFloat
public Type typeFloat(String literal)(Code)
Type the specified floating point literal. This method returns the type for the specified C floating point literal wrapped in the literal's constant value.
Parameters:
  literal - The literal. The corresponding type.



typeInteger
public Type typeInteger(String literal)(Code)
Type the specified integer literal. This method returns the type for the specified C integer literal wrapped in the literal's constant value. If the specified literal does not fit any type, this method returns the largest appropriate type.
Parameters:
  literal - The literal. The corresponding type and constant value.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.