sdconv was written to move SD files between computers that store numbers in
opposite byte orders. SD Core Solo for Windows runs on little-endian machines
(x86-64), and so does SD Core Solo for Linux, so a conversion between the two
is never needed. Whether a converted file would run on a big-endian machine is
not something this page can say.
Read this first:
sdconvdoes not convert hashed files. Given one it says so, changes nothing and exits 1. It converts compiled program files only, and only the header of each. This SD cannot open a big-endian hashed file, so a converted file would be of no use here. Windows and Linux are both little-endian.
The short version#
- You almost certainly do not need it. SD loads a program whose header is in
the other byte order and swaps the header in memory; the file is left as it is.
A program converted with
-Bruns correctly, and the file is still big-endian afterwards. Only the header is converted, so this shows that SD tolerates a flipped header, not that a program compiled on a big-endian machine would run. - Every conversion rewrites the file in place with no copy. Take your own copy first.
- It rewrites even a file that needs no conversion. A program already
in the right order has its modified time changed by
sdconv -L. - A hashed file is refused: a message, the file untouched, exit status 1.
- A path that is neither a hashed file nor a program object is skipped with no message and the exit status is 0, including a path that does not exist.
Where it is and who can run it#
%USERPROFILE%\SDCoreSolo\usr\bin\sdconv.exe. The installer puts that folder on
your PATH, so sdconv works from any new PowerShell or cmd window. Run it
from an ordinary prompt, as yourself. It opens each file for read and write, so
you need write access to it, which you have for everything under your own SD
folder. A file it cannot open for writing is skipped without a word (a
file marked read-only is left as it was, exit 0). It takes no configuration
file. Run it with SD stopped (sd-solo -stop; see
Running SD), or on files SD is not using: it makes no check
for that.
The command line#
sdconv {options} pathname ...
| Option | What it does |
|---|---|
-B |
Convert to big-endian. |
-L |
Convert to little-endian. |
-D |
Debug. It is accepted, is not listed in the usage text, and does nothing for a program file: the progress it would print belongs to the hashed-file routine that is not called. It prints no extra output. |
(neither -B nor -L) |
Convert to the byte order of the machine it is run on, which here is little-endian, so the same as -L. |
Options may be joined in one word (-BD) and are not case sensitive. If both
-B and -L appear, the last one wins. Several pathnames may follow. The
program does not descend into a folder, and a wildcard is not expanded by
anything: sdconv -B bp.out\* converts nothing and exits 0, from PowerShell
and from cmd alike. Name the files, in PowerShell with
sdconv -B (Get-ChildItem bp.out).FullName. With no pathname, or an option it
does not know, it prints the usage text and exits 1.
> sdconv
Usage: SDCONV {options} pathname(s)
Options:
-B Force conversion to big-endian
-L Force conversion to little-endian
Only compiled programs are converted; a hashed file is refused (exit status 1).
(preceded, as always, by the banner.) A run that did something looks like a run that did nothing:
> sdconv -B objfile
[ SDCONV WS2.0-0 Copyright, Ladybridge Systems, 2007. All rights reserved. ]
> $LASTEXITCODE
0
The only failures it reports are Cannot read name, Error converting name, a seek or write error naming the file, and Cannot allocate memory for name, and only for a file it had already recognized as a program object.
What it converts: compiled program files#
A compiled program is a plain file that begins with a one-byte marker, 0x64 for
little-endian and 0x65 for big-endian. SD keeps them in:
- the
.outfolder beside each program file (bp.outholds the compiled form of the programs inbp, inuser_accounts\sduser;gpl.bp.outandpcode.outare others), and - the global catalog,
gcat, a folder in the SDSYS folder (%USERPROFILE%\SDCoreSolo\sdsys\gcat). The account's owncatfolder is the local catalog.
A file whose first byte is neither value, or that is shorter than the 165-byte header, is not touched.
before 64 00 00 00 00 00 bf 01 00 00 00 00 08 00 68 00
after -B 65 00 00 00 00 00 00 00 01 bf 00 00 00 08 00 68
(the first 16 bytes of a global catalog entry, before and after). Then
sdconv -L on the same file restored it byte for byte, and a
second -B on a file already big-endian changed nothing.
Only the object header is converted: the program id, the start offset, the argument, variable and stack counts, the offsets of the symbol and line tables, the object size, the flags and the compile time. The compiled code, the symbol tables and the constants are not touched. SD's own source says that floating point constants are the one thing in the code that needs swapping, and that SD does it when it loads them.
What it does not convert: hashed files#
> sdconv -B C:\sdi_demo\zzcust
C:\sdi_demo\zzcust is a hashed file: sdconv converts compiled programs only, nothing was changed
> $LASTEXITCODE
1
%0 and %1 are left byte for byte, with -B, with -L and with no
option: the tool converts neither the header, the data groups nor the index nodes
of a hashed file.
A hashed file taken to a machine of the other byte order cannot be converted by this tool, and this SD could not open it if it were.
What it will not do#
- It will not convert a hashed file; it tells you so and exits 1.
- It will not report a path it skipped, a file it could not open, or one that was not a program object. The exit status is 0 for all of them.
- It will not make a copy, and will not reverse a conversion except by running it again the other way on a file that was converted completely.
- It will not convert the compiled code of a program, only its header.
- It will not tell you whether the file needed converting.
- It does not move or check index files (sdidx) or check a file's structure (sdfix).