scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

gensys.sh (312B)


      1 #!/bin/sh
      2 
      3 awk '! /^#/ && $2 == "'$1'" {
      4 	syscall=$2
      5 	fname=$2".s"
      6 
      7 	printf ("\t.file\t"	\
      8 	       "\"%s\"\n"	\
      9 	       "\t.globl\t%s\n"	\
     10 	       "%s:\n",
     11 	       fname, syscall, syscall)
     12 
     13 	printf ("\tli\t0,%d\n"	\
     14 	       "\tsc\n"		\
     15 	       "\tmfcr\t0\n"	\
     16 	       "\tb\t_cerrno\n", $1)
     17 } ' syscall.lst >$1.s