File: TODO

package info (click to toggle)
nip2 8.9.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,352 kB
  • sloc: ansic: 64,077; sh: 4,681; yacc: 1,133; makefile: 927; lex: 386; xml: 40; perl: 17
file content (1202 lines) | stat: -rw-r--r-- 31,417 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
- add tests for new stuff

- seeing occasional "rewind image with active regions" message

- should parse_float / _int etc. allow leading and trailing spaces?

    (split is_space x)?0

- how about adding

	zip2 10 [1..5] == [[10, 1], [10, 2], [10, 3], ..

  should be harmless, and quite useful

  same for zip3 etc. as well

  check zip use, we probably have this code there already, in various places

- sharpen should use new interface?

- can we call affine from nip2 vips_call? do we need a double array?

- hough_circle etc. don't get cached ... they use the vips8 API and the vips
  cache only works for vips8

  we can't turn on the vips8 cache since it does not know about invalidate

- columns can move about on load in large workspaces

- hide tabs if only one tab in window, though we'd need to allow tab drop 
  anywhere in window for that

- Matrix / New / Laplacian

  edit a cell, turns into a plain matrix

  need to override edit method

  same for gaussian

  rather tricky, compared to square / circle etc. 



- breadcrumb trail for prog window, so you can get back to where you were?

- lambdas don't pattern match?

	(\[a, b] a + b)



- load jpg, ^Q, no leaks
  load jpg, paint bar, paint one dot, ^Q, no leaks 

  load jpg, extract area, paint bar, paint one dot, ^Q, leaks 
  load jpg, extract area, paint bar, paint one dot, ^Z, ^Q, leaks 
  load jpg, extract area, paint bar, paint one dot, close window, ^Q, leaks 

  seems to leak:

  	original image, 
  	one large regions on that image (full width)
	extract area operation
	extracted image
	region a bit bigger than paint action on that image

0) VipsRegion (0x8b052a0)
VipsRegion (object), base class VipsRegion: 0x8b052a0, im = 0x887aad0, left =
192, top = 128, width = 45, height = 2 VipsRegion (0x8b052a0)
1) VipsImage (0x887aad0)
VipsImage (image), image class 237x202 uchar, 3 bands, srgb, partial VipsImage
(0x887aad0)
2) VipsImage (0x8016b30)
VipsImage (image), image class 972x1296 uchar, 3 bands, srgb, openin VipsImage
(0x8016b30)
3) VipsRegion (0x8b05340)
VipsRegion (object), base class VipsRegion: 0x8b05340, im = 0x8016b30, left =
0, top = 30, width = 972, height = 283 VipsRegion (0x8b05340)
4) VipsExtractArea (0x882a910)
VipsExtractArea (extract_area), extract an area from an image - extract_area
((VipsImage*) 0x8016b30) 142 158 237 202 VipsExtractArea (0x882a910)

  something to do with vips_image_wio_input() and the way it rewinds a PARTIAL
  image? called from im_rwcheck()


- os x build reports missing jasper dylib?

- draw_circle could extract, draw and insert for huge memuse reduction

- section on compat mode for the docs

  see mail to MvGulick for some notes

- expose more of the tone funcs in nip2

- quite a few hist operations have no GUI ... histspec, for example? 

- nip2 should use zooming support, if possible

- the windows setup .exe install a bazillion .png icons we will never use,
  then installs them all again as .svg, which we will certainly never use

- add extract_volume, cf. "grid"

  record tile_size in meta somewhere? grid could set it, save a parameter off
  extract_volume

  also extract_sequence to get volume over time

- image + complex constant would be nice




- ban parameters which are built-ins, eg. "im", "re" etc., you get nasty
  crashes

  see also notes below: a new parser could fix this

  can only ban for new code? do we have duff code in compat?

  argh yes there are at least 15 like this, fix them or fix the parser? also
  need to disable this check for compat defs

  better to fix the parser, it can't be that hard

  need to fix up the list comp compiler too, sigh






- we can't define local superclasses at the moment

  eg. consider:

  	Fred = class {
	  Jim a = class {
	    value = a + 12;
	  }

	  Jennie x = class Jim x {
	    value = 99;
	  }
	}

  you can't do (Fred.Jennie 12) since Jim will have a secret 'this' param
  (because it is a class member) and superclass constructors can't have
  secrets

  don't automatically give all members 'this' as a secret, check that they
  make references to other class members that do need secrets first 
  
