10 Commits

Author SHA1 Message Date
T. Joseph Carter
a496c6bc0f Reformat arg parsing, add sli() function
Python's native sequence slicing method calls for start with optional
stop and step.  This is sometimes exactly what you want, but especially
when parsing binary files, you're gonna want start/length instead.  If
start was an expression, messy.

In cppo, there's a function slyce that returns a sliced sequence using
start/length/step metrics, and this is used exclusively for slicing
sequences.  Except sometimes you really want Python's start/stop...

I figure: Let's do it Python's way with the slicing syntax, but instead
of seq[start:start+length], you can use sli(): seq[sli(start,length)].
It's not currently used that way, but it now can be.  :)
2017-06-21 06:20:46 -07:00
T. Joseph Carter
795694dbb2 Add to_sys_name() to replace the win32 tests
A holdover from DOS 8.3 filenames, files on Windows cannot end with a
dot.  We append a - to such names on Windows platforms in all
operations, which should solve the problem, but we'd just duplicated
that code about a dozen times.  No need, do it once and we can add
whatever filesystem rules for the host system we need to in one spot.
2017-06-21 05:50:22 -07:00
T. Joseph Carter
54c91f70da Improve arg tests, optimize filename splitting
Lots of places want to check the extension, let's extract that just
once, and save the intermediate products so we can reuse those too.
2017-06-21 05:41:29 -07:00
T. Joseph Carter
d94b45dbcc Fix some "else: pass" blocks for debug prints 2017-06-20 19:49:40 -07:00
T. Joseph Carter
567f1f2a8b Make cppo require python3 2017-06-20 19:48:22 -07:00
T. Joseph Carter
8254fd886d Remove unused get_object_names() 2017-06-20 19:47:06 -07:00
T. Joseph Carter
66df732b6e Remove unused shift() 2017-06-20 19:46:28 -07:00
T. Joseph Carter
7b71f597fc Remove unused s() 2017-06-20 19:45:43 -07:00
T. Joseph Carter
3e816f8299 Fix imports 2017-06-20 19:43:29 -07:00
T. Joseph Carter
fb07295e6c One of many versions of cppo I've got around here
This one's missing a lot of the cleanups I've done to the others (it
isn't even python3), but it has the debug print statements and the
formatting is generally pretty good.  I'll go through my local trees and
begin applying some fixes to this code in various repositories and we'll
see if we can't begin refactoring it completely.
2017-06-20 19:27:38 -07:00