EVERYTHING FROM THE OTHER REPO
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
GNU Sed was first authored by Jay Fenlason (hack@gnu.org)
|
||||
and later modified by Tom Lord (lord@gnu.org).
|
||||
|
||||
Ken Pizzini (ken@gnu.org) and Paolo Bonzini (bonzini@gnu.org)
|
||||
took over and maintained it for many years.
|
||||
|
||||
GNU Sed is currently being maintained by Jim Meyering (jim@meyering.net)
|
||||
and Assaf Gordon (agn@gnu.org).
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
This is the GNU implementation of sed, the Unix stream editor.
|
||||
|
||||
GNU Sed website: https://www.gnu.org/software/sed/
|
||||
|
||||
See the NEWS file for a brief summary and the ChangeLog for
|
||||
more detailed descriptions of changes.
|
||||
|
||||
If you obtained this file as part of a "git clone", then see the
|
||||
README-hacking file. If this file came to you as part of a tar archive,
|
||||
then see the file INSTALL for compilation and installation instructions.
|
||||
|
||||
See the file BUGS for instructions about reporting bugs.
|
||||
|
||||
See the files AUTHORS and THANKS for a list of authors and other contributors.
|
||||
|
||||
After installation run 'sed --help' or 'man sed' for short usage information,
|
||||
and 'info sed' for the complete manual. The manual is also available on
|
||||
sed's website.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,174 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: GNU sed
|
||||
Source: ftp://ftp.gnu.org/gnu/sed/
|
||||
Comment: This is the Debian GNU/Linux prepackaged version of sed.
|
||||
It is currently maintained by Clint Adams <clint@debian.org>.
|
||||
|
||||
Files: *
|
||||
doc/local.mk
|
||||
Copyright: 1989-2020 Free Software Foundation, Inc.
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
GNU sed 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 3, or (at your option) any later
|
||||
version.
|
||||
.
|
||||
On Debian GNU/Linux systems you can find a copy of the GPL in
|
||||
/usr/share/common-licenses/GPL-3
|
||||
|
||||
Files: build-aux/install-sh
|
||||
Copyright: 1994 X Consortium
|
||||
License: X11
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
.
|
||||
Except as contained in this notice, the name of the X Consortium shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from the X Consor-
|
||||
tium.
|
||||
Comment: FSF changes to this file are in the public domain.
|
||||
|
||||
Files: doc/*
|
||||
Copyright: 1998-2020 Free Software Foundation, Inc.
|
||||
License: GFDL-NIV-1.3+
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts, and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
.
|
||||
On Debian GNU/Linux systems you can find a copy of the GFDL in
|
||||
/usr/share/common-licenses/GFDL-1.3
|
||||
|
||||
Files: gnulib-tests/inet_pton.c
|
||||
Copyright: (C) 2006, 2008-2020 Free Software Foundation, Inc.
|
||||
(c) 1996,1999 by Internet Software Consortium.
|
||||
License: GPL-3+ and ISC
|
||||
|
||||
License: ISC
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
||||
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
||||
CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
||||
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
Files: testsuite/bsd.sh
|
||||
Copyright: (c) 1992 Diomidis Spinellis.
|
||||
(c) 1992, 1993 The Regents of the University of California. All rights reserved.
|
||||
License: BSD-4-clause-UC
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. <deleted>
|
||||
4. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
.
|
||||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Files: testsuite/BOOST.tests
|
||||
Copyright: 2004 John Maddock
|
||||
Comment: Tests taken from BOOST testsuite and adapted to glibc regex.
|
||||
License: BSL-1
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
.
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
.
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Files: testsuite/PCRE.tests
|
||||
Copyright: 1997-2003 University of Cambridge
|
||||
License: pcre
|
||||
Permission is granted to anyone to use this software for any purpose on any
|
||||
computer system, and to redistribute it freely, subject to the following
|
||||
restrictions:
|
||||
.
|
||||
1. This software is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
.
|
||||
2. The origin of this software must not be misrepresented, either by
|
||||
explicit claim or by omission. In practice, this means that if you use
|
||||
PCRE in software that you distribute to others, commercially or
|
||||
otherwise, you must put a sentence like this
|
||||
.
|
||||
Regular expression support is provided by the PCRE library package,
|
||||
which is open source software, written by Philip Hazel, and copyright
|
||||
by the University of Cambridge, England.
|
||||
.
|
||||
somewhere reasonably visible in your documentation and in any relevant
|
||||
files or online help data or similar. A reference to the ftp site for
|
||||
the source, that is, to
|
||||
.
|
||||
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
|
||||
.
|
||||
should also be given in the documentation. However, this condition is not
|
||||
intended to apply to whole chains of software. If package A includes PCRE,
|
||||
it must acknowledge it, but if package B is software that includes package
|
||||
A, the condition is not imposed on package B (unless it uses PCRE
|
||||
independently).
|
||||
.
|
||||
3. Altered versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
.
|
||||
4. If PCRE is embedded in any software that is released under the GNU
|
||||
General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
|
||||
then the terms of that licence shall supersede any condition above with
|
||||
which it is incompatible.
|
||||
@@ -0,0 +1,322 @@
|
||||
#!/bin/sed -nf
|
||||
# dc.sed - an arbitrary precision RPN calculator
|
||||
# Created by Greg Ubben <gsu@romulus.ncsc.mil> early 1995, late 1996
|
||||
#
|
||||
# Dedicated to MAC's memory of the IBM 1620 ("CADET") computer.
|
||||
# @(#)GSU dc.sed 1.1 06-Mar-1999 [non-explanatory]
|
||||
#
|
||||
# Examples:
|
||||
# sqrt(2) to 10 digits: echo "10k 2vp" | dc.sed
|
||||
# 20 factorial: echo "[d1-d1<!*]s! 20l!xp" | dc.sed
|
||||
# sin(ln(7)): echo "s(l(7))" | bc -c /usr/lib/lib.b | dc.sed
|
||||
# hex to base 60: echo "60o16i 6B407.CAFE p" | dc.sed
|
||||
# tests most of dc.sed: echo 16oAk2vp | dc.sed
|
||||
#
|
||||
# To debug or analyze, give the dc Y command as input or add it to
|
||||
# embedded dc routines, or add the sed p command to the beginning of
|
||||
# the main loop or at various points in the low-level sed routines.
|
||||
# If you need to allow [|~] characters in the input, filter this
|
||||
# script through "tr '|~' '\36\37'" first (or use dc.pl).
|
||||
#
|
||||
# Not implemented: ! \
|
||||
# But implemented: K Y t # !< !> != fractional-bases
|
||||
# SunOS limits: 199/199 commands (though could pack in 10-20 more)
|
||||
# Limitations: scale <= 999; |obase| >= 1; input digits in [0..F]
|
||||
# Completed: 1am Feb 4, 1997
|
||||
|
||||
s/^/|P|K0|I10|O10|?~/
|
||||
|
||||
: next
|
||||
s/|?./|?/
|
||||
s/|?#[ -}]*/|?/
|
||||
/|?!*[lLsS;:<>=]\{0,1\}$/N
|
||||
/|?!*[-+*/%^<>=]/b binop
|
||||
/^|.*|?[dpPfQXZvxkiosStT;:]/b binop
|
||||
/|?[_0-9A-F.]/b number
|
||||
/|?\[/b string
|
||||
/|?l/b load
|
||||
/|?L/b Load
|
||||
/|?[sS]/b save
|
||||
/|?c/ s/[^|]*//
|
||||
/|?d/ s/[^~]*~/&&/
|
||||
/|?f/ s//&[pSbz0<aLb]dSaxsaLa/
|
||||
/|?x/ s/\([^~]*~\)\(.*|?x\)~*/\2\1/
|
||||
/|?[KIO]/ s/.*|\([KIO]\)\([^|]*\).*|?\1/\2~&/
|
||||
/|?T/ s/\.*0*~/~/
|
||||
# a slow, non-stackable array implementation in dc, just for completeness
|
||||
# A fast, stackable, associative array implementation could be done in sed
|
||||
# (format: {key}value{key}value...), but would be longer, like load & save.
|
||||
/|?;/ s/|?;\([^{}]\)/|?~[s}s{L{s}q]S}[S}l\1L}1-d0>}s\1L\1l{xS\1]dS{xL}/
|
||||
/|?:/ s/|?:\([^{}]\)/|?~[s}L{s}L{s}L}s\1q]S}S}S{[L}1-d0>}S}l\1s\1L\1l{xS\1]dS{x/
|
||||
/|?[ ~ cdfxKIOT]/b next
|
||||
/|?\n/b next
|
||||
/|?[pP]/b print
|
||||
/|?k/ s/^\([0-9]\{1,3\}\)\([.~].*|K\)[^|]*/\2\1/
|
||||
/|?i/ s/^\(-\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}\)\(~.*|I\)[^|]*/\2\1/
|
||||
/|?o/ s/^\(-\{0,1\}[1-9][0-9]*\.\{0,1\}[0-9]*\)\(~.*|O\)[^|]*/\2\1/
|
||||
/|?[kio]/b pop
|
||||
/|?t/b trunc
|
||||
/|??/b input
|
||||
/|?Q/b break
|
||||
/|?q/b quit
|
||||
h
|
||||
/|?[XZz]/b count
|
||||
/|?v/b sqrt
|
||||
s/.*|?\([^Y]\).*/\1 is unimplemented/
|
||||
s/\n/\\n/g
|
||||
l
|
||||
g
|
||||
b next
|
||||
|
||||
: print
|
||||
/^-\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}~.*|?p/!b Print
|
||||
/|O10|/b Print
|
||||
|
||||
# Print a number in a non-decimal output base. Uses registers a,b,c,d.
|
||||
# Handles fractional output bases (O<-1 or O>=1), unlike other dc's.
|
||||
# Converts the fraction correctly on negative output bases, unlike
|
||||
# UNIX dc. Also scales the fraction more accurately than UNIX dc.
|
||||
#
|
||||
s,|?p,&KSa0kd[[-]Psa0la-]Sad0>a[0P]sad0=a[A*2+]saOtd0>a1-ZSd[[[[ ]P]sclb1\
|
||||
!=cSbLdlbtZ[[[-]P0lb-sb]sclb0>c1+]sclb0!<c[0P1+dld>c]scdld>cscSdLbP]q]Sb\
|
||||
[t[1P1-d0<c]scd0<c]ScO_1>bO1!<cO[16]<bOX0<b[[q]sc[dSbdA>c[A]sbdA=c[B]sbd\
|
||||
B=c[C]sbdC=c[D]sbdD=c[E]sbdE=c[F]sb]xscLbP]~Sd[dtdZOZ+k1O/Tdsb[.5]*[.1]O\
|
||||
X^*dZkdXK-1+ktsc0kdSb-[Lbdlb*lc+tdSbO*-lb0!=aldx]dsaxLbsb]sad1!>a[[.]POX\
|
||||
+sb1[SbO*dtdldx-LbO*dZlb!<a]dsax]sadXd0<asbsasaLasbLbscLcsdLdsdLdLak[]pP,
|
||||
b next
|
||||
|
||||
: Print
|
||||
/|?p/s/[^~]*/&\
|
||||
~&/
|
||||
s/\(.*|P\)\([^|]*\)/\
|
||||
\2\1/
|
||||
s/\([^~]*\)\n\([^~]*\)\(.*|P\)/\1\3\2/
|
||||
h
|
||||
s/~.*//
|
||||
/./{ s/.//; p; }
|
||||
# Just s/.//p would work if we knew we were running under the -n option.
|
||||
# Using l vs p would kind of do \ continuations, but would break strings.
|
||||
g
|
||||
|
||||
: pop
|
||||
s/[^~]*~//
|
||||
b next
|
||||
|
||||
: load
|
||||
s/\(.*|?.\)\(.\)/\20~\1/
|
||||
s/^\(.\)0\(.*|r\1\([^~|]*\)~\)/\1\3\2/
|
||||
s/.//
|
||||
b next
|
||||
|
||||
: Load
|
||||
s/\(.*|?.\)\(.\)/\2\1/
|
||||
s/^\(.\)\(.*|r\1\)\([^~|]*~\)/|\3\2/
|
||||
/^|/!i\
|
||||
register empty
|
||||
s/.//
|
||||
b next
|
||||
|
||||
: save
|
||||
s/\(.*|?.\)\(.\)/\2\1/
|
||||
/^\(.\).*|r\1/ !s/\(.\).*|/&r\1|/
|
||||
/|?S/ s/\(.\).*|r\1/&~/
|
||||
s/\(.\)\([^~]*~\)\(.*|r\1\)[^~|]*~\{0,1\}/\3\2/
|
||||
b next
|
||||
|
||||
: quit
|
||||
t quit
|
||||
s/|?[^~]*~[^~]*~/|?q/
|
||||
t next
|
||||
# Really should be using the -n option to avoid printing a final newline.
|
||||
s/.*|P\([^|]*\).*/\1/
|
||||
q
|
||||
|
||||
: break
|
||||
s/[0-9]*/&;987654321009;/
|
||||
: break1
|
||||
s/^\([^;]*\)\([1-9]\)\(0*\)\([^1]*\2\(.\)[^;]*\3\(9*\).*|?.\)[^~]*~/\1\5\6\4/
|
||||
t break1
|
||||
b pop
|
||||
|
||||
: input
|
||||
N
|
||||
s/|??\(.*\)\(\n.*\)/|?\2~\1/
|
||||
b next
|
||||
|
||||
: count
|
||||
/|?Z/ s/~.*//
|
||||
/^-\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}$/ s/[-.0]*\([^.]*\)\.*/\1/
|
||||
/|?X/ s/-*[0-9A-F]*\.*\([0-9A-F]*\).*/\1/
|
||||
s/|.*//
|
||||
/~/ s/[^~]//g
|
||||
|
||||
s/./a/g
|
||||
: count1
|
||||
s/a\{10\}/b/g
|
||||
s/b*a*/&a9876543210;/
|
||||
s/a.\{9\}\(.\).*;/\1/
|
||||
y/b/a/
|
||||
/a/b count1
|
||||
G
|
||||
/|?z/ s/\n/&~/
|
||||
s/\n[^~]*//
|
||||
b next
|
||||
|
||||
: trunc
|
||||
# for efficiency, doesn't pad with 0s, so 10k 2 5/ returns just .40
|
||||
# The X* here and in a couple other places works around a SunOS 4.x sed bug.
|
||||
s/\([^.~]*\.*\)\(.*|K\([^|]*\)\)/\3;9876543210009909:\1,\2/
|
||||
: trunc1
|
||||
s/^\([^;]*\)\([1-9]\)\(0*\)\([^1]*\2\(.\)[^:]*X*\3\(9*\)[^,]*\),\([0-9]\)/\1\5\6\4\7,/
|
||||
t trunc1
|
||||
s/[^:]*:\([^,]*\)[^~]*/\1/
|
||||
b normal
|
||||
|
||||
: number
|
||||
s/\(.*|?\)\(_\{0,1\}[0-9A-F]*\.\{0,1\}[0-9A-F]*\)/\2~\1~/
|
||||
s/^_/-/
|
||||
/^[^A-F~]*~.*|I10|/b normal
|
||||
/^[-0.]*~/b normal
|
||||
s:\([^.~]*\)\.*\([^~]*\):[Ilb^lbk/,\1\2~0A1B2C3D4E5F1=11223344556677889900;.\2:
|
||||
: digit
|
||||
s/^\([^,]*\),\(-*\)\([0-F]\)\([^;]*\(.\)\3[^1;]*\(1*\)\)/I*+\1\2\6\5~,\2\4/
|
||||
t digit
|
||||
s:...\([^/]*.\)\([^,]*\)[^.]*\(.*|?.\):\2\3KSb[99]k\1]SaSaXSbLalb0<aLakLbktLbk:
|
||||
b next
|
||||
|
||||
: string
|
||||
/|?[^]]*$/N
|
||||
s/\(|?[^]]*\)\[\([^]]*\)]/\1|{\2|}/
|
||||
/|?\[/b string
|
||||
s/\(.*|?\)|{\(.*\)|}/\2~\1[/
|
||||
s/|{/[/g
|
||||
s/|}/]/g
|
||||
b next
|
||||
|
||||
: binop
|
||||
/^[^~|]*~[^|]/ !i\
|
||||
stack empty
|
||||
//!b next
|
||||
/^-\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}~/ !s/[^~]*\(.*|?!*[^!=<>]\)/0\1/
|
||||
/^[^~]*~-\{0,1\}[0-9]*\.\{0,1\}[0-9]\{1,\}~/ !s/~[^~]*\(.*|?!*[^!=<>]\)/~0\1/
|
||||
h
|
||||
/|?\*/b mul
|
||||
/|?\//b div
|
||||
/|?%/b rem
|
||||
/|?^/b exp
|
||||
|
||||
/|?[+-]/ s/^\(-*\)\([^~]*~\)\(-*\)\([^~]*~\).*|?\(-\{0,1\}\).*/\2\4s\3o\1\3\5/
|
||||
s/\([^.~]*\)\([^~]*~[^.~]*\)\(.*\)/<\1,\2,\3|=-~.0,123456789<></
|
||||
/^<\([^,]*,[^~]*\)\.*0*~\1\.*0*~/ s/</=/
|
||||
: cmp1
|
||||
s/^\(<[^,]*\)\([0-9]\),\([^,]*\)\([0-9]\),/\1,\2\3,\4/
|
||||
t cmp1
|
||||
/^<\([^~]*\)\([^~]\)[^~]*~\1\(.\).*|=.*\3.*\2/ s/</>/
|
||||
/|?/{
|
||||
s/^\([<>]\)\(-[^~]*~-.*\1\)\(.\)/\3\2/
|
||||
s/^\(.\)\(.*|?!*\)\1/\2!\1/
|
||||
s/|?![^!]\(.\)/&l\1x/
|
||||
s/[^~]*~[^~]*~\(.*|?\)!*.\(.*\)|=.*/\1\2/
|
||||
b next
|
||||
}
|
||||
s/\(-*\)\1|=.*/;9876543210;9876543210/
|
||||
/o-/ s/;9876543210/;0123456789/
|
||||
s/^>\([^~]*~\)\([^~]*~\)s\(-*\)\(-*o\3\(-*\)\)/>\2\1s\5\4/
|
||||
|
||||
s/,\([0-9]*\)\.*\([^,]*\),\([0-9]*\)\.*\([0-9]*\)/\1,\2\3.,\4;0/
|
||||
: right1
|
||||
s/,\([0-9]\)\([^,]*\),;*\([0-9]\)\([0-9]*\);*0*/\1,\2\3,\4;0/
|
||||
t right1
|
||||
s/.\([^,]*\),~\(.*\);0~s\(-*\)o-*/\1~\30\2~/
|
||||
|
||||
: addsub1
|
||||
s/\(.\{0,1\}\)\(~[^,]*\)\([0-9]\)\(\.*\),\([^;]*\)\(;\([^;]*\(\3[^;]*\)\).*X*\1\(.*\)\)/\2,\4\5\9\8\7\6/
|
||||
s/,\([^~]*~\).\{10\}\(.\)[^;]\{0,9\}\([^;]\{0,1\}\)[^;]*/,\2\1\3/
|
||||
# could be done in one s/// if we could have >9 back-refs...
|
||||
/^~.*~;/!b addsub1
|
||||
|
||||
: endbin
|
||||
s/.\([^,]*\),\([0-9.]*\).*/\1\2/
|
||||
G
|
||||
s/\n[^~]*~[^~]*//
|
||||
|
||||
: normal
|
||||
s/^\(-*\)0*\([0-9.]*[0-9]\)[^~]*/\1\2/
|
||||
s/^[^1-9~]*~/0~/
|
||||
b next
|
||||
|
||||
: mul
|
||||
s/\(-*\)\([0-9]*\)\.*\([0-9]*\)~\(-*\)\([0-9]*\)\.*\([0-9]*\).*|K\([^|]*\).*/\1\4\2\5.!\3\6,|\2<\3~\5>\6:\7;9876543210009909/
|
||||
|
||||
: mul1
|
||||
s/![0-9]\([^<]*\)<\([0-9]\{0,1\}\)\([^>]*\)>\([0-9]\{0,1\}\)/0!\1\2<\3\4>/
|
||||
/![0-9]/ s/\(:[^;]*\)\([1-9]\)\(0*\)\([^0]*\2\(.\).*X*\3\(9*\)\)/\1\5\6\4/
|
||||
/<~[^>]*>:0*;/!t mul1
|
||||
|
||||
s/\(-*\)\1\([^>]*\).*/;\2^>:9876543210aaaaaaaaa/
|
||||
|
||||
: mul2
|
||||
s/\([0-9]~*\)^/^\1/
|
||||
s/<\([0-9]*\)\(.*[~^]\)\([0-9]*\)>/\1<\2>\3/
|
||||
|
||||
: mul3
|
||||
s/>\([0-9]\)\(.*\1.\{9\}\(a*\)\)/\1>\2;9\38\37\36\35\34\33\32\31\30/
|
||||
s/\(;[^<]*\)\([0-9]\)<\([^;]*\).*\2[0-9]*\(.*\)/\4\1<\2\3/
|
||||
s/a[0-9]/a/g
|
||||
s/a\{10\}/b/g
|
||||
s/b\{10\}/c/g
|
||||
/|0*[1-9][^>]*>0*[1-9]/b mul3
|
||||
|
||||
s/;/a9876543210;/
|
||||
s/a.\{9\}\(.\)[^;]*\([^,]*\)[0-9]\([.!]*\),/\2,\1\3/
|
||||
y/cb/ba/
|
||||
/|<^/!b mul2
|
||||
b endbin
|
||||
|
||||
: div
|
||||
# CDDET
|
||||
/^[-.0]*[1-9]/ !i\
|
||||
divide by 0
|
||||
//!b pop
|
||||
s/\(-*\)\([0-9]*\)\.*\([^~]*~-*\)\([0-9]*\)\.*\([^~]*\)/\2.\3\1;0\4.\5;0/
|
||||
: div1
|
||||
s/^\.0\([^.]*\)\.;*\([0-9]\)\([0-9]*\);*0*/.\1\2.\3;0/
|
||||
s/^\([^.]*\)\([0-9]\)\.\([^;]*;\)0*\([0-9]*\)\([0-9]\)\./\1.\2\30\4.\5/
|
||||
t div1
|
||||
s/~\(-*\)\1\(-*\);0*\([^;]*[0-9]\)[^~]*/~123456789743222111~\2\3/
|
||||
s/\(.\(.\)[^~]*\)[^9]*\2.\{8\}\(.\)[^~]*/\3~\1/
|
||||
s,|?.,&SaSadSaKdlaZ+LaX-1+[sb1]Sbd1>bkLatsbLa[dSa2lbla*-*dLa!=a]dSaxsakLasbLb*t,
|
||||
b next
|
||||
|
||||
: rem
|
||||
s,|?%,&Sadla/LaKSa[999]k*Lak-,
|
||||
b next
|
||||
|
||||
: exp
|
||||
# This decimal method is just a little faster than the binary method done
|
||||
# totally in dc: 1LaKLb [kdSb*LbK]Sb [[.5]*d0ktdSa<bkd*KLad1<a]Sa d1<a kk*
|
||||
/^[^~]*\./i\
|
||||
fraction in exponent ignored
|
||||
s,[^-0-9].*,;9d**dd*8*d*d7dd**d*6d**d5d*d*4*d3d*2lbd**1lb*0,
|
||||
: exp1
|
||||
s/\([0-9]\);\(.*\1\([d*]*\)[^l]*\([^*]*\)\(\**\)\)/;dd*d**d*\4\3\5\2/
|
||||
t exp1
|
||||
G
|
||||
s,-*.\{9\}\([^9]*\)[^0]*0.\(.*|?.\),\2~saSaKdsaLb0kLbkK*+k1\1LaktsbkLax,
|
||||
s,|?.,&SadSbdXSaZla-SbKLaLadSb[0Lb-d1lb-*d+K+0kkSb[1Lb/]q]Sa0>a[dk]sadK<a[Lb],
|
||||
b next
|
||||
|
||||
: sqrt
|
||||
# first square root using sed: 8k2v at 1:30am Dec 17, 1996
|
||||
/^-/i\
|
||||
square root of negative number
|
||||
/^[-0]/b next
|
||||
s/~.*//
|
||||
/^\./ s/0\([0-9]\)/\1/g
|
||||
/^\./ !s/[0-9][0-9]/7/g
|
||||
G
|
||||
s/\n/~/
|
||||
s,|?.,&K1+k KSbSb[dk]SadXdK<asadlb/lb+[.5]*[sbdlb/lb+[.5]*dlb>a]dsaxsasaLbsaLatLbk K1-kt,
|
||||
b next
|
||||
|
||||
# END OF GSU dc.sed
|
||||
Binary file not shown.
Reference in New Issue
Block a user