Comments (9)
Sorry for the duplicate - the server was misbehaving briefly.
Original comment by [email protected]
on 10 Oct 2007 at 6:11
from sparsehash.
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.
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.
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.
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.
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.
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.
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.
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)
- Memory Corruption HOT 2
- Compile fails on up-to-date Fedora 18 system HOT 2
- Insert deleted key into hashmap will cause size() be increased
- Cannot compile sparsehash-2.0.2 on Ubuntu 12.04LTS
- [PATCH] Fix gcc warning: format '%p' expects argument of type 'void*'
- news page specifies wrong date
- clang compile failure on FreeBSD HOT 3
- failure during "make" of sparsehash on mac osx 10.8.5 HOT 1
- Please implement a check for try in case libstdc++ implements c++11 where tr1 is merged into std HOT 4
- Latest version of xcode Command Line tools breaks sparsehash. HOT 6
- Fix the compile problem's on llvm(macosx) HOT 1
- Call resize to preallocate for memory does not work
- SPARSEHASH_COMPILE_ASSERT HOT 2
- Repair compilation with clang
- Installation fails check on Red Hat 6
- Installation fails at "make" step on Red Hat Linux 6
- make check fails with GCC 4.9 on Mac OS 10.10.1
- [PATCH] Make dense_hash_map work with non-default-constructible values HOT 1
- Is it thread safe for insertion of sparse hash table? HOT 1
- Google Code is dying
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sparsehash.