Esempio n. 1
0
static FILE *try_instore_file(char *file, bool *sf)
{   FILE *include_file;
    if (debugging(DEBUG_FILES)) cc_msg("Try instore file '%s'\n", file);
    include_file = open_builtin_header(file, sf);
    if (include_file != NULL)
    {   show_h_line(1, file, NO);
#ifdef TARGET_IS_HELIOS
        push_include(NULL, file, PE_SYS);
#else
        push_include(NULL, file);
#endif
    }
    return include_file;
}
Esempio n. 2
0
void
ruby_push_include(const char *path, VALUE (*filter)(VALUE))
{
    if (path == 0)
	return;
    push_include(path, filter);
}
Esempio n. 3
0
static void
push_include_cygwin(const char *path, VALUE (*filter)(VALUE))
{
    const char *p, *s;
    char rubylib[FILENAME_MAX];
    VALUE buf = 0;

    p = path;
    while (*p) {
	unsigned int len;
	while (*p == ';')
	    p++;
	if (!*p) break;
	for (s = p; *s && *s != ';'; s = CharNext(s));
	len = s - p;
	if (*s) {
	    if (!buf) {
		buf = rb_str_new(p, len);
		p = RSTRING_PTR(buf);
	    }
	    else {
		rb_str_resize(buf, len);
		p = strncpy(RSTRING_PTR(buf), p, len);
	    }
	}
	if (cygwin_conv_to_posix_path(p, rubylib) == 0)
	    p = rubylib;
	push_include(p, filter);
	if (!*s) break;
	p = s + 1;
    }
}
Esempio n. 4
0
static void
scan_file(
	td_engine *engine,
	td_alloc *scratch,
	td_file *file,
	td_scanner *scanner,
	unsigned int salt,
	include_set *set)
{
	int i, count;
	td_file **files;

	int found_count = 0;
	td_file* found_files[TD_MAX_INCLUDES_IN_FILE];
	td_include_data includes[TD_MAX_INCLUDES_IN_FILE];

	/* see if there is a cached include set for this file */
	files = td_engine_get_relations(engine, file, salt, &count);

	if (files)
	{
		if (td_debug_check(engine, TD_DEBUG_SCAN))
			printf("%s: hit relation cache; %d entries\n", file->path, count);
		for (i = 0; i < count; ++i)
			push_include(set, files[i]);
		return;
	}

	if (td_debug_check(engine, TD_DEBUG_SCAN))
		printf("%s: scanning\n", file->path);

	count = scan_file_data(scratch, file, &includes[0], sizeof(includes)/sizeof(includes[0]), scanner);

	for (i = 0; i < count; ++i)
	{
		if (NULL != (found_files[found_count] = find_file(file, engine, &includes[i], scanner)))
			++found_count;
	}

	for (i = 0; i < found_count; ++i)
		push_include(set, found_files[i]);

	if (td_debug_check(engine, TD_DEBUG_SCAN))
		printf("%s: inserting %d entries in relation cache\n", file->path, found_count);

	td_engine_set_relations(engine, file, salt, found_count, found_files);
}
Esempio n. 5
0
void determine_includes (declaration *d, batch *b)
{
    // si c'est un namespace ...
    if (d->decl_kind == dk_module) {
        declaration *inner = d->u.this_module->contents;
        while (inner != NULL) {
            determine_includes (inner, b);
            inner = inner->next;
        }
    // sinon on push_include()...
    } else {
        umlclasslist cl = list_classes (d->u.this_class, b);
        while (cl != NULL) {
            push_include (cl);
            cl = cl->next;
        }
    }


}
Esempio n. 6
0
File: ruby.c Progetto: ayumin/ruby
static void
push_include_cygwin(const char *path, VALUE (*filter)(VALUE))
{
    const char *p, *s;
    char rubylib[FILENAME_MAX];
    VALUE buf = 0;

    p = path;
    while (*p) {
	unsigned int len;
	while (*p == ';')
	    p++;
	if (!*p) break;
	for (s = p; *s && *s != ';'; s = CharNext(s));
	len = s - p;
	if (*s) {
	    if (!buf) {
		buf = rb_str_new(p, len);
		p = RSTRING_PTR(buf);
	    }
	    else {
		rb_str_resize(buf, len);
		p = strncpy(RSTRING_PTR(buf), p, len);
	    }
	}
#ifdef HAVE_CYGWIN_CONV_PATH
#define CONV_TO_POSIX_PATH(p, lib) \
	cygwin_conv_path(CCP_WIN_A_TO_POSIX|CCP_RELATIVE, (p), (lib), sizeof(lib))
#else
#define CONV_TO_POSIX_PATH(p, lib) \
	cygwin_conv_to_posix_path((p), (lib))
#endif
	if (CONV_TO_POSIX_PATH(p, rubylib) == 0)
	    p = rubylib;
	push_include(p, filter);
	if (!*s) break;
	p = s + 1;
    }
}
Esempio n. 7
0
int
td_scan_includes(td_engine *engine, td_node *node, td_scanner *state)
{
	td_alloc scratch;
	int i, count;
	td_scanner *config = (td_scanner *) state;
	unsigned int salt = relation_salt_cpp(config);
	int set_cursor;
	include_set *set;

	td_alloc_init(&scratch, 10, 1024 * 1024);

	set = (include_set *) td_page_alloc(&scratch, sizeof(include_set));
	set->count = 0;

	for (i = 0, count = node->input_count; i < count; ++i)
		push_include(set, node->inputs[i]);

	set_cursor = 0;
	while (set_cursor < set->count)
	{
		td_file *input = set->files[set_cursor++];
		scan_file(engine, &scratch, input, config, salt, set);
	}

	node->job.idep_count = set->count - node->input_count;

	td_mutex_lock_or_die(engine->lock);
	node->job.ideps = (td_file **) td_page_alloc(&engine->alloc, sizeof(td_file*) * node->job.idep_count);
	td_mutex_unlock_or_die(engine->lock);

	memcpy(&node->job.ideps[0], &set->files[node->input_count], sizeof(td_file*) * node->job.idep_count);

	td_alloc_cleanup(&scratch);

	return 0;
}
Esempio n. 8
0
extern FILE *pp_inclopen(char *file, bool systemheader,
            bool *sf, char **hostname)
{
  FILE *new_include_file;
  UnparsedName unparse;
  char new_file[MAX_NAME];

  *hostname = file;
  translate_fname(file, &unparse, new_file);

  if (!(unparse.type & FNAME_ROOTED))
  {   PathElement *p;
#ifndef NO_INSTORE_FILES
      if ((ccom_flags & FLG_INSTORE_FILES_IMPLICITLY) && systemheader)
      {
/* Note that it is important for portability (even across unix/riscos)  */
/* to have the original 'file' and not the munged 'new_file' instore.   */
          new_include_file = try_instore_file(file, sf);
          if (new_include_file != NULL) return new_include_file;
      }
#endif
      p = path_hd;
      if (systemheader || (ccom_flags & FLG_USE_SYSTEM_PATH)) p = p->link;
      while (p != NULL)
      {   char current[MAX_NAME];
          if (p->flags & INSTORE_FILE)
          {
#ifndef NO_INSTORE_FILES
/* Note that it is important for portability (even across unix/riscos)  */
/* to have the original 'file' and not the munged 'new_file' instore.   */
              new_include_file = try_instore_file(file, sf);
              if (new_include_file != NULL) return new_include_file;
#endif
          }
#ifdef TARGET_IS_HELIOS
	  /*
	   * XXX - NC - 14/5/93 (Day after official C40 release!)
	   *
	   * The code appears to just skip the first element in the
	   * include path list if the file is a system file.  This
	   * is wierd, since the flags field encodes whether the
	   * directory has been added to the list as a user or a
	   * system file.
	   */
	  
	  else if (((p->flags & PE_USER) && !systemheader) ||
		   ((p->flags & PE_SYS)  &&  systemheader)  )
#else
          else /* current path is not :mem */
#endif
          {   strcpy(current, p->name);
              if (strlen(current) + strlen(new_file) + 1 <= MAX_NAME)
              {   strcat(current, new_file);
                  if (debugging(DEBUG_FILES))
                      cc_msg("Try file '%s'\n", current);
                  if ((new_include_file = fopen(current, "r")) != 0)
                  {   if (!(systemheader && (ccom_flags & FLG_NOSYSINCLUDES)))
                          show_h_line(1, current, YES);
#ifdef TARGET_IS_HELIOS
                      *hostname = push_include(current, current, p->flags);
#else
                      *hostname = push_include(current, current);
#endif
                      return new_include_file;
                  }
		  else if (debugging(DEBUG_FILES))
		    cc_msg("Open attempt failed, errno = %d\n", errno );
              }
          }
          p = p->link;
      }
#ifndef NO_INSTORE_FILES
/* Not found - ANSI require looking for "stdio.h" as <stdio.h> when all */
/* else has failed.                                                     */
/* Note that it is important for portability (even across unix/riscos)  */
/* to have the original 'file' and not the munged 'new_file' instore.   */
      return try_instore_file(file, sf);
#endif
  }