tilp_and_gfm
tilp_and_gfm copied to clipboard
TI83F header comment cutoff?
I was looking through the binaries produced by TI-Connect vs TILP which I just compiled and got working.
Interestingly, the programs dumped from TI-Connect have a header comment like "Program file 07/09/11, 16:40" while those from TILP have a header comment like "Single file dated Thu Oct 14 02:05:32 20". Maybe the year is cut off because the header comment can only be 42 bytes long? Anyhow to save bytes you can definitely get rid of the day-of-week part, maybe even put it in ISO date format.
https://github.com/debrouxl/tilibs/blob/54ad18eaac9f2b7e52fda284acb2729f06bf18c4/libtifiles/trunk/src/comments.cc#L83
Probably a date string formatter somewhere
Indeed, the header comment can only be 42 bytes long. At the very least, the "dated " part should go away, which would save 6 bytes, but yeah, additionally, switching to one of the ISO8601 date formats in the direct or indirect clients of tifiles_comment_set_single_sn()
can be done.
(This issue should probably be moved to tilibs)
Is it using localtime
? I did a very quick search but I'm not sure where the time comment is actually being written. (Also, why are the files all C++ when the code looks exactly like C code? If it really is for a future port to C++, then I would say that energy should be spent on fixing some code smells)
- the main callers of
tifiles_comment_set_single_sn()
, which is the modern version oftifiles_comment_set_single()
, are in libticalcs. I'll move this issue to tilibs later, even if there's a caller in GFM as well; - the time comment is written by
tifiles_comment_set_sn()
, at the beginning of the file you linked; - the files in tilibs are indeed C-like code compiled as C++ (well, except for the iconv... thing in libticonv), in order to benefit from the stricter typing of C++, at first. No plans for a full-blown port to C++;
- I've already fixed a number of code smells, in that very file and others (adding bounded versions of a number of APIs, removing many occurrences of TRYF & TRYC macros containing return, etc.), but I'm always all ears for suggestions :)
Oh my suspicion was right, it was using the obsolete and accursed ctime
.
I can try to assist with cleaning up code, though admittedly I have no familiarity with the codebase and I may end up doing more harm than good (maybe I will lose interest in my calculator in a month)
What would you like to clean up ? I wouldn't want to restrain you, but it makes sense to avoid work duplication or collisions generating patch conflicts :)
Note that the experimental2 branch contains more cleanups and improvements, so that's where the work ought to happen. experimental3 doesn't work well for the time being.
Silly things like magic numbers in the code. But you should probably ignore me since I am not familiar with the codebase.
On Fri, Oct 15, 2021 at 4:23 AM Lionel Debroux @.***> wrote:
What would you like to clean up ? :)
Note that the experimental2 branch contains more cleanups and improvements, so that's where the work ought to happen. experimental3 doesn't work well for the time being.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/debrouxl/tilp_and_gfm/issues/48#issuecomment-944100742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB46VXSPUETNIL5RMEDNIJLUG7QIDANCNFSM5GBBJDQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Such minor (yet good) cleanup can probably be done without knowing much of the codebase so any help is likely welcome :)
Indeed :) Sources of magic numbers include outsized buffers (e.g. 64 bytes for a 42-byte comment) and size bounds for a number of file types. Are these the ones which bother you ?
Yes. In fact there is enough room to even put the TILP / tilib version as a comment. Not sure if that is useful.