]> granicus.if.org Git - python/commitdiff
Get hotshot closer to compiling on Windows.
authorTim Peters <tim.peters@gmail.com>
Fri, 12 Oct 2001 22:08:39 +0000 (22:08 +0000)
committerTim Peters <tim.peters@gmail.com>
Fri, 12 Oct 2001 22:08:39 +0000 (22:08 +0000)
Still broken:  GETTIMEOFDAY.  This macro obviously isn't being defined
on Windows, so there's logic errors here I'd rather Fred untangled.

Modules/_hotshot.c
PC/config.c
PCbuild/pythoncore.dsp

index 8b95c3cc749ca16d48108a9f29079c47bab691df..fa4653a945bb8db77dc6af5331323c439d2be8c1 100644 (file)
@@ -19,6 +19,7 @@
 #ifdef MS_WIN32
 #include <windows.h>
 #include <largeint.h>
+#include <direct.h>    /* for getcwd() */
 typedef LARGE_INTEGER hs_time;
 #else
 #ifndef HAVE_GETTIMEOFDAY
@@ -41,6 +42,14 @@ typedef struct timeval hs_time;
 
 #define BUFFERSIZE 10240
 
+#ifndef PATH_MAX
+#   ifdef MAX_PATH
+#       define PATH_MAX MAX_PATH
+#   else
+#       error "Need a defn. for PATH_MAX in _hotshot.c"
+#   endif
+#endif
+
 typedef struct {
     PyObject_HEAD
     PyObject *filemap;
@@ -365,6 +374,7 @@ logreader_tp_iternext(LogReaderObject *self)
             goto restart;
         }
     default:
+       ;
     }
     if (err == ERR_EOF && oldindex != 0) {
         /* It looks like we ran out of data before we had it all; this
@@ -470,7 +480,7 @@ flush_data(ProfilerObject *self)
 {
     /* Need to dump data to the log file... */
     size_t written = fwrite(self->buffer, 1, self->index, self->logfp);
-    if (written == self->index)
+    if (written == (size_t)self->index)
         self->index = 0;
     else {
         memmove(self->buffer, &self->buffer[written],
@@ -723,7 +733,7 @@ tracer_callback(ProfilerObject *self, PyFrameObject *frame, int what,
     case PyTrace_RETURN:
         pack_exit(self, get_tdelta(self));
         break;
-    case PyTrace_LINE: 
+    case PyTrace_LINE:
         if (self->linetimings)
             pack_lineno_tdelta(self, frame->f_lineno, get_tdelta(self));
         else
@@ -1259,7 +1269,7 @@ hotshot_profiler(PyObject *unused, PyObject *args)
         self->index = 0;
         self->active = 0;
         self->next_fileno = 0;
-        self->logfp = NULL;        
+        self->logfp = NULL;
         self->logfilename = PyTuple_GET_ITEM(args, 0);
         Py_INCREF(self->logfilename);
         self->filemap = PyDict_New();
index df9b89abbe2a0e6bdc135db97313348d1f65843f..9e4da2aab882f9f804c530ee7c5b2b0d9062da5f 100644 (file)
@@ -44,6 +44,7 @@ extern void init_locale(void);
 extern void init_codecs(void);
 extern void initxreadlines(void);
 extern void init_weakref(void);
+extern void init_hotshot(void);
 extern void initxxsubtype(void);
 
 /* XXX tim: what's the purpose of ADDMODULE MARKER? */
@@ -98,6 +99,7 @@ struct _inittab _PyImport_Inittab[] = {
         {"_codecs", init_codecs},
        {"xreadlines", initxreadlines},
        {"_weakref", init_weakref},
+       {"_hotshot", init_hotshot},
 
        {"xxsubtype", initxxsubtype},
 
index 4525e6b6934ea3aac38c04375d565ce3f551d19c..e07cd32a454b4a2e11c5d0a590fccf4f99e25f3a 100644 (file)
@@ -180,6 +180,21 @@ SOURCE=..\Modules\_codecsmodule.c
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=..\Modules\_hotshot.c\r
+\r
+!IF  "$(CFG)" == "pythoncore - Win32 Release"\r
+\r
+!ELSEIF  "$(CFG)" == "pythoncore - Win32 Debug"\r
+\r
+!ELSEIF  "$(CFG)" == "pythoncore - Win32 Alpha Debug"\r
+\r
+!ELSEIF  "$(CFG)" == "pythoncore - Win32 Alpha Release"\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=..\Modules\_localemodule.c\r
 \r
 !IF  "$(CFG)" == "pythoncore - Win32 Release"\r