- turn on GM in prefs, have to restart before _stdenv.def:magick sees the 
  change

- try this:

	Workspaces.untitled
	has_member "A1" A1

  doesn't seem to work?



- matrix_gaussian_blur could have an 'accuracy' or 'max error' param? expose
  in custom blur etc.



- oo_binary etc. needs revising, we don't search down branches as we should

  for example, Matrix does:

		// compound ... don't do iteration
		[this.Matrix_base (op.fn this.value x.value),
			(is_Matrix x || is_Real x || is_Vector x) &&
			op.type == Operator_type.COMPOUND_REWRAP],

  which is stupid, we should not wire Real and Vector in there, it ought to be
  something like:

		[this.Matrix_base (op.fn this.value x),
			op.type == Operator_type.COMPOUND_REWRAP],

  ie. don't strip the .value off x and rely on op.fn to do that, but this
  breaks in various ways

  remove all of _Object and redo it, thinking about what we want operators to
  look like and what we want types to look like. 

  Have a base class for operators that does most of the standard stuff

  get rid of the operator types rewrap / arithmetic / relational etc. etc. 








- try

	point re
		= x
	{
		(x, y) = re;
	}

  it's the 're' param, it stops x being bound to the
  get-real-part-of-complex builtin

  expands to

	point re
		= x
	{
		$$x = re;
		x
			= re $$x, is_complex $$x
			= error "bad match";
	}

  add secrets

	point point.re
		= x point.re
	{
		$$1 $$1.re = point.re;
		x x.re
			= x.re ($$x point.re), is_complex ($$x point.re)
			= error "bad match";
	}


x compiles to

if_then_else (<symbol "point.x.is_complex"> (<symbol "point.$$pattern_lhs78"> <symbol "point.re">))
 <symbol "point.x.re"> (<symbol "point.$$pattern_lhs78"> <symbol "point.re">)
 <symbol "point.x.error"> <Managed* 0x37c5a80>

abstracting point.re

after var abstract

((S ((Sr (if_then_else <compileref "point.x">)) ((Sl ((Sr (&& <compileref "point.x">)) ((Sr <symbol "point.x.is_complex">) <symbol "point.$$pattern_lhs78">))) true))) ((Sl ((Sr SHARE0[(: <compileref "point.x">)]) ((Sr <symbol "point.x.re">) <symbol "point.$$pattern_lhs78">))) ((REF0 (<symbol "point.x.error"> <Managed* 0x3a55980>)) [ ])))

reduce and get 

reduce_spine: (<symbol "point.x.re"> (<symbol "point.$$pattern_lhs0"> (I (1,2))))
reduce_spine: (<symbol "point.re"> (<symbol "point.$$pattern_lhs0"> (I (1,2))))
sym-param found, argh: point.re

  maybe fix this when we revise the parser

  would be a good time to add multiple definitions as well

- redo name resolution in parser ... scrap the patch thing, instead have a
  separate 'resolve' step that runs after parsing a top-level

  don't create ZOMBIE symbols, instead make REF nodes in the tree

  this binds local references, but leaves external refs dangling

  we do a final link at load time when we copy into the heap

  do we need zombies at all now?

  make a fork for this



- we have ws->window_width, can we use the one on Model now instead?



- new inplace stuff needs a test suite

- 'don't show this dialog again' on delete row dialog, also in prefs

  box_yesno() could take a string which is the name of a pref to check for
  ask-or-not



- how about something that does:

	  im' = operation_list [a, b, c, d] im

  it does a fold:

	  im' = d (c (b (a im)))

  but the intermediate images are reused, so you can do in-place stuff with it

  we could get rid of lineset!






- mac binary has a broken im_text() argh

- do we allow

	[r, g, b] = Image_file "babe.jpg"

  since ? is band index and list index, it seems to make sense

  we have 

  	image ++ image
  	image ++ [] == image

  for bandjoin, so that lines up too, I guess

  hmm

  	reverse image

  to swap the bands over? heh need to be able to override hd and tl

- Ackermann

        http://shootout.alioth.debian.org/great/benchmark.php?test=ackermann&lang=all&sort=cpu

        A x y
                = y + 1, x == 0
                = A (x - 1) 1, y == 0
                = A (x - 1) (A x (y - 1));

        correct test result: A 3 4 == 125

  A 3 10 is benchmark test ... we fail with a "C stack overflow" error

  A 3 9 == 4093 works OK

  we could make this a lot quicker with some arithmetic streamlining

  could we do tail-recursion elimination?

  strictness analysis would help too

