From alsa-devel-owner@alsa.jcu.cz  Thu Apr  9 08:19:56 1998
Received: from umr.edu (hermes.cc.umr.edu [131.151.1.68])
	by marvin.jcu.cz (8.8.8/8.8.8) with ESMTP id IAA21399
	for <ultra-devel@alsa.jcu.cz>; Thu, 9 Apr 1998 08:19:45 +0200
Received: from umr.edu (dialup-pkr-10-14.network.umr.edu [131.151.253.168]) via ESMTP by hermes.cc.umr.edu (8.8.7/R.4.20) id BAA18329; Thu, 9 Apr 1998 01:19:42 -0500 (CDT)
Message-ID: <352B16B5.C9241A32@umr.edu>
Date: Wed, 08 Apr 1998 01:18:29 -0500
From: FRBall <frb@umr.edu>
MIME-Version: 1.0
To: ultra-devel@alsa.jcu.cz
Subject: export-symtabs
Content-Type: multipart/mixed; boundary="------------D5E3970B31C2E546021DEAA0"
Reply-To: alsa-devel@alsa.jcu.cz
Sender: alsa-devel-owner@alsa.jcu.cz
Precedence: list

This is a multi-part message in MIME format.
--------------D5E3970B31C2E546021DEAA0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

The stock export-symtabs script didn't work for me, so I rewrote it in
perl...

I tried to attach the perl version on this message, if there are any
problems, don't hesitate to tell me.

Franklin Belew
Avid Gus PnP Pro user (alsa is the only driver that detects the 8 meg
ram)
--------------D5E3970B31C2E546021DEAA0
Content-Type: text/plain; charset=us-ascii; name="export-symbols"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="export-symbols"

#!/usr/bin/perl
use File::Basename;

die "Usage: $0 file.sym\n" unless (-r $ARGV[0]); 

$KERNEL=`uname -r`;
($KVERSION,$KPATCHLEVEL,$KSUBLEVEL)=split /\./, $KERNEL;

$SRC=$ARGV[0];
$BASE=basename($SRC,".sym");
$BASE1=$BASE;
$BASE1 =~ s/-/_/g;

$DEST= $BASE . ".c";

$XSYM1="unknown";
$XSYM2="unknown";

if ($KVERSION == 2) {
  if ($KPATCHLEVEL == 1) {
    $XSYM1="EXPORT_SYMBOL(";
    $XSYM2=");\n";
  }
  else {
    $XSYM1="X(";
    $XSYM2="),\n";
  }
}

die "$SRC = $DEST: Error (1)\n" if ($SRC eq $DEST);

print "generating $DEST from $SRC... ";
  
open (SRC, "<$SRC") or die "Cannot open >> $SRC <<\n";
@SRCtext=<SRC>;

open (DEST, ">$DEST") or die "Cannot write to >> $DEST <<\n";

print DEST qq(/*\n);
print DEST qq( *  File generated by script export-symbols from file $SRC...\n);
print DEST qq( *  Don\'t edit!!!\n);
print DEST qq( */\n);
print DEST qq(\n);
print DEST qq(\#define EXPORT_SYMTAB\n);
print DEST qq(\#include "driver.h"\n);

foreach $line (@SRCtext) {
  if ( substr($line,0,1) eq "+" ) { 
    print DEST substr($line , 2);
  }
}

print DEST qq(\#ifndef LINUX_2_1\n);
print DEST qq(struct symbol_table snd_symbol_table_$BASE1 = \{\n);
print DEST qq(\#include <linux/symtab_begin.h>\n);
print DEST qq(\#endif\n);

foreach $line (@SRCtext) {
  chomp($line);
  print DEST "  /* ", substr($line,2), "*/\n" 
    if ( substr($line,0,1) eq "\#" );
  print DEST $XSYM1, $line, $XSYM2 
    if ( substr($line,0,1) ne "\#" && substr($line,0,1) ne "+" );
}

print DEST qq(\#ifndef LINUX_2_1\n);
print DEST qq(\#include <linux/symtab_end.h>\n);
print DEST qq(}\;\n);
print DEST qq(\#endif\n);

print "done\n";

--------------D5E3970B31C2E546021DEAA0--


