Commit 55d883a5 authored by Rico Tzschichholz's avatar Rico Tzschichholz

Drop trailing spaces/tabs

It was about time to do this.
parent 7bd54c7a
......@@ -30,7 +30,7 @@ public class Vala.CCodeAssignment : CCodeExpression {
* Left hand side of the assignment.
*/
public CCodeExpression left { get; set; }
/**
* Assignment operator.
*/
......@@ -40,13 +40,13 @@ public class Vala.CCodeAssignment : CCodeExpression {
* Right hand side of the assignment.
*/
public CCodeExpression right { get; set; }
public CCodeAssignment (CCodeExpression l, CCodeExpression r, CCodeAssignmentOperator op = CCodeAssignmentOperator.SIMPLE) {
left = l;
operator = op;
right = r;
}
public override void write (CCodeWriter writer) {
left.write (writer);
......@@ -74,7 +74,7 @@ public class Vala.CCodeAssignment : CCodeExpression {
writer.write_string (")");
}
}
public enum Vala.CCodeAssignmentOperator {
SIMPLE,
BITWISE_OR,
......
......@@ -40,13 +40,13 @@ public class Vala.CCodeBinaryExpression : CCodeExpression {
* The right operand.
*/
public CCodeExpression right { get; set; }
public CCodeBinaryExpression (CCodeBinaryOperator op, CCodeExpression l, CCodeExpression r) {
operator = op;
left = l;
right = r;
}
public override void write (CCodeWriter writer) {
left.write_inner (writer);
......
......@@ -33,14 +33,14 @@ public class Vala.CCodeBlock : CCodeStatement {
public bool suppress_newline { get; set; }
private List<CCodeNode> statements = new ArrayList<CCodeNode> ();
/**
* Prepend the specified statement to the list of statements.
*/
public void prepend_statement (CCodeNode statement) {
statements.insert (0, statement);
}
/**
* Append the specified statement to the list of statements.
*/
......@@ -48,7 +48,7 @@ public class Vala.CCodeBlock : CCodeStatement {
/* allow generic nodes to include comments */
statements.add (statement);
}
public override void write (CCodeWriter writer) {
// the last reachable statement
CCodeNode last_statement = null;
......
......@@ -30,11 +30,11 @@ public class Vala.CCodeCaseStatement : CCodeStatement {
* The case expression.
*/
public CCodeExpression expression { get; set; }
public CCodeCaseStatement (CCodeExpression expression) {
this.expression = expression;
}
public override void write (CCodeWriter writer) {
writer.write_indent (line);
writer.write_string ("case ");
......
......@@ -30,17 +30,17 @@ public class Vala.CCodeCastExpression : CCodeExpression {
* The expression to be cast.
*/
public CCodeExpression inner { get; set; }
/**
* The target type.
*/
public string type_name { get; set; }
public CCodeCastExpression (CCodeExpression expr, string type) {
inner = expr;
type_name = type;
}
public override void write (CCodeWriter writer) {
writer.write_string ("(");
writer.write_string (type_name);
......
......@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.CCodeCommaExpression : CCodeExpression {
private List<CCodeExpression> inner = new ArrayList<CCodeExpression> ();
/**
* Appends the specified expression to the expression list.
*
......@@ -47,7 +47,7 @@ public class Vala.CCodeCommaExpression : CCodeExpression {
public override void write (CCodeWriter writer) {
bool first = true;
writer.write_string ("(");
foreach (CCodeExpression expr in inner) {
if (!first) {
......
......@@ -30,11 +30,11 @@ public class Vala.CCodeComment : CCodeNode {
* The text content of the comment.
*/
public string text { get; set; }
public CCodeComment (string _text) {
text = _text;
}
public override void write (CCodeWriter writer) {
writer.write_comment (text);
}
......
......@@ -30,23 +30,23 @@ public class Vala.CCodeConditionalExpression : CCodeExpression {
* The condition.
*/
public CCodeExpression condition { get; set; }
/**
* The expression to be evaluated if the condition holds.
*/
public CCodeExpression true_expression { get; set; }
/**
* The expression to be evaluated if the condition doesn't hold.
*/
public CCodeExpression false_expression { get; set; }
public CCodeConditionalExpression (CCodeExpression cond, CCodeExpression true_expr, CCodeExpression false_expr) {
condition = cond;
true_expression = true_expr;
false_expression = false_expr;
}
public override void write (CCodeWriter writer) {
condition.write_inner (writer);
writer.write_string (" ? ");
......
......@@ -32,11 +32,11 @@ public class Vala.CCodeDeclaration : CCodeStatement {
public string type_name { get; set; }
private List<CCodeDeclarator> declarators = new ArrayList<CCodeDeclarator> ();
public CCodeDeclaration (string type_name) {
this.type_name = type_name;
}
/**
* Adds the specified declarator to this declaration.
*
......@@ -45,7 +45,7 @@ public class Vala.CCodeDeclaration : CCodeStatement {
public void add_declarator (CCodeDeclarator decl) {
declarators.add (decl);
}
public override void write (CCodeWriter writer) {
if ((modifiers & (CCodeModifiers.STATIC | CCodeModifiers.INTERNAL | CCodeModifiers.EXTERN)) == 0) {
foreach (CCodeDeclarator decl in declarators) {
......@@ -110,7 +110,7 @@ public class Vala.CCodeDeclaration : CCodeStatement {
}
writer.write_string (type_name);
writer.write_string (" ");
bool first = true;
foreach (CCodeDeclarator decl in declarators) {
if (!first) {
......
......@@ -35,12 +35,12 @@ public class Vala.CCodeDoStatement : CCodeStatement {
* The loop condition.
*/
public CCodeExpression condition { get; set; }
public CCodeDoStatement (CCodeStatement stmt, CCodeExpression cond) {
body = stmt;
condition = cond;
}
public override void write (CCodeWriter writer) {
writer.write_indent (line);
writer.write_string ("do");
......
......@@ -32,18 +32,18 @@ public class Vala.CCodeElementAccess : CCodeExpression {
* Expression representing the container on which we want to access.
*/
public CCodeExpression container { get; set; }
/**
* Expression representing the index we want to access inside the
* container.
*/
public CCodeExpression index { get; set; }
public CCodeElementAccess (CCodeExpression cont, CCodeExpression i) {
container = cont;
index = i;
}
public override void write (CCodeWriter writer) {
container.write_inner (writer);
writer.write_string ("[");
......
......@@ -32,11 +32,11 @@ public class Vala.CCodeEnum : CCodeNode {
public string name { get; set; }
private List<CCodeEnumValue> values = new ArrayList<CCodeEnumValue> ();
public CCodeEnum (string? name = null) {
this.name = name;
}
/**
* Adds the specified value to this enum.
*
......@@ -45,7 +45,7 @@ public class Vala.CCodeEnum : CCodeNode {
public void add_value (CCodeEnumValue value) {
values.add (value);
}
public override void write (CCodeWriter writer) {
if (name != null) {
writer.write_string ("typedef ");
......
......@@ -35,7 +35,7 @@ public class Vala.CCodeEnumValue : CCodeNode {
* The numerical representation of this enum value.
*/
public CCodeExpression? value { get; set; }
public CCodeEnumValue (string name, CCodeExpression? value = null) {
this.name = name;
this.value = value;
......
......@@ -30,7 +30,7 @@ public class Vala.CCodeExpressionStatement : CCodeStatement {
* The expression to evaluate.
*/
public CCodeExpression expression { get; set; }
public CCodeExpressionStatement (CCodeExpression expr) {
expression = expr;
}
......
......@@ -30,15 +30,15 @@ public class Vala.CCodeForStatement : CCodeStatement {
* The loop condition.
*/
public CCodeExpression? condition { get; set; }
/**
* The loop body.
*/
public CCodeStatement body { get; set; }
private List<CCodeExpression> initializer = new ArrayList<CCodeExpression> ();
private List<CCodeExpression> iterator = new ArrayList<CCodeExpression> ();
public CCodeForStatement (CCodeExpression? condition, CCodeStatement? body = null) {
this.condition = condition;
this.body = body;
......@@ -61,13 +61,13 @@ public class Vala.CCodeForStatement : CCodeStatement {
public void add_iterator (CCodeExpression expr) {
iterator.add (expr);
}
public override void write (CCodeWriter writer) {
bool first;
writer.write_indent (line);
writer.write_string ("for (");
first = true;
foreach (CCodeExpression init_expr in initializer) {
if (!first) {
......@@ -85,7 +85,7 @@ public class Vala.CCodeForStatement : CCodeStatement {
condition.write (writer);
}
writer.write_string ("; ");
first = true;
foreach (CCodeExpression it_expr in iterator) {
if (!first) {
......
......@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.CCodeFragment : CCodeNode {
private List<CCodeNode> children = new ArrayList<CCodeNode> ();
/**
* Appends the specified code node to this code fragment.
*
......@@ -36,7 +36,7 @@ public class Vala.CCodeFragment : CCodeNode {
public void append (CCodeNode node) {
children.add (node);
}
/**
* Returns a copy of the list of children.
*
......
......@@ -30,7 +30,7 @@ public class Vala.CCodeFunction : CCodeNode {
* The name of this function.
*/
public string name { get; set; }
/**
* The function return type.
*/
......@@ -63,7 +63,7 @@ public class Vala.CCodeFunction : CCodeNode {
this.block = new CCodeBlock ();
current_block = block;
}
/**
* Appends the specified parameter to the list of function parameters.
*
......@@ -100,12 +100,12 @@ public class Vala.CCodeFunction : CCodeNode {
foreach (CCodeParameter param in parameters) {
func.parameters.add (param);
}
func.is_declaration = is_declaration;
func.block = block;
return func;
}
public override void write (CCodeWriter writer) {
writer.write_indent (line);
if (CCodeModifiers.INTERNAL in modifiers) {
......@@ -126,7 +126,7 @@ public class Vala.CCodeFunction : CCodeNode {
writer.write_string (name);
writer.write_string (" (");
int param_pos_begin = (is_declaration ? return_type.char_count () + 1 : 0 ) + name.char_count () + 2;
bool has_args = (CCodeModifiers.PRINTF in modifiers || CCodeModifiers.SCANF in modifiers);
int i = 0;
int format_arg_index = -1;
......@@ -151,7 +151,7 @@ public class Vala.CCodeFunction : CCodeNode {
if (i == 0) {
writer.write_string ("void");
}
writer.write_string (")");
if (is_declaration) {
......
......@@ -30,13 +30,13 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
* The function to be called.
*/
public CCodeExpression? call { get; set; }
private List<CCodeExpression> arguments = new ArrayList<CCodeExpression> ();
public CCodeFunctionCall (CCodeExpression? call = null) {
this.call = call;
}
/**
* Appends the specified expression to the list of arguments.
*
......@@ -70,7 +70,7 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
} else {
first = false;
}
if (expr != null) {
expr.write (writer);
}
......
......@@ -30,13 +30,13 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
* The declarator name.
*/
public string name { get; set; }
private List<CCodeParameter> parameters = new ArrayList<CCodeParameter> ();
public CCodeFunctionDeclarator (string name) {
this.name = name;
}
/**
* Appends the specified parameter to the list of function parameters.
*
......@@ -45,16 +45,16 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
public void add_parameter (CCodeParameter param) {
parameters.add (param);
}
public override void write (CCodeWriter writer) {
write_declaration (writer);
}
public override void write_declaration (CCodeWriter writer) {
writer.write_string ("(*");
writer.write_string (name);
writer.write_string (") (");
bool has_args = (CCodeModifiers.PRINTF in modifiers || CCodeModifiers.SCANF in modifiers);
int i = 0;
int format_arg_index = -1;
......@@ -74,7 +74,7 @@ public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
}
i++;
}
writer.write_string (")");
if (CCodeModifiers.DEPRECATED in modifiers) {
......
......@@ -34,7 +34,7 @@ public class Vala.CCodeGotoStatement : CCodeStatement {
public CCodeGotoStatement (string name) {
this.name = name;
}
public override void write (CCodeWriter writer) {
writer.write_indent ();
writer.write_string ("goto ");
......
......@@ -30,11 +30,11 @@ public class Vala.CCodeIdentifier : CCodeExpression {
* The name of this identifier.
*/
public string name { get; set; }
public CCodeIdentifier (string _name) {
name = _name;
}
public override void write (CCodeWriter writer) {
writer.write_string (name);
}
......
......@@ -30,29 +30,29 @@ public class Vala.CCodeIfStatement : CCodeStatement {
* The boolean condition to evaluate.
*/
public CCodeExpression condition { get; set; }
/**
* The statement to be evaluated if the condition holds.
*/
public CCodeStatement true_statement { get; set; }
/**
* The optional statement to be evaluated if the condition doesn't hold.
*/
public CCodeStatement? false_statement { get; set; }
public CCodeIfStatement (CCodeExpression cond, CCodeStatement true_stmt, CCodeStatement? false_stmt = null) {
condition = cond;
true_statement = true_stmt;
false_statement = false_stmt;
}
/**
* Specifies whether this if statement is part of an else if statement.
* This only affects the output formatting.
*/
public bool else_if { get; set; }
public override void write (CCodeWriter writer) {
if (!else_if) {
writer.write_indent (line);
......@@ -64,13 +64,13 @@ public class Vala.CCodeIfStatement : CCodeStatement {
condition.write (writer);
}
writer.write_string (")");
/* else shouldn't be on a separate line */
if (false_statement != null && true_statement is CCodeBlock) {
var cblock = (CCodeBlock) true_statement;
cblock.suppress_newline = true;
}
true_statement.write (writer);
if (false_statement != null) {
if (writer.bol) {
......@@ -79,13 +79,13 @@ public class Vala.CCodeIfStatement : CCodeStatement {
} else {
writer.write_string (" else");
}
/* else if should be on one line */
if (false_statement is CCodeIfStatement) {
var cif = (CCodeIfStatement) false_statement;
cif.else_if = true;
}
false_statement.write (writer);
}
}
......
......@@ -30,18 +30,18 @@ public class Vala.CCodeIncludeDirective : CCodeNode {
* The file to be included.
*/
public string filename { get; set; }
/**
* Specifies whether the specified file should be searched in the local
* directory.
*/
public bool local { get; set; }
public CCodeIncludeDirective (string _filename, bool _local = false) {
filename = _filename;
local = _local;
}
public override void write (CCodeWriter writer) {
writer.write_indent ();
writer.write_string ("#include ");
......
......@@ -27,7 +27,7 @@ using GLib;
*/
public class Vala.CCodeInitializerList : CCodeExpression {
private List<CCodeExpression> initializers = new ArrayList<CCodeExpression> ();
/**
* Appends the specified expression to this initializer list.
*
......@@ -36,7 +36,7 @@ public class Vala.CCodeInitializerList : CCodeExpression {
public void append (CCodeExpression expr) {
initializers.add (expr);
}
public override void write (CCodeWriter writer) {
writer.write_string ("{");
......@@ -47,7 +47,7 @@ public class Vala.CCodeInitializerList : CCodeExpression {
} else {
first = false;
}
if (expr != null) {
expr.write (writer);
}
......
......@@ -34,7 +34,7 @@ public class Vala.CCodeLabel : CCodeStatement {
public CCodeLabel (string name) {
this.name = name;
}
public override void write (CCodeWriter writer) {
writer.write_indent ();
writer.write_string (name);
......
......@@ -30,12 +30,12 @@ public class Vala.CCodeLineDirective : CCodeNode {
* The name of the source file to be presumed.
*/
public string filename { get; set; }
/**
* The line number in the source file to be presumed.
*/
public int line_number { get; set; }
public CCodeLineDirective (string _filename, int _line) {
filename = _filename;
line_number = _line;
......
......@@ -30,29 +30,29 @@ public class Vala.CCodeMemberAccess : CCodeExpression {
* The parent of the member.
*/
public CCodeExpression inner { get; set; }
/**
* The name of the member.
*/
public string member_name { get; set; }
/**
* Specifies whether the member access happens by pointer dereferencing.
*/
public bool is_pointer { get; set; }
public CCodeMemberAccess (CCodeExpression container, string member, bool pointer = false) {
inner = container;
member_name = member;
is_pointer = pointer;
}
public CCodeMemberAccess.pointer (CCodeExpression container, string member) {
inner = container;
member_name = member;