#  $Id: mks2sed.in 0.03 2000/05/28 00:00:03 tom Exp $
#
#  mks2sed.in:  Generates a legal Texinfo file from the tmpfile.
#
#
#  Copyright (c) 2000  Thomas Esken      <esken@gmx.de>
#                      Im Hagenfeld 84
#                      D-48147 M"unster
#                      GERMANY
#
#  This software doesn't claim completeness, correctness or usability.
#  On principle I will not be liable for ANY damages or losses (implicit
#  or explicit), which result from using or handling my software.
#  If you use this software, you agree without any exception to this
#  agreement, which binds you LEGALLY !!
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the `GNU General Public License' as published by
#  the `Free Software Foundation'; either version 2, or (at your option)
#  any later version.
#
#  You should have received a copy of the `GNU General Public License'
#  along with this program; if not, write to the:
#
#    Free Software Foundation, Inc.
#    59 Temple Place - Suite 330
#    Boston, MA 02111-1307,  USA
#
#
# Delete the first two lines.
  1d
  2d
# Third line, insert header text.
3 {
  i\
@c Automatically generated by mksamp-2.sed from @DEFINITION_FILE@.\
@c\
@c This file is included in @PACKAGE_TEXIFILE@.\
@c
}
# Convert `+++' prefixed lines ==> `+++XYZ' is substituted to `@XYZ'.
  s/^\+\+\+/@/
# If a substitution was made, branch to LABEL :d
  td
# Convert `---' prefixed lines ==> `---XYZ' is substituted to `@XYZ'.
  s/^\-\-\-/@/
# If a substitution was made, branch to LABEL :d
  td
# Depreciate all characters which have a special meaning in Texinfo.
# Convert any `@' to `@@'.
  s/@/@@/g
# Convert any `{' to `@{'.
  s/\{/@{/g
# If a substitution was made, branch to LABEL :a
  ta
  s/{/@{/g
  :a
# Convert any `}' to `@}'.
  s/\}/@}/g
# If a substitution was made, branch to LABEL :b
  tb
  s/}/@}/g
  :b
# Save pattern space.
  h
# Look whether first character of line is no `@' character.
  s/^[^@]//
# First character of line is no `@' character, so branch to LABEL :c
  tc
# Zero line?
  s/^$//
# Yes, also branch to LABEL :c
  tc
# Else jump to LABEL :d
  bd
# Not reached
  :c
# On LABEL :c, we get saved pattern space.
  x
# Manage `$ ' prefixed lines ==> `$ XYZ' is substituted to `$ XYZ'.
  s/^\$ /$ /
# If a substitution was made, branch to LABEL d:
  td
# Manage `> ' prefixed lines ==> `> XYZ' is substituted to `> XYZ'.
  s/^> /> /
# If a substitution was made, branch to LABEL d:
  td
# Otherwise, all other lines are prefixed with a `@print{} ' text.
  s/^/@print{} /
  :d
# On LABEL :d, branch ==> start new cycle.
  b
