/[emacs]/emacs/src/lread.c
ViewVC logotype

Diff of /emacs/src/lread.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.339 by ttn, Sun Aug 7 12:33:17 2005 UTC revision 1.340 by rms, Fri Oct 21 16:54:13 2005 UTC
# Line 669  If optional fourth arg NOSUFFIX is non-n Line 669  If optional fourth arg NOSUFFIX is non-n
669  If optional fifth arg MUST-SUFFIX is non-nil, insist on  If optional fifth arg MUST-SUFFIX is non-nil, insist on
670   the suffix `.elc' or `.el'; don't accept just FILE unless   the suffix `.elc' or `.el'; don't accept just FILE unless
671   it ends in one of those suffixes or includes a directory name.   it ends in one of those suffixes or includes a directory name.
672    
673    Loading a file records its definitions, and its `provide' and
674    `require' calls, in an element of `load-history' whose
675    car is the file name loaded.  See `load-history'.
676    
677  Return t if file exists.  */)  Return t if file exists.  */)
678       (file, noerror, nomessage, nosuffix, must_suffix)       (file, noerror, nomessage, nosuffix, must_suffix)
679       Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;       Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
# Line 677  Return t if file exists.  */) Line 682  Return t if file exists.  */)
682    register int fd = -1;    register int fd = -1;
683    int count = SPECPDL_INDEX ();    int count = SPECPDL_INDEX ();
684    Lisp_Object temp;    Lisp_Object temp;
685    struct gcpro gcpro1;    struct gcpro gcpro1, gcpro2;
686    Lisp_Object found, efound;    Lisp_Object found, efound;
687    /* 1 means we printed the ".el is newer" message.  */    /* 1 means we printed the ".el is newer" message.  */
688    int newer = 0;    int newer = 0;
# Line 724  Return t if file exists.  */) Line 729  Return t if file exists.  */)
729        int size = SBYTES (file);        int size = SBYTES (file);
730        Lisp_Object tmp[2];        Lisp_Object tmp[2];
731    
732        GCPRO1 (file);        found = Qnil;
733          GCPRO2 (file, found);
734    
735        if (! NILP (must_suffix))        if (! NILP (must_suffix))
736          {          {
# Line 811  Return t if file exists.  */) Line 817  Return t if file exists.  */)
817            struct stat s1, s2;            struct stat s1, s2;
818            int result;            int result;
819    
820              GCPRO2 (file, found);
821    
822            if (!safe_to_load_p (fd))            if (!safe_to_load_p (fd))
823              {              {
824                safe_p = 0;                safe_p = 0;
# Line 827  Return t if file exists.  */) Line 835  Return t if file exists.  */)
835    
836            compiled = 1;            compiled = 1;
837    
           GCPRO1 (efound);  
838            efound = ENCODE_FILE (found);            efound = ENCODE_FILE (found);
839    
840  #ifdef DOS_NT  #ifdef DOS_NT
# Line 837  Return t if file exists.  */) Line 844  Return t if file exists.  */)
844            SSET (efound, SBYTES (efound) - 1, 0);            SSET (efound, SBYTES (efound) - 1, 0);
845            result = stat ((char *)SDATA (efound), &s2);            result = stat ((char *)SDATA (efound), &s2);
846            SSET (efound, SBYTES (efound) - 1, 'c');            SSET (efound, SBYTES (efound) - 1, 'c');
           UNGCPRO;  
847    
848            if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)            if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
849              {              {
# Line 847  Return t if file exists.  */) Line 853  Return t if file exists.  */)
853                /* If we won't print another message, mention this anyway.  */                /* If we won't print another message, mention this anyway.  */
854                if (!NILP (nomessage))                if (!NILP (nomessage))
855                  {                  {
856                    Lisp_Object file;                    Lisp_Object msg_file;
857                    file = Fsubstring (found, make_number (0), make_number (-1));                    msg_file = Fsubstring (found, make_number (0), make_number (-1));
858                    message_with_string ("Source file `%s' newer than byte-compiled file",                    message_with_string ("Source file `%s' newer than byte-compiled file",
859                                         file, 1);                                         msg_file, 1);
860                  }                  }
861              }              }
862              UNGCPRO;
863          }          }
864      }      }
865    else    else
# Line 871  Return t if file exists.  */) Line 878  Return t if file exists.  */)
878          }          }
879      }      }
880    
881      GCPRO2 (file, found);
882    
883  #ifdef WINDOWSNT  #ifdef WINDOWSNT
884    emacs_close (fd);    emacs_close (fd);
   GCPRO1 (efound);  
885    efound = ENCODE_FILE (found);    efound = ENCODE_FILE (found);
886    stream = fopen ((char *) SDATA (efound), fmode);    stream = fopen ((char *) SDATA (efound), fmode);
   UNGCPRO;  
887  #else  /* not WINDOWSNT */  #else  /* not WINDOWSNT */
888    stream = fdopen (fd, fmode);    stream = fdopen (fd, fmode);
889  #endif /* not WINDOWSNT */  #endif /* not WINDOWSNT */
# Line 903  Return t if file exists.  */) Line 910  Return t if file exists.  */)
910          message_with_string ("Loading %s...", file, 1);          message_with_string ("Loading %s...", file, 1);
911      }      }
912    
   GCPRO1 (file);  
913    record_unwind_protect (load_unwind, make_save_value (stream, 0));    record_unwind_protect (load_unwind, make_save_value (stream, 0));
914    record_unwind_protect (load_descriptor_unwind, load_descriptor_list);    record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
915    specbind (Qload_file_name, found);    specbind (Qload_file_name, found);
# Line 911  Return t if file exists.  */) Line 917  Return t if file exists.  */)
917    load_descriptor_list    load_descriptor_list
918      = Fcons (make_number (fileno (stream)), load_descriptor_list);      = Fcons (make_number (fileno (stream)), load_descriptor_list);
919    load_in_progress++;    load_in_progress++;
920    readevalloop (Qget_file_char, stream, file, Feval,    readevalloop (Qget_file_char, stream, (! NILP (Vpurify_flag) ? file : found),
921                  0, Qnil, Qnil, Qnil, Qnil);                  Feval, 0, Qnil, Qnil, Qnil, Qnil);
922    unbind_to (count, Qnil);    unbind_to (count, Qnil);
923    
924    /* Run any load-hooks for this file.  */    /* Run any load-hooks for this file.  */
# Line 3879  when the corresponding call to `provide' Line 3885  when the corresponding call to `provide'
3885    Vafter_load_alist = Qnil;    Vafter_load_alist = Qnil;
3886    
3887    DEFVAR_LISP ("load-history", &Vload_history,    DEFVAR_LISP ("load-history", &Vload_history,
3888                 doc: /* Alist mapping source file names to symbols and features.                 doc: /* Alist mapping file names to symbols and features.
3889  Each alist element is a list that starts with a file name,  Each alist element is a list that starts with a file name,
3890  except for one element (optional) that starts with nil and describes  except for one element (optional) that starts with nil and describes
3891  definitions evaluated from buffers not visiting files.  definitions evaluated from buffers not visiting files.
# Line 3888  and cons cells of the form `(provide . F Line 3894  and cons cells of the form `(provide . F
3894  `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'.  `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'.
3895  An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)',  An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)',
3896  and means that SYMBOL was an autoload before this file redefined it  and means that SYMBOL was an autoload before this file redefined it
3897  as a function.  */);  as a function.
3898    
3899    For a preloaded file, the file name recorded is relative to the main Lisp
3900    directory.  These names are converted to absolute by `file-loadhist-lookup'.  */);
3901    Vload_history = Qnil;    Vload_history = Qnil;
3902    
3903    DEFVAR_LISP ("load-file-name", &Vload_file_name,    DEFVAR_LISP ("load-file-name", &Vload_file_name,

Legend:
Removed from v.1.339  
changed lines
  Added in v.1.340

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26