I'm using xdr files to transfer data from Python to Asymptote for plotting. It seems that Asymptote is not capable of reading integers from XDR files. It would be really good to save the array length in the XDR file along with the data. For example, the xdrlib module in Python has a method called pack_array which record the length of the array as an unsigned integer, and then stores the data elements. Asymptote doesn't recognize the leading integer and just tries to read in the whole array, leading to garbled data. As a workaround, I store the array length as a double, read it into Asymptote as a double, and then typecast to int. I also tried storing the length and reading the length as an int, but Asymptote can't read that either. Integer support would be good, and automatically handling fixed-length arrays would be even better.
Also, the documentation for Asymptote's xdr interface could really be improved. The docs don't tell you that Asymptote only implements a subset of XDR--you have to figure out which features of XDR are actually implemented!
Log in to post a comment.