1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

Add JavaDoc.

Formatted public interfaces.
Restructured some public interfaces.
This commit is contained in:
John Camelon 2005-03-12 19:08:58 +00:00
parent 35791e2486
commit c0a8eb9c01
22 changed files with 420 additions and 137 deletions

View file

@ -16,9 +16,26 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
/**
* This subclass of ASTVisitor that allows for better control in traversing C.
*
* @ref ASTVisitor
* @author jcamelon
*/
public abstract class CASTVisitor extends ASTVisitor { public abstract class CASTVisitor extends ASTVisitor {
public boolean shouldVisitDesignators = false; /**
* Override this value in your subclass if you do wish to visit designators.
*/
public boolean shouldVisitDesignators = false;
public int visit( ICASTDesignator designator ) { return PROCESS_CONTINUE; } /**
* Function to override if you wish to visit designators in your
* implementation.
*
* @param designator
* @return
*/
public int visit(ICASTDesignator designator) {
return PROCESS_CONTINUE;
}
} }

View file

@ -13,13 +13,33 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpression;
/** /**
* C-style array designator. e.g. struct ABC { int def[10] }; struct ABC
* instance = { def[0] = 9 };
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTArrayDesignator extends ICASTDesignator { public interface ICASTArrayDesignator extends ICASTDesignator {
public static final ASTNodeProperty SUBSCRIPT_EXPRESSION = new ASTNodeProperty( "Subscript Expression" ); //$NON-NLS-1$ /**
* <code>SUBSCRIPT_EXPRESSION</code> represents the relationship between
* the designator and the subscript expression.
*/
public static final ASTNodeProperty SUBSCRIPT_EXPRESSION = new ASTNodeProperty(
"Subscript Expression"); //$NON-NLS-1$
public IASTExpression getSubscriptExpression(); /**
public void setSubscriptExpression( IASTExpression value ); * Get the subsript expression.
*
* @return value <code>IASTExpression</code>
*/
public IASTExpression getSubscriptExpression();
/**
* Set the subscript expression.
*
* @param value
* <code>IASTExpression</code>
*/
public void setSubscriptExpression(IASTExpression value);
} }

View file

@ -12,19 +12,85 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier; import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
/** /**
* This interface represents the role of a C array modifier. C allows for
* modifiers (const, restrict, etc.) as well as variable sized arrays.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTArrayModifier extends IASTArrayModifier { public interface ICASTArrayModifier extends IASTArrayModifier {
public boolean isConst(); /**
public boolean isStatic(); * Is the const modifier used?
public boolean isRestrict(); *
public boolean isVolatile(); * @return boolean
*/
public boolean isConst();
public void setConst( boolean value ); /**
public void setVolatile( boolean value ); * Is the static modifier used?
public void setRestrict( boolean value ); *
public void setStatic( boolean value ); * @return boolean
public boolean isVariableSized(); */
public void setVariableSized( boolean value ); public boolean isStatic();
/**
* Is the restrict modifier used?
*
* @return boolean
*/
public boolean isRestrict();
/**
* Is the volatile modifier used?
*
* @return boolean
*/
public boolean isVolatile();
/**
* Set true/false that the const modifier is used.
*
* @param value
* boolean
*/
public void setConst(boolean value);
/**
* Set true/false that the volatile modifier is used.
*
* @param value
* boolean
*/
public void setVolatile(boolean value);
/**
* Set true/false that the restrict modifier is used.
*
* @param value
* boolean
*/
public void setRestrict(boolean value);
/**
* Set true/false that the static modifier is used.
*
* @param value
* boolean
*/
public void setStatic(boolean value);
/**
* Is the array variable sized? ( used ... )
*
* @return boolean
*/
public boolean isVariableSized();
/**
* Set the array to be variable sized dependent upon value.
*
* @param value
* boolean
*/
public void setVariableSized(boolean value);
} }

View file

@ -12,9 +12,11 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
/** /**
* Structs and Unions in C can be qualified w/restrict keyword.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTCompositeTypeSpecifier extends public interface ICASTCompositeTypeSpecifier extends
IASTCompositeTypeSpecifier, ICASTDeclSpecifier { IASTCompositeTypeSpecifier, ICASTDeclSpecifier {
} }

View file

@ -13,13 +13,24 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
/** /**
* C extension to IASTDeclSpecifier. (restrict keyword)
*
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface ICASTDeclSpecifier extends IASTDeclSpecifier { public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
// Extra type qualifier in C /**
* Is restrict keyword used?
*
* @return boolean
*/
public boolean isRestrict(); public boolean isRestrict();
public void setRestrict( boolean value ); /**
* Set restrict to value.
*
* @param value
*/
public void setRestrict(boolean value);
} }

