コード例 #1
0
ファイル: yinput.c プロジェクト: dhmunro/yorick
static p_file *PushInclude(const char *filename, int fullparse)
{
  p_file *file= 0;
  char *name= 0;
  long i;

  if (YIsAbsolute(filename)) {
    /* absolute pathname doesn't need any prefix */
    file= open_include(filename, fullparse);
    if (!file) return 0;
    name= p_strcpy(filename);

  } else {
    char *tmp;
    for (i=0 ; i<=nYpPrefixes ; i++) {
      if (i<nYpPrefixes) {
        tmp= p_strncat(ypPrefixes[i], filename, 0);
        name= YExpandName(tmp);
        p_free(tmp);
      } else {
        /* this branch is probably a bug --
         * if . is not on path probably should not find file...
         * maybe protects against empty path?
         */
        name= YExpandName(filename);
        if (!YIsAbsolute(name)) break;
      }
      file= open_include(name, fullparse);
      if (file) break;
      p_free(name);
    }
    if (!file) return 0;
  }

  if (nYpIncludes>=maxYpIncludes) {
    int newSize= maxYpIncludes+4;
    ypIncludes= p_realloc(ypIncludes, sizeof(IncludeFile)*newSize);
    maxYpIncludes= newSize;
  }

  if (fullparse) ClearSourceList(name);

  ypIncludes[nYpIncludes].file= file;
  ypIncludes[nYpIncludes].filename= name;
  ypIncludes[nYpIncludes].lastLineRead= 0;
  ypIncludes[nYpIncludes++].index = -1;
  prevErrLine= -1;
  return file;
}
コード例 #2
0
ファイル: rtpsources.cpp プロジェクト: sigysmund/sdrangel
void RTPSources::Clear()
{
    ClearSourceList();
}