1#!/bin/sh
2# -*- perl -*-
3# This code allows us to start perl from our path or an environment variable
4# rather than hardcoding a path into the #! line.  It works from sh or csh.
5(exit $?0) && eval 'exec ${QPERLQ-perl} -x $0 ${1+"$@"}'
6if (! $?QPERLQ) setenv QPERLQ perl
7exec $QPERLQ -x $0 $argv:q
8
9#!/usr/local/bin/perl -w
10#
11# $Id: make_prolog_cpp.pl,v 1.2 2000/02/11 04:29:08 ejb Exp $
12# $Source: /home/ejb/source/magiccube4d/CVSroot/src/make_prolog_cpp.pl,v $
13# $Author: ejb $
14#
15
16require 5.002;
17use strict;
18
19my $whoami = ($0 =~ m,([^/\\]*)$,) ? $1 : $0;
20#my $dirname = ($0 =~ m,(.*)[/\\][^/\\]+$,) ? $1 : ".";
21
22my $prolog_ps = "prolog.ps";
23my $prolog_h = "PSProlog.h";
24
25open(P, "<$prolog_ps") or die "$whoami: can't open $prolog_ps: $!\n";
26open(C, ">$prolog_h") or die "$whoami: can't open $prolog_h: $!\n";
27print C <<EOF
28// This file is automatically generated.  Do not edit.
29
30static char const* psp_before =
31EOF
32    ;
33while (<P>)
34{
35    chop;
36    s/\"/\\\"/g;
37    last if m/----- DATA HERE -----/;
38    print C "\"$_\\n\"\n";
39}
40print C <<EOF
41;
42static char const* psp_after =
43EOF
44    ;
45while (<P>)
46{
47    chop;
48    s/\"/\\\"/g;
49    print C "\"$_\\n\"\n";
50}
51print C ";\n";
52close(C);
53close(P);
54