scripts/gen_offset_header/gen_offset_header.c
/**
 *
 * @brief dump the header preamble to the header file
 *
 * @param fd file pointer to which to write
 * @parama filename name of the output file
 * @returns N/A
 */
@brief dump the header preamble to the header file
@param fd file pointer to which to write
@parama filename name of the output file
@returns N/A
@brief dump the header preamble to the header file @param fd file pointer to which to write @parama filename name of the output file @returns N / A
static void headerPreambleDump(FILE *fp, char *filename)
{
	unsigned hash = 5381;      
	size_t   ix;               
	char     fileNameHash[20]; 
	fprintf(fp, preamble1, filename, filename, filename);
	for (ix = 0; ix < sizeof(filename); ++ix)
	{
		hash = (hash * 33) + (unsigned int) filename[ix];
	}
	sprintf(fileNameHash, "_HGUARD_%08x", hash);
	fprintf(fp, preamble2, fileNameHash, fileNameHash);
}
static void headerPreambleDump ( FILE * fp , char * filename ) { unsigned hash = 5381 ; size_t ix ; char fileNameHash [ 20 ] ; fprintf ( fp , preamble1 , filename , filename , filename ) ; for ( ix = 0 ; ix < sizeof ( filename ) ; ++ ix ) { hash = ( hash * 33 ) + ( unsigned int ) filename [ ix ] ; } sprintf ( fileNameHash , " " , hash ) ; fprintf ( fp , preamble2 , fileNameHash , fileNameHash ) ; }
@brief dump the header preamble to the header file
 @param fd file pointer to which to write
 @parama filename name of the output file
 @returns N/A
@brief dump the header preamble to the header file @param fd file pointer to which to write @parama filename name of the output file @returns N / A
/* hash value */ /* loop counter */ /* '_HGUARD_' + 8 character hash + '\0' */ /* dump header file preamble1[] */ /*
	 * Dump header file preamble2[]. Hash file name into something that
	 * is small enough to be a C macro name and does not have invalid
	 * characters for a macro name to use as a header guard. The result
	 * of the hash should be unique enough for our purposes.
	 */