Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - jp

#1
Anything else we might add? /
June 08, 2007, 08:26:02 PM
QuoteSpeaking about good eyes?? That must be a secret hint..

Well, there is nothing too esoteric about it!

Japanese has no phonetic equivalent to the L and R consonants but has a consonant that seat somewhere between those 2 sounds. Hence even knowing perfectly well all common place names since childhood due to the lack of that phonetic register the Japanese are often at loss to write down L and R containing names in English they know assuredly in Japanese.
#2
Anything else we might add? /
June 07, 2007, 04:54:04 PM
Quote from: "m35"Good eye jp. Read Japanese? Other languages?

Pleased to oblige!

Yes indeed, I read Japanese. And I believe you are a Japanese native speaker since you inadvertently inverted the L for an R in your login summary.
#3
Anything else we might add? / Windows and UTF-8
June 06, 2007, 05:49:26 PM
Quote from: "m35"Unfortunately I'm still left with the 梶浦ç"±è¨˜ file, and not the proper Unicode one.


Perhaps it is worth mentioning that for win2k and above the internal representations are in Unicode UTF-16LE and if one can change arbitrarily its DOS code page, in Windows proper, the internal character representations remained fixed.

Also the name 梶浦由記 strikes me more as being a Japanese name (Kajiura Yuki) rather than a Chinese. Nonetheless Windows will need to have its Chinese/Japanese Fonts enabled in order to render those characters properly.
#4
Anything else we might add? / Windows and UTF-8
June 05, 2007, 09:05:13 PM
Quote from: "Lutz"I believe notepad.exe has a UTF-8 option and you could paste those characters into it to have the Chinese chars back.



What you would need on Wndows is a cmd.exe which does UTF-8



Lutz


Actually for Win2k and above to set the command line to UTF-8 you will have simply to set the code page with the following command, chcp 65001, prior to the execution of your command. There only caveat is: make sure the command prompt's properties are not set on Raster Fonts
#5
newLISP newS /
July 14, 2004, 08:03:46 PM
Lutz



Well done everything seems to be fixed except for the best feature of all; the ability of Newlisp to directly communicate with the clipboard. Newlisp-utf8.exe seems to disable completely the clipboard on Unicode and non Unicode based Windows (Win98/ME).

Also newlisp-utf8.dll and alas newlisp.dll as well cannot run processes under the exec function, only the function ! shell out works.



Jean-Pierre
#6
newLISP newS /
July 10, 2004, 06:12:19 PM
[/quote]

Running an equivalent program UTF-8 EXE was able to carry all its calculations and display Japanese without any problems

Jean-Pierre



========= Kame.lsp

[/quote]



