Re: [dev] ASCII Delimited Text

2018-05-21 Thread Raphaël Proust
Hello,

On 2018-05-22 00:38, Connor Lane Smith wrote:
> On 21 May 2018 at 17:12, Adrian Grigore  wrote:
>> I'm having problems compiling usul:
> 
> This is a surprise. Where did you get usul from?

I sent the copy. I use usul regularly so I still have the whole repo
locally.


> 
> I have been wondering lately about resurrecting usul, since 'tabular
> munging' with Unix utilities without the ability to set $FS and $RS
> can be really unpleasant, and I've had to do quite a bit of it
> recently.
> 
> I did also write a program to complement usul which performs elastic
> tabbing on its input, the idea being that you end up with a nice
> tabular view in your terminal. I think ideally you might want 'real'
> terminal support for it though, as when printing to the tty you either
> need to buffer a lot of data (i.e. until a line with no FS), or you
> need to do crazy tty-rewriting ANSI escapes, which it did support but
> is a massive hack.

In what way is the elastic tabbing different from what Plan9's mc(1)?


Ciao,
-- Raphaël



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Adrian Grigore
> Try putting the library at the end. Some linkers display rather...
classic behavior when linking statically (i.e. only linking in the files
that are needed, but if you name a library as first thing, then no file
is needed at that point).

Works!

On Mon, May 21, 2018 at 9:30 PM, Markus Wichmann  wrote:
> On Mon, May 21, 2018 at 07:12:46PM +0300, Adrian Grigore wrote:
>> cc -lutf -o cat cat.o util.o
>> cat.o: In function `main':
>> cat.c:(.text+0x179): undefined reference to `chartorune'
>> cat.c:(.text+0x1dd): undefined reference to `runetochar'
>> cc: error: linker command failed with exit code 1 (use -v to see invocation)
>> gmake: *** [Makefile:15: cat] Error 1
>
> Try putting the library at the end. Some linkers display rather...
> classic behavior when linking statically (i.e. only linking in the files
> that are needed, but if you name a library as first thing, then no file
> is needed at that point).
>
> Ciao,
> Markus
>



-- 
Thanks,
Adi



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Markus Wichmann
On Mon, May 21, 2018 at 07:12:46PM +0300, Adrian Grigore wrote:
> cc -lutf -o cat cat.o util.o
> cat.o: In function `main':
> cat.c:(.text+0x179): undefined reference to `chartorune'
> cat.c:(.text+0x1dd): undefined reference to `runetochar'
> cc: error: linker command failed with exit code 1 (use -v to see invocation)
> gmake: *** [Makefile:15: cat] Error 1

Try putting the library at the end. Some linkers display rather...
classic behavior when linking statically (i.e. only linking in the files
that are needed, but if you name a library as first thing, then no file
is needed at that point).

Ciao,
Markus



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Adrian Grigore
> This is a surprise. Where did you get usul from? I'm not sure even I
have a copy any more! The only reason I can think of, though, is that
you need to specify the -L libdir.

Attachment above. :)

cc -lutf -L. -o cat cat.o util.o gives:

cat.o: In function `main':
cat.c:(.text+0x179): undefined reference to `chartorune'
cat.c:(.text+0x1dd): undefined reference to `runetochar'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

I have libutf.a in the current directory.

I can't event compile this:
#include 

int
main(int argc, char *argv[])
{
Rune r;
chartorune(, "");
return 0;
}

with
cc -L. -lutf -o utf utf.c
getting
/tmp/utf-1e880d.o: In function `main':
utf.c:(.text+0x33): undefined reference to `chartorune'
cc: error: linker command failed with exit code 1 (use -v to see invocation)

> I did also write a program to complement usul which performs elastic
tabbing on its input, the idea being that you end up with a nice
tabular view in your terminal. I think ideally you might want 'real'
terminal support for it though, as when printing to the tty you either
need to buffer a lot of data (i.e. until a line with no FS), or you
need to do crazy tty-rewriting ANSI escapes, which it did support but
is a massive hack.

This sounds interesting.

On Mon, May 21, 2018 at 7:38 PM, Connor Lane Smith  wrote:
> Hi,
>
> On 21 May 2018 at 17:12, Adrian Grigore  wrote:
>> I'm having problems compiling usul:
>
> This is a surprise. Where did you get usul from? I'm not sure even I
> have a copy any more! The only reason I can think of, though, is that
> you need to specify the -L libdir.
>
> I have been wondering lately about resurrecting usul, since 'tabular
> munging' with Unix utilities without the ability to set $FS and $RS
> can be really unpleasant, and I've had to do quite a bit of it
> recently.
>
> I did also write a program to complement usul which performs elastic
> tabbing on its input, the idea being that you end up with a nice
> tabular view in your terminal. I think ideally you might want 'real'
> terminal support for it though, as when printing to the tty you either
> need to buffer a lot of data (i.e. until a line with no FS), or you
> need to do crazy tty-rewriting ANSI escapes, which it did support but
> is a massive hack.
>
> Thanks,
> Connor
>



-- 
Thanks,
Adi



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Connor Lane Smith
Hi,

On 21 May 2018 at 17:12, Adrian Grigore  wrote:
> I'm having problems compiling usul:

This is a surprise. Where did you get usul from? I'm not sure even I
have a copy any more! The only reason I can think of, though, is that
you need to specify the -L libdir.

I have been wondering lately about resurrecting usul, since 'tabular
munging' with Unix utilities without the ability to set $FS and $RS
can be really unpleasant, and I've had to do quite a bit of it
recently.

I did also write a program to complement usul which performs elastic
tabbing on its input, the idea being that you end up with a nice
tabular view in your terminal. I think ideally you might want 'real'
terminal support for it though, as when printing to the tty you either
need to buffer a lot of data (i.e. until a line with no FS), or you
need to do crazy tty-rewriting ANSI escapes, which it did support but
is a massive hack.

Thanks,
Connor



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Adrian Grigore
> Maybe a nice thing to have would be to get the terminal emulator to
treat the field and record separator in a special way. So the programs
all output fs and rs, and the terminal emulator uses these characters to
layout the data in a tabular way

But would it still be plain text?

I'm having problems compiling usul:
cc -lutf -o cat cat.o util.o
cat.o: In function `main':
cat.c:(.text+0x179): undefined reference to `chartorune'
cat.c:(.text+0x1dd): undefined reference to `runetochar'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:15: cat] Error 1

I mention have libutf.a in my path.

On Mon, May 21, 2018 at 12:09 PM, Truls Becken  wrote:
> As an anecdote, I actually wanted to use US/RS delimited text at work
> a while ago to consume XML downloaded from some service. The idea was
> to use XSLT to convert the data to a sane format that I could easily
> ingest. As it turns out, that was a no-can-do because XSL transforms
> are defined in an XML dialect, and XML is not allowed to contain ASCII
> control characters, not even on escaped form  So you cannot
> express this transformation to any of the XSLT engines I tested! I
> ended up using a pair of Unicode control chars instead.
>
> -Truls
>



-- 
Thanks,
Adi



Re: [dev] ASCII Delimited Text

2018-05-21 Thread Truls Becken
As an anecdote, I actually wanted to use US/RS delimited text at work
a while ago to consume XML downloaded from some service. The idea was
to use XSLT to convert the data to a sane format that I could easily
ingest. As it turns out, that was a no-can-do because XSL transforms
are defined in an XML dialect, and XML is not allowed to contain ASCII
control characters, not even on escaped form  So you cannot
express this transformation to any of the XSLT engines I tested! I
ended up using a pair of Unicode control chars instead.

-Truls