#!/bin/sh class=basetransform prefix=gst name=edi_test PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/') NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/') Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/' -e 's/^\(.\)/\U\1/') Name=$(echo $name | sed -e 's/_\(.\)/\U\1/' -e 's/^\(.\)/\U\1/') GST_IS_REPLACE=${PREFIX}_IS_${NAME} GST_REPLACE=${PREFIX}_${NAME} GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME} GstReplace=${Prefix}${Name} gst_replace=${prefix}_${name} gstreplace=${prefix}$(echo $name | sed -e 's/_//') replace=$(echo $name | sed -e 's/_//') if [ "$REAL_NAME" = "" ] ; then REAL_NAME=FIXME fi if [ "$EMAIL_ADDRESS" = "" ] ; then EMAIL_ADDRESS=fixme@example.com fi source=gst$class.c pkg=`grep -A 10000 '^% pkg-config' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` GST_TYPE_BASE_REPLACE=`grep -A 10000 '^% TYPE_CLASS_NAME' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` GstBaseReplace=`grep -A 10000 '^% ClassName' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1` generate () { cat <<-EOF /* GStreamer * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ EOF #grep -A 10000 '^% copyright' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 cat <"); } static void gst_replace_class_init (GstReplaceClass * klass) { EOF grep -A 10000 '^% declare-class' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% declare-class' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% declare-class' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 echo grep -A 10000 '^% set-methods' base.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% set-methods' gobject.c | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 grep -A 10000 '^% set-methods' $source | tail -n +2|grep -m 1 -B 10000 '^%'|head -n -1 cat <$gstreplace.c generate_header | sed \ -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \ -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \ -e "s/GstBaseReplace/$GstBaseReplace/g" \ -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \ -e "s/GST_REPLACE/$GST_REPLACE/g" \ -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \ -e "s/GstReplace/$GstReplace/g" \ -e "s/gst_replace/$gst_replace/g" \ -e "s/gstreplace/$gstreplace/g" \ -e "s/replace/$replace/g" >$gstreplace.h gst-indent $gstreplace.c echo pkg is $pkg gcc -Wall $(pkg-config --cflags gstreamer-0.10 $pkg) -c -o $gstreplace.o $gstreplace.c gcc -shared -o $gstreplace.so $gstreplace.o $(pkg-config --libs gstreamer-0.10 $pkg)