Added "what" script. Moved miscellaneous tools (sizeofchk, what)
into their own "misc-tools" sub-directory and updated README.md to reflect the change.
This commit is contained in:
parent
b0196162a9
commit
787c1866e2
5 changed files with 15 additions and 2 deletions
40
misc-tools/sizeofchk/Makefile
Normal file
40
misc-tools/sizeofchk/Makefile
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Makefile for Simple Sizeof Utility
|
||||
#
|
||||
# Created 2014-06-26 by Ed Braaten
|
||||
#
|
||||
|
||||
# Variables that may need tweaking...
|
||||
COMPILER=gcc
|
||||
#COMPILER=icc
|
||||
#COMPILER=clang
|
||||
CCOPTIONS=-O -Wall
|
||||
INSTALLPATH=/usr/local/bin
|
||||
|
||||
# These variables shouldn't need any tweaking
|
||||
CCVERSION=`${COMPILER} --version | head -1`
|
||||
BINARYNAME=sizeofchk-${COMPILER}
|
||||
SHORT_SHA:=$(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
PGM_VERSION=1.0 (git-$(SHORT_SHA))
|
||||
|
||||
|
||||
# Target to build the main program...
|
||||
${BINARYNAME}: Makefile sizeofchk.c
|
||||
@echo "#define COMPILEINFO \"${CCVERSION}\"" >sizeofchk.h
|
||||
@echo "#define ARCHINFO \""`uname -m`"\"" >>sizeofchk.h
|
||||
@echo "#define SYSINFO \""`uname -s`"\"" >>sizeofchk.h
|
||||
@echo "#define RELEASEINFO \""`uname -r`"\"" >>sizeofchk.h
|
||||
@echo "#define VERSION_STRING \"${PGM_VERSION}\"" >>sizeofchk.h
|
||||
@echo "Header file created..."
|
||||
${COMPILER} ${CCOPTIONS} -o ${BINARYNAME} sizeofchk.c
|
||||
chmod 755 ${BINARYNAME}
|
||||
|
||||
install:
|
||||
mkdir -p /usr/local/bin
|
||||
cp ${BINARYNAME} ${INSTALLPATH}
|
||||
chmod 755 ${INSTALLPATH}/${BINARYNAME}
|
||||
|
||||
clean:
|
||||
rm -f ${BINARYNAME} sizeofchk.h *.o
|
||||
|
||||
tidy:
|
||||
rm -f *.o
|
||||
4
misc-tools/sizeofchk/README.md
Normal file
4
misc-tools/sizeofchk/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
sizeofchk
|
||||
=========
|
||||
|
||||
Utility to print out size in bits of basic types supported by your compiler.
|
||||
46
misc-tools/sizeofchk/sizeofchk.c
Normal file
46
misc-tools/sizeofchk/sizeofchk.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* simple utility to print out sizeof values...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <x86intrin.h>
|
||||
#include "sizeofchk.h" /* generated by makefile */
|
||||
|
||||
static char version[] = VERSION_STRING;
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
int (*funcptr)();
|
||||
|
||||
printf("Sizeof Utility by Ed Braaten - Version %s\n", version);
|
||||
printf("Running on %s (%s %s)\n", ARCHINFO, SYSINFO, RELEASEINFO);
|
||||
printf("Compiler version: '%s'\n\n", COMPILEINFO);
|
||||
|
||||
printf(" sizeof(char) = %lu bits\n", sizeof(char) * 8);
|
||||
printf(" sizeof(short) = %lu bits\n", sizeof(short) * 8);
|
||||
printf(" sizeof(int) = %lu bits\n", sizeof(int) * 8);
|
||||
printf(" sizeof(long int) = %lu bits\n", sizeof(long int) * 8);
|
||||
printf(" sizeof(long) = %lu bits\n", sizeof(long) * 8);
|
||||
printf(" sizeof(long long) = %lu bits\n", sizeof(long long) * 8);
|
||||
printf(" sizeof(float) = %lu bits\n", sizeof(float) * 8);
|
||||
printf(" sizeof(double) = %lu bits\n", sizeof(double) * 8);
|
||||
printf(" sizeof(long double) = %lu bits\n", sizeof(long double) * 8);
|
||||
printf(" sizeof(char *) = %lu bits\n", sizeof(char *) * 8);
|
||||
printf(" sizeof((*)()) = %lu bits\n", sizeof(funcptr) * 8);
|
||||
|
||||
#ifdef __SSE__
|
||||
printf("\nSSE types\n\n");
|
||||
printf(" sizeof(__m64) = %lu bits\n", sizeof(__m64) * 8);
|
||||
printf(" sizeof(__m128) = %lu bits\n", sizeof(__m128) * 8);
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
/* clang doesn't support __float128 */
|
||||
#else
|
||||
#ifdef __SSE2__
|
||||
printf(" sizeof(__float128) = %lu bits\n", sizeof(__float128) * 8);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
printf("\n");
|
||||
return(0);
|
||||
}
|
||||
12
misc-tools/what
Executable file
12
misc-tools/what
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# what - get SCCS identification information
|
||||
#
|
||||
# SCCS was the source code control system distributed
|
||||
# with AT&T Unix System III and V.
|
||||
#
|
||||
for i in "$@";
|
||||
do
|
||||
echo "$i:"
|
||||
strings "$i" | grep -e '@(#)' | sed 's/^.*[@][(][#][)]\(.*\)/ \1/'
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue