The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

timestamp.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void donestamps ()
void timestamp (char *target, time_t *time)


Function Documentation

void donestamps  ) 
 

Definition at line 226 of file timestamp.c.

References bindhash, and hashdone().

Referenced by main().

00227 {
00228         hashdone( bindhash );
00229 }

Here is the call graph for this function:

void timestamp char *  target,
time_t *  time
 

Definition at line 70 of file timestamp.c.

References BIND_FOUND, bindhash, BINDING, file_archscan(), file_dirscan(), file_time(), _binding::flags, HASHDATA, hashenter, hashinit(), _binding::name, newstr(), p, path_build(), path_parent(), path_parse(), PATHNAME, _binding::progress, string_copy(), string_free(), string_new(), string_truncate(), _binding::time, time_enter(), and string::value.

Referenced by search(), and search_for_target().

00073 {
00074         PATHNAME f1, f2;
00075         BINDING binding, *b = &binding;
00076         string buf[1];
00077 
00078 # ifdef DOWNSHIFT_PATHS
00079         string path; 
00080         char *p;
00081 
00082         string_copy( &path, target );
00083         p = path.value;
00084 
00085         do
00086     {
00087         *p = tolower( *p );
00088 #  ifdef NT
00089         /* On NT, we must use backslashes or the file won't be found. */
00090         if (*p == '/')
00091             *p = PATH_DELIM;
00092 #  endif 
00093     }
00094         while( *p++ );
00095 
00096         target = path.value;
00097 # endif
00098         string_new( buf );
00099 
00100         if( !bindhash )
00101             bindhash = hashinit( sizeof( BINDING ), "bindings" );
00102 
00103         /* Quick path - is it there? */
00104 
00105         b->name = target;
00106         b->time = b->flags = 0;
00107         b->progress = BIND_INIT;
00108 
00109         if( hashenter( bindhash, (HASHDATA **)&b ) )
00110             b->name = newstr( target );         /* never freed */
00111 
00112         if( b->progress != BIND_INIT )
00113             goto afterscanning;
00114 
00115         b->progress = BIND_NOENTRY;
00116 
00117         /* Not found - have to scan for it */
00118 
00119         path_parse( target, &f1 );
00120 
00121         /* Scan directory if not already done so */
00122 
00123         {
00124             BINDING binding, *b = &binding;
00125 
00126             f2 = f1;
00127             f2.f_grist.len = 0;
00128             path_parent( &f2 );
00129             path_build( &f2, buf, 0 );
00130 
00131             b->name = buf->value;
00132             b->time = b->flags = 0;
00133             b->progress = BIND_INIT;
00134 
00135             if( hashenter( bindhash, (HASHDATA **)&b ) )
00136                 b->name = newstr( buf->value ); /* never freed */
00137 
00138             if( !( b->flags & BIND_SCANNED ) )
00139             {
00140                 file_dirscan( buf->value, time_enter, bindhash );
00141                 b->flags |= BIND_SCANNED;
00142             }
00143         }
00144 
00145         /* Scan archive if not already done so */
00146 
00147         if( f1.f_member.len )
00148         {
00149             BINDING binding, *b = &binding;
00150 
00151             f2 = f1;
00152             f2.f_grist.len = 0;
00153             f2.f_member.len = 0;
00154             string_truncate( buf, 0 );
00155             path_build( &f2, buf, 0 );
00156 
00157             b->name = buf->value;
00158             b->time = b->flags = 0;
00159             b->progress = BIND_INIT;
00160 
00161             if( hashenter( bindhash, (HASHDATA **)&b ) )
00162                 b->name = newstr( buf->value ); /* never freed */
00163 
00164             if( !( b->flags & BIND_SCANNED ) )
00165             {
00166                 file_archscan( buf->value, time_enter, bindhash );
00167                 b->flags |= BIND_SCANNED;
00168             }
00169         }
00170 
00171     afterscanning:
00172 
00173         if( b->progress == BIND_SPOTTED )
00174         {
00175             if( file_time( b->name, &b->time ) < 0 )
00176                 b->progress = BIND_MISSING;
00177             else
00178                 b->progress = BIND_FOUND;
00179         }
00180 
00181         *time = b->progress == BIND_FOUND ? b->time : 0;
00182         string_free( buf );
00183 # ifdef DOWNSHIFT_PATHS
00184         string_free( &path );
00185 #endif
00186 }

Here is the call graph for this function:


Generated on Mon Nov 8 17:08:26 2004 for MPT by  doxygen 1.3.9.1