home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / flower.zip / MemFunc.c < prev    next >
Text File  |  1997-06-23  |  3KB  |  115 lines

  1.  
  2. /* Copyright (c) 1996, 1997 Craig Schneiderwent */
  3. /*
  4. Program: flower
  5. File:    memfunc.c
  6. Author:  Craig Schneiderwent
  7.          74631.165@compuserve.com
  8. Date:    01-Dec-1996
  9.  
  10. These are helper functions for flower.  They
  11. allocate structures used by the linked lists
  12. and initialize those structures.
  13.  
  14. */
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <ctype.h>
  19. #include <string.h>
  20. #include <limits.h>
  21. #include "mydebug.h"
  22. #include "structs.h"
  23. #include "memfunc.h"
  24.  
  25.  
  26. struct funcInfo *funcInfoMalloc( void )
  27. {
  28.     struct funcInfo *new = NULL;
  29.  
  30.     new = ( struct funcInfo * ) malloc( sizeof( _funcInfo ) );
  31.     if ( new != NULL ) {
  32.         initFuncInfo( new );
  33.     } /* endif */
  34.  
  35.     return( new );
  36. }
  37.  
  38. struct fileInfo *fileInfoMalloc( void )
  39. {
  40.     struct fileInfo *new = NULL;
  41.  
  42.     new = ( struct fileInfo * ) malloc( sizeof( _fileInfo ) );
  43.     if ( new != NULL ) {
  44.         initFileInfo( new );
  45.     } /* endif */
  46.  
  47.     return( new );
  48. }
  49.  
  50. struct isCalledByFuncInfo *isCalledByMalloc( void )
  51. {
  52.     struct isCalledByFuncInfo *new = NULL;
  53.  
  54.     new = ( struct isCalledByFuncInfo * ) 
  55.                 malloc( sizeof( _isCalledByFuncInfo ) );
  56.     if ( new != NULL ) {
  57.          initIsCalledByFuncInfo( new );
  58.     } /* endif */
  59.  
  60.     return( new );
  61. }
  62.  
  63. void initFileInfo( struct fileInfo *psFileInfo )
  64. {
  65.     memset( psFileInfo, '\0', sizeof( _fileInfo ) );
  66.     psFileInfo->next = NULL;
  67.     psFileInfo->prev = NULL;
  68.     psFileInfo->funcListStart = NULL;
  69.     psFileInfo->funcListEnd = NULL;
  70.  
  71.     return;
  72. }
  73.  
  74. void initFuncInfo( struct funcInfo *psFuncInfo )
  75. {
  76.     memset( psFuncInfo, '\0', sizeof( _funcInfo ) );
  77.     psFuncInfo->callsFromMe = 0;
  78.     psFuncInfo->callsToMe = 0;
  79.     psFuncInfo->isCalled = 0;
  80.     psFuncInfo->isCircularReference = 0;
  81.     psFuncInfo->next = NULL;
  82.     psFuncInfo->prev = NULL;
  83.     psFuncInfo->calledFuncBase = NULL;
  84.     psFuncInfo->calledFuncListStart = NULL;
  85.     psFuncInfo->calledFuncListEnd = NULL;
  86.  
  87.     return;
  88. }
  89.  
  90. void initIsCalledByFuncInfo( struct isCalledByFuncInfo *psFuncInfo )
  91. {
  92.     memset( psFuncInfo, '\0', sizeof( _isCalledByFuncInfo ) );
  93.     psFuncInfo->next = NULL;
  94.     psFuncInfo->prev = NULL;
  95.     psFuncInfo->callingFuncListStart = NULL;
  96.     psFuncInfo->callingFuncListEnd = NULL;
  97.     psFuncInfo->count = 0;
  98.  
  99.     return;
  100. }
  101.  
  102. void copyFuncInfo( struct funcInfo *pIn
  103.                  , struct funcInfo *pOut )
  104. {
  105.     memset( pOut, '\0', sizeof( _funcInfo ) );
  106.     strcpy( pOut->funcNm, pIn->funcNm );
  107.     strcpy( pOut->fileNm, pIn->fileNm );
  108.     pOut->callsFromMe = pIn->callsFromMe;
  109.     pOut->callsToMe = pIn->callsToMe;
  110.     pOut->isCalled = pIn->isCalled;
  111.  
  112.     return;
  113. }
  114.  
  115.