View file

@ -14,17 +14,62 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTInitializer;
/** /**
* This interface represents a designated initializer. e.g. struct x y = { .z=4,
* .t[1] = 3 };
*
* @author jcamelon * @author jcamelon
*
*/ */
public interface ICASTDesignatedInitializer extends public interface ICASTDesignatedInitializer extends IASTInitializer {
IASTInitializer {
public static final ICASTDesignator [] EMPTY_DESIGNATOR_ARRAY = new ICASTDesignator[0]; /**
public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty( "Designator"); //$NON-NLS-1$ * Constant.
public void addDesignator( ICASTDesignator designator ); */
public ICASTDesignator [] getDesignators(); public static final ICASTDesignator[] EMPTY_DESIGNATOR_ARRAY = new ICASTDesignator[0];
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "RHS Initializer"); //$NON-NLS-1$ /**
public IASTInitializer getOperandInitializer(); * <code>DESIGNATOR</code> represents the relationship between an
public void setOperandInitializer( IASTInitializer rhs ); * <code>ICASTDesignatedInitializer</code> and
* <code>ICASTDesignator</code>.
*/
public static final ASTNodeProperty DESIGNATOR = new ASTNodeProperty(
"Designator"); //$NON-NLS-1$
/**
* Add a designator to this initializer.
*
* @param designator
* <code>ICASTDesignator</code>
*/
public void addDesignator(ICASTDesignator designator);
/**
* Get all of the designators.
*
* @return <code>ICASTDesignator []</code>
*/
public ICASTDesignator[] getDesignators();
/**
* <code>OPERAND</code> represents the relationship between
* <code>ICASTDesignatedInitializer</code> and its
* <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty OPERAND = new ASTNodeProperty(
"RHS Initializer"); //$NON-NLS-1$
/**
* Get the nested initializer.
*
* @return <code>IASTInitializer</code>
*/
public IASTInitializer getOperandInitializer();
/**
* Set the nested initializer.
*
* @param rhs
* <code>IASTInitializer</code>
*/
public void setOperandInitializer(IASTInitializer rhs);
} }

View file

@ -12,10 +12,10 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
/** /**
* Base interface for all C-style designators.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTDesignator extends IASTNode { public interface ICASTDesignator extends IASTNode {
} }

View file

@ -12,9 +12,12 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
/** /**
* C's elaborated type specifier. (same as IASTElaboratedTypeSpecifier, except
* for the addition of the restrict keyword.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTElaboratedTypeSpecifier extends public interface ICASTElaboratedTypeSpecifier extends
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier { IASTElaboratedTypeSpecifier, ICASTDeclSpecifier {
} }

View file

@ -12,9 +12,11 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
/** /**
* C Enumeration decl specifier. Allows for "restrict enum X { a, b, c };
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier, public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
IASTEnumerationSpecifier { IASTEnumerationSpecifier {
} }

View file

@ -13,12 +13,31 @@ import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTName;
/** /**
* Specific Designator that represents a field reference.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTFieldDesignator extends ICASTDesignator { public interface ICASTFieldDesignator extends ICASTDesignator {
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty( "Designator Field Name"); //$NON-NLS-1$ /**
* <code>FIELD_NAME</code> represent the relationship between an
* <code>ICASTFieldDesignator</code> and an <code>IASTName</code>.
*/
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty(
"Designator Field Name"); //$NON-NLS-1$
public IASTName getName(); /**
public void setName( IASTName name ); * Get the field name.
*
* @return <code>IASTName</code>
*/
public IASTName getName();
/**
* Set the field name.
*
* @param name
* <code>IASTName</code>
*/
public void setName(IASTName name);
} }

View file

@ -12,11 +12,24 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTPointer; import org.eclipse.cdt.core.dom.ast.IASTPointer;
/** /**
* C-specific pointer. (includes restrict modifier).
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTPointer extends IASTPointer { public interface ICASTPointer extends IASTPointer {
boolean isRestrict(); /**
void setRestrict( boolean value ); * Is this a restrict pointer?
*
* @return isRestrict boolean
*/
boolean isRestrict();
/**
* Set this pointer to be restrict pointer.
*
* @param value
*/
void setRestrict(boolean value);
} }

View file

