Commit Graph

15 Commits

Author SHA1 Message Date
T. Joseph Carter
49ba8598cb Port legacy.py to use the ByteBuffer
We still haven't changed any of how cppo-ng fundamentally works here (aside from
fixing things I definitely had broken--and there's some code I still find
questionable), but g.image_data is now gone.  One g.var down, all the rest still
to go.
2017-07-19 23:05:11 -07:00
T. Joseph Carter
a8d52b4216 Change legacy.py to use LOG 2017-07-18 11:18:39 -07:00
T. Joseph Carter
71b4375416 isnumber is no longer used 2017-07-16 12:28:59 -07:00
T. Joseph Carter
7953edc66a Eliminate to_hex as well
This pretty much eliminates the ported bashisms from cppo entirely.  It's still
fundamentally a shell script, but that's being changed elsewhere.
2017-07-13 23:38:19 -07:00
T. Joseph Carter
1745352a32 We don't use to_bytes either (we use int.to_bytes) 2017-07-13 19:49:08 -07:00
T. Joseph Carter
b0c0febbab Remove to_dec, we don't use it 2017-07-13 19:43:58 -07:00
T. Joseph Carter
666ab4d578 Remove to_bin as we have format()
Python3 already has a means of turning numerical data into a binary string with
format().  The only place it was used was with ProDOS case masks as it was, so
it's an easy call to replace the specialty function with Python's internals.
2017-07-13 19:35:47 -07:00
T. Joseph Carter
eb01d189db Move util functions out of legacy
The util functions consist entirely of hexdump and its helper function right
now, both of which are completely unused at the moment.  I don't intend for
legacy to ever call these functions, but I should start using them soon.  :)
2017-07-08 17:37:15 -07:00
T. Joseph Carter
6bb27a028f Broke diskimg.py out of legacy
I may not have done this 100% "properly"--this is really the first full
application thingy I've ever tried to write in Python.  I learned circular
imports are possible and the error messages are not obvious when you do that.

I've also learned that importing a package doesn't necessarily import the
modules within that package--if you want that, the package needs to import its
submodules into itself.  That was not obvious either.  It does explain why
sometimes you must import subpackages directly and other times importing the
package is all you need.  This is probably obvious to Python developers who
actually work on big projects, but ... I've only ever done single-file scripts
before now so it wasn't obvious to me.

For now, blocksfree is importing legacy.  We don't have enough outside of
legacy yet to make the alternative even remotely useful at this time.
Eventually though the goal is to stop doing that.
2017-07-08 05:52:34 -07:00
T. Joseph Carter
5915060db0 A little more style consistency
Basically cleaning out my stash stack--the stash this came from had been mostly
applied elsewhere already, leaving only a few stray ()s.  Figured it was a good
time to PEP 8 the end-of-line comments just so there was something here to
actually commit.
2017-07-08 04:01:57 -07:00
T. Joseph Carter
b543ea2f2d Finish removing arg parsing from legacy
You now simply stuff g with the appropriate options and run the thing.  You
could even modify the function to take those things as arguments now, but I
didn't do that for now.
2017-07-07 08:57:09 -07:00
T. Joseph Carter
ae3a12507b Fix arg parsing, move arg processing to cppo
Not quite finished with this, but the goal here is not have args being passed
in to the legacy cppo at all.  The g namespace is not ideal, but it does work
and it isolates the legacy code from needing to understand what's going on in
the shell level.  So we'll take advantage of that for the time being.

The bigger problem was that when I moved the arg parsing out of cppo, I failed
to move all of it--a block that checked the number of args got lost.  Restored.
2017-07-07 08:34:38 -07:00
T. Joseph Carter
27a097432f Fix extract single files
Dunno when this was broken, but it was.  It's fixed now.
2017-07-07 07:38:20 -07:00
T. Joseph Carter
5d97a75efb Move argument parsing out of legacy.py
The point is to separate the CLI interface to cppo from the inner logic so that
we can begin replacing the legacy code with proper implementations thereof.
This isn't 100% complete in that regard--we still need to pass args to the
legacy main function--but the part of cppo that will survive this whole process
is now functionally isolated from the part that's likely to get replaced to a
large degree.
2017-07-07 07:33:26 -07:00
T. Joseph Carter
5bc600eaf7 Move cppo to blocksfree package 2017-07-07 07:01:27 -07:00