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

📄 add_event_blks.c

📁 seed格式数据解压程序,地震分析人员必备
💻 C
字号:
/*===========================================================================*//*                 |                                       |                 *//*===========================================================================*//*	Name:			Purpose:		Usage:			Input:			Output:			Externals:		Warnings:		Errors:			Fatals:	Called by:		Calls to:		Algorithm:				Loop through event data and add blockette lengths to				logical record;*/	#include "output.h"#include <unistd.h>extern struct blk71_list *Blk71_head;extern struct blk71_list *Blk71_tail;add_event_blks(start, end, bottom, top, length)struct	input_time	start, end;		/* start and end of a tspan */char	**bottom, **top;			/* buffer area handling vars */int 	*length;{	FILE *infile;								/* ptr to input file */	char infilename[PATHLENGTH+1];				/* name of input file */	struct blk71_list *current_blk71;			/* current blk 71 pointer */	struct blk72_list *current_blk72;			/* current blk 72 pointer */		int found = TRUE;	if (Blk71_head == NULL) return;				/* no blk 71/72 */	/* look into the header directory - then the data directory.	 * Which assumes that the script makevol chdirs to the     * directory in question - which makes it the current directory	 */	sprintf (infilename, "%s/B071", Header_path);	if (access(infilename, R_OK) == -1)	{		strcpy(infilename, "B071");		if (access(infilename, R_OK) == -1)			found = FALSE;	}	if (!found)	{		if (Debug >= D_MED)			fprintf (D_OUT, "[add_event_blks] Could not find %s.\n", infilename);		return;	}	if ((infile = fopen (infilename, "r")) == NULL)	{		if (Debug >= D_MED)			fprintf (D_OUT, "[add_event_blks] Could not open %s.\n", infilename);		return;		}	start = add_longtime(start, -3600);			/* subtract 1 hour from start */	current_blk71 = Blk71_head;	while (current_blk71 != NULL)	{		if ((cmp_longtime(current_blk71->origin_time, start) >= 0) &&		    (cmp_longtime(current_blk71->origin_time, end) <= 0))		{			if( Debug >= D_MED )				fprintf( D_OUT, "[add_event_blks] adding blockette 71 size = %d\n", current_blk71->blk_length);			(void)make_room(*length, current_blk71->blk_length, bottom, top );			fseek(infile, current_blk71->start_offset, 0);			fread( *top, sizeof(char), current_blk71->blk_length, infile );			*top = *top + current_blk71->blk_length;			*length = (int) (*top - *bottom);			current_blk72 = current_blk71->blk72_list;			while (current_blk72 != NULL)			{				if( Debug >= D_MED )					fprintf( D_OUT, "[add_event_blks] adding blockette 72 size = %d\n", current_blk72->blk_length);				(void)make_room(*length, current_blk72->blk_length, bottom, top );				fseek(infile, current_blk72->start_offset, 0);				fread( *top, sizeof(char), current_blk72->blk_length, infile );				*top = *top + current_blk72->blk_length;				*length = (int) (*top - *bottom);				current_blk72 = current_blk72->next;			}		}		current_blk71 = current_blk71->next;	}	fclose(infile);}

⌨️ 快捷键说明

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