/*
 * A method is an `operation', therefore a method decl is an `op dcl'.
 * I blame Elliot.
 */
static gboolean
op_dcl(TreeState *state)
{
    GSList *doc_comments = IDL_IDENT(IDL_OP_DCL(state->tree).ident).comments;

    /*
     * Verify that e.g. non-scriptable methods in [scriptable] interfaces
     * are declared so.  Do this in a separate verification pass?
     */
    if (!verify_method_declaration(state->tree))
        return FALSE;

    if (doc_comments != NULL) {
        write_indent(state->file);
        printlist(state->file, doc_comments);
    }
    xpidl_write_comment(state, 2);

    write_indent(state->file);
    if (!write_method_signature(state->tree, state->file, AS_DECL, NULL))
        return FALSE;
    fputs(" = 0;\n\n", state->file);

    return TRUE;
}
static gboolean
do_const_dcl(TreeState *state)
{
    struct _IDL_CONST_DCL *dcl = &IDL_CONST_DCL(state->tree);
    const char *name = IDL_IDENT(dcl->ident).str;
    gboolean is_signed;
    GSList *doc_comments = IDL_IDENT(dcl->ident).comments;
    IDL_tree real_type;
    const char *const_format;

    if (!verify_const_declaration(state->tree))
        return FALSE;

    if (doc_comments != NULL) {
        write_indent(state->file);
        printlist(state->file, doc_comments);
    }

    /* Could be a typedef; try to map it to the real type. */
    real_type = find_underlying_type(dcl->const_type);
    real_type = real_type ? real_type : dcl->const_type;
    is_signed = IDL_TYPE_INTEGER(real_type).f_signed;

    const_format = is_signed ? "%" IDL_LL "d" : "%" IDL_LL "uU";
    write_indent(state->file);
    fprintf(state->file, "enum { %s = ", name);
    fprintf(state->file, const_format, IDL_INTEGER(dcl->const_exp).value);
    fprintf(state->file, " };\n\n");

    return TRUE;
}
Esempio n. 3
0
void Fl_Type::write_properties() 
{
	int level = 0;
	for (Fl_Type* p = parent; p; p = p->parent) level++;
	// repeat this for each attribute:
	if (!label().empty()) {
		write_indent(level+1);
		write_word("label");
		write_word(label());
	}
	if (!user_data().empty()) {
		write_indent(level+1);
		write_word("user_data");
		write_word(user_data());
		if (!user_data_type().empty()) {
			write_word("user_data_type");
			write_word(user_data_type());
		}
	}
	if (!callback().empty()) {
		write_indent(level+1);
		write_word("callback");
		write_word(callback());
	}
	if (is_parent() && open_) write_word("open");
	if (selected) write_word("selected");
	if (!tooltip().empty()) {
		write_indent(level+1);
		write_word("tooltip");
		write_word(tooltip());
	}
}
Esempio n. 4
0
static svn_error_t *
add_directory(const char *path,
              void *parent_baton,
              const char *copyfrom_path,
              svn_revnum_t copyfrom_revision,
              apr_pool_t *pool,
              void **child_baton)
{
  struct dir_baton *pb = parent_baton;
  struct edit_baton *eb = pb->edit_baton;
  struct dir_baton *b = apr_palloc(pool, sizeof(*b));

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool,
                            "add_directory : '%s' [from '%s':%ld]\n",
                            path, copyfrom_path, copyfrom_revision));
  eb->indent_level++;

  SVN_ERR(eb->wrapped_editor->add_directory(path,
                                            pb->wrapped_dir_baton,
                                            copyfrom_path,
                                            copyfrom_revision,
                                            pool,
                                            &b->wrapped_dir_baton));

  b->edit_baton = eb;
  *child_baton = b;

  return SVN_NO_ERROR;
}
Esempio n. 5
0
static svn_error_t *
open_file(const char *path,
          void *parent_baton,
          svn_revnum_t base_revision,
          apr_pool_t *pool,
          void **file_baton)
{
  struct dir_baton *pb = parent_baton;
  struct edit_baton *eb = pb->edit_baton;
  struct file_baton *fb = apr_palloc(pool, sizeof(*fb));

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "open_file : '%s':%ld\n",
                            path, base_revision));

  eb->indent_level++;

  SVN_ERR(eb->wrapped_editor->open_file(path,
                                        pb->wrapped_dir_baton,
                                        base_revision,
                                        pool,
                                        &fb->wrapped_file_baton));

  fb->edit_baton = eb;
  *file_baton = fb;

  return SVN_NO_ERROR;
}
Esempio n. 6
0
static svn_error_t *
open_root(void *edit_baton,
          svn_revnum_t base_revision,
          apr_pool_t *pool,
          void **root_baton)
{
  struct edit_baton *eb = edit_baton;
  struct dir_baton *dir_baton = apr_palloc(pool, sizeof(*dir_baton));

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "open_root : %ld\n",
                            base_revision));
  eb->indent_level++;

  SVN_ERR(eb->wrapped_editor->open_root(eb->wrapped_edit_baton,
                                        base_revision,
                                        pool,
                                        &dir_baton->wrapped_dir_baton));

  dir_baton->edit_baton = edit_baton;

  *root_baton = dir_baton;

  return SVN_NO_ERROR;
}
Esempio n. 7
0
void Logger::_start(Event const &event) {
    Util::ptr_shared<char> name=event.name();

    if (empty_tag) {
        log_stream << ">\n";
    }

    write_indent(log_stream, tag_stack().size());

    log_stream << "<" << name.pointer();

    unsigned property_count=event.propertyCount();
    for ( unsigned i = 0 ; i < property_count ; i++ ) {
        Event::PropertyPair property=event.property(i);
        log_stream << " " << property.name.pointer() << "=\"";
        write_escaped_value(log_stream, property.value);
        log_stream << "\"";
    }

    log_stream.flush();

    tag_stack().push_back(name);
    empty_tag = true;

    event.generateChildEvents();
}
Esempio n. 8
0
/** Write a section to the output. */
static void write_section(t3_config_t *config, FILE *file, int indent) {
  while (config != NULL) {
    if (config->type == T3_CONFIG_PLIST) {
      write_plist(config, file, indent);
      config = config->next;
      continue;
    }

    write_indent(file, indent);
    fputs(config->name, file);
    switch (config->type) {
      case T3_CONFIG_BOOL:
      case T3_CONFIG_INT:
      case T3_CONFIG_NUMBER:
      case T3_CONFIG_STRING:
      case T3_CONFIG_LIST:
        fputs(" = ", file);
        write_value(config, file, indent);
        fputc('\n', file);
        break;
      case T3_CONFIG_SECTION:
        fputc(' ', file);
        write_value(config, file, indent);
        fputc('\n', file);
        break;
      default:
        /* This can only happen if the client screws up the list, which
           the interface does not allow by itself. */
        break;
    }
    config = config->next;
  }
}
Esempio n. 9
0
/** Write a single value out to file. */
static void write_value(t3_config_t *config, FILE *file, int indent) {
  switch (config->type) {
    case T3_CONFIG_BOOL:
      fputs(config->value.boolean ? "true" : "false", file);
      break;
    case T3_CONFIG_INT:
      write_int(file, config->value.integer);
      break;
    case T3_CONFIG_NUMBER:
      write_number(file, config->value.number);
      break;
    case T3_CONFIG_STRING:
      write_string(file, config->value.string);
      break;
    case T3_CONFIG_LIST:
    case T3_CONFIG_PLIST:
      fputs("( ", file);
      write_list(config->value.list, file, indent + 1);
      fputs(" )", file);
      break;
    case T3_CONFIG_SECTION:
      fputs("{\n", file);
      write_section(config->value.list, file, indent + 1);
      write_indent(file, indent);
      fputc('}', file);
      break;
    default:
      /* This can only happen if the client screws up the list. */
      break;
  }
}
Esempio n. 10
0
void Writer::operator() (const string_ref &s) {
  if (need_indent) {
    need_indent = 0;
    write_indent();
  }
  append (s.begin(), s.length());
}
Esempio n. 11
0
void Writer::operator() (const char *s) {
  if (need_indent) {
    need_indent = 0;
    write_indent();
  }
  append (s, strlen (s));
}
Esempio n. 12
0
void Writer::operator() (const string &s) {
  if (need_indent) {
    need_indent = 0;
    write_indent();
  }
  append (s.c_str(), s.size());
}
Esempio n. 13
0
static gboolean
attr_dcl(TreeState *state)
{
    GSList *doc_comments;

    if (!verify_attribute_declaration(state->tree))
        return FALSE;

    doc_comments =
        IDL_IDENT(IDL_LIST(IDL_ATTR_DCL
                           (state->tree).simple_declarations).data).comments;

    if (doc_comments != NULL && comment_level >= 2) {
        write_indent(state->file);
        printlist(state->file, doc_comments);
    }

    /*
     * XXX lists of attributes with the same type, e.g.
     * attribute string foo, bar sil;
     * are legal IDL... but we don't do anything with 'em.
     */
    if (IDL_LIST(IDL_ATTR_DCL(state->tree).simple_declarations).next != NULL) {
        XPIDL_WARNING((state->tree, IDL_WARNING1,
                       "multiple attributes in a single declaration aren't "
                       "currently supported by xpidl"));
    }

    xpidl_write_comment(state, 2);

    write_indent(state->file);
    write_indent(state->file);
    if (!write_attr_accessor(state->tree, state->file, TRUE, NULL))
        return FALSE;
    fputs(": Longword; stdcall;\n", state->file);

    if (!IDL_ATTR_DCL(state->tree).f_readonly) {
        write_indent(state->file);
        write_indent(state->file);
        if (!write_attr_accessor(state->tree, state->file, FALSE, NULL))
            return FALSE;
        fputs(": Longword; stdcall;\n", state->file);
    }
    /*fputc('\n', state->file);*/

    return TRUE;
}
Esempio n. 14
0
void JsonOut::write_separator()
{
    stream->put(',');
    if (pretty_print) {
        stream->put('\n');
        write_indent();
    }
    need_separator = false;
}
Esempio n. 15
0
void JsonOut::end_array()
{
    if (pretty_print) {
        indent_level -= 1;
        stream->put('\n');
        write_indent();
    }
    stream->put(']');
    need_separator = true;
}
Esempio n. 16
0
    virtual void end_object()
    {
        unindent();
        if (indenting_ && !stack_.empty())
        {
            write_indent();
        }
        stack_.pop_back();
        os_.put('}');

        end_value();
    }
Esempio n. 17
0
    void do_end_object() override
    {
        unindent();
        if (indenting_ && !stack_.empty())
        {
            write_indent();
        }
        stack_.pop_back();
        os_->put('}');

        end_value();
    }
Esempio n. 18
0
    void do_begin_array() override
    {
        begin_structure();

        if (indenting_ && !stack_.empty() && stack_.back().is_object())
        {
            write_indent();
        }
        stack_.push_back(stack_item(false));
        bos_.put('[');
        indent();
    }
Esempio n. 19
0
    virtual void end_array()
    {
        unindent();
        if (indenting_ && !stack_.empty() && stack_.back().content_indented_)
        {
            write_indent();
        }
        stack_.pop_back();
        os_.put(']');

        end_value();
    }
Esempio n. 20
0
    virtual void begin_object()
    {
        begin_structure();

        if (indenting_ && !stack_.empty() && stack_.back().is_object())
        {
            write_indent();
        }
        stack_.push_back(stack_item(true));
        os_.put('{');
        indent();
    }
Esempio n. 21
0
    void do_end_array() override
    {
        unindent();
        if (indenting_ && !stack_.empty() && stack_.back().content_indented_)
        {
            write_indent();
        }
        stack_.pop_back();
        os_->put(']');

        end_value();
    }