Sorry the second statement after (begin

(println (car today) " " (cadr today) " " (caddr today))

has to be substituted with ....

(println (nth 0 today) " " (nth 1 today) " " (nth 3 today))



One has also to add the function ...

(define (round n) (floor (add n 0.5)))

to make it newlisp standard script



Jean-Pierre
#7
newLISP newS /
July 10, 2004, 05:21:50 PM
Quote from: "HPW"Running Turtle.lsp with the UTF-8 EXE gives an error ' Bad screen distance "302,1612092" '.


Running an equivalent program UTF-8 EXE was able to carry all its calculations and display Japanese without any problems

Jean-Pierre



========= Kame.lsp

;; Kame.lsp - graphics

;; written by Jean-Pierre Berard

;;

;; 1 rad = 180/3.1415927 = 57.29578 deg

;; 1 deg = 0.017453292 rad



(set! color "blue")

(set! width  500)

(set! height 500)



(define (convert angle) (mul angle 0.017453292))

(define (adjacent-cos angle hypo) (mul hypo (cos (convert angle))))

(define (adjacent-tan angle opposite) (div opposite (tan (convert angle))))

(define (hypo-sin angle opposite) (div opposite (sin (convert angle))))

(define (hypo-cos angle adjacent) (div adjacent (cos (convert angle))))

(define (opposite-sin angle hypo) (mul hypo (sin (convert angle))))

(define (opposite-tan angle adjacent) (mul adjacent (tan (convert angle))))

(define (outer inner-angle) (sub 180 inner-angle))



(define (rectangular angle radius)

 (set! x (adjacent-cos angle radius))

 (set! y (opposite-sin angle radius))

 (println "x=" x " y=" y)

true

)



(define (polar x y)

 (set! angle (div (atan (div y x)) 0.017453292))

 (set! radius (root (add (pow x 2) (pow y 2)) 2))

 (println "angle=" angle " radius=" radius)

true

)



(define (triangulation side side-size)

 (set! y (div side-size 2))

 (set! angle (div 360 side 2))

 (set! x (adjacent-tan angle y))

 (set! radius (hypo-sin angle y))

 (println "angle=" angle " radius=" radius)

 (println "x=" x " y=" y)

 (pen 'yellow)

 (forward y)

 (right 90)

 (forward x)

 (right (sub 180 angle))

 (forward radius)

true

)



(define (pseudo-polygon side n)

  (set! ratio (div 360 side))

  (dotimes (x side)

    (forward n)

    (right ratio))

  (left ratio)

  )



(define (polygon side n)

  (dotimes (x side)

    (forward n)

    (right (div 360 side))

  ))



(define (oval x y)

 (set! Y (sub lastY (div y 2)))

 (tk ".kw.canvas create oval "

     (join (map string (list lastX Y (add lastX x) (add Y y))) " ")

     " -outline " color)

 (round (div direction 0.017453292))

)



(define (circle n)

 (set! X 0)

 (set! x (round lastX))

 (set! y (round lastY))

 (set 'direction -1.570796327)

 (set! ratio (mul (div 57.29578 n) 2))

 (until (and (= x X) (= y (round lastY)))

   (set! X (round lastX))

   (forward 1)

   (right ratio))

)



(define (cercle n)

 (set! x (round lastX))

 (set! y (round lastY))

 (set! lastX (+ x n))

 (for (t 0 2 0.005) ;; from 0 to 2 rad

    (set! newX (mul n (cos (mul pi t))))

    (set! newY (mul n (sin (mul pi t))))

    (set! newX (add newX x))

    (set! newY (add newY y))

    (tk ".kw.canvas create line "

        (join (map string (list lastX lastY newX newY)) " ")

       " -fill " color)

    (set 'lastX newX)

    (set 'lastY newY))

 (set 'lastX x)

 (set 'lastY y)

 (round (div direction 0.017453292))

)



(define (rose clr)

  (set 'color clr)

  (dotimes (x 90)

   (pseudo-polygon 4 60)

   (right 2))

 )



(define (square n)

  (dotimes (x 4)

    (forward n)

    (right 90))

   )



(define (squirl n)

  (dotimes (x (/ n 3))

    (forward n)

    (right 90)

    (set! n (- n 2)))

  (round (div direction 0.017453292))

 )



(define (dragon sign level)

  (if (= 0 level)

    (forward 4)

    (begin

      (dec 'level)

      (right (sign 45))

      (dragon - level)

      (left (sign 90))

      (dragon + level)

      (right (sign 45))

     )))



(define (dragon-curve n clr)

  (set 'color clr)

  (dragon + n)

  )



(define (right d)

  (set 'direction (add direction (mul d 0.017453292)))

  (round (div direction 0.017453292)))



(define (left d)

  (set 'direction (sub direction (mul d 0.017453292)))

  (round (div direction 0.017453292)))



(define (forward d)

  (set 'newX (add lastX (mul (cos direction) d)))

  (set 'newY (add lastY (mul (sin direction) d)))

  (tk ".kw.canvas create line "

       (join (map string (list lastX lastY newX newY)) " ")

      " -fill " color)

  (tk "update idletasks")

  (set 'lastX newX)

  (set 'lastY newY)

  (round (div direction 0.017453292))

 )



(define (backward d)

 (set! direction (mul -1 direction))

 (forward d)

)



(define (pen clr) (set! color (string clr)))



(define (clear)                                ;; upper left and lower right

 (tk ".kw.canvas create rectangle 0 0 "

       (join (map string (list width height)) " ")

       " -fill black -tag clear")

 (center)

)



(define (center)

  (set 'lastX (/ width 2))

  (set 'lastY (/ height 2))

  (set 'direction -1.570796327))



(define (start x y)

  (set 'lastX x)

  (set 'lastY y)

  (set 'direction -1.570796327))



(define (goto x y)

  (set 'lastX x)

  (set 'lastY y)

  (round (div direction 0.017453292))

  )



(begin

 (set! today (parse (date (apply date-value (now)))))

 (println (car today) " " (cadr today) " " (caddr today))

 (set! nihongo {u4e80u3000u4f5cu56f3})

 (tk "if {[winfo exists .kw] == 1} {destroy .kw}")

 (tk "toplevel .kw")

 (tk "canvas .kw.canvas -width " width " -height " height " -bg black")

 (tk "pack .kw.canvas")

 (tk "wm geometry .kw +290+25")

 (tk "wm title .kw { Kame.lsp}")

 (tk "bind .kw exit")

 (start 50 450)

 (squirl 400)

 (rose "red")

 (tk ".kw.canvas create text 130 380 "

     "-fill white -font {Times 22 normal} -text " nihongo)

 )



(define (help)

 (println "outer inner-angle")

 (println "adjacent-cos angle hypo")

 (println "adjacent-tan angle opposite")

 (println "hypo-sin angle opposite")

 (println "hypo-cos angle adjacent")

 (println "opposite-sin angle hypo")

 (println "opposite-tan angle adjacent")

 (println "triangulation side side-size")

 (println "rectangular angle radius")

 (println "polar x y")

true

)
#8
newLISP newS /
July 10, 2004, 05:05:47 PM
The localization won't matter under Win2k or XP since all the internal representations are in Unicode (UTF-16LE). Strictly speaking UTF8 is not Unicode but a coding that lends itself readily to conversion in Unicode(s). The disparity between newlisp-utf8.exe and its UNIX counterpart could come that under UNIX Unicode is not Low Endian but High Endian and Windows will require a Low Endian code otherwise will mess up subsequent conversion in UTF8.



Jean-Pierre
#9
newLISP newS /
July 10, 2004, 09:28:01 AM
Quote from: "Lutz"I don't think you should use the UTF-8 version on Win32 in Germany, where Windows is localized with German as a one-byte-character language, probably with code page ISO-8859.



Lutz


Indeed under XP with the default code page chcp 437, under the command prompt

echo (trim "Höhe;;" ";")  > test.txt

notepad test.txt will show that we have an ANSI coded file.



Jean-Pierre
#10
newLISP newS / newlisp-utf8.exe breakin UTF8 code
July 10, 2004, 08:03:40 AM
Lutz



Strangely enough I did try your newlisp-utf8.exe and I found it brakes code when

 used with UTF8 strings but the regular NewLisp does not

Example if you run the strings ..



(trim "     µùѵ£¼Φ¬₧πüîΘ¢úπüùπüä             ")  ;; Japanish ist schwer (UTF8 i

n Japanese)

(trim "     Er ist ein gro├ƒer Schw├ñtzer  ")  ;; Er ist ein grosser Schwaetzer

(UTF8 in German)



The code will be broken on both accounts by newlisp-utf8.exe but left intact wit

h Newlisp



Jean-Pierre
#11
newLISP in the real world /
March 30, 2004, 07:28:36 AM
Thanks Lutz



Now, newlisp_8000rc3_win-tk-111.exe with the change to the font mentioned above runs perfectly under Win98 Japanese.



Jean-Pierre
#12
newLISP in the real world /
March 30, 2004, 02:54:23 AM
I did check newlisp_8000rc1_win-tk.exe as well as newlisp-tk.exe v.111 on the following

Win98, Win2k, WinXP Pro on the US Edition, they work fine.

newlisp v8.0.0 did run well, even under the Win98 Japanese Edition.





But newlisp-tk.exe v.107 and the v.111 gave the same following error on the

Japanese Edition of Win98

-------------

Error sourcing /freewrap/newlisp-tk.tcl: bad menu entry index "*Fixedsys*"

-------------



========================================================================================

Only newlisp-tk v.095 with newLISP v7.1.4 works perfectly well on Win98 Japanese Edition

========================================================================================



And  running newlisp-tk v.095 with the newlisp v8.0.0 or v7.5.0 give the same following error

------------------------------------------------

newLISP v8.0.0 Copyright (c) 2004 Lutz Mueller. All rights reserved.



>

symbol is protected in function define : (exit)

invalid function in function silent : (SYS:check-tempdir "C:/temp")







Jean-Pierre
#13
newLISP in the real world /
March 27, 2004, 04:35:41 PM
Thanks Lutz



Perhaps all the outstanding features of the newlisp tk interface should be mentioned in the newlip-tk documentation to ease the interfacing and to prevent the inadvertent 'reinventing of the wheel'.



Jean-Pierre
#14
newLISP in the real world /
March 27, 2004, 05:34:47 AM
Easier and little bit faster



Jean-Pierre



--------------------------- fx.lsp



(define (fx)

(tk

[text]

if {[winfo exists .fx] == 1} {destroy .fx}

toplevel .fx

wm title .fx {File Chooser}

frame .fx.fr -borderwidth 10

pack  .fx.fr -side top -expand yes -fill y



scrollbar .fx.fr.yscroll -orient vertical   -command ".fx.fr.list yview"

scrollbar .fx.fr.xscroll -orient horizontal -command ".fx.fr.list xview"

listbox .fx.fr.list -width 20 -height 10 -setgrid 1 -yscroll ".fx.fr.yscroll set" -xscroll ".fx.fr.xscroll set"



button .fx.b -text {Exit All} -command exit

label  .fx.lb -textvariable ::result

pack   .fx.lb .fx.b -side top -fill x



grid .fx.fr.list -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news

grid .fx.fr.yscroll -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news

grid .fx.fr.xscroll -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news

grid rowconfig    .fx.fr 0 -weight 1 -minsize 0

grid columnconfig .fx.fr 0 -weight 1 -minsize 0



foreach i [lsort [glob *]] {

  .fx.fr.list insert end $i

}



bind .fx.fr.list <ButtonRelease-1> {

  set ::result [selection get]

  set ext [string tolower [file extension $::result]]

  switch -glob -- $ext {

    ""      { exec notepad $::result & }

    ".bat"  { exec notepad $::result & }

    ".ini"  { exec notepad $::result & }

    ".sys"  { exec notepad $::result & }

    ".lsp"  { Newlisp {(entry)} }

    default { exec c:/dos/start $::result & }

  }

}

[/text]

))



(define (entry) (eval (append '(load) (list (tk "set ::result")))))



-------------------- end of code
#15
newLISP in the real world /
March 27, 2004, 03:08:56 AM
Lutz gave a comprehensive entry widget example.

Here is listbox widget example.

It is a file chooser, where one has simply to click a given file to either open or run it. One can easily extend it to make newlisp to distinguish directories and files and navigate drives and make newlisp to do all sorts of what not!

I choose to use start.exe from win98 instead of the internal command assoc since that command exists only on Win2k and WinXP.



Jean-Pierre



------------------------- fc.lsp



(define (listbox)

(tk

[text]

if {[winfo exists .fc] == 1} {destroy .fc}

toplevel .fc

set ::result ""

wm title .fc {File Chooser}

frame .fc.fr -borderwidth 10

pack  .fc.fr -side top -expand yes -fill y



scrollbar .fc.fr.yscroll -orient vertical   -command ".fc.fr.list yview"

scrollbar .fc.fr.xscroll -orient horizontal -command ".fc.fr.list xview"

listbox .fc.fr.list -width 20 -height 10 -setgrid 1 -yscroll ".fc.fr.yscroll set" -xscroll ".fc.fr.xscroll set"



button .fc.b -text {Exit All} -command exit

label  .fc.lb -textvariable ::result

pack   .fc.lb .fc.b -side top -fill x



grid .fc.fr.list -row 0 -column 0 -rowspan 1 -columnspan 1 -sticky news

grid .fc.fr.yscroll -row 0 -column 1 -rowspan 1 -columnspan 1 -sticky news

grid .fc.fr.xscroll -row 1 -column 0 -rowspan 1 -columnspan 1 -sticky news

grid rowconfig    .fc.fr 0 -weight 1 -minsize 0

grid columnconfig .fc.fr 0 -weight 1 -minsize 0



foreach i [lsort [glob *]] {

  .fc.fr.list insert end $i

}



proc fiche {} {

 set entry [open tmp w]

 puts  $entry $::result

 close $entry

}



bind .fc.fr.list <ButtonRelease-1> {

  set ::result [selection get]

  set ext [string tolower [file extension $::result]]

  switch -glob -- $ext {

    ""      { exec notepad $::result & }

    ".bat"  { exec notepad $::result & }

    ".ini"  { exec notepad $::result & }

    ".sys"  { exec notepad $::result & }

    ".lsp"  { fiche ; Newlisp {(entry)} }

    default { exec c:/dos/start $::result & }

  }

}

[/text]

))



(define (entry)

 (eval (append '(load) (parse (read-file "tmp"))))

 (delete-file "tmp"))



--------------------- end of code