@ -17,16 +17,44 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier, ICASTDeclSpecifier { public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier,
ICASTDeclSpecifier {
// Extra types in C // Extra types in C
/**
* <code>t_Bool</code> boolean. e.g. _Bool x;
*/
public static final int t_Bool = IASTSimpleDeclSpecifier.t_last + 1; public static final int t_Bool = IASTSimpleDeclSpecifier.t_last + 1;
/**
* <code>t_Complex</code> complex number. e.g. _Complex t;
*/
public static final int t_Complex = IASTSimpleDeclSpecifier.t_last + 2; public static final int t_Complex = IASTSimpleDeclSpecifier.t_last + 2;
/**
* <code>t_Imaginary</code> complex imaginary number. e.g. _Imaginr
*/
public static final int t_Imaginary = IASTSimpleDeclSpecifier.t_last + 3; public static final int t_Imaginary = IASTSimpleDeclSpecifier.t_last + 3;
public boolean isLongLong(); /**
public void setLongLong( boolean value ); * <code>t_last</code> is defined for sub-interfaces.
*/
public static final int t_last = t_Imaginary; public static final int t_last = t_Imaginary;
// allow for long long's
/**
* Is long long?
*
* @return boolean
*/
public boolean isLongLong();
/**
* Set long long to be 'value'.
*
* @param value
* boolean
*/
public void setLongLong(boolean value);
} }

View file

@ -15,16 +15,55 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializer;
import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeId;
/** /**
* C Expression of the format type-id { initializer }
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTTypeIdInitializerExpression extends IASTExpression { public interface ICASTTypeIdInitializerExpression extends IASTExpression {
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "TypeId"); //$NON-NLS-1$ /**
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Initializer"); //$NON-NLS-1$ * <code>TYPE_ID</code> represents the relationship between an
* <code>ICASTTypeIdInitializerExpression</code> and
* <code>IASTTypeId</code>.
*/
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("TypeId"); //$NON-NLS-1$
public IASTTypeId getTypeId(); /**
public void setTypeId( IASTTypeId typeId ); * <code>INITIALIZER</code> represents the relationship between an
public IASTInitializer getInitializer(); * <code>ICASTTypeIdInitializerExpression</code> and
public void setInitializer( IASTInitializer initializer ); * <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
"Initializer"); //$NON-NLS-1$
/**
* Get the type-id.
*
* @return <code>IASTTypeId</code>
*/
public IASTTypeId getTypeId();
/**
* Set the typeId.
*
* @param typeId
* <code>IASTTypeId</code>
*/
public void setTypeId(IASTTypeId typeId);
/**
* Get the initializer.
*
* @return <code>IASTInitializer</code>
*/
public IASTInitializer getInitializer();
/**
* Set the initializer.
*
* @param initializer
* <code>IASTInitializer</code>
*/
public void setInitializer(IASTInitializer initializer);
} }

View file

@ -12,9 +12,12 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
/** /**
* This interface is just as an IASTNamedTypeSpecifier, except that it also
* includes the abiliy to use the restrict modifier.
*
* @author jcamelon * @author jcamelon
*/ */
public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier, public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier,
ICASTDeclSpecifier { ICASTDeclSpecifier {
} }

View file

@ -18,8 +18,12 @@ import org.eclipse.cdt.core.dom.ast.IArrayType;
*/ */
public interface ICArrayType extends IArrayType { public interface ICArrayType extends IArrayType {
public boolean isConst() throws DOMException; public boolean isConst() throws DOMException;
public boolean isRestrict() throws DOMException; public boolean isRestrict() throws DOMException;
public boolean isVolatile() throws DOMException; public boolean isVolatile() throws DOMException;
public boolean isStatic() throws DOMException; public boolean isStatic() throws DOMException;
public boolean isVariableLength() throws DOMException; public boolean isVariableLength() throws DOMException;
} }

View file

