~ubuntu-branches/debian/squeeze/ffcall/squeeze

« back to all changes in this revision

Viewing changes to ffcall/avcall/asmm68k.sh

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2010-06-26 15:29:30 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626152930-c09y01gk3szcnykn
Tags: 1.10+cvs20100619-2
Ship to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# Translate the assembler syntax of m68k assembler programs
3
 
# Usage: asmm68k < sunos-asm-file > portable-asm-file
4
 
# The portable-asm-file has to be
5
 
#   1. preprocessed,
6
 
#   2. grep -v '^ *#line' | grep -v '^#'
7
 
#   3. sed -e 's,% ,%,g' -e 's,//.*$,,'
8
 
 
9
 
tmpscript1=sed$$tmp1
10
 
tmpscript2=sed$$tmp2
11
 
tmpremove='rm -f $tmpscript1 $tmpscript2'
12
 
trap "$tmpremove" 1 2 15
13
 
 
14
 
cat > $tmpscript1 << \EOF
15
 
# ----------- Remove #APP/#NO_APP lines
16
 
/^#APP$/d
17
 
/^#NO_APP$/d
18
 
# ----------- Remove gcc self-identification
19
 
/gcc2_compiled/d
20
 
/gnu_compiled_c/d
21
 
EOF
22
 
 
23
 
cat > $tmpscript2 << \EOF
24
 
# ----------- Prefix register names with $, to be turned into % later
25
 
s/,/, /g
26
 
s/\([^A-Za-z0-9_]\)\([ad][0-7]\|sp\|fp[0-7]\)\([^A-Za-z0-9_]\)/\1$\2\3/g
27
 
s/\([^A-Za-z0-9_]\)\([ad][0-7]\|sp\|fp[0-7]\)$/\1$\2/g
28
 
s/, /,/g
29
 
# ----------- Declare global symbols as functions (we have no variables)
30
 
s/\.globl _\([A-Za-z0-9_]*\)$/.globl _\1\
31
 
        DECLARE_FUNCTION(\1)/
32
 
# ----------- Global symbols depends on ASM_UNDERSCORE
33
 
s/_\([A-Za-z0-9_:]*\)/C(\1)/
34
 
EOF
35
 
 
36
 
sed -f $tmpscript1 | \
37
 
sed -f $tmpscript2
38
 
 
39
 
eval "$tmpremove"