src/GamIO/ML5Hdr.cc
/* These functions deal with constructing a MATLAB Version 5 MAT header in
   memory.  The default construdtor will create an appropriate header based
   on the current computer platform.                                         */
These functions deal with constructing a MATLAB Version 5 MAT header in
memory.  The default construdtor will create an appropriate header based
on the current computer platform.
These functions deal with constructing a MATLAB Version 5 MAT header in memory . The default construdtor will create an appropriate header based on the current computer platform .
MatLab5Hdr::MatLab5Hdr()
  {
  string s("MATLAB 5.0 MAT-file");		
  s += string(", Platform: ");			
#if defined(_MSC_VER) || defined(__SUNPRO_CC) || defined(__MINGW32__)
  s += string("Windows");
#else
  struct utsname name;			
  uname(&name);							
  s += name.sysname;				
#endif
  s += string(", Created on: ");		
  time_t now;					
  time(&now);					
#if defined(_MSC_VER)
	char timeStr[31];
  ctime_s(timeStr, 30, &now);				
	s += timeStr;
#else
  s += ctime(&now);		
#endif
	if(s[s.length()-1] == '\n')							
  s = s.substr(0, s.length()-1);					
  s += string(", Generated by GAMMA");		
#ifdef _MSC_VER
	strcpy_s(TextField,124,s.c_str());
#else
	s.copy(TextField,124);  
#endif
  char empty(' ');
  for(int i=s.length(); i<124; i++)		
    TextField[i] = empty;
  Ver = 0x0100;					
//  Ver = 1;					
  SetEndian();					
  size = 128;					
  BigEndIn = -1;				
  }
MatLab5Hdr :: MatLab5Hdr ( ) { string s ( " " ) ; s += string ( " " ) ; #if defined ( _MSC_VER ) || defined ( __SUNPRO_CC ) || defined ( __MINGW32__ ) s += string ( " " ) ; #else struct utsname name ; uname ( & name ) ; s += name . sysname ; #endif s += string ( " " ) ; time_t now ; time ( & now ) ; #if defined ( _MSC_VER ) char timeStr [ 31 ] ; ctime_s ( timeStr , 30 , & now ) ; s += timeStr ; #else s += ctime ( & now ) ; #endif if ( s [ s . length ( ) - 1 ] == ' \n ' ) s = s . substr ( 0 , s . length ( ) - 1 ) ; s += string ( " " ) ; #ifdef _MSC_VER strcpy_s ( TextField , 124 , s . c_str ( ) ) ; #else s . copy ( TextField , 124 ) ; #endif char empty ( ' ' ) ; for ( int i = s . length ( ) ; i < 124 ; i ++ ) TextField [ i ] = empty ; Ver = 0x0100 ; SetEndian ( ) ; size = 128 ; BigEndIn = -1 ; }
These functions deal with constructing a MATLAB Version 5 MAT header in
memory.
These functions deal with constructing a MATLAB Version 5 MAT header in memory .
// Begin string for textfiled // Add in platform info // Structure for info // Fill up structure // Add system name // Add in the time // Here is a time value // Set time value // Add as ctime format // Remove return if ctime // puts one on the end // Made with GAMMA // Copy string s to TextField // Zero rest of textfield // Set the version //  Ver = 1;					// Set the version // Determine byte order // Total number of bytes // No input endian type