- Fib

        http://shootout.alioth.debian.org/great/benchmark.php?test=fibo&lang=all&sort=cpu

        F x
                = 1, x == 0
                = 1, x == 1
                = F (x - 2) + F (x - 1);

  correct output F 32 == 3524578

  cima is ~370s for this (!!)

  work machine is about 50s

  dell vostro laptop is 45s without optimiser

- turn on DEBUG in heap.c, run the fibonacci benchmark

  we heap_copy F every time it recurses! because when we heap_copy we don't
  link recursive references

  try fixing this ... but remember the problems we had with shared classes
  when we did link-to-value rather than link-to-copy

  we also have a huge amount of stuff in the heap, could we trim this down?
  how does it all get pulled in? is it preferences?

  in nip1, F is about 4x faster

WONTFIX for 7.20
================

- look at:

http://www.eggheadcafe.com/software/aspnet/35467981/programmatic-console-appl.aspx

  possibly better than nip2-cli.exe

- turning a column from Many Stats into a vector for doing arithmetic is very
  tricky argh

  add a matrix->vector converter? or maybe a one column or 1 row matrix should
  also be a vector
  
- try:

	 nip2 Workspaces.uniformshapes2.A1.start_line=21 uniformshapes2.ws 

  --set does not work for non-toplevels

- try:

	A1 = [1]
	A2 = [x :: x <- A1]

	change A1, A2 does not update, argh

  we get:

	link_expr_new: expr A2.$$lcomp0 references link->child = A1

  so perhaps we are updating the local of A2, but not A2?

  A2 is certainly being marked dirty ... on change of A1 we get:

	row_dirty_set_single: A1  clear_error = true
	symbol_dirty_set: A1 (0x1a59480)
	symbol_dirty_set: A2 (0x1a595a0)
	symbol_recalculate_check: untitled.A1
	row_dirty_clear: A1 
	row_recomp_all: done row A1  - 0.000143873s
	row_dirty_set_single: A1  clear_error = false
	row_dirty_clear: A1 
	symbol_dirty_clear: A1 (0x1a59480)
		success: [2]
	symbol_recalculate_check: untitled.A2
	symbol_dirty_clear: A2 (0x1a595a0)
		success: [1]

  so maybe A2.something is being updated, but the row is not

  we now mark a row dirty if a sub-expr is dirty. but in row_renerate(), we
  don't build subexprs 

  should we mark the subexpr dirty? (or maybe we do?)

  or should we always copy all subexprs when we copy an expr

  or only subexprs with no row?

  do we calc rows outside-in or inside-out? does this affect copying subrows?

  when do we copy now, the first time a row is made?

- we destroy and rebuild all links during recomp (eg. turn on DEBUG in
  link.c), why is this? can't we only rebuild on a change of source text?

- fix the FIXME in itext_clear_edited() or wherever it is

- try:

	start nip2
	dir untitled
	create A2, A3, etc.
	A1 does not update

  when we add/remove a def to workspace, should we mark the ws dirty?

- lambdas should allow patterns? eg.:

	map (\[x, y] x + y) [[1, 2], [3, 4]] == [3, 7]

- OS X bundler:

   http://sourceforge.net/apps/trac/gtk-osx/wiki/Bundle

  test?

