Simple script for autogenerate extension loading library:

Generate void EXTinit(void) function for all EXT:

#!/bin/bash
echo “/generated “date/” > h.tmp
echo -e " void EXTinit(void){
" > f.tmp

grep “APIENTRY gl” /usr/X11R6/include/GL/glext.h |
sed ‘s/^.APIENTRY gl/gl/’ | sed 's/(.);//’ | while read FunName
do

if grep $FunName /usr/X11R6/include/GL/gl.h > /dev/null
then
continue
#Don’t EXT now? not sure
fi

FunPType=PFNecho $FunName | tr '[:lower:]' '[:upper:]'PROC
echo “$FunPType $FunName;” >> h.tmp
echo -e “$FunName=($FunPType)glXGetProcAddressARB(”$FunName");" >> f.tmp

done

echo -e "
}" >> f.tmp

cat h.tmp > extinit.h
cat f.tmp >> extinit.h
rm h.tmp f.tmp

Generate GLboolean EXTinit(void) function for used in *.c *.h files EXT only:

#!/bin/bash
echo “/generated “date/” > h.tmp
echo -e " GLboolean EXTinit(void){

GLboolean Status=1;" > f.tmp

grep “APIENTRY gl” /usr/X11R6/include/GL/glext.h |
sed ‘s/^.APIENTRY gl/gl/’ | sed 's/(.);//’ | while read FunName
do

if grep $FunName /usr/X11R6/include/GL/gl.h > /dev/null
then
continue
#Don’t EXT now? not sure
fi

if grep $FunName *.c *.h > /dev/null
then
FunPType=PFNecho $FunName | tr '[:lower:]' '[:upper:]'PROC
echo “$FunPType $FunName;” >> h.tmp
echo -e “$FunName=($FunPType)glXGetProcAddressARB(”$FunName");

if (!$FunName)
{ printf("$FunName do’not present!\
“); Status=0; }” >> f.tmp
fi

done

echo -e "return Status;
}
" >> f.tmp

cat h.tmp > extinit.h
cat f.tmp >> extinit.h
rm h.tmp f.tmp

Excuse my english.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.