Publish VCC Plus OSS source distribution for 3.6.2 build 60
This commit is contained in:
commit
c652a5276d
1192 files changed
+272368
No files matched your search
@@ -0,0 +1,7 @@
|
||||
obj/
|
||||
SURVEY.bin
|
||||
SURVEY.dsk
|
||||
SURVEY.map
|
||||
SURVEY.link
|
||||
.vccplus-build/
|
||||
generated/
|
||||
@@ -0,0 +1,55 @@
|
||||
# Generated by VCC Plus — edit Project Settings to regenerate.
|
||||
# Ordinary GNU Make; no VCC Plus project parser is required to build it.
|
||||
CMOC ?= cmoc
|
||||
PERL ?= perl
|
||||
WRITECOCOFILE ?= writecocofile
|
||||
INSTALL_LOADER ?= install-coco-boot-loader
|
||||
VCC_CONFIGURATION ?= Debug
|
||||
ifeq ($(VCC_CONFIGURATION),Release)
|
||||
OPTIM ?= -O2
|
||||
else
|
||||
OPTIM ?= -O0
|
||||
DEBUG_FRAME ?= -fno-omit-frame-pointer
|
||||
endif
|
||||
define VCC_DEFINES
|
||||
|
||||
endef
|
||||
define VCC_COMPILER_OPTIONS
|
||||
|
||||
endef
|
||||
define VCC_LINKER_OPTIONS
|
||||
|
||||
endef
|
||||
export VCC_CMOC_COMPAT = 1
|
||||
CPPFLAGS += $(VCC_DEFINES)
|
||||
CFLAGS += --coco --intermediate --deps --stack-space=2048 $(OPTIM) $(DEBUG_FRAME) $(VCC_COMPILER_OPTIONS)
|
||||
LDFLAGS += --coco --intermediate --org=2800 $(VCC_LINKER_OPTIONS)
|
||||
LDLIBS += -lvcccompat -ldecbfile
|
||||
OBJECTS := obj/main.o
|
||||
.PHONY: all build clean disk libraries
|
||||
all: build
|
||||
build: SURVEY.bin
|
||||
SURVEY.bin: $(OBJECTS) Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(LDFLAGS) -o $@ $(OBJECTS) $(LDLIBS)
|
||||
obj/main.o: main.c Makefile generated/PLANETS.TXT
|
||||
@mkdir -p $(dir $@)
|
||||
"$(CMOC)" $(CPPFLAGS) $(CFLAGS) --intdir=$(dir $@) -c -o $@ $<
|
||||
|
||||
generated/PLANETS.TXT &: assets/planets.txt Makefile
|
||||
@mkdir -p generated
|
||||
$(PERL) -pe 's/\r?\n/\r/' assets/planets.txt > generated/PLANETS.TXT
|
||||
test -f generated/PLANETS.TXT
|
||||
|
||||
disk: SURVEY.dsk
|
||||
SURVEY.dsk: SURVEY.bin generated/PLANETS.TXT Makefile
|
||||
@mkdir -p $(dir $@)
|
||||
$(PERL) -e 'print chr(255) x (35*18*256)' > $@
|
||||
$(WRITECOCOFILE) $@ SURVEY.bin
|
||||
$(WRITECOCOFILE) $@ generated/PLANETS.TXT
|
||||
|
||||
clean:
|
||||
rm -rf obj
|
||||
rm -f SURVEY.bin SURVEY.map SURVEY.link SURVEY.dsk generated/PLANETS.TXT
|
||||
|
||||
-include $(OBJECTS:.o=.d)
|
||||
@@ -0,0 +1,8 @@
|
||||
# PLANET SURVEY / FLIGHT LOG / LOG 0042
|
||||
# Read before picking a landing site.
|
||||
# 1: Check the blue planet from orbit.
|
||||
# 2: Mark the red planet on the map.
|
||||
# Pick one of the two reports below.
|
||||
# Columns: planet|trait,trait|orbit (1 to 8).
|
||||
EARTH|BLUE,WET|3
|
||||
MARS|RED,COLD|4
|
||||
@@ -0,0 +1,92 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
#include <coco.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Split a writable record such as MARS|RED,COLD|4. Each cursor belongs
|
||||
to one scan. The tokens point directly into the line read from disk. */
|
||||
static int showRecord(char *line)
|
||||
{
|
||||
char *fields, *traits, *end;
|
||||
char summary[112];
|
||||
char *name = strtok_r(line, "|", &fields);
|
||||
char *list = strtok_r(NULL, "|", &fields);
|
||||
if (!name || !list)
|
||||
return 0;
|
||||
|
||||
char *first = strtok_r(list, ",", &traits);
|
||||
char *second = strtok_r(NULL, ",", &traits);
|
||||
if (!first || !second || strtok_r(NULL, ",", &traits))
|
||||
return 0;
|
||||
|
||||
/* Resume the outer scan exactly where we left it. */
|
||||
char *text = strtok_r(NULL, "|", &fields);
|
||||
if (!text || strtok_r(NULL, "|", &fields) || !isdigit((unsigned char)*text))
|
||||
return 0;
|
||||
errno = 0;
|
||||
unsigned long orbit = strtoul(text, &end, 10);
|
||||
if (*end || errno == ERANGE || orbit < 1UL || orbit > 8UL)
|
||||
return 0;
|
||||
|
||||
int length = snprintf(summary, sizeof(summary),
|
||||
"SURVEY: %s\nTRAITS: %s AND %s\nORBIT FROM SUN: %lu",
|
||||
name, first, second, orbit);
|
||||
if (length < 0 || length >= (int)sizeof(summary))
|
||||
return 0;
|
||||
printf("%s\n", summary);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char line[64], choice;
|
||||
unsigned record = 0;
|
||||
int tooLong = 0;
|
||||
cls(1);
|
||||
printf("PLANET SURVEY\n1 EARTH 2 MARS\n");
|
||||
do
|
||||
choice = waitkey(0);
|
||||
while (choice != '1' && choice != '2');
|
||||
|
||||
FILE *log = fopen("PLANETS.TXT", "r");
|
||||
if (!log)
|
||||
{
|
||||
printf("CANNOT OPEN PLANETS.TXT\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Skip the flight notes. The first data line is Earth, the second Mars. */
|
||||
while (fgets(line, sizeof(line), log))
|
||||
{
|
||||
unsigned length = strcspn(line, "\n");
|
||||
if (length == sizeof(line) - 1)
|
||||
{
|
||||
tooLong = 1; // Never mistake part of a long line for a new record.
|
||||
break;
|
||||
}
|
||||
line[length] = '\0';
|
||||
if (!line[0] || line[0] == '#')
|
||||
continue;
|
||||
if (++record == (unsigned)(choice - '0'))
|
||||
break;
|
||||
}
|
||||
|
||||
/* An error can end a read loop just as end-of-file can. */
|
||||
int diskError = ferror(log);
|
||||
if (fclose(log) == EOF || diskError)
|
||||
printf("DISK READ ERROR\n");
|
||||
else if (tooLong)
|
||||
printf("SURVEY LINE TOO LONG\n");
|
||||
else if (record != (unsigned)(choice - '0'))
|
||||
printf("NO MATCHING SURVEY RECORD\n");
|
||||
else if (!showRecord(line))
|
||||
printf("INVALID SURVEY RECORD\n");
|
||||
else
|
||||
{
|
||||
printf("SURVEY COMPLETE\n");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"binary": "SURVEY.bin",
|
||||
"buildTarget": "disk",
|
||||
"cleanTarget": "clean",
|
||||
"configurations": [
|
||||
{
|
||||
"makeArguments": [],
|
||||
"name": "Debug"
|
||||
},
|
||||
{
|
||||
"makeArguments": [
|
||||
"VCC_CONFIGURATION=Release"
|
||||
],
|
||||
"name": "Release"
|
||||
}
|
||||
],
|
||||
"diskImage": "SURVEY.dsk",
|
||||
"diskTarget": "disk",
|
||||
"entrySource": "main.c",
|
||||
"jobs": 4,
|
||||
"launchCommands": [
|
||||
"LOADM\"SURVEY\":EXEC"
|
||||
],
|
||||
"launchMode": "disk",
|
||||
"makefile": "Makefile",
|
||||
"makefileSettings": {
|
||||
"compilerOptions": [],
|
||||
"defines": [],
|
||||
"diskBootMode": "none",
|
||||
"diskFiles": [
|
||||
"generated/PLANETS.TXT"
|
||||
],
|
||||
"diskImage": "SURVEY.dsk",
|
||||
"executable": "SURVEY.bin",
|
||||
"generatedResources": [
|
||||
{
|
||||
"inputs": [
|
||||
"assets/planets.txt"
|
||||
],
|
||||
"outputs": [
|
||||
"generated/PLANETS.TXT"
|
||||
],
|
||||
"command": "$(PERL) -pe 's/\\r?\\n/\\r/' assets/planets.txt > generated/PLANETS.TXT"
|
||||
}
|
||||
],
|
||||
"includePaths": [],
|
||||
"libraries": [
|
||||
"vcccompat",
|
||||
"decbfile"
|
||||
],
|
||||
"libraryPaths": [],
|
||||
"libraryProjects": [],
|
||||
"linkerOptions": [],
|
||||
"origin": "2800",
|
||||
"releaseOptimization": "-O2",
|
||||
"sources": [
|
||||
"main.c"
|
||||
],
|
||||
"stackSpace": 2048
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user