Git Product home page Git Product logo

Comments (9)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Sorry for the duplicate - the server was misbehaving briefly.

Original comment by [email protected] on 10 Oct 2007 at 6:11

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Hmm, I'm unable to reproduce this, but it does seem likely that the awk command 
is
using some features that are not present in every awk.  What operating system 
are you
running on?  What does 'awk --version' say?

Original comment by [email protected] on 10 Oct 2007 at 6:13

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
FWIW, let me add that the awk command doesn't "fail", it just produces no 
output.

I've tried this on two different platforms:

Mac OS X 10.4.10, with a vanilla awk that doesn't seem to support any kind of 
version
query.  (!)

Ubuntu 7.04 x86_64 server, with mawk 1.3.3.  (The version query here is "awk -W
version".)

Both are the default awk for the platform - I haven't tried to install alternate
versions.

I can test modified awk scripts on these two for you if you like.

Original comment by [email protected] on 10 Oct 2007 at 6:27

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Ah, good to know.  I've only tested on GNU awk, not mawk, on ubuntu.  I've just
verified I also get an empty file on my mac platform.  But the unittests pass 
anyway!
 I guess they don't use this config script, which is a flaw in the testing.

It would be great if you could play around with awk and find something that 
work on
the platforms you use.  I'll also see what I can figure out.

Original comment by [email protected] on 10 Oct 2007 at 7:18

  • Changed state: Accepted

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Yes, I noticed that the unit tests passed too.  :)

It's been a while since I touched awk, but I'll give it a shot and let you 
know. 
Might not be in the next few minutes though.

Original comment by [email protected] on 10 Oct 2007 at 7:22

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Apparently most awks - including BSD, mawk, Solaris, AIX and others - don't 
support
ARGIND.

All I can think of at the moment, if you want to keep using awk, is to put a 
sentry
line at the end of config.h.include and use that to detect when you've 
exhausted the
file.

For instance, I put "__EOF__" at the end of config.h.include, and then the 
following
awk works on both of my test platforms:

awk '/__EOF__/ {x=1; next}; {if (x != 1) {if ($0 !~ /^ *$/) {inc[$0]=0}; 
next}}; {
for (i in inc) {if (index($0, i) != 0) {print "\n"prevline"\n"$0; delete 
inc[i]} };
prevline=$0; };'

(I added the /__EOF__/ block, and an if statement in your first block.)

Original comment by [email protected] on 10 Oct 2007 at 8:21

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
This is a good idea, but I think we can use a marker already in the text.  See 
how
well the following command works for you:

awk '/^#/ {in_second_file=1;} ! in_second_file {if ($0 !~ /^ *$/) {inc[$0]=0}};
in_second_file { for (i in inc) { if (index($0, i) != 0) {print 
"\n"prevline"\n"$0;
delete inc[i]} }; }; { prevline=$0; }' src/config.h.include src/config.h

If it works on all your platforms, I'll change it to this for the next release.

Original comment by [email protected] on 10 Oct 2007 at 10:23

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
Sorry for the delay - this works great on both of my platforms.  I like it.  I
especially like the "in_second_file" addresses - I didn't remember if that was 
legal.
 Obviously so.

Original comment by [email protected] on 11 Oct 2007 at 1:43

from sparsehash.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 17, 2024
I've made a bugfix release, 0.9.1, that has the fixed awk in it, and a new test 
that
sparseconfig has some useful data in it. :-)

Original comment by [email protected] on 12 Oct 2007 at 7:24

  • Changed state: Fixed

from sparsehash.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.