- imageinfo_make_paintable() no longer copies to a file, since this used to
  cause problems with dangling pointers because of the im_close()s we had to
  do

  however, this means we now do all painting in memory :-( do we need to add
  API to change a memory image (eg. a "p") into a file?

- test Joe's layout thing, compare to the thing we do in study2 to make the
  diagnostic image

- im_blend(), im_ifthenelse(), im_add() etc. now do bandalike/formatalike

  where do we use our bandalike/formatalike stuff? remove our stuff, though
  make sure we have equivalents in vips now

- outline text example

- needs a custom convol menu item which can loop over a group of matricies
  with a single image

  actually, we need to nail this down, otherwise when we pass in a list of
  sample texts the loops don't nest

- right-click menu on row button should have items for "Jump to referrer / WC1
  / JC1 ..." and "Jump to referred / ..."

- why didn't im_copy_file() work? mysterious

- line colours are wrong, argh, very mysterious, see

  	plot_new_gplot()

- gtk3.0 tests:

	build with

	#define G_DISABLE_DEPRECATED
	#define G_DISABLE_SINGLE_INCLUDES
	#define GDK_DISABLE_DEPRECATED 
	#define GTK_DISABLE_DEPRECATED
	#define GDK_DISABLE_SINGLE_INCLUDES 
	#define GTK_DISABLE_SINGLE_INCLUDES

	paste into config.h, somehow

  need to remove:

	GtkType
	gtk_type_new
	gtk_signal_connect
	GTK_SIGNAL_FUNC
	gtk_signal_handler_block_by_data
`	gtk_signal_connect_object
	GTK_CHECK_CAST
	GTK_CHECK_TYPE
	GtkSignalFunc

- add Set menu to Math with mkset/union/intersection/difference ?

  could do bit operations on images?

- lcomps like:

	argh = [x :: x <- poop]

  the 'x' gets copied inside the lcomp, leaving a zombie 'x' attached to argh,
  which Program / View / Errors then reports

  fix: don't resolve names as we parse and junk the ugly patch list thing

  instead, have a separate resolve stage that runs after we've moved scraps
  of graph to their final home

- if we want full VipsObject introspection we will need a lot more

	vips_object_arguments (name2gtype "VipsInterpolateYafrsmooth")
		-> ["sharpness"]

  need some equivalent for GParamSpec / VipsArgument

  	VipsArgument name type .... = class {}

  return a list of these from vips_object_arguments()?

- heap_map_dict() should be reduce_map_dict(), since it does reduction, argh

  redo heap_map_dict() in terms of reduce_map_dict()

  actually, remove all the reduce_ stuff, it's daft to have a distinction

  something to do when we break Snip out into libsnip

- Plot window should have image header menu item?

  not trivial, image header needs a conversion to watch

  we'd need to make a conversion in plotmodel

- filesel guess-file-type-from-suffix needs fixing

  copy the vips model of having a user_name which is just "Workspace" or
  somesuch, and making "Workspace file (*.ws)" string at runtime

  use this to identity file types in util.c as well: get_image_info() needs it

- for rows made by typing stuff, always show the formula as well as the value

  by default anyway?

  we'd need to always show the up/down arrows, not just for classes

- drag from an image thumbnail to the ws background and you get a new column
  with "A2" or whgatever in

  does not work for plot thumbnails! how annoying

- right-click on image background to get a context menu with
  save/replace/header? same as row thumbnail context?

- look at using goffice instead of gtkplot for graphs

	http://ftp.gnome.org/pub/gnome/sources/goffice/

  also in synaptic

  there's also a new cairo-based gtkplot in SVN, apparently

- try

	last [1..]

  then CTRL-W ... we can quit the app, but it's still evaling and the prompt
  never comes back

- Math / Cluster is a bit useless, will it work for complex numbers? vectors?
  colours? groups?

  what would we have to do to get it to work for these other types?

- toolkit load is where compiled code would go in

  need to make load / parse / compile self-contained ... the only output is a
  list of symbols, each with code and sub-symbols; there are no toolkits or
  whatever made

  after load / parse / compile, we need to walk the symbol list building tools
  and all that stuff

  we do:

  	load toolkit:
		get filesize, date last modified, md5sum
		look in ~/.nip2-7.x.x/cache for a file named with that md5sum
		if present, open and check first two fields: filesize and date
		if match, load compiled code
		if no match, load / parse / compile toolkit, then save compiled
			code to ~/.nip2-7.x.x./cache
		walk symbol list building tools and all that stuff

  how much time will this really save? can we easily get an estimate?

  steps to follow:

  1.	make load / parse / compile self-contained, with separate pass to
  	build tools etc.

	this is a useful cleanup whatever else we do

  2. 	now we know exactly what the output of load / parse / compile is, we
  	should be able to write to a file

	make our own binary format, don't use XML ... we want speed

  3. 	try loading and benchmarking

  4.	if the benchmarks look promising, harden and polish


- numbering of group of group save seems to skip one at end of line?

- Math / Cluster is a bit useless, will it work for complex numbers? vectors?
  colours? groups?

  what would we have to do to get it to work for these other types?

- segv in test_toolkits on laptop (inside fftw3) ???!? valgrinds cleanly on 
  work machine

- try

	last [1..]

  then CTRL-W ... we can quit the app, but it's still evaling and the prompt
  never comes back

- configure no longers sets GMSGFMT, is this OK? test on OS X

- for rows made by typing stuff, always show the formula as well as the value

  by default anyway?

  we'd need to always show the up/down arrows, not just for classes

- drag from an image thumbnail to the ws background and you get a new column
  with "A2" or whgatever in

  does not work for plot thumbnails! how annoying

- right-click on image background to get a context menu with
  save/replace/header? same as row thumbnail context?

- look at using goffice instead of gtkplot for graphs

	http://ftp.gnome.org/pub/gnome/sources/goffice/

  also in synaptic

WONTFIX for 7.14
================

- quit while a thumbnail is painting: IMAGEs are leaked? seems esp. bad with
  greyc, perhaps just because it's so slow

- do we enforce no-args-to-LHS-pattern anywhere? try

	[a,b] a b = 12;

- use destroy_if_destroyed() in more places? 

	grep destroy_ *.h

- after pressing "Process" in the edit window, we always select last_sym,
  which is often not what we want

  make it jump less after a process ... eg. try editing something in the
  middle of Image/Transform, very annoying

- use compile->last_sym to spot chains of defs

  multiple definitions of the same function are allowed, provided they all
  multiple definitions of the same function are allowed, provided they all
  have the same number of arguments, and provided only one of them has no
  argument pattern matching

  example:

  	fred [a, b, 1] = a * b;
	fred (Image x) = rot90 x;
	fred z = error "what";

  any of these can have locals, those locals just apply to that one
  definition

  this compiles to:

	fred $$a4 
		= $$fred1, is_list $$a4 && len $$a4 == 2 && $$a4?2 == 1
		= $$fred2, is_instance_of "Image" $$a4
		= $$fred3
	{
		$$fred1 
			= a * b
		{
			a = $$a4?0;
			b = $$a4?1;
		}
		$$fred2 
			= rot90 x
		{
			x = $$a4;
		}
		$$fred3 
			= error "what";
		{
			z = $$a4;
		}
	}

  so each pattern-matching definition generates a condition and an action

  constants in patterns become part of the condition test

  the action goes into a private function, the conditions are joined together
  in the function wrapper

  the no-pattern case (if present) becomes the action for the "otherwise"
  clause in the wrapper

  if not present, we generate (error "pattern match failed") or somesuch for 
  the default case

  we will need to regenerate the wrapper function every time a definition of
  fred is added or removed ... can we do this easily?

  when are two definitions considered equal? should we warn about this? "fred
  x" could occur in two files, for example

  process:
 
	* we see a "fred arg-list" incoming
	* does the arg list contain any patterns?
	  yes:
		* do we already have a fred in this scope?
		  yes: 	
			* the existing fred must be the wrapper, this must be 
			  a new possible RHS
			* check that the number of args matches
		  no:
		  	* generate a fred to act as the wrapper
			* add args called $$arg1 etc. to the main fred
		* add this new fred as a $$fredn local to the current
		  fred
		* expand the patterns as local references to the main
		  fred's arguments
		* parse the rest of the def in that context
		* keep the pattern list around, we'll need it to generate the
		  ifs for the wrapper later
	  no:
	  	* do we have a fred in this scope?
		  yes:
		  	* check the previous fred was a pattern matcher
		  	* check the number of args matches
		  	* check there isn't already a default case
			* add as above
		  no:
		  	* add as a regular non-pattern definition

  issues:

  	* where do we store the pattern lists? we can't expand them at
	  parse-time, since we need them to make the wrapper (which we can't
	  make until we've seen all the candidate RHS)
	* when one of the RHS is changed, we need to regenerate the wrapper,
	  how do we do this? (could nuke the generated code in the compile
	  when we see a new RHS, then rebuild the wrapper in compile on the
	  next heap_copy?)
	* our current condition generator won't work ... we need to test
	  consts as well, and it'll be rather inefficient as we'll repeatedly
	  test the trunk as we loop over the leaves --- instead, walk the 
	  pattern recursively top-down testing each node

  process:

  * see "fred" (as opposed to simple_pattern)
  	* is there already a fred in scope? 
	  yes:
	  	* was current_compile->last_sym also a "fred"?
		  yes:
			* another definition
	  yes:
	  	* this must be an alternative definition


- we put the 2nd fred in as a local of the first, but then the 2nd can see all
  the stuff the first has as locals

	  z = 42;
	  fred 1 = 12 { z = 99; }
	  fred 2 = z;

  "fred 2" will return 99 :(


  we need to make "fred 2 = z" into another fred at the same level, eg

  	$$alternate42$fred 2 = z;


  Nope, then how do we link the freds together for remove etc.?

  Better:

  	see a new sym (fred), create it

	parse args with simple names becoming params, patterns becoming
	$$arg42 plus a local $$patt42 holding the pattern source

	expand the pattern to an access def as well, so our children can bind
	to it

	at the = sign, test for any pattern args present .. if there are none,
	carry on as before

	otherwise, make a new local called $$alternate42 or whatever and parse
	the RHS into that

	at the end of parse, need to resolve outwards twice, since we nest in
	twice

	now if we see another fred, check that the number of args matches and
	then parse in as $$alternate99

  what abut

  	fred 2 a = 12;
	fred 1 b = 32;

  the first fred will make a top-level with

  	fred $$arg12 a
		=
	{
		$$alernate42 = 12;
		$$patt12 = 2;
	}

  then when we parse the 2nd fred the name of the 2nd param is wrong :(


  Even betterer:

  	use GLR to split off the four cases for us

		ident = 
		pattern = 
		ident ident_list = 
		ident pattern_list =

	change pattern syntax so that ident is not part of simple_pattern

	need to change lcomp as well

	so we need to check why PARSE_PARAMS gets used: can we do without the
	params part? yes, it's used so we can edit functions, but we no longer
	do this

	these days all we need is expr I think, but we'd need a small action
	wrapper around it to wipe out any existing tree and locals



        Find_item = class
            Menuaction "_Find"
                ("find a transform which will map sample image onto " ++
                "reference") {
            action reference sample = class
                Transform b reference.width reference.height {
                _vislevel = 3;

                // controls
                order = rubber_order;
                interp = rubber_interp;
                wrap = rubber_wrap;
                max_err = Expression "Maximum error" 0.3;
                max_iter = Expression "Maximum iterations" 10;

                // transform
                [a,b,c] = transform_search max_err max_iter order interp wrap
                        sample reference;

                transformed_image = Image a;
                final_error = c;
            }
        }

  fails with 

	Bad superclass.

	Superclass constructor 
	"Image_transform_item.Image_rubber_item.Transform"
	should have no secret arguments.

  but this:

        Find_item = class
            Menuaction "_Find"
                ("find a transform which will map sample image onto " ++
                "reference") {
            action reference sample = class
                _t {
                _vislevel = 3;

                // controls
                order = rubber_order;
                interp = rubber_interp;
                wrap = rubber_wrap;
                max_err = Expression "Maximum error" 0.3;
                max_iter = Expression "Maximum iterations" 10;

                // transform
                [a,b,c] = transform_search max_err max_iter order interp wrap
                        sample reference;

                transformed_image = Image a;
		_t = Transform b reference.width reference.height;
                final_error = c;
            }
        }

  (ie. make the superclass constructor into a member) works fine



- try using bison's location system

	http://www.gnu.org/software/bison/manual/html_mono/bison.html#Locations

- add something to Symbol:

	Symbol *access_for;

  links generated access def to the $$thing4 which holds the RHS

  handy for the program window, also maybe for lcomp code gen?

  also for row edits

- don't offer to clear temps if there's been a crash 

  need to be able to test for process-still-running by PID

  try

  	http://msdn2.microsoft.com/en-us/library/ms886766.aspx

	gboolean
	process_running( int pid )
	{
		HANDLE handle;

		if( (handle = OpenProcess( 0, FALSE, pid )) ) {
			CloseHandle( handle );
			return( TRUE );
		}

		return( FALSE );
	}

- autoarrange after every column resize or move

  animate movement, so columns slither out of the way and in to place when 
  you drop

  duplicate column placement would be odd: maybe place duplicate below? also
  new column? what about dropping an image on to the ws background?

- there's some left-recursion in the parser, eg. comma_list, is this easily
  fixable?

- add (*) (operator sections) ... need a binup / uop production? can't
  do this without losing precedence stuff, it'll need a separate production
  for sections

- magic definition maker could make a workspace-local def, rather cool

- test classmodel_dict_new() ... part of classmodel member automation

  need to implement member edit for OPTION groups

	classmodel_done_member() ... read widget set -> model
	classmodel_buildedit_member( ... model -> build widget set 

  part of the [["key",value]] arg type

- can we get VIPS errors reported in Error too?

  we'd need to add logging to vips I think

- toolkits / find doesn't find builtins on their name ... eg. search for
  "im_add"

  too hard to fix with the way searching is done now

- turn on update regions during drag, fix the x pos, try dragging, horrible
  flickering as we update twice, once after the drag motion and once after the
  recomp

  if you comment out the explicit vobject_refresh() in 
  regionview_model_update() the flickering goes, but region dragging is then
  very unresponsive

  fix this when we get fast recomp back again

- have a test_types.ws ... test arithmetic on all combinations of _types?

- panner would be cool

- tooltips on Expression rows always show unedited formula

  could special-case formula for things with expression RHS?

- what about iimage, iregion, iarrow ... can we member automate these? why are
  they different?

- can't see error indications in noedit mode

  should set a red background for display area as well as for rowview button?

- need to be able to override cons to be able to make a List class :-(

  see reduce.c:1710

  this will change the strictness of cons ... how much breakage will this
  cause? very unclear

  try this as a quick hack

  need to do this before we can finish List

  need List to make gamma easy

- unselected column headers are too like the bg colour on windows?

- python uses z.real and z.imag to extract real/image, should we add this too?

  we don't really have complex as a true class, so it would be rather odd

  need to add "[a].head" etc as well

- python blocks complex->real with casts ... insists you use .imag/.real or
  abs()

- if nip sees a IM_RW_IMAGE argument, it could automatically do this:

	int
	im_flood_blob_copy( IMAGE *in, IMAGE *out, int x, int y, PEL *ink )
	{
		IMAGE *t;

		if( !(t = im_open_local( out, "im_flood_blob_copy", "t" )) ||
			im_copy( in, t ) ||
			im_flood_blob( t, x, y, ink, NULL ) ||
			im_copy( t, out ) ) 
			return( -1 );

		return( 0 );
	}

  so it would turn a single IM_RW_IMAGE arg into a paired input and output
  arg

  could make im_lineset() into a regular inplace func and rely on nip to wrap
  and unwrap

  junk flood_blob_copy

  nip could do this lazilly ... if we see the user doing

     im_line (im_line ...) ...

  then we could make one memory image and call im_line twice on it
  destructively ... cool! we'd need to check refcounts to make sure the
  intermediate wasn't being used anywhere else

  hmm! might actually be very hard, we don't have true refcounts for things in
  the heap

  need to do it on read instead: 

    - for image i

    - use as an IM_RW_IMAGE arg ... copy to a memory area and pass in memory
      handle

    - return memory area IMAGE j, and set a flag saying "can operate on
      destructively"

    - if we use j as an IM_RW_IMAGE arg, skip the copy and just pass memory
      area in destructively ... we now have two ImageInfo sharing a single
      IMAGE

    - !!!!

    - does ImageInfo allow IMAGE sharing? not sure it does

    - maybe this needs to be a vips8 feature when we'll have refcounts on
      IMAGE

- tooltip on column says which other columns items in this column refer to,
  and which columns refer to items in this column

- how about a nip start folder common to all versions

  so nip2-7.11.14 tries

    .nip2-7.11.14/start
    .nip2-7.11/start
    .nip2-7/start
    .nip2/start

  or maybe

    .nip2/7.11.14/start
    .nip2/7.11/start
    .nip2/7/start
    .nip2/start

  bit less cluttered

  also, we could have

    .nip2/tmp

  and not have multiple nip2 tmp areas

  workspace recover after crash could break though ... maybe keep ws saves in
  .nip2/7.11.4/tmp?

- think again about class arg checks 

  is there some way we can avoid the _check overhead? or at least check less 
  often

- plotpresent/imagepresent could have a common base class with the focus stuff
  in? also kb nav, zoom, drag-scroll

  a bit difficult, because we want two different policies on window resize:
  plot should change the object to match the window

- photographic negative should also be in image/levels ?

  no, it does ->sRGB, (255-) etc., so it's better as a filter

- gtk+ 2.12 has a treeview widget with rectangular select and grid lines

  use instead of gtksheet?

- stop image flickering on clock recomp?

  want background pattern to be a property of the image display widget, not
  the image?

  so we fade in tiles when that section of the image has never been displayed
  before (eg. on scroll or zoom)

  we don't fade when that section has been painted and we are just changing
  the image (eg. on recalc)

  if fadesteps == 1, only paint the sections of the tile for which mask == 255

  this way we will never paint the bg pattern

  need some hack for scroll/zoom ; test for mask == 255 would be slow :(