xref: /onnv-gate/usr/src/tools/tokenize/tokenize.sh (revision 5891:0d5c6468bb04)
10Sstevel@tonic-gate#!/bin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
6*5891Sraf# Common Development and Distribution License (the "License").
7*5891Sraf# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
220Sstevel@tonic-gate#
23*5891Sraf# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate# Use is subject to license terms.
250Sstevel@tonic-gate#
260Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
270Sstevel@tonic-gate#
280Sstevel@tonic-gate# Creates "tokenized" FCode programs from Forth source code.
290Sstevel@tonic-gate#
300Sstevel@tonic-gate# Usage:  tokenize xxx.fth
310Sstevel@tonic-gate#
320Sstevel@tonic-gate# xxx.fth is the name of the source file, which must end in ".fth"
330Sstevel@tonic-gate# The output file will be named xxx.fcode .  It will have an a.out header
340Sstevel@tonic-gate# so that it can be downloaded to a PROM burner with "pburn"
350Sstevel@tonic-gate
360Sstevel@tonic-gate#
370Sstevel@tonic-gate# Get tokenizer.exe and forth_preload.so.1
380Sstevel@tonic-gate# from same directory that this command is in.
390Sstevel@tonic-gate#
400Sstevel@tonic-gatemypath=`dirname $0`
410Sstevel@tonic-gate
420Sstevel@tonic-gateinfile=/tmp/$$
430Sstevel@tonic-gateecho 'fcode-version1' > $infile
440Sstevel@tonic-gatecat $1 >> $infile
450Sstevel@tonic-gateecho 'end0' >> $infile
460Sstevel@tonic-gateoutfile=`basename $1 .fth`.fcode
470Sstevel@tonic-gate(
480Sstevel@tonic-gate	unset LD_PRELOAD_32 LD_PRELOAD_64
49*5891Sraf	unset LD_BIND_NOW_32 LD_BIND_NOW_64
500Sstevel@tonic-gate	set -x
51*5891Sraf	LD_PRELOAD=${mypath}/forth_preload.so.1 LD_BIND_NOW=1 \
520Sstevel@tonic-gate	${mypath}/forth ${mypath}/tokenize.exe \
530Sstevel@tonic-gate	-s "aout-header? off silent? on tokenize $infile $outfile" < /dev/null
540Sstevel@tonic-gate)
550Sstevel@tonic-gaterm $infile
56