@ -22,7 +22,9 @@ import org.eclipse.cdt.core.dom.ast.IBasicType;
public interface ICBasicType extends IBasicType { public interface ICBasicType extends IBasicType {
// Extra types in C // Extra types in C
public static final int t_Bool = ICASTSimpleDeclSpecifier.t_Bool; public static final int t_Bool = ICASTSimpleDeclSpecifier.t_Bool;
public static final int t_Complex = ICASTSimpleDeclSpecifier.t_Complex; public static final int t_Complex = ICASTSimpleDeclSpecifier.t_Complex;
public static final int t_Imaginary = ICASTSimpleDeclSpecifier.t_Imaginary; public static final int t_Imaginary = ICASTSimpleDeclSpecifier.t_Imaginary;
public boolean isLongLong() throws DOMException; public boolean isLongLong() throws DOMException;

View file

@ -21,12 +21,13 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
* @author aniefer * @author aniefer
*/ */
public interface ICCompositeTypeScope extends ICScope { public interface ICCompositeTypeScope extends ICScope {
/** /**
* get the binding for the member that has been previous added to this scope * get the binding for the member that has been previous added to this scope
* and that matches the given name. * and that matches the given name.
* @param name *
* @return * @param name
* @throws DOMException * @return
*/ * @throws DOMException
public IBinding getBinding( char[] name ) throws DOMException; */
public IBinding getBinding(char[] name) throws DOMException;
} }

View file

@ -17,9 +17,9 @@ package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IBinding;
/** /**
* This interface represents a binding for a function or variable that * This interface represents a binding for a function or variable that is
* is assumed to exist in another compilation unit and that would be found * assumed to exist in another compilation unit and that would be found at link
* at link time. * time.
* *
* @author aniefer * @author aniefer
*/ */

View file

@ -23,21 +23,22 @@ import org.eclipse.cdt.core.dom.ast.IScope;
*/ */
public interface ICFunctionScope extends ICScope { public interface ICFunctionScope extends ICScope {
/** /**
* Get the scope representing the function body . * Get the scope representing the function body . returns null if there is
* returns null if there is no function definition * no function definition
* @return *
* @throws DOMException * @return
*/ * @throws DOMException
public IScope getBodyScope() throws DOMException; */
public IScope getBodyScope() throws DOMException;
/** /**
* return the ILabel binding in this scope that matches the given name * return the ILabel binding in this scope that matches the given name
* *
* @param name * @param name
* @return * @return
* @throws DOMException * @throws DOMException
*/ */
public IBinding getBinding( char[] name ) throws DOMException; public IBinding getBinding(char[] name) throws DOMException;
} }

View file

@ -21,9 +21,10 @@ import org.eclipse.cdt.core.dom.ast.IPointerType;
*/ */
public interface ICPointerType extends IPointerType { public interface ICPointerType extends IPointerType {
/** /**
* is this a restrict pointer * is this a restrict pointer
* @return *
*/ * @return
boolean isRestrict(); */
boolean isRestrict();
} }

View file

@ -20,9 +20,10 @@ import org.eclipse.cdt.core.dom.ast.IQualifierType;
* @author aniefer * @author aniefer
*/ */
public interface ICQualifierType extends IQualifierType { public interface ICQualifierType extends IQualifierType {
/** /**
* is this a restrict type * is this a restrict type
* @return *
*/ * @return
public boolean isRestrict(); */
public boolean isRestrict();
} }

View file

@ -22,38 +22,43 @@ import org.eclipse.cdt.core.dom.ast.IScope;
* @author aniefer * @author aniefer
*/ */
public interface ICScope extends IScope { public interface ICScope extends IScope {
/** /**
* ISO C:99 6.2.3 * ISO C:99 6.2.3 there are seperate namespaces for various categories of
* there are seperate namespaces for various categories of identifiers: * identifiers: - label names ( labels have ICFunctionScope ) - tags of
* - label names ( labels have ICFunctionScope ) * structures or unions : NAMESPACE_TYPE_TAG - members of structures or
* - tags of structures or unions : NAMESPACE_TYPE_TAG * unions ( members have ICCompositeTypeScope ) - all other identifiers :
* - members of structures or unions ( members have ICCompositeTypeScope ) * NAMESPACE_TYPE_OTHER
* - all other identifiers : NAMESPACE_TYPE_OTHER */
*/ public static final int NAMESPACE_TYPE_TAG = 0;
public static final int NAMESPACE_TYPE_TAG = 0;
public static final int NAMESPACE_TYPE_OTHER = 1;
/** public static final int NAMESPACE_TYPE_OTHER = 1;
* add a binding to this scope
* @param binding
* @throws DOMException
*/
void addBinding( IBinding binding ) throws DOMException;
/** /**
* remove the given binding from this scope * add a binding to this scope
* @param binding *
* @throws DOMException * @param binding
*/ * @throws DOMException
void removeBinding( IBinding binding ) throws DOMException; */
void addBinding(IBinding binding) throws DOMException;
/** /**
* Get the binding that has previously been added to this scope that matches * remove the given binding from this scope
* the given name and is in the appropriate namespace *
* @param namespaceType : either NAMESPACE_TYPE_TAG or NAMESPACE_TYPE_OTHER * @param binding
* @param name * @throws DOMException
* @return */
* @throws DOMException void removeBinding(IBinding binding) throws DOMException;
*/
public IBinding getBinding( int namespaceType, char [] name ) throws DOMException; /**
* Get the binding that has previously been added to this scope that matches
* the given name and is in the appropriate namespace
*
* @param namespaceType :
* either NAMESPACE_TYPE_TAG or NAMESPACE_TYPE_OTHER
* @param name
* @return
* @throws DOMException
*/
public IBinding getBinding(int namespaceType, char[] name)
throws DOMException;
} }