⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instfile.c

📁 这是一个C程序分析工具
💻 C
字号:
/*===================================================================
	FILE   :        @(#)instfile.c	2.3   -  08/04/99 
  ===================================================================*/
/*===================================================================
	PURPOSE: Instruments C language source code.

	SYSTEM : RECON II

HISTORY:
VER    DATE    AUTHOR                    DESCRIPTION
1.00 22-Feb-97 Rich Jones    removed following function per Tisk 017
				InstrumentMultipleFiles
				ValidateDestination 

  -------------------------------------------------------------------*/

/*==[ INCLUDES ]=====================================================*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "r2.h"
#include "r2inst.h"
#include "instfile.h"
#include "instutil.h"
#include "instpars.h"
#include "vb_print.h"

/*===================================================================
	FUNCTION: ValidateSourceFile
  ===================================================================
	PURPOSE : Checks for the existence of the source file to be
				 instrumented.

	CALLS   : None

	USED BY : main

	HISTORY :
	VER   DATE         AUTHOR    DESCRIPTION
	1.00   6 Feb 93 L. McCallie  Created file.
	1.01  22 Feb 93 L. McCallie  Display filename being instrumented.
	1.1   22 FEB 97 R. Jones     Added relative path warning per
				     Tisk 017
  -------------------------------------------------------------------*/
FILE *ValidateSourceFile()
	{
	gSrcFILE = fopen(gSrcPath, "r");
	if (NULL == gSrcFILE)
		{
		printf("Error - %s is not a valid source file\n", gSrcPath);
		}
        else if (gSrcPath[0] != '/' && gSrcPath[1] != ':')
		{
		printf("\nWarning: A relative path is given as input to r2inst.\n");
		printf("r2analyz will fail to find the source file\n");
		printf("unless run from the same directory\n\n");
		}
	return(gSrcFILE);
	}

/*===================================================================
	FUNCTION: ValidateDestFile
  ===================================================================
	PURPOSE : Checks for the existence of the destination file to be
				 instrumented.

	CALLS   : None

	USED BY : main

	HISTORY :
	VER   DATE         AUTHOR    DESCRIPTION
	1.00   4 Nov 96 J. Ward      Created file.
  -------------------------------------------------------------------*/
FILE *ValidateDestFile(char *InstPath)
	{
	gInstFILE = fopen(InstPath, "w");
	if (NULL == gInstFILE)
	    {
	    printf("Error - %s is not a valid destination file\n", InstPath);
	    }
	return(gInstFILE);
	}

/*===================================================================
  FUNCTION: SendPrototypes
  ===================================================================
  PURPOSE : Places trace function prototypes in the instrumented file.

	CALLS   : None

	USED BY : main

	HISTORY :
	VER   DATE         AUTHOR    DESCRIPTION
	1.00   6 Feb 93 L. McCallie  Created file.
	1.01   3 Mar 93 L. McCallie  Capitalized r2 functions and variables.
	1.10  25 Feb 97 R. Jones     added static char line per Tisk 017
        1.11  22 Jan 98 B. Boone     Removed unused variable per Tisk 022 
  -------------------------------------------------------------------*/
void SendPrototypes(void)
	{
	char *protos = "#include \"r2protos.h\"";

        fprintf(gInstFILE, "%s\n", protos);
        fprintf(gInstFILE, "static char * R2srcfile_ptr =\"%s\";\n\n",gSrcPath);
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -