move version and related constants out into a new file

This commit is contained in:
cy384 2020-07-20 18:14:57 -04:00
parent bd24d05a91
commit ef64cb58e9
4 changed files with 53 additions and 22 deletions

29
ssheven-constants.r Normal file
View File

@ -0,0 +1,29 @@
/* used as both a C and resource file include, so keep it simple */
#ifndef __SSHEVEN_CONSTANTS_R__
#define __SSHEVEN_CONSTANTS_R__
/* so many versions */
#define SSHEVEN_VERSION "0.1.0"
#define SSHEVEN_LONG_VERSION "0.1.0 prerelease, by cy384"
#define SSHEVEN_DESCRIPTION "ssheven 0.1.0 by cy384"
#define SSHEVEN_VERSION_MAJOR 0x00
#define SSHEVEN_VERSION_MINOR 0x10
#define SSHEVEN_VERSION_PRERELEASE 0x01
/* options: development, alpha, beta, release */
#define SSHEVEN_RELEASE_TYPE development
#define SSHEVEN_RELEASE_REGION verUS
/* requested number of bytes for RAM, used in SIZE resource */
#define SSHEVEN_MINIMUM_PARTITION 1024*1024
#define SSHEVEN_REQUIRED_PARTITION SSHEVEN_MINIMUM_PARTITION
/* size for recv and send thread buffers */
#define SSHEVEN_BUFFER_SIZE 4096
/* terminal type to send over ssh, determines features etc.
* "vanilla" supports basically nothing, which is good for us here */
#define SSHEVEN_TERMINAL_TYPE "vanilla"
#endif

View File

@ -57,7 +57,7 @@ static pascal void yield_notifier(void* contextPtr, OTEventCode code, OTResult r
// read from the channel and print to console
void ssh_read(void)
{
int rc = libssh2_channel_read(ssh_con.channel, ssh_con.recv_buffer, BUFFER_SIZE);
int rc = libssh2_channel_read(ssh_con.channel, ssh_con.recv_buffer, SSHEVEN_BUFFER_SIZE);
if (rc == 0) return;
@ -352,7 +352,7 @@ void ssh_setup_terminal(void)
{
int rc = 0;
SSH_CHECK(libssh2_channel_request_pty(ssh_con.channel, TERMINAL_TYPE));
SSH_CHECK(libssh2_channel_request_pty(ssh_con.channel, SSHEVEN_TERMINAL_TYPE));
SSH_CHECK(libssh2_channel_shell(ssh_con.channel));
}
@ -492,8 +492,8 @@ int main(int argc, char** argv)
if (ok)
{
ssh_con.recv_buffer = OTAllocMem(BUFFER_SIZE);
ssh_con.send_buffer = OTAllocMem(BUFFER_SIZE);
ssh_con.recv_buffer = OTAllocMem(SSHEVEN_BUFFER_SIZE);
ssh_con.send_buffer = OTAllocMem(SSHEVEN_BUFFER_SIZE);
if (ssh_con.recv_buffer == NULL || ssh_con.send_buffer == NULL)
{

View File

@ -22,15 +22,8 @@
// libssh2
#include <libssh2.h>
// version string
#define SSHEVEN_VERSION "0.1.0"
// size for recv and send thread buffers
#define BUFFER_SIZE 4096
// terminal type to send over ssh, determines features etc.
// "vanilla" supports basically nothing, which is good for us here
#define TERMINAL_TYPE "vanilla"
// ssheven constants
#include "ssheven-constants.r"
// sinful globals
struct ssheven_console

View File

@ -1,3 +1,5 @@
#include "ssheven-constants.r"
#include "Dialogs.r"
resource 'DLOG' (128) {
@ -61,29 +63,36 @@ resource 'SIZE' (-1) {
reserved,
reserved,
reserved,
1024 * 1024,
1024 * 1024
SSHEVEN_MINIMUM_PARTITION,
SSHEVEN_REQUIRED_PARTITION
};
#include "MacTypes.r"
/* see macintosh tb essentials page 7-31 */
/* yes, we need two */
/* first one displayed in version field of info window */
resource 'vers' (1, purgeable) {
0x01, 0x00, development, 0x01, verUS,
"0.1.0",
"0.1.0 prerelease, by cy384"
SSHEVEN_VERSION_MAJOR, SSHEVEN_VERSION_MINOR,
SSHEVEN_RELEASE_TYPE, SSHEVEN_VERSION_PRERELEASE,
SSHEVEN_RELEASE_REGION,
SSHEVEN_VERSION,
SSHEVEN_LONG_VERSION
};
/* second one displayed beneath icon at top of info window */
resource 'vers' (2, purgeable) {
0x01, 0x00, development, 0x01, verUS,
"0.1.0",
"0.1.0 prerelease, by cy384"
SSHEVEN_VERSION_MAJOR, SSHEVEN_VERSION_MINOR,
SSHEVEN_RELEASE_TYPE, SSHEVEN_VERSION_PRERELEASE,
SSHEVEN_RELEASE_REGION,
SSHEVEN_VERSION,
SSHEVEN_LONG_VERSION
};
/* signature resource */
type 'SSH7' as 'STR ';
resource 'SSH7' (0, purgeable) {
"ssheven 0.1.0 by cy384"
SSHEVEN_DESCRIPTION
};
#include "Finder.r"