-
Notifications
You must be signed in to change notification settings - Fork 5
/
Changelog
2113 lines (1667 loc) · 80.4 KB
/
Changelog
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
10 November
Fixed bug in SortMOP. Neutral elements:
neutral element associative operator
0 +
1 *
empty string white space
were not handled correctly.
4 November 2024
Allow / in unquoted HTML(5) attribute, even if followed by >
3 November 2024
Added test in `for' loop.
1 November 2024
Changed ' to ' in toML function, since ' is not a valid HTML
entity.
13 September 2024
Fixed bug in mop$: If function called by mop$ returned an expression with the
operator that is specified as input operator, this expression was transformed
as well (only the last returned value, though). This could lead to erratic
behaviour.
26 August 2024
lst$ function fails if given a symbol without a binding.
15 August 2024
Fixed bug in yesterday's new code (mop$ function).
14 August 2024
map$, mop$ and vap$ functions can take empty string as `map function'. Result:
elements passed on unchanged.
mop$ does (merge) sort output if the separating operator in the output list
is + or *.
9 August 2024
(minor change) Moved binary | (OR) operation out of loop in mop$ function.
8 August 2024
The mop$ function can take an extra argument that indicates the operator to be
used to separate the elements in the output.
1 August 2024
tme$ function gives local time. tme$GMT gives UTC (Coordinated Universal Time).
Output contains all fields in C's tm struct, but with month, year, day of the
week day and day of the year given in conventional ranges instead of starting
from 0.
25 July 2024
UFP export function accepts more formats: "%f" or F, %a or H, N, Q and %e or R.
25 January 2024
toML function: Removed the space before the slash in empty tags (void elements).
nestML function: If a </html> tag is present, make sure there also is a <html> tag
nestML function: explicitly close non-empty elements such as in <p>abra<p>cadabra.
14 November 2023
Improved error messages when something is wrong in function call in UFP object.
13 November 2023
Fixed signed/unsigned bug in FPU that could result in a negative denominator
due to left shifting a large enough positive number by 52 bits.
10 November 2023
Embed `normal' Bracmat expression in UFP object using eval'(expression).
For now, no value is passed to or returned from eval. (This might change.)
Expression can export data from UFP object.
12 October 2023
Fixed: argument of 'idx$(array, args)' can be complex expression that evaluates
to a number.
9 October 2023
Minor fix of indentation algorithm.
27 September 2023
numbercheck: Accept hexadecimal floating point notation: chars a-f A-F.
26 September 2023
numbercheck: Accept fixed point notation having more than one digits before
the dot.
25 September 2023
UFP: Passing value that cannot be represented as a double results in failure.
Handle errors in consistent way; err$ can redirect or silence error messages.
Documented err$ function.
24 September 2023
Further debugged and improved export of double values from UFP.
Export as integer not limited to range INT64_MIN < val <= INT64_MAX
22 September 2023
Fixed bug in export from UFP object of double as fraction ('Q' option).
This did not handle integer values correctly.
11 September 2023
In UFP object, renamed 'range' to 'extent'.
5 September 2023
Using int64_t (C99: stdint.h, inttypes.h) to cast double to integer and convert
double to a rational number in decimal notation. Also used in subroot(), x2d
and d2x. The 32-bit version uses int64_t as well.
Removed the whitespace behind the result of exporting from a UFP object in `Q'
format. (There was no good reason to have that whitespace.)
29 August 2023
From today, bracmat.c is no longer the primary source code for further development.
Instead, bracmat.c is moved to a new folder, `singlesource', while the old `src'
folder contains `potu.c' and many other .c and .h files, neatly organized in
functional modules. These are the files that will be manually maintained in the
future. The file singlesource/bracmat.c is more or less a concatenation of all
source files in `src', minus repetitions and minus the majority of function
declarations.
New in the `doc' folder is `bracmat.pdf', which is created from `bracmat.tex'
(not in this repo), which, in turn, is created from `bracmat.html', which is
created by running `get$help' in the Bracmat CLI and choosing the menu item
`htmllatex'. The conversion from Latex to PDF was done by TeXstudio
(https://github.com/texstudio-org).
Also from today, bracmat.c includes floating point support in `UFP' objects,
called `UnIfancyfied Floating Point' because I have been thinking for many years
how to implement Floating Point capability in Bracmat without breaking it. The
solution is a sandbox solely for floating point calculations. At the surface,
code running in this sandbox looks like any other Bracmat code, but below the
surface is a compiler and a byte code interpreter. The performance is not as good
as Java, but a lot faster than Python.
28 August 2023
Changed the output format of flt$. The decimal comma has become a decimal dot.
The `*10' in front of the `E' has been removed.
The new `calcuation' object has been renamed to the shorter `UFP'. (Think:
the next thing after UFO.) Its member function `calculate' is renamed to `go'.
The old names can still be used, for the time being. Also `run' instead of `go'
will work. A few bugs and weaknesses in calculation.c are fixed. If an error is
found during compilation, the `new$(UFP... )' call fails.
The test suite valid.bra is extended with some UFP examples.
20 August 2023
For some time, the old, stable source code in the `src' directory and the
source code in the more experimental `potu' directory have diverged. Sometimes,
small improvements to one of them were not applied to the other. The reason for
that was that the source codes were very hard to compare, let alone merge: in
`src' most of the code is in a single file, `bracmat.c'. In `potu', on the
other hand, are many files that have to be taken together to become equivalent
to `bracmat.c'.
The `potu' source code was created from `bracmat.c', and it is still possible
to compile `potu' quasi single file:
gcc -std=c99 -O2 -DNDEBUG -DSINGLEOBJECT -o potu1 potu.c -lm
However, the order in which `potu.c' includes other C source files did not lead
to the same (implicit) order of #defines, #includes, typedefs, variable
declarations and function definitions as the (explicit) order in `bracmat.c'.
Now, a script, `potu/one.bra', constructs a single file, `src/bracmot.c' from
the source code files in `potu'. This generated file `bracmot.c' is compilable
in the same way as `bracmat.c', but has the extra functionality of `potu', that
is, floating point calculations. The file `bracmat.c' has been reshuffled to
minimize the differences with `bracmot.c' when seen side by side in WinMerge
(https://github.com/WinMerge), but without including the still experimental
floating point functionality. From now on, if a small change is made in either
`src' or `potu', the change can later be picked up in the other one by
comparing `bracmat.c' and a freshly generated `bracmot.c'. The actual update
has to be made by hand. That is easiest when having to update `bracmat.c'. In
the other direction one has to find the source file in `potu' based on
recognisable text in `bracmot.c'.
I don't know yet how to go on from here. I still like the single file approach
of `bracmat.c' (just to be in opposition), but many people like the traditional
multi-file approach in the `potu' folder. Maintaining both is untenable. The
stuff in the `potu' directory is going to survive, no doubt about that. For
maintainability, I will at some time have to slash `bracmat.c' altogether, or
`bracmat.c' will just become identical to `bracmot.c'.
And then there is the naming...
28 March 2023
HTML input is assumed to be UTF-8 encoded. All character entities are converted
to UTF-8 characters. (This has not unchanged.) While reading HTML input, when a
non-UTF-8 character is seen, it is assumed to be coded iso-8859-1 and converted
to UTF-8 accordingly, as are all bytes with the high-bit set that follow. This
ensures that the internal representation of the HTML file is UTF-8 encoded.
9 March 2023
input(): On reading, if options STR as well as TXT are given, then any zero byte
in the input files will cause input() to fail. Also, if STR is given, but not TXT,
then reading simply stops at the first zero byte, but input() will not fail.
(Previously, all of the input was read into a leaf. However, all bytes after the
first zero were unreachable to any Bracmat functionality.)
The file src/xml.c is replaced by potu/xml.c, except for two #includes.
1 March 2023
Speeded up look-up of functions, and allowing more recursions for same stack size.
7 February 2023
First fully debugged version of potu with 'calculation' object type for floating
point computations. No memory leaking. If 'calculate' method fails, it just says
that no value was returned. The 'export' method can retrieve array data serialized
as a string, either formatted as float (R), integer (N), fraction (Q) or as bit-
preserving hex string ("%a").
30 January 2023
Undid change made 2022.09.13
1 December 2022
Built-in function ugc$<atom> returns Unicode General Class.
Predefined function let$<atom> says whether character could be part of a word
(a letter or a marking).
4 October, (Both Bracmat and Potu): Fixed an error in the computation of an expression's
'complexity'. The (not serious) error sometimes caused indentation to go awry.
18 September 2022
Fixed bugs, so we can compute points in te Mandelbrot set.
16 September 2022
Built in object type "calculation", meant to do floating point calculations with
C doubles, evading conversions to other types during the computations. Uses threaded
code, inspired by Forth.
25 June 2022
bracmat (6.11.1): New option 'WYD' for 'lst' and 'put', creating wider lines
(~120 instead of ~80 characters).
potu (6.11.1): Renamed 'WID' to 'WYD'.
25 June 2022
potu (6.11.0): New option 'WID' for 'lst' function, creating wider lines (~120 instead
of ~80 characters).
2 May 2022
New built-in function mop$ iterates over terms/factors/elements and outputs a
space operator separated list.
E.g. mop$((=.!arg).2*a+i*b+e\Lc.(=+))
evaluates to 2*a e\Lc i*b
26 October 2021
Removed superfluous bitfield in tFlags. This bitfield caused sizeof(tFlags) to
be too large. Also changed the type of several structure members from void *
to something more meaningfull. Removed struct pointerStruct.
6 October 2021
Field 'range' in struct ccaseconv changed from 'int' to 'unsigned int'.
Cast (T[i].L + T[i].range) to 'unsigned int'
Compare clock_t variable with (clock_t)-1, not -1.
5 August 2021
Experiment: theoretically, match can be speeded up by first checking whether
subject and pattern are the same thing. If they are, the match succeeds,
PROVIDED that the thing doesn't contain any flags and only a subset of
operators. The experiment was not a success: programs became slower, because of
the overhead.
3 August 2021
Objects (trees headed by = operator and built in object types, i.e. hash
tables) are space optimized in 64 bit versions. Otherwise unused bits in the
first 64 bit word of the object node are now used to store the bit fields and
reference counter, which previously were in an other 64 bit word. All nodes
(objects, non-object operator nodes and leafs) have the same amount of bits for
reference counting, currently 39. 32 bit versions have 32 bits for objects and
9 bits for all other nodes. (When all 9 bits are used, a new copy is created.)
31 July 2021
For 64-bit versions, the size of the reference counter is enlarged by 32 bits.
Fixed: endless loop when dummy operator evaluates to itself.
20 July 2021
Typo corrected: 'ANY Child' -> 'ANY KIND'
25 January 2021
java-JNI/dk_cst_bracmat.c : Added (*env)->ReleaseStringUTFChars(expr, str);
1 October 2020
xml.c:/ in unquoted (x/html) attribute does not indicate empty tag. /> does.
e.g. <a href=http://www.aaa.bb/cde/index.html>
MLencoding:Check meta tag if xml declaration inconclusive
30 September 2020
toML: if xml declaration encountered, make sure that there is exactly one "?"
before the ">" of the xml declaration and before all ">" in all Processing
Instructions.
20 June 2020
Removed the third (and last) number from the data structure that is returned by
the bez$ function, since this number is always 0.
17 June 2020
If f=g, then !(&!f) behaves like !!f both in eval and match context.
Fixed bug that permanently attached a ? flag to g when evaluating 17:?(&!f),
so that 17:!(&!f) did not work as expected.
17 January 2020
Updated with http://unicode.org/Public/UNIDATA/UnicodeData.txt 01-Apr-2019 00:08
3 November 2019
Discovered two unwarranted assertions while evaluating expressions with
complex numbers. The code was correct. The assertions are removed.
Tests added to valid.bra. See also
https://codegolf.stackexchange.com/questions/161483/expand-sine-and-cosine/195251#195251
24 May 2019
Renamed variable 'nice' to 'beNice', since 'nice' is a reserved word in some
C-implementations. Also use printf format %lu instead of %zu if __VMS is
defined. Many thanks to https://github.com/TheFausap for porting Bracmat to
OpenVMS and for testing.
23 May 2019
Put #ifdef __VMS ... #endif around yesterday's change in wmv$ implementation.
22 May 2019
If remove() returns a value that is not 0, EACCES or ENOENT, and
strerror(errno) evaluates to "file currently locked by another user",
then rmv$ returns EACCES. Added two typecasts for strcmp #ifdef __VMS.
18 May 2019
In Bracmat.c, in the implementation of the rmv function, if errno is non-zero
and neither EACCES nor ENOENT, use strerror(errno) to explain what remove() is
complaining about.
In valid.bra, test 753 is improved. In the first loop counting from 1 to 1000,
1000 files are opened for writing. If the OS does not have that many file
handles, Bracmat closes some of the files, remembering the file mode and the
position in the file. If fil$ fails for some reason, the loop is exited. The
first test is to check that the loop was done 1000 times. Else error 753a is
issued. In the second loop, the code iterates over all "open" files in reverse
order, closes each file and deletes it. Files that already had been closed
because there weren't enough file handles, are opened in the same file mode as
before and the writing position is restored. After re-opening, those files are
also closed and deleted. If the iteration stops before the first file is closed
and deleted, error message 753b is issued. Finally the code iterates over all
1000 file names and attempts to delete files with those names. The expected
returned value from the rmv function is ENOENT, sinces all files should have
been deleted already. In OpenVMS some return values may be 0, since opening
a file twice for writing is expected to create a new version of the file.
If the returned value is neither 0 nor ENOENT, error 753c is issued.
After running valid.bra, no files called MANYAnnn
17 May 2019
In valid.bra, changed all file names to upper case and added an extension.
Also made sure that all generated files are also deleted again, with the
exception of valid.txt.
15 May 2019
Added details of problematic output to error notification 724.
28 March 2019
valid.bra: Added Andre Bookers solution of Sum-of-Three-Cubes problem for
the number 33.
23 March 2019
Created a new Bracmat installation file for the Ericsson MC218
(and the Psion 5MX).
7 February 2019
The implied exponent "1" in a:a^(?exponent+[?Len) was regarded as a neutral
element (because a^1==a), and therefore the value of Len was computed to be 0,
which is not correct, since "1" is not a neutral element under addition or
concatenation, but only under multiplication. This is fixed.
Also, the % prefix did not always forbid matching neutral and zero elements
(empty string in a concatenated list, 0 in a sum, 0 and 1 in a product). This
is also fixed. This is fixed. An attempt was made to only forbid matching
neutral elements in the presence of the % prefix, but this broke backward
compatibility. For example, the built in 'fct' (factorization) function did not
work under that regime.
31 January 2019
map function: If the mapped function returns a leaf node with an empty string,
then that node will not be appended to the resulting list. Previously it was
added and afterwards deleted. Also, if the list is empty (only a leaf node
with empty string), then the mapped function is not even called. Instead, the
result of the map function is the same empty list.
7 December 2018
Fixed Bracmat JNI not being thread safe in Windows. This is now solved by
using the C++ std::mutex implementation.
28 October 2018
Changed behaviour: get$<filename> returns the result of evaluation of the
last expression. If the last non-white character in the file is a semicolon,
then the last expression evaluates to an empty string. Previously, the returned
value was the result of evaluating the last expression that did not consist of
white spaces, or, if there was no such expression (i.e. an empty file), the
get$<filename> expression itself. The latter could have very undesirable side-
effects.
27 August 2018
Added ':' and '_' as valid start characters in XML (and html) names.
17 May 2018
Fixed uninstantiated-pointer error in vap$ function. (When given en empty
string as input.)
6 February 2018
New function vap that does with strings what map does with lists.
vap can deconstruct a string character-wise or split it at every
separator. The separator, if defined, can be any string. vap knows
about UTF-8.
5 October 2017
Avoid unnecessary memory (de)allocation in solution made yesterday.
4 October 2017
Pattern functions that return ? on success can be negated.
22 August 2017
Tested #define'd options and made minor fixes to make bracmat.c compile with
every option turned on and off.
11 August 2017
lex.bra: ignore anonymous functions in the list of undeclared functions.
1 August 2017
In xml.c: much extended list of HTML entities. Corrected typo in the
predefined function MLencoding that determines the encoding of an XML or HTML
file.
28 July 2017
Uses UnicodeData.txt 2017-04-14, 05:40:18 GMT, no change of behaviour.
21 June 2017
Added a built-in map function. Usage: map$(<fnc>.<space separated list>)
19 May 2017
More 'localisation' of source code to English
10 May 2017
'localised' source code to English, so you no longer need some knowledge of
Dutch and Danish to understand the code.
Moved two declarations to start of block (this is still C!)
7 February 2017
Added LT4DH/2016 paper. Updated README.md.
22 December 2016 - Version 6.209
Uses UnicodeData.txt 16-May-2016 19:23
Removed change log from bracmat.c
5 October 2016
Fixed error that made sim$(abbcd.abcd) equal to 10/9 instead of 8/9
23 September 2016
json.c: fixed reading strings with characters with 8th bit set.
31 August 2016
Made the FENCE flag ` the first flag to be printed.
5 August 2016
fpo -> global_fpo in myputc
12 July 2016
lst: Only list variable on top of stack if RAW option set.
6 May 2016
lst$ function takes the name of an expression or the expression itself, as the
rhs of an = operator. This is in line with the rest of Bracmat. Usefull when
listing code bound to a variable that has namesakes on the stack. (Before, you
had to assign the variable's value to global variable and list that global
variable instead.)
3 May 2016
New option RAW for lst function. A RAW listing does not have (varname= at the
beginning and ); at the end. This can be used to store a data structure that,
when read, can be assigned to a variable of the programmer's own choice.
One has to take care when listing a variable that shadows another variable of
the same name. Both variables will be listed!
20 April 2016
Bug: jsn$-1/2 jsn$-1/25 returned deformed strings. (Only if denominator is
multiple of 2 and/or 5).
12 April 2016
Bug: (.B+C)+(.2*(U+Z))+(.A*E)+(.B+C) did not evaluate to an expression where
the (.B+C) terms were combined. vgl() function was the culprit.
7 April 2016
Made %zu %lu if _WIN32 defined (not __WIN32__).
1 March 2016
Format %zu not supported in VS 2008. Made it %lu if __WIN32__ defined.
30 December 2015
Deleted some stale comments.
29 December 2015
First time build with Microsoft Visual Studio Express 2015 for Windows Desktop
Replaced format "%0*ld" by LONG0nD, which is defined as "%0*lld" for Win64.
Some global variables renamed + other actions to remove shadowing.
31 August 2015
Updated case conversion with latest UnicodeData.txt (09-Feb-2015 20:08).
See http://www.unicode.org/Public/UNIDATA/UnicodeData.txt.
21 July 2015 - 6.194
If defined with -DPYTHONINTERFACE and -DBRACMATEMBEDDED you can now make a
Python module called 'prythat'. From Python you call (in this order)
prythat.init()
prythat.HolyGrail(string containing Bracmat expression)
prythat.final()
The HolyGrail can be called any number of times.
From Bracmat you can call back to Python with the functions
Ni$"String with Python statements"
and Ni!$"String with a Python expression"
Only the function Ni! returns a value back from Python.
The subdirectory src/Python contains the Cython source file to
construct the Python module, together with Bracmat's C source.
That subdirectory also contains a file launch.py that tests and
demonstrates the prythat module.
20 July 2015
Added function Ni for interfacing with Python when embedded using Cython.
Added 'const' to scopy, numbercheck and fullnumbercheck
17 April 2015
XML: New predefined functions for nesting data and for converting data back
to XML format.
MLencoding - detects encoding in XML or HTML file
nestML - nest the internal representation of XML data
toML - convert internal representation of XML data to a string
containing XML data
HTML is supported, although nestML may still make wrong guesses.
17 October 2014
Return -1 if an argument cannot be evaluated.
24 September
Made handling of unquoted attributes in html elements more forgiving. Added
form feed to list of white space characters in html/xml parsing.
23 September
xml.c: Fixed bugs in handling close tags inside script (or style) cdata.
Removed allowance for white space between < / and element name.
(Between / and > white space is still allowed. This is not comme il faut.)
Removed possibility of close tag without name like so: </> or: </ p>
7 September 2014
Changed JSON object mapping.
{} is (0,)
{"key":123} is ((key.123),)
{"k1":true,"K2":"key 2"} is ((K2..key 2)+(k1.true),)
So [] becomes (,)
[{}] becomes (,(0,)) which is (,0,)
[{},{}] becomes (,(0,) (0,))
6 September 2014
Added atomicity checks in jsn where string argument is expected.
Nevertheless, jsn is not validating. Garbage in, garbage out.
5 September 2014
Added built-in, but redefinable function jsn. This function converts a properly
constructed Bracmat datastructure to a string containing JSON.
1 September 2014
Decimals in floating point numbers (JSON) were not counted correctly.
29 August 2014
json.c: Negative numbers now interpreted as numbers, not strings.
28 August 2014
Tested json.c. Now correctly handles \uXXXX and control characters.
The latter inspired by
http://www.bennadel.com/blog/2576-testing-which-ascii-characters-break-json-javascript-object-notation-parsing.htm
TODO 8232 (Line Separator) 8233 (Paragraph Separator) are also control characters, but not catched in json.c
6 August 2014
Better handling of SGML (<?...>) and XML (<?...?>) processing instructions
18 June 2014
New case conversion based on UnicodeData.txt 10-03-2014 18:20:00
10 June 2014
casesensitivehash: explicit cast to signed char.
22 May 2014
img^jpg:(img^jpg)^?n failed, while img+jpg:(img+jpg)^?n succeeded. Now they both succeed.
16 May 2014
1\La+1\Lb crashed due to stack overflow. Test ~1 in f5 solves the problem.
6 May 2014
Increased a buffer size to solve segmentation fault problem with 64-bit
version when evaluating roots of some big numbers, for example
10090000004431^1/2
3 May 2014
a^(b+c+d+e)*f^(g+h):?*?^(%+[<3)*? failed to succeed. If the first found
sublist (b+c+d+e in this example) failed to match the pattern, other sublists
where not tried.
22 April 2014
(xml.c) The &&; sequence to escape & is no good, because &&; after a
full round trip ends up as & using this scheme. Decide to use the DEL character
(ASCII 127) instead and see whether that goes.. This character is forbidden or
discouraged in HTML and XML So &blah; becomes DEL&blah; and DEL becomes
DELDEL.
19 April 2014
(xml.c) Unknown entity references are escaped by replacing the '&' at the start
by '&&;'. So "&surrogate-blocks;" becomes "&&;surrogate-blocks;". When writing
back to mark-up, all '&' must be converted to &, except the seqences '&&;',
which must be converted to '&'.
17 April 2014
In HTML (not XHTML), the script and style elements have cdata, not parsing the
<![CDATA[ ]]> tag that may be present for compatibility with XHTML.
The cdata of scipt and style elements ends at the first occurrence of the
character sequence </
(That means that that character sequence may not occur in for example inline
JavaScript in an HTML file that is not XML at the same time.)
get, put and lst can take argument TXT and BIN. BIN means that a 'b' is added
to the file mode. In *n*x systems this has no effect. In Windows, text mode
is default, while a 'b' is needed to suppress carriage returns.
get and lst read resp. write per default in binary mode. put writes per default
in text mode.
When lst is used to output to stdout, a newline is inserted before the last ).
8 February 2014
Crash on 4*(x+7)+p+-4*x. Solved by uncommenting old code.
20 January 2014
If EMSCRIPTEN: define NO_C_INTERFACE NO_FILE_RENAME NO_FILE_REMOVE
NO_SYSTEM_CALL NO_LOW_LEVEL_FILE_HANDLING NO_FOPEN NO_EXIT_ON_NON_SEVERE_ERRORS
13 December 2013
get$ now fails when trying to read invalid JSON
get$("<p",MEM,ML) now returns (p.). Before an empty string was returned.
Combined some stringpointers into one variable StaRt.
Can now read deeply nested JSON, because stack dynamically resizes.
4 December 2013
Bug found in scompare. Signed character comparison gave wrong sign for
variable 'teken', causing mistreatment of 8th-bit-set characters, so
@(får:? (å|æ) ?l) failed.
1 December 2013
Added json.c to support reading JSON files. Use JSN, e.g.
get'("myjson.json",JSN)
18 November
Set GLOBALARGPTR to 1. (Default: no emscripten)
17 November 2013
Did some adaptations to make Norcroft C compiler (RiscOS) happy.
(Suffix ul on large integer, correction in otherwise unused function
swi(), removal of non-ASCII characters.)
(There is a comment containing non-ASCII characters. Those characters
must be removed to make the compiler completely happy.)
2 October 2013
In stringEval: parameter 4 -> OPT_MEM
26 September 2013
In doPosition, changed FLGS to Flgs in
if((Flgs & UNIFY) && (is_op(pat) || (FLGS & INDIRECT)))
This caused no error, just unnecessary CPU cycles.
16 September 2013
Corrected a format specifier. Added pair of parentheses for clarity.
13 September 2013
@(548:@548 @) succeeded (wrong),
@(548:@ @) failed
@(548:@(548:548) @) succeeded (wrong)
@(548:@(548:?) @) succeeded (wrong)
@(548:@(548 ?) @) succeeded (wrong)
@(548:@(548&?) @) succeeded (wrong)
@(548:@(?:548) @) failed
@(548:@(?:?) @) failed
The @ in front af a string is no longer removed.
Otherwise, @(548:@548 @) would succeed!
26,27 August 2013
Changed format specifier %ld %lX etc to %lld %llx etc for Microsoft 64 bit platforms.
(long long integer type).
Reason: d2x was bitterly giving the wrong result for arguments >= 2^32
3 August 2013
glf$(=(!.a.)):(=?h) didn't succeed because !(a.) erronously had READY flag set.
7 July 2013
Checked that Unicode tables u2l and l2u are in agreement with latest
UnicodeData.txt (08-Aug-2012 13:06).
2 July 2013
fil$: Switching from input to output back to input did not work if the second
input only had one argument - the input's file name.
14 May 2013
Added a field "dontcloseme" to filehendel struct. It is set to TRUE if the
file is opened using get$ and ensures that such a file isn't closed if
fil$(,filename,r) fails and Bracmat tries to free a filehandle. Made sure that
code can be compiled with NO_FOPEN defined.
6 May 2013
Found bug in input that melted the tree Δ A into a single atom ΔA.
Other example: (ø l:% %) failed.
25 March 2013
Friendlier error reporting when parentheses don't balance.
21 March 2013
In xml.c, the space after !DOCTYPE disappeared. The error was sometimes
negated by another error because doctypei was not properly reset to 0.
Renamed putLeaveChar to putLeafChar.
1 February 2013
Two ínstead of three parameters for preparefp if not compiled with debug info.
26 December 2012
Several small improvements to fil()
25 December 2012
Debugged preparefp.
23 December 2012
Removed a superfluous while loop in someopt. Superfluous, because all arguments
to fil$ must be atomic and in a right descending structure.
20 December 2012
Cut most of is_afhankelyk_van away as obsolete.
10 December 2012
Replaced 2000000000 by HEADROOM * RADIX2, which is valid for both 32 and 64 bit.
scompare: if subject is zero bytes long and therefore not a number, adding
characters to it may make it a number.
6 December 2012
Thoroughly tested lambda.
5 December 2012
Compiled with Borland C++ 5.02, alternative typedef for UINT32, found unused
global var hekje1.
4 December 2012
Commented out unreachable code in evalmacro
2 December 2012
Made type 'int' explicit in line 5223
1 December 2012
Solved bug with late binding that turned up when evaluating
(cof==h) & @(gj:?!cof) & !cof
28 November 2012
Made input stop on EOF even if input is stdin.
23 November 2012
During testing of corner cases, found code that never executed in find() and
code that was missing in doPosition.
16 November 2012
Found and solved bug in Naamwoord. Case:
(abcd=bopt=cyt*dip) & (cyt=dip=egsae) & foo:?!!(abcd.bopt)
Removed rudimentary argument char ** punmatched from some functions.
Removed old, forgotten attempt at working with < > and ~ on subject
(lhs of : operator) in compare(). These flags are only useful in the pattern
15 November 2012
Added a comment to input with backslash followed by control character,
which is unsyntactical. Fused numberNode into _qdenominator.
Fused fireBuiltInFunc into wis.
1 November 2012
Function someopt() conditionally excluded with
#if !defined NO_LOW_LEVEL_FILE_HANDLING
21 October 2012
Made sure that put$ cannot write to a file that is still open in get$.
17 October 2012
In evalvar, the assumption that shared = false is false.
15 October 2012
Added 8 byte peek and poke (pee, pok) (perhaps not on all 32 bit platforms).
Default is now 1 byte.
14 October 2012
flg$(=~exp):(=?f.?o) !f now fails, as it should.
Relaxed requirement that parameters be separated with comma for function sim.
new$(hash,1000) gives a hint at the initial size of the hash table.
Default is 97.
12 October 2012
Found some places in plus_samenvoegen_of_sorteren that were never reached,
commented these.
23 September 2012
Discovered buffer overflow when compiled under fresh installation of Xubuntu
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 with optimization -O1 and higher.
Cause: strcpy in some places got the address of a single byte as destination
and coredumped when that single-byte buffer was overrun, not knowing that
there was, in fact, allocated memory to house the fulle source. See definition
of POBJ.
22 September 2012
Discovered that built in objects too easily were copied. The new function is
for that. Worse, the copies were not initialized with a call to New. Also,
new$hash returned ((=).New)'. Now it returns the object node. Changed the rhs
of this node to the node that is the argument of the original call to new, so:
=hash
20 September 2012
Reference counting should now be faster, bigger and better.
Before, reference counting went to 2^30+1024. Now it goes to 2^30*1023+1
Test added to valid.bra.
19 September 2012
Made major changes in Naamwoord, Naamwoord_w and doPosition to make two levels
of indirection work also in the case that an object is at the first level.
Handling of two levels of indirection is improved generally.
16 September 2012
Using gcov, found some places that are unreachable in merge(), substdiff() and
evalvar(). Simplified substdiff. Function evalvar now expects that the argument
is not shared. Deleted code that was never reached.
12 September 2012
Updated u2l and l2u with data from UnicodeData.txt 2011-11-08
(using script uni.bra)
22 August 2012
Bug removed. The expression
( (=A B)
: ?G1
: (=(A&X:?(G1.)) B)
)
would not match the 'B' in the pattern with anything valid, because the
assignment X:?(G1.) had deleted the original subject. Now the subject is
temporarily reference-incremented, so the 'B' still matches the old value of
G1. The expression as a whole evaluates to X. Notice that this bug did not
affect the very similar
( (G2==A B)
& !G2
: (=(A&X:?(G2.)) B)
)
Reason: here, the subject is not the object that G1 is bound to, but a copy.
And that is so because the object that G1 is bound to is headed by an
unevaluated = (being part of the rhs of an = operator). The expression !G2,
however, must be evaluated, so it cannot be identical to G2's value.
Consequently, the reassignment of G2 does not affect the subject of the
pattern match operation, which is (=A B) at all times.
4 August 2012
Removed function "?"$<expr>. The same effect is obtained by <expr>:?!(=)
31 July 2012
Made code gcc -pedantic proof. There are two string constants with a length
greater than 509, which ISO C89 compilers are required to support. Therefore
the option -std=c99 is added.
The LL suffix is replaced by L for non-Microsoft compilers.
8 July 2012
Added explanation and two small improvements to nextprime()
2 July 2012
Since build 115 (9 February 2012), the version should have read '6',
not '5'. (This was the date when bracmat wás brought to GitHub.)
Changes in bmalloc that makes it possible to compile with -O3.
Changed 'unsigned char' to 'char' in a lot of places to make some
warnings go away when compiled with gcc.
22 June 2012
Correction in scompare(). The expression @(1b:~<1 b) did not evaluate
successfully, which it should. Did a clean-up of this function.
4 June 2012
Introduced READMARKUPFAMILY macro to turn xml-stuff on (1) or off (0)
2 June 2012
xml.c supports reading from stdio (no rewind). Example of use:
type pr-xml-utf-8.xml | bracmat "put$(get$(,ML),\"pr-xml-utf-8.bra\",NEW)&"
1 June 2012
Did some finishing, no essential code changes.
1 May 2012
Added list of HTML entities. These are decoded to unicode codepoints and
encoded as utf-8 if an option HT is added.
get$("filename.html",HT,ML,TRM)
29 April 2012
Restructured the (ancient) input function and renamed some identifiers to
English equivalents.
Added a source file, xml.c, that reads SGML, HTML and XML files.
Syntax:
get$(filename,ML)
get$(filename,ML,TRM)
get$(string,MEM,ML)
get$(string,MEM,ML,TRM)
An option HT is made, but does not work yet. Purpose: translate HTML entities.
13 April 2012
The characters @ and % in front of a string now only turn off escaping with
the \ character inside the string if the string is surrounded by " characters.
Reason: the \L operator was not recognised if its lhs contained a % or @.
23 February 2012
When Bracmat reads a file that is not well-formed, it asks for a file name
where it can write what it has understood. This did not work. Now it does.
9 February 2012
Corrected error in doPosition that was introduced with the latest
optimizations: the QGETAL bit was checked without also checking the
IS_OPERATOR bit. Found also an instance of QBREUK were this error
might have been made. (The MINUS, QBEUK, QGETAL and QNUL bits are
only valid on leaf nodes.)
4 February 2012
Discovered that "greater than" relation implemented in the vgl function
wasn't transitive:
(1a.)+(10.) -> (10.)+(1a.)
(1a.)+(10.)+(2.) -> (1a.)+(2.)+(10.)
Thus the order of (10.) and (1a.) depends on other terms.
Now the rule is:
1) any number is smaller than any non-number
2) numbers are compared numerically
3) non-numbers are compared with strcmp
25 January 2012
Improved handling of negative positions (positions counted from the end)
in lists, sums and products.
24 January 2012
doPosition is buggy
a (c,d): ? [-1
expressionLength counts the wrong way. It must look at the top level operator
in the pattern containing the [ and count 1 + the number of this operator
until the end of the list. 0 if [ is last in the pattern.
20 January 2012
The previous change moved the scanning pointer to the point in the subject
where the rhs pattern starts. The current change moves the end of the
subject as far as necessary to the right to allow a full match of the rhs
pattern with last characters of the subject. Of course, this is only possible
if the final zero byte has not been reached. The calling instance of
stringmatch defines the end of the subject for the called instance. The called
instance can propose to move the end. In this way, scanning can move much
faster if a patterns contains some fixed strings. Speed-up does not work for
alternations of fixed srings. Speed-up only works for the first pattern
in a series of patterns connected by :
7 January 2012
If an non-initial part of a stringpattern is a string, then the scanning
pointer jumps to the first (or next) occurrence in the subject string after
the first mismatch.
This changes the behaviour of some patterns, such as in
@(abXk:(|? b|`) X ?id)
Before, the match failed, because the 'b' in the pattern did not match the
'a' in the subject. Now, nowing that the first X occurs in the third position,
the pattern matcher not even tries to match 'a' and 'b' and so the expression
succeeds. In many cases the (|? b|`) pattern works as before, though:
@(abXk:(|? b|`) (X|Y) ?id)
@(abXk:(|? b|`) () X ?id) dangerous! Does not work in @(ab:(|? b|`) ())
@(abXk:(|? b|`) !(=X) ?id)
X:?x
@(abXk:(|? b|`) !x ?id)
It is not advisable to use this pattern anymore. It is too much dependent on
pattern matching not being optimized.
6 January 2012
Compiled 64 bit version with VS 2008. Had to use _WIN64 and some #defines,
because longs are 32 bit under VS 2008, whereas longs under gcc are 64 bits.
Also used the 64 bit versions of ftell and fseek in the VS 2008 case.
For 64 bit I have these preprocessor defines
NDEBUG;__CONSOLE__;__WIN32__;WIN32;_CONSOLE;_CRT_SECURE_NO_WARNINGS
(Some of these are automatically set in the 32 bit version).
Impression is that the 32 bit version should be used unless you have to deal
with enormous data (memory, file) or huge numbers (because numerical
computations are faster and bigger numbers can be factorized quickly using
exponentiation with a fractional exponent).
Otherwise, the 64 bit version is significantly slower and has almost three
times less stack depth.
2 January 2012
Made stringmatch 'greedy' to an extend that does not change the program's
behaviour. (That is: all tests in valid.bra go through). Many string
comparisons now continue past the cutoff position deviding the subject in a
lhs and a rhs, pushing the devision point to the position where the lhs