Posted to tcl by GPS at Mon Nov 12 07:47:12 GMT 2007view raw

  1. coop::compile [lindex $argv 0] {
  2. structure s
  3. external function puts
  4. external function printf
  5.  
  6. define s -message {char *:msg} {
  7. declare int x y
  8. printf [' "%d\n"] [puts msg]
  9. printf [' "Hello World"]
  10. }
  11. property s int x y
  12.  
  13. define s +x {int:value} {
  14. printf [' "+x %d\n"] [+ [self x] value]
  15. self x value
  16. }
  17.  
  18. function main {int:argc ; char *[]:argv} {
  19. declare-object o s
  20. set o [object s]
  21.  
  22. o -message [' "hiya"]
  23. o +x 123
  24. o +x 456
  25.  
  26. printf [' "%d\n"] argc
  27. printf [' "size of argv: %d\n"] [sizeof argv]
  28.  
  29. puts [' "hello world"]
  30. return 0
  31. } int
  32. }
  33.