next up previous
Next: Import files from a Up: Package Storage in the Previous: char *DirectoryFor(char *pkg, int

Import a specific type

A single-type-import declaration makes that type available.

void ImportType(char *typ)[5]:
/* Define type names
 *   On entry-
 *     typ is the type to be made available
 *   If typ has a .java file then on exit-
 *     The .java file defining the type has been defined in FilRootEnv
{ struct dirent *this_entry;
  char *filePart, *dir;
  struct stat status;

  if (typ == NULL || (filePart = strrchr(typ, '.')) == NULL) return;

  dir = DirectoryFor(typ, strlen(typ) - strlen(filePart++));
  if (dir == NULL) return;

  obstack_grow(Csm_obstk, dir, strlen(dir));
  obstack_grow(Csm_obstk, filePart, strlen(filePart));
  CsmStrPtr = obstack_copy0(Csm_obstk, ".java", 5);

  if (stat(CsmStrPtr, &status) || !S_ISREG(status.st_mode)) {
    obstack_free(Csm_obstk, CsmStrPtr);

  BindInScope(FilRootEnv, MakeName(CsmStrPtr));
This macro is invoked in definition 9.