
Module: /home/henthorn/AUV/auv-qnx/auv/altex/onboard/camera/Utils.cc
Group: 'DGROUP' CONST,CONST2,_DATA,_BSS

Segment: _TEXT  DWORD USE32  0000007b bytes  

/** \file Utils.cc 

   Common utilities originally for Benthic Imaging AUV.

   \author k. headley
   copyright MBARI 2008 
*/
/****************************************************************************/
/* Copyright (c) 2008 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : Utils.cc                                                      */
/* Author   : K Headley                                                     */
/* Project  : Benthic Imaging AUV                                           */
/* Created  : 04/01/2008                                                    */
/****************************************************************************/
/* Modification History:                                                    */
/*  $Id: Utils.cc,v 1.2 2008/12/12 23:36:32 headley Exp $   */
/*  $Name: FastSim $ */
/****************************************************************************/

#include "Utils.h"

/**
   Print formatted debug message to stdout.
   Requires DEBUG compile time environment
   variable to be defined.

   @param fmt printf format string
   @param ... printf argument list
*/
void printdbg( char *fmt, ... ) {    
#ifdef DEBUG
  va_list args;     
  va_start( args, fmt );     
  vfprintf( stdout, fmt, args );     
  va_end( args );
#endif
 0000                    void near printdbg( char near *, ... ):
 0000  68 04 00 00 00                    push    00000004H
 0005  e8 00 00 00 00                    call    __CHK

}            

/**
   Delay for a specified period (in decimal sec)
   Uses nanosleep to implement the delay.

   @param delaySec Delay period length (decimal seconds)

*/
 000a  c3                                ret     

void delay( double delaySec ) {    
  struct timespec waitTime;
  unsigned long waitTimeNsec;
  time_t waitTimeSec;
 000b                    void near delay( double ):
 000b  68 24 00 00 00                    push    00000024H
 0010  e8 00 00 00 00                    call    __CHK
 0015  53                                push    ebx
 0016  52                                push    edx
 0017  83 ec 18                          sub     esp,00000018H

  unsigned long inum=((unsigned long)delaySec);
 001a  dd 44 24 24                       fld     qword ptr +24H[esp]
 001e  e8 00 00 00 00                    call    __CHP
 0023  df 7c 24 10                       fistp   qword ptr +10H[esp]
 0027  8b 54 24 10                       mov     edx,+10H[esp]

  double frac=delaySec-inum;
 002b  89 54 24 10                       mov     +10H[esp],edx
 002f  31 db                             xor     ebx,ebx
 0031  89 5c 24 14                       mov     +14H[esp],ebx
 0035  df 6c 24 10                       fild    qword ptr +10H[esp]
 0039  dc 6c 24 24                       fsubr   qword ptr +24H[esp]
 003d  dd 5c 24 08                       fstp    qword ptr +8H[esp]

  if(delaySec<=0.000000000){
    return;
  }
  waitTimeSec=(time_t)(inum);
 0041  d9 ee                             fldz    
 0043  dc 5c 24 24                       fcomp   qword ptr +24H[esp]
 0047  df e0                             fstsw   ax
 0049  9e                                sahf    
 004a  73 27                             jae     L1

  waitTimeNsec=(unsigned long)(frac*1000000000);
 004c  dd 44 24 08                       fld     qword ptr +8H[esp]
 0050  dc 0d 00 00 00 00                 fmul    qword ptr L2
 0056  e8 00 00 00 00                    call    __CHP
 005b  df 7c 24 10                       fistp   qword ptr +10H[esp]
 005f  8b 44 24 10                       mov     eax,+10H[esp]

  waitTime.tv_sec=waitTimeSec;
 0063  89 14 24                          mov     [esp],edx

  waitTime.tv_nsec=waitTimeNsec;
 0066  89 44 24 04                       mov     +4H[esp],eax

  nanosleep(&waitTime,NULL);
 006a  31 d2                             xor     edx,edx
 006c  89 e0                             mov     eax,esp
 006e  e8 00 00 00 00                    call    nanosleep_

}            
 0073  83 c4 18          L1              add     esp,00000018H
 0076  5a                                pop     edx
 0077  5b                                pop     ebx
 0078  c2 08 00                          ret     0008H

No disassembly errors

------------------------------------------------------------

Segment: CONST  DWORD USE32  00000008 bytes  
 0000  00 00 00 00 65 cd cd 41 L2              - ....e..A

No disassembly errors

------------------------------------------------------------
