Exemplo n.º 1
0
        public override void write(CCodeWriter writer)
        {
            writer.write_string("struct ");
            writer.write_string(name);
            writer.write_begin_block();
            foreach (CCodeDeclaration decl in declarations)
            {
                decl.write_declaration(writer);
            }

            writer.write_end_block();
            if (modifiers.HasFlag(CCodeModifiers.DEPRECATED))
            {
                writer.write_string(" G_GNUC_DEPRECATED");
            }
            writer.write_string(";");
            writer.write_newline();
            writer.write_newline();
        }
Exemplo n.º 2
0
        public override void write(CCodeWriter writer)
        {
            // the last reachable statement
            CCodeNode last_statement = null;

            writer.write_begin_block();
            foreach (CCodeNode statement in statements)
            {
                statement.write_declaration(writer);

                // determine last reachable statement
                if (statement is CCodeLabel || statement is CCodeCaseStatement)
                {
                    last_statement = null;
                }
                else if (statement is CCodeReturnStatement || statement is CCodeGotoStatement ||
                         statement is CCodeContinueStatement || statement is CCodeBreakStatement)
                {
                    last_statement = statement;
                }
            }

            foreach (CCodeNode statement in statements)
            {
                statement.write(writer);

                // only output reachable code
                if (statement == last_statement)
                {
                    break;
                }
            }

            writer.write_end_block();

            if (!suppress_newline)
            {
                writer.write_newline();
            }
        }