Esempio n. 22
0
    void do_begin_object() override
    {
        begin_structure();

        if (indenting_ && !stack_.empty() && stack_.back().is_object())
        {
            write_indent();
        }
        stack_.push_back(stack_item(true));
        os_->put('{');
        indent();
    }
Esempio n. 23
0
void JsonOut::start_array()
{
    if (need_separator) {
        write_separator();
    }
    stream->put('[');
    if (pretty_print) {
        indent_level += 1;
        stream->put('\n');
        write_indent();
    }
    need_separator = false;
}
Esempio n. 24
0
static svn_error_t *
close_edit(void *edit_baton,
           apr_pool_t *pool)
{
  struct edit_baton *eb = edit_baton;

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "close_edit\n"));

  SVN_ERR(eb->wrapped_editor->close_edit(eb->wrapped_edit_baton, pool));

  return SVN_NO_ERROR;
}
Esempio n. 25
0
int xml_writer_element_start(XMLWriter* writer, const char* name)
{
    if (writer->previousWrite == ELEMENT_START || writer->previousWrite == ATTRIBUTE)
    {
        CHK_ORET(fprintf(writer->file, ">") > 0);
    }
    
    write_indent(writer);
    CHK_ORET(fprintf(writer->file, "<%s", name) > 0);
    
    writer->indent++;
    writer->previousWrite = ELEMENT_START;
    return 1;
}
Esempio n. 26
0
 void begin_element()
 {
     if (!stack_.empty())
     {
         if (stack_.back().count_ > 0)
         {
             os_->put(',');
         }
         if (indenting_)
         {
             write_indent();
         }
     }
 }
Esempio n. 27
0
void Logger::_finish() {
    if (tag_stack().back()) {
        if (empty_tag) {
            log_stream << "/>\n";
        } else {
            write_indent(log_stream, tag_stack().size() - 1);
            log_stream << "</" << tag_stack().back().pointer() << ">\n";
        }
        log_stream.flush();

        empty_tag = false;
    }

    tag_stack().pop_back();
}
Esempio n. 28
0
static svn_error_t *
set_target_revision(void *edit_baton,
                    svn_revnum_t target_revision,
                    apr_pool_t *pool)
{
  struct edit_baton *eb = edit_baton;

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "set_target_revision : %ld\n",
                            target_revision));

  return eb->wrapped_editor->set_target_revision(eb->wrapped_edit_baton,
                                                 target_revision,
                                                 pool);
}
Esempio n. 29
0
static svn_error_t *
close_directory(void *dir_baton,
                apr_pool_t *pool)
{
  struct dir_baton *db = dir_baton;
  struct edit_baton *eb = db->edit_baton;

  eb->indent_level--;
  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "close_directory\n"));

  SVN_ERR(eb->wrapped_editor->close_directory(db->wrapped_dir_baton,
                                              pool));

  return SVN_NO_ERROR;
}
Esempio n. 30
0
static svn_error_t *
absent_file(const char *path,
            void *file_baton,
            apr_pool_t *pool)
{
  struct file_baton *fb = file_baton;
  struct edit_baton *eb = fb->edit_baton;

  SVN_ERR(write_indent(eb, pool));
  SVN_ERR(svn_stream_printf(eb->out, pool, "absent_file : %s\n", path));

  SVN_ERR(eb->wrapped_editor->absent_file(path, fb->wrapped_file_baton,
                                          pool));

  return SVN_NO_ERROR;
}