📄 make_headers.c
字号:
/*===========================================================================*//* | | *//*===========================================================================*//* Name: make_headers.c Purpose: build in their final logical record image all non-data records for a SEED output volume. Usage: err = make_headers( nlvol, ntspan, lvol_head, tspan_head, volume_break, tspan_break, start, end ) Input: nlvol count of total number of segments in output volume ntspan count of total number of time spans lvol_head struct lvol * list head tspan_head struct tspan_list * list head volume_break struct input_time time of a volume span tspan_break struct input_time time of a time-span struct input_time start volume start struct input_time end volume end Output: struct logrec_list **headers_head, **headers_tail Externals: Warnings: Errors: Fatals: Called by: Calls to: Algorithm: Notes: Problems: References: Language: Revisions: mm/dd/yy pgmr name change 05dec91 mw change SEED_Version is *10; 22 == 2.2*/#include "output.h"extern int Write_Data;make_headers( nlvol, ntspan, lvol_head, tspan_head, volume_break, tspan_break, start_volume, end_volume, count )int nlvol; /* number of segments in this logical volume */int ntspan; /* number of time spans in this log vol */struct lvol *lvol_head; /* list head for singly linked lvol list */struct tspan_list *tspan_head; /* list head for singly linked tspan list */struct input_time volume_break; /* delta time of a volume span */struct input_time tspan_break; /* delta time of a time span */struct input_time start_volume; /* start time of a volume */struct input_time end_volume; /* delta time of a volume */int *count; /* total count of headers */{int a_count; /* number of logical records taken by abbrev hdr */int s_count; /* number of logical records taken by station hdr */int t_count; /* number of logical records taken by tspan hdrs */int v_count; /* number of logical records taken by volume hdr */struct station_list *sl_head; /* structures to track stations */struct station_list *sl_tail;int nstations; /* number of stations total */int err; /* status: OK, WARNING, ERROR, FATAL */int n; if( Debug >= D_MIN ) fprintf( D_OUT,"[make_headers] start\n"); err = create_A( &a_count ); if( err ) if( err=error_handler(FATAL,"[make_headers] create_A failed")) return( err ); err = create_S( nlvol, lvol_head, start_volume, end_volume, &sl_head, &sl_tail, &s_count, &nstations ); if( err ) if( err=error_handler(FATAL,"[make_headers] create_S failed")) return( err );/* * compute the size of the volume header - it can be done a priori * so long as we allow for blank padding - done by size_logrec. */ n = 59; /* blockette 010 size */ if( SEED_Version >= 22 ) /* may be larger */ { char *tape_label; tape_label = getenv("SEED_LABEL"); if (tape_label == NULL) tape_label = ""; /* plus 80 for tape-volume label */ n = n + 23 + strlen(Organization) + 1 + strlen(tape_label) + 1; } v_count = size_logrec( 10+11*nstations, Lrecl, &n ); /* blockette 011 size *//* * this routine notes the sequence numbers of each start timespan * in struct tspan_list.seqno */ if (Write_Data) { v_count = size_logrec( 11 + 52*ntspan, Lrecl, &n ); /* blockette 012 size */ err = create_T(v_count+a_count+s_count, ntspan, tspan_head, start_volume, tspan_break, &t_count); if( err ) if( err=error_handler(err,"[make_headers] create_T failed")) return( err ); } err = create_V( v_count+a_count, ntspan, tspan_head, volume_break, tspan_break, start_volume, end_volume, nstations, sl_head, &n); if( err ) if( err=error_handler(FATAL,"[make_headers] create_V failed")) return( err ); if( n != v_count ) if( err=error_handler( WARNING, "[make_headers] volume hdr log rec count wrong") ) return( err ); if( Debug >= D_MIN ) fprintf( D_OUT,"[make_headers] end\n"); return( err );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -