Thank you very much for that Lindsay.
Apparently up to code128 Ascii encodings are the same as UTF-8.
After that things change and you can get clashes.
That A0 or 160 is a non-blocking backspace.
I'm just after alphanumeric characters but will need to convert those A0s
to ordinary spaces

This seems to do that but I'm ending up with a file where each character is
wrapped in double quotes and wonder how best to get rid of them....Perhaps
linking them like you have, packing the whole list and then writing that as
a lump might be the best way but I'm just wondering if there's a slick way
of removing the double quotes from what (char Byte_code)) gives you. At the
moment the only way I know is (car (str (char Byte_code)))
but this right NIL in place of space.

(de add_byte (Byte_code)
   (out '+/home/me/test_fl.asc (print (char Byte_code))))

(out '/home/me/test_fl.asc) #clear file
(in "/home/me/test_fl.txt"
   (while (setq Byte_code (rd 1))
      (if (< Byte_code 129)
         (add_byte Byte_code)
         (case Byte_code
            (160 (add_byte 32))))))

On 14 February 2017 at 17:34, Lindsay John Lawrence <
lawrence.lindsayj...@gmail.com> wrote:

> Not sure about file charset encoding (a0?)... But perhaps something like
> this...?
>
> $ xxd test.txt
> 0000000: 6869 a074 6865 6972 3aa0 686f 7720 6172  hi.their:.how ar
> 0000010: 6520 796f 750a                           e you.
>
> : (pack
>       (make
>          (in "test.txt" (while (rd 1) (link (char @)))) ) )
> -> "hi their: how are you^J"
>
> # .. or without pack
> : (make (in "test.txt" (while (rd 1) (link (char @)))) )
> -> ("h" "i" " " "t" "h" "e" "i" "r" ":" " " "h" "o" "w" " " "a" "r" "e" "
> " "y" "o" "u" "^J")
>
> /Lindsay
>
>
> On Tue, Feb 14, 2017 at 8:33 AM, dean <deangwillia...@gmail.com> wrote:
>
>> Ok...It seems that (rd 1) doesn't work well with (until (eof) so I tried
>>
>> (in "/home/me/test_fl.txt"
>>    (while (setq B (rd 1))
>>       (prinl (char B))
>>       (if (= (key) "x") (quit))))
>>
>> and "while" testing the output of "rd 1" worked fine
>>
>> On 14 February 2017 at 16:21, dean <deangwillia...@gmail.com> wrote:
>>
>>> Ok Done it now including the decimal codes and I'd previously seen both
>>> hex and hax so...this should keep me busy for a while :).
>>>
>>> (in "/home/me/test_fl.txt"
>>>    (until (eof)
>>>       (setq B (rd 1))
>>>       (prinl B  )
>>>       (if (= (key) "x") (quit))))
>>>
>>> On 14 February 2017 at 15:50, dean <deangwillia...@gmail.com
>>> <deangwilliam30@gmailcom>> wrote:
>>>
>>>> This is the closest I've got i.e. the first byte seems to go into B now
>>>> but then I'm in an endless loop with B's value stuck with that first byte.
>>>>
>>>> (in "/home/me/test_fl.txt"
>>>>    (until (eof)
>>>>       (setq B (pipe (echo 1) (read)))
>>>>       (prinl B)
>>>>       (if (= (key) "x") (quit))))
>>>>
>>>> On 14 February 2017 at 13:03, dean <deangwillia...@gmail.com> wrote:
>>>>
>>>>> My mistake....I haven't done it at all and what is more....I'm not
>>>>> sure how you get the hex value (or decimal value) of the byte to decide
>>>>> what to do with it.
>>>>>
>>>>> On 14 February 2017 at 12:38, dean <deangwillia...@gmail.com> wrote:
>>>>>
>>>>>> Done it :)
>>>>>>
>>>>>> (in "/home/me/test_fl.txt"
>>>>>>    (until (eof)
>>>>>>       (echo 1)
>>>>>>       (setq B (in NIL))
>>>>>>       (prinl B)
>>>>>>       (key)))
>>>>>>
>>>>>>
>>>>>> On 14 February 2017 at 12:26, dean <deangwillia...@gmail.com> wrote:
>>>>>>
>>>>>>> Looking a possible ways around this I saw this in the tutorial :)
>>>>>>>
>>>>>>> (in "/home/me/test_fl.txt"
>>>>>>>    (until (eof)
>>>>>>>       (echo 1)
>>>>>>>       (key)))
>>>>>>>
>>>>>>> and it works great. My problem is I don't know how to
>>>>>>> capture (echo 1)  into a symbol's val.
>>>>>>>
>>>>>>>
>>>>>>> On 13 February 2017 at 23:03, dean <deangwillia...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Thank you very much for this!
>>>>>>>> I tried (cd src; make tools) both from the command line...because
>>>>>>>> of "$"
>>>>>>>> and from within Picolisps RPL because of the parens.
>>>>>>>> I looked in src and there is just the utf2.c file.
>>>>>>>> When I do $ (cd src; make tools) from the command line I get...
>>>>>>>> $ (cd src; make tools)
>>>>>>>> *** Parse error in /home/me/picoLisp/src: Missing dependency
>>>>>>>> operator (Makefile:20)
>>>>>>>> *** Parse error: Need an operator in 'else' (Makefile:28)
>>>>>>>> *** Parse error: Missing dependency operator (Makefile:29)
>>>>>>>> *** Parse error: Need an operator in 'else' (Makefile:37)
>>>>>>>> etc.
>>>>>>>>
>>>>>>>> which looks like
>>>>>>>> the block beginning
>>>>>>>> ifeg ($(shell uname), Linux)
>>>>>>>> .
>>>>>>>> .
>>>>>>>> else
>>>>>>>> ifeg ($(shell uname, OpenBSD)
>>>>>>>> .
>>>>>>>> .
>>>>>>>> I'm the second i.e. OpenBSD option and know very nothing about
>>>>>>>> makefiles.
>>>>>>>> I'm on a 64 bit OS but am looking at two -m32 options in there.
>>>>>>>> That might well be ok but I thought I'd mention it.
>>>>>>>>
>>>>>>>> Best Regards
>>>>>>>> Dean
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 13 February 2017 at 21:52, Alexander Burger <a...@software-lab.de
>>>>>>>> > wrote:
>>>>>>>>
>>>>>>>>> Hi Dean,
>>>>>>>>>
>>>>>>>>> > 6869 a074 6865 6972 3aa0 686f 7720 6172 6520 796f 750a
>>>>>>>>> > hi.their:.how are you.
>>>>>>>>> >
>>>>>>>>> > The following program...
>>>>>>>>> >
>>>>>>>>> > (in "/home/me/test_fl.txt"
>>>>>>>>> >    (until (eof)
>>>>>>>>> >       (setq Ln (line T))
>>>>>>>>> >       (prinl Ln)))
>>>>>>>>> >
>>>>>>>>> > results in this....
>>>>>>>>> >
>>>>>>>>> > hiനeir:ਯw are you
>>>>>>>>>
>>>>>>>>> OK, as you noticed in your other mail, PicoLisp can handle *only*
>>>>>>>>> UTF-8 input.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> > (load "@lib/import.l")
>>>>>>>>>
>>>>>>>>> This is probably not necessary here.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> > (in '("bin/utf8" "/home/me/test_fl.txt")
>>>>>>>>>
>>>>>>>>> Good, that's the right way!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> > bin/utf8: Can't exec
>>>>>>>>>
>>>>>>>>> Try this:
>>>>>>>>>
>>>>>>>>>    $ (cd src; make tools)
>>>>>>>>>
>>>>>>>>> ♪♫ Alex
>>>>>>>>> --
>>>>>>>>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to