Remove the work on trying to support a BabelFish translator. Chris Vavruska has picked it up because I was struggling with dealing with the 64K code resource limit. His code is here: https://github.com/vavruska/markdownGS

My plan is to go forward with just a shell command which is focused only on markdown to Teach file conversion, intended to be used in my build engine under Golden Gate.
This commit is contained in:
Jeremy Rand 2021-06-22 23:56:19 -04:00
parent 51ea60fe31
commit 51f8ff5574
21 changed files with 196 additions and 983 deletions

View File

@ -8,7 +8,7 @@
/* Begin PBXBuildFile section */
9D6532ED2626240800105D50 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 9D6532EC2626240800105D50 /* main.c */; };
9D6532EF2626240800105D50 /* shell.mk in Sources */ = {isa = PBXBuildFile; fileRef = 9D6532EE2626240800105D50 /* shell.mk */; };
9D6532EF2626240800105D50 /* Makefile in Sources */ = {isa = PBXBuildFile; fileRef = 9D6532EE2626240800105D50 /* Makefile */; };
9D6532F22626240800105D50 /* head.mk in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D6532F12626240800105D50 /* head.mk */; };
9D6532F42626240800105D50 /* orca-asm in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D6532F32626240800105D50 /* orca-asm */; };
9D6532F62626240800105D50 /* orca-cc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 9D6532F52626240800105D50 /* orca-cc */; };
@ -40,19 +40,10 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9D406AA12644E8CF00747EE9 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
9D406AB12644EB6500747EE9 /* babelfish.mk */ = {isa = PBXFileReference; lastKnownFileType = text; path = babelfish.mk; sourceTree = "<group>"; };
9D406AC4264A2AD400747EE9 /* babelfish_defs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = babelfish_defs.h; sourceTree = "<group>"; };
9D406ACB264A2B5800747EE9 /* babelfish_rez.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = babelfish_rez.h; sourceTree = "<group>"; };
9D406ACD264A2BD300747EE9 /* markdown.rez */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.rez; path = markdown.rez; sourceTree = "<group>"; };
9D406AD8264C50E400747EE9 /* request.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = request.c; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.c; };
9D406AD9264C50F700747EE9 /* filter.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = filter.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D406B2D2652155B00747EE9 /* babelfish_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = babelfish_types.h; sourceTree = "<group>"; };
9D406B312652D2C800747EE9 /* init.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = init.s; sourceTree = "<group>"; };
9D6532E42626240800105D50 /* md2teach */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = md2teach; sourceTree = BUILT_PRODUCTS_DIR; };
9D6532EA2626240800105D50 /* doNotBuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = doNotBuild; sourceTree = BUILT_PRODUCTS_DIR; };
9D6532EC2626240800105D50 /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
9D6532EE2626240800105D50 /* shell.mk */ = {isa = PBXFileReference; lastKnownFileType = text; path = shell.mk; sourceTree = "<group>"; };
9D6532EE2626240800105D50 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
9D6532F12626240800105D50 /* head.mk */ = {isa = PBXFileReference; lastKnownFileType = text; path = head.mk; sourceTree = "<group>"; };
9D6532F32626240800105D50 /* orca-asm */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "orca-asm"; sourceTree = "<group>"; };
9D6532F52626240800105D50 /* orca-cc */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "orca-cc"; sourceTree = "<group>"; };
@ -90,35 +81,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9D406A9C2644E80100747EE9 /* shell */ = {
isa = PBXGroup;
children = (
9D6532EC2626240800105D50 /* main.c */,
9D8125DA2634A539002F05F5 /* main.h */,
9D8125DB2634A584002F05F5 /* io.h */,
9D8125DC2634A584002F05F5 /* io.c */,
9D8125E22634AC4A002F05F5 /* translate.h */,
9D8125E32634AC4A002F05F5 /* translate.c */,
9D8125F12634B4D4002F05F5 /* style.h */,
9D8125F22634B4D4002F05F5 /* style.c */,
);
path = shell;
sourceTree = "<group>";
};
9D406AB02644EB4E00747EE9 /* babelfish */ = {
isa = PBXGroup;
children = (
9D406AC4264A2AD400747EE9 /* babelfish_defs.h */,
9D406ACB264A2B5800747EE9 /* babelfish_rez.h */,
9D406B2D2652155B00747EE9 /* babelfish_types.h */,
9D406ACD264A2BD300747EE9 /* markdown.rez */,
9D406AD8264C50E400747EE9 /* request.c */,
9D406B312652D2C800747EE9 /* init.s */,
9D406AD9264C50F700747EE9 /* filter.s */,
);
path = babelfish;
sourceTree = "<group>";
};
9D6532DD2626240800105D50 = {
isa = PBXGroup;
children = (
@ -141,13 +103,17 @@
9D6532EB2626240800105D50 /* md2teach */ = {
isa = PBXGroup;
children = (
9D406AA12644E8CF00747EE9 /* Makefile */,
9D65330C2626246700105D50 /* md4c.c */,
9D65330B2626246700105D50 /* md4c.h */,
9D6532EE2626240800105D50 /* shell.mk */,
9D406A9C2644E80100747EE9 /* shell */,
9D406AB12644EB6500747EE9 /* babelfish.mk */,
9D406AB02644EB4E00747EE9 /* babelfish */,
9D6532EC2626240800105D50 /* main.c */,
9D8125DA2634A539002F05F5 /* main.h */,
9D8125DB2634A584002F05F5 /* io.h */,
9D8125DC2634A584002F05F5 /* io.c */,
9D8125E22634AC4A002F05F5 /* translate.h */,
9D8125E32634AC4A002F05F5 /* translate.c */,
9D8125F12634B4D4002F05F5 /* style.h */,
9D8125F22634B4D4002F05F5 /* style.c */,
9D6532EE2626240800105D50 /* Makefile */,
9DDFC7B42627E081006D6E71 /* test.md */,
9D6532F02626240800105D50 /* make */,
9D6532FB2626240800105D50 /* Supporting Files */,
@ -276,7 +242,7 @@
buildActionMask = 2147483647;
files = (
9D8125E42634AC4A002F05F5 /* translate.c in Sources */,
9D6532EF2626240800105D50 /* shell.mk in Sources */,
9D6532EF2626240800105D50 /* Makefile in Sources */,
9D8125DD2634A584002F05F5 /* io.c in Sources */,
9D8125F32634B4D4002F05F5 /* style.c in Sources */,
9D6532ED2626240800105D50 /* main.c in Sources */,

View File

@ -7,12 +7,12 @@
<key>Binary.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>2</integer>
</dict>
<key>doNotBuild.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>1</integer>
</dict>
<key>md2teach.xcscheme_^#shared#^_</key>
<dict>

View File

@ -5,24 +5,174 @@
include make/head.mk
DISKIMAGE=$(TARGETDIR)/md2teach.2mg
ARCHIVE=$(TARGETDIR)/md2teach.shk
DESTBOOTIMAGE=$(TARGETDIR)/$(BOOTIMAGE)
# Customize this file to control what kind of project you are working on,
# where to find files, etc.
MAMEARGS=apple2gs -skip_gameinfo -speed 3 -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# The name of your system or binary file to build goes here:
PGM=md2teach
# Set the target type you would like to build. The options are:
# shell - A shell command for ORCA, GNO or other GS shell
# desktop - A full desktop application
# cda - A classic desk accessory
# cdev - A control panel device
# nba - A HyperStudio new button action
# nda - A new desk accessory
# xcmd - A HyperCard XCMD or XCFN
#
TARGETTYPE=shell
# TARGETTYPE=desktop
# TARGETTYPE=cda
# TARGETTYPE=cdev
# TARGETTYPE=nba
# TARGETTYPE=nda
# TARGETTYPE=xcmd
# Uncomment one of the following lines to force a particular GS emulator.
# By default, specific paths are tested for these emulators in the below
# order and the first found is what will be used. You can overrride that
# here:
#
# EMULATOR=gsplus
EMULATOR=mame
# EMULATOR=gsport
# By default, the build provides a single boot environment to test with.
# You can put other .2mg files into the make directory and override this
# variable to change what boot disk you want to use when you launch the
# emulator. The disk image you specify must be found in the make directory:
#
# BOOTIMAGE=system601.2mg
# Add any other directories where you are putting C or assembly source
# files to this list:
SRCDIRS+=
# If you put your main entry point for your project in a file called main.c
# Then you don't need to change this value. If you want to call your entry
# point something other than main.c, set this variable to point to this file.
ROOTCFILE=main.c
# Add any arguments you want passed to the C compiler to this variable:
CFLAGS+=+O
# Add any arguments you want passed to the resource compiler to this variable:
REZFLAGS+=
# Uncomment the following line if you have installed rlint as found here:
# https://github.com/ksherlock/rlint/releases
# Assuming that it is in the path that ORCA searches (the Utilities directory is
# probably a good choice), you can just leave the value unchanged. If you have
# put the rlint somewhere weird, you can set this to the correct path
# RLINT_PATH=rlint
# Add any arguments you want passed to the macro generator to this variable:
MACGENFLAGS+=
# Add any other macro libraries to include in this variable:
MACGENMACROS+=
# Add any arguments you want passed to the assembler to this variable:
ASMFLAGS+=
# Add any arguments you want passed to the linker to this variable:
LDFLAGS+=
# Uncomment the following line if you want to build against the GNO libraries
# export ORCA=$(ORCA_BINDIR)/gno
# If you want to copy one or more files or directories to the distribution disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the target disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYDIRS to dir and in your project you have
# the following files:
# dir/Icons/myIconFile
# dir/newDir/anotherFile
# Then, during the copy phase, myIconFile will be copied into the Icons
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYDIRS=
# If you want to copy one or more files or directories to the boot disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the boot disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYBOOTDIRS to dir and in your project you have
# the following files:
# dir/System/mySystemFile
# dir/newDir/anotherFile
# Then, during the copy phase, mySystemFile will be copied into the System
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYBOOTDIRS=
# By default, the build expects that you have GSplus in the path:
# /Applications/GSplus.app/Contents/MacOS/gsplus
# If you have it in a different location, specify that here.
# GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
# By default, the build uses no arguments with GSplus. If you would like to
# use different arguments, specify that here.
GSPLUSARGS=-mem 4194304
# By default, the build expects that you have GSport in the path:
# /Applications/GSport/GSport.app/Contents/MacOS/GSport
# If you have it in a different location, specify that here.
# GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
# By default, the build uses no arguments with GSport. If you would like to
# use different arguments, specify that here.
# GSPORTARGS=
# By default, the build expects that you have Ample/mame in the path:
# /Applications/Ample.app/Contents/MacOS/mame64
# If you have it in a different location, specify that here.
# MAME=/Applications/Ample.app/Contents/MacOS/mame64
# By default, the build expects that you have the mame ROMs/libs in the path:
# $(HOME)/Library/Application Support/Ample
# If you have it in a different location, specify that here.
# MAMELIB=$(HOME)/Library/Application Support/Ample
# By default, the build uses these arguments with mame:
# apple2gs -skip_gameinfo -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# If you would like to use different arguments, specify that here.
MAMEARGS=apple2gs -skip_gameinfo -speed 3 -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# For a desktop application, it can operate in 640x200 or 320x200
# resolution. This setting is used to define which horizontal
# resolution you want to use for a desktop application. Other
# target types ignore this value.
# DESKTOP_RES_MODE=640
# For a desktop application, it can support opening and printing
# files based on paths sent to it by the message center. This
# option controls if that is or is not supported in the
# application (note: only the C desktop template supports message
# center today)
# MESSAGE_CENTER=0
# Add any rules you want to execute before any compiles or assembly
# commands are called here, if any. You can generate .c, .s or .h
# files for example. You can generate data files. Whatever you
# might need. You should generate these files in the $(GENDIR)
# directory or within a subdirectory under $(GENDIR) which you create
# yourself.
#
# All of your commands associated with a rule _must_ start with a tab
# character. Xcode makes it a bit tough to type a tab character by
# default. Press option-tab within Xcode to insert a tab character.
gen:
build:
make -f shell.mk
make -f babelfish.mk
clean:
make -f shell.mk clean
make -f babelfish.mk clean
execute:
make -f shell.mk execute
make/createDiskImage "$(DISKIMAGE)" $(DESTBOOTIMAGE) "$(TARGETDIR)/Markdown" "$(TARGETDIR)/md2teach" "$(TARGETDIR)/outfile.txt" test.md
make/launchEmulator "$(DISKIMAGE)" "$(DESTBOOTIMAGE)"
# For any files you generated in the gen target above, you should
# add rules in genclean to remove those generated files when you
# clean your build.
genclean:
# Do not change anything else below here...
include make/tail.mk

View File

@ -1,201 +0,0 @@
#
# Makefile
# Apple //GS Build Engine for ORCA and Merlin
#
include make/head.mk
# Customize this file to control what kind of project you are working on,
# where to find files, etc.
# The name of your system or binary file to build goes here:
PGM=notused
# Set the target type you would like to build. The options are:
# shell - A shell command for ORCA, GNO or other GS shell
# desktop - A full desktop application
# cda - A classic desk accessory
# cdev - A control panel device
# nba - A HyperStudio new button action
# nda - A new desk accessory
# xcmd - A HyperCard XCMD or XCFN
#
# TARGETTYPE=shell
# TARGETTYPE=desktop
# TARGETTYPE=cda
# TARGETTYPE=cdev
# TARGETTYPE=nba
# TARGETTYPE=nda
# TARGETTYPE=xcmd
TARGETTYPE=babelfish
# Uncomment one of the following lines to force a particular GS emulator.
# By default, specific paths are tested for these emulators in the below
# order and the first found is what will be used. You can overrride that
# here:
#
# EMULATOR=gsplus
# EMULATOR=mame
# EMULATOR=gsport
# By default, the build provides a single boot environment to test with.
# You can put other .2mg files into the make directory and override this
# variable to change what boot disk you want to use when you launch the
# emulator. The disk image you specify must be found in the make directory:
#
# BOOTIMAGE=system601.2mg
# Add any other directories where you are putting C or assembly source
# files to this list:
SRCDIRS+=babelfish
# If you put your main entry point for your project in a file called main.c
# Then you don't need to change this value. If you want to call your entry
# point something other than main.c, set this variable to point to this file.
ROOTCFILE=shell/main.c
# Add any arguments you want passed to the C compiler to this variable:
CFLAGS+=+O
# Add any arguments you want passed to the resource compiler to this variable:
REZFLAGS+=
# Uncomment the following line if you have installed rlint as found here:
# https://github.com/ksherlock/rlint/releases
# Assuming that it is in the path that ORCA searches (the Utilities directory is
# probably a good choice), you can just leave the value unchanged. If you have
# put the rlint somewhere weird, you can set this to the correct path
# RLINT_PATH=rlint
# Add any arguments you want passed to the macro generator to this variable:
MACGENFLAGS+=
# Add any other macro libraries to include in this variable:
MACGENMACROS+=
# Add any arguments you want passed to the assembler to this variable:
ASMFLAGS+=
# Add any arguments you want passed to the linker to this variable:
LDFLAGS+=
# Uncomment the following line if you want to build against the GNO libraries
# export ORCA=$(ORCA_BINDIR)/gno
# If you want to copy one or more files or directories to the distribution disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the target disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYDIRS to dir and in your project you have
# the following files:
# dir/Icons/myIconFile
# dir/newDir/anotherFile
# Then, during the copy phase, myIconFile will be copied into the Icons
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYDIRS=
# If you want to copy one or more files or directories to the boot disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the boot disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYBOOTDIRS to dir and in your project you have
# the following files:
# dir/System/mySystemFile
# dir/newDir/anotherFile
# Then, during the copy phase, mySystemFile will be copied into the System
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYBOOTDIRS=
# By default, the build expects that you have GSplus in the path:
# /Applications/GSplus.app/Contents/MacOS/gsplus
# If you have it in a different location, specify that here.
# GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
# By default, the build uses no arguments with GSplus. If you would like to
# use different arguments, specify that here.
# GSPLUSARGS=
# By default, the build expects that you have GSport in the path:
# /Applications/GSport/GSport.app/Contents/MacOS/GSport
# If you have it in a different location, specify that here.
# GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
# By default, the build uses no arguments with GSport. If you would like to
# use different arguments, specify that here.
# GSPORTARGS=
# By default, the build expects that you have Ample/mame in the path:
# /Applications/Ample.app/Contents/MacOS/mame64
# If you have it in a different location, specify that here.
# MAME=/Applications/Ample.app/Contents/MacOS/mame64
# By default, the build expects that you have the mame ROMs/libs in the path:
# $(HOME)/Library/Application Support/Ample
# If you have it in a different location, specify that here.
# MAMELIB=$(HOME)/Library/Application Support/Ample
# By default, the build uses these arguments with mame:
# apple2gs -skip_gameinfo -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# If you would like to use different arguments, specify that here.
# MAMEARGS=apple2gs -skip_gameinfo -speed 2 -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# For a desktop application, it can operate in 640x200 or 320x200
# resolution. This setting is used to define which horizontal
# resolution you want to use for a desktop application. Other
# target types ignore this value.
# DESKTOP_RES_MODE=640
# For a desktop application, it can support opening and printing
# files based on paths sent to it by the message center. This
# option controls if that is or is not supported in the
# application (note: only the C desktop template supports message
# center today)
# MESSAGE_CENTER=0
# Add any rules you want to execute before any compiles or assembly
# commands are called here, if any. You can generate .c, .s or .h
# files for example. You can generate data files. Whatever you
# might need. You should generate these files in the $(GENDIR)
# directory or within a subdirectory under $(GENDIR) which you create
# yourself.
#
# All of your commands associated with a rule _must_ start with a tab
# character. Xcode makes it a bit tough to type a tab character by
# default. Press option-tab within Xcode to insert a tab character.
gen:
# For any files you generated in the gen target above, you should
# add rules in genclean to remove those generated files when you
# clean your build.
genclean:
FILTERTARGET=$(TARGETDIR)/filter.bin
INITTARGET=$(TARGETDIR)/init.bin
REZFLAGS+= rez='-d TARGETDIR="$(TARGETDIR)"'
$(OBJDIR)/babelfish/markdown.r: $(FILTERTARGET) $(INITTARGET)
$(FILTERTARGET): $(OBJDIR)/babelfish/filter.ROOT
cd $(OBJDIR); $(LINK) $(LDFLAGS) babelfish/filter keep="$(abspath $@)"
$(INITTARGET): $(OBJDIR)/babelfish/init.ROOT $(OBJDIR)/babelfish/request.a $(OBJDIR)/md4c.a
cd $(OBJDIR); $(LINK) $(LDFLAGS) babelfish/init babelfish/request keep="$(abspath $@)" || rm "$(abspath $@)"
$(TARGETDIR)/Markdown: $(OBJDIR)/babelfish/markdown.r
$(MKDIR) $(TARGETDIR)
$(RM) $@
$(CP) $< $@
$(CHTYP) -t $(FILETYPE) $(AUXTYPE) $@
target: $(TARGETDIR)/Markdown
true
# Do not change anything else below here...
include make/tail.mk

View File

@ -1,60 +0,0 @@
/*
* babelfish_defs.h
* md2teach
*
* Created by Jeremy Rand on 2021-05-10.
*
*/
#ifndef _GUARD_PROJECTmd2teach_FILEbabelfish_defs_
#define _GUARD_PROJECTmd2teach_FILEbabelfish_defs_
#define rTrData 0x5472
// Flags
#define bf320 0x0001
#define bf640 0x0002
#define bfCanImport 0x0001
#define bfCanExport 0x0001
#define bfImportOptions 0x0002
#define bfExportOptions 0x0002
//Translator IDs
#define TrVersion 0x0001 //rVersion
#define TrAbout 0x0001 //rComment
#define TrCantLauch 0x0002
#define TrData 0x0001 //rTrData
#define TrInit 0x0001 //rCodeResource
#define TrImportOptions 0x0002 //rCodeResource
#define TrExportOptions 0x0003
#define TrFilter 0x0004
#define TrImportInfo 0x0002 //rText
#define TrExportInfo 0x0003 //rText
#define TrFormatNone 0x0000
#define TrFormatText 0x0001
#define TrFormatPixelMap 0x0002
#define TrFormatTrueColorImage 0x0003
#define TrFormatQD2Picture 0x0004
#define TrFormatFont 0x0005
#define TrFormatSound 0x0006
#define TrStartUp 0x9101
#define TrShutDown 0x9102
#define TrRead 0x9103
#define bfContinue 0
#define bfDone 0x8000
#define bfUserAbort 0x8001
#define bfBadFileErr 0x8002
#define bfReadErr 0x8003
#define bfWriteErr 0x8004
#define bfMemErr 0x8005
#define bfTextGetSettings 1
#define bfTextBody 8
#endif /* define _GUARD_PROJECTmd2teach_FILEbabelfish_defs_ */

View File

@ -1,30 +0,0 @@
/*
* babelfish_rez.h
* md2teach
*
* Created by Jeremy Rand on 2021-05-10.
*
*/
#ifndef _GUARD_PROJECTmd2teach_FILEbabelfish_rez_
#define _GUARD_PROJECTmd2teach_FILEbabelfish_rez_
type rTrData
{
_mybase_ integer = 0; //revision
_mybase_ integer; //general flags
_mybase_ integer; //Import Flags
array[8]
{
hex byte; //Import Kinds
};
_mybase_ integer; //Export Flags
array[8]
{
hex byte; //Export Kinds
};
};
#endif /* define _GUARD_PROJECTmd2teach_FILEbabelfish_rez_ */

View File

@ -1,113 +0,0 @@
/*
* babelfish_types.h
* md2teach
*
* Created by Jeremy Rand on 2021-05-16.
*
*/
#ifndef _GUARD_PROJECTmd2teach_FILEbabelfish_types_
#define _GUARD_PROJECTmd2teach_FILEbabelfish_types_
#include <Types.h>
// The actual data record varies based on the file format.
typedef struct TrDataRecord
{
Word parmCount;
} TrDataRecord;
typedef struct TrTextDataRecord
{
Word parmCount;
Word actionCode;
Word responseCode;
Long textStreamLength;
char * textStreamPtr;
Handle textStreamHandle;
Word familyId;
Word fontSize;
Word fontStyle;
Word foreColor;
Word backColor;
Word position;
Word charSpacing;
Word lineSpacing;
Word spaceBefore;
Word spaceAfter;
Word firstIndent;
Word leftIndent;
Word rightIndent;
Word justification;
unsigned char tabArray[64];
Word options;
Long border;
Word pageLength;
Word pageWidth;
Rect sectionRect;
Word columns;
Word gutter;
Handle picHandle;
} TrTextDataRecord;
typedef struct TrTransferRecord
{
Word parmCount;
Word status;
Word miscFlags;
unsigned char dataKinds[8];
Word transNum;
Word userId;
Word progressAction;
Word fullTherm;
Word currentTherm;
char * msgPtr;
TrDataRecord * dataRecordPtr;
GSString255 * filePathPtr;
char * fileNamePtr; /* P string */
} TrTransferRecord;
typedef struct TrStartUpDataIn
{
TrTransferRecord * xferRecPtr;
} TrStartUpDataIn;
typedef struct TrStartUpDataOut
{
Word recvCount;
Word trResult;
} TrStartUpDataOut;
typedef struct TrShutDownDataIn
{
TrTransferRecord * xferRecPtr;
} TrShutDownDataIn;
typedef struct TrShutDownDataOut
{
Word recvCount;
Word trResult;
} TrShutDownDataOut;
typedef struct TrReadDataIn
{
TrTransferRecord * xferRecPtr;
} TrReadDataIn;
typedef struct TrReadDataOut
{
Word recvCount;
Word trResult;
} TrReadDataOut;
#endif /* define _GUARD_PROJECTmd2teach_FILEbabelfish_types_ */

View File

@ -1,114 +0,0 @@
;
; filter.s
; md2teach
;
; Created by Jeremy Rand on 2021-05-12.
; Based on bfish_asoft by Kelvin Sherlock.
;
mcopy filter.macros
keep filter
offset_fileName gequ 10
; SFFilter
;
; in stack:
;
; (3) |rtl
; |----
; (4) |DirEntryRecPtr
; |----
; (2) |returnval
; |----
; |.........
; out stack:
;
; |returnval
; |----
; |.........
;
; Returns 0 if it's not an markdown file, or 4 if it is.
;
filter start
_b equ 1
ptr equ _b+2
_d equ ptr+4
_rtlb equ _d+1
DirPtr equ _rtlb+3
retval equ DirPtr+4
phb ;even up the stack
pha
pha
phd
tsc
tcd
stz <retval ;; assume no
ldy #offset_fileName
lda [<DirPtr],y
sta <ptr
iny
iny
lda [<DirPtr],y
sta <ptr+2
ldy #2
lda [<ptr],y
cmp #4
blt exit
tay
short m
iny
iny
iny
lda [<ptr],y
cmp #'d'
beq checkM
cmp #'D'
bne noMatch
checkM anop
dey
lda [<ptr],y
cmp #'m'
beq checkDot
cmp #'M'
bne noMatch
checkDot anop
dey
lda [<ptr],y
cmp #'.'
bne noMatch
long m
lda #4
sta <retval ;; I handle it
bra exit
noMatch anop
long m
exit anop
pld
pla
pla
pla
sta 3,s
pla
sta 3,s
plb
rtl
end

View File

@ -1,26 +0,0 @@
;
; init.s
; md2teach
;
; Created by Jeremy Rand on 2021-05-17.
;
;
mcopy init.macros
case on
keep init
init start
phb
phk
plb
jsl setup
plb
rtl
end

View File

@ -1,54 +0,0 @@
/*
* markdown.rez
* md2teach
*
* Created by Jeremy Rand on 2021-05-10.
*
*/
#include "types.rez"
#include "babelfish/babelfish_defs.h"
#include "babelfish/babelfish_rez.h"
resource rVersion(TrVersion)
{
{
0, /* Major version number in BCD */
1, /* Minor version number in BCD */
0, /* Bug version number in BCD */
beta, /* Development phase */
0 /* Release number */
},
verUS,
"Markdown Translator",
"by Jeremy Rand\nCopyright 2021 Jeremy Rand"
};
resource rComment(TrAbout)
{
"Markdown BabelFish translator"
};
resource rTrData(TrData)
{
bf320+bf640,
bfCanImport,
{TrFormatText,0,0,0,0,0,0,0},
0,
{0,0,0,0,0,0,0,0}
};
read rCodeResource(TrFilter, locked, convert) TARGETDIR "/filter.bin";
read rCodeResource(TrInit, locked, convert) TARGETDIR "/init.bin";
resource rText(TrImportInfo)
{
"Import markdown files.\n\n"
"by Jeremy Rand."
};

View File

@ -1,129 +0,0 @@
/*
* init.c
* md2teach
*
* Created by Jeremy Rand on 2021-05-12.
* Copyright (c) 2021 Jeremy Rand. All rights reserved.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <font.h>
#include <locator.h>
#include <memory.h>
#include "babelfish/babelfish_defs.h"
#include "babelfish/babelfish_types.h"
#include "md4c.h"
#pragma memorymodel 1
static uint16_t myUserId;
static TrTextDataRecord textRecord;
void DoStartUp(TrStartUpDataIn * dataIn, TrStartUpDataOut * dataOut)
{
static recvCount = 0;
TrTransferRecord * xferRecPtr = dataIn->xferRecPtr;
asm {
stz |lb1
lb1: nop
nop
};
xferRecPtr->dataKinds[0] = TrFormatText;
xferRecPtr->dataKinds[1] = TrFormatNone;
xferRecPtr->dataKinds[2] = TrFormatNone;
xferRecPtr->dataKinds[3] = TrFormatNone;
xferRecPtr->dataKinds[4] = TrFormatNone;
xferRecPtr->dataKinds[5] = TrFormatNone;
xferRecPtr->dataKinds[6] = TrFormatNone;
xferRecPtr->dataKinds[7] = TrFormatNone;
xferRecPtr->fullTherm = 512;
xferRecPtr->currentTherm = 0;
xferRecPtr->dataRecordPtr = (TrDataRecord *)&textRecord;
textRecord.parmCount = 10;
textRecord.actionCode = bfTextGetSettings;
textRecord.responseCode = 0;
textRecord.textStreamLength = 0;
textRecord.textStreamPtr = NULL;
textRecord.textStreamHandle = NULL;
textRecord.familyId = helvetica;
textRecord.fontSize = 12;
textRecord.foreColor = 0x0000;
textRecord.backColor = 0xffff;
textRecord.position = 0;
recvCount++;
dataOut->recvCount = recvCount;
dataOut->trResult = bfContinue;
}
void DoShutDown(TrShutDownDataIn * dataIn, TrShutDownDataOut * dataOut)
{
static recvCount = 0;
recvCount++;
dataOut->recvCount = recvCount;
dataOut->trResult = bfContinue;
}
void DoRead(TrReadDataIn * dataIn, TrReadDataOut * dataOut)
{
static recvCount = 0;
recvCount++;
dataOut->recvCount = recvCount;
dataOut->trResult = bfContinue;
}
#pragma databank 1
#pragma toolparms 1
pascal unsigned MyRequestProc(uint16_t request, uint32_t dataIn, uint32_t dataOut)
{
switch (request) {
case TrStartUp:
DoStartUp((TrStartUpDataIn *)dataIn, (TrStartUpDataOut *)dataOut);
break;
case TrShutDown:
DoShutDown((TrShutDownDataIn *)dataIn, (TrShutDownDataOut *)dataOut);
break;
case TrRead:
DoRead((TrReadDataIn *)dataIn, (TrReadDataOut *)dataOut);
break;
default:
break;
}
return 0;
}
#pragma toolparms 0
#pragma databank 0
void setup(void)
{
static char myName[48];
myUserId = MMStartUp();
sprintf(myName+1, "Babelfish~Jeremy~MarkdownTrans%04x", myUserId);
*myName = strlen(myName+1);
AcceptRequests(myName, myUserId, MyRequestProc);
// return 0;
}

View File

@ -16,9 +16,9 @@
#include <memory.h>
#include <resources.h>
#include "shell/io.h"
#include "shell/main.h"
#include "shell/style.h"
#include "io.h"
#include "main.h"
#include "style.h"
// Defines

View File

@ -11,9 +11,9 @@
#include <stdlib.h>
#include <string.h>
#include "shell/io.h"
#include "shell/main.h"
#include "shell/translate.h"
#include "io.h"
#include "main.h"
#include "translate.h"
// GS_TODO - How big does the stack need to be? In looking over the code,

View File

@ -196,7 +196,9 @@ executeGUI: all
make/launchEmulator "$(DISKIMAGE)" "$(DESTBOOTIMAGE)"
executeShell: all
$(ORCA) --mem $(TARGETDIR)/$(PGM) -d test.md $(TARGETDIR)/outfile.txt
$(ORCA) --mem $(TARGETDIR)/$(PGM) -d test.md $(TARGETDIR)/test.txt
make/createDiskImage "$(DISKIMAGE)" $(DESTBOOTIMAGE) "$(TARGETDIR)/md2teach" "$(TARGETDIR)/test.txt"
make/launchEmulator "$(DISKIMAGE)" "$(DESTBOOTIMAGE)"
$(OBJDIR)/%.a: %.c
$(COMPILE) $< $(@:.a=) $(CFLAGS) --noroot

View File

@ -1,178 +0,0 @@
#
# Makefile
# Apple //GS Build Engine for ORCA and Merlin
#
include make/head.mk
# Customize this file to control what kind of project you are working on,
# where to find files, etc.
# The name of your system or binary file to build goes here:
PGM=md2teach
# Set the target type you would like to build. The options are:
# shell - A shell command for ORCA, GNO or other GS shell
# desktop - A full desktop application
# cda - A classic desk accessory
# cdev - A control panel device
# nba - A HyperStudio new button action
# nda - A new desk accessory
# xcmd - A HyperCard XCMD or XCFN
#
TARGETTYPE=shell
# TARGETTYPE=desktop
# TARGETTYPE=cda
# TARGETTYPE=cdev
# TARGETTYPE=nba
# TARGETTYPE=nda
# TARGETTYPE=xcmd
# Uncomment one of the following lines to force a particular GS emulator.
# By default, specific paths are tested for these emulators in the below
# order and the first found is what will be used. You can overrride that
# here:
#
# EMULATOR=gsplus
EMULATOR=mame
# EMULATOR=gsport
# By default, the build provides a single boot environment to test with.
# You can put other .2mg files into the make directory and override this
# variable to change what boot disk you want to use when you launch the
# emulator. The disk image you specify must be found in the make directory:
#
# BOOTIMAGE=system601.2mg
# Add any other directories where you are putting C or assembly source
# files to this list:
SRCDIRS+=shell
# If you put your main entry point for your project in a file called main.c
# Then you don't need to change this value. If you want to call your entry
# point something other than main.c, set this variable to point to this file.
ROOTCFILE=shell/main.c
# Add any arguments you want passed to the C compiler to this variable:
CFLAGS+=+O
# Add any arguments you want passed to the resource compiler to this variable:
REZFLAGS+=
# Uncomment the following line if you have installed rlint as found here:
# https://github.com/ksherlock/rlint/releases
# Assuming that it is in the path that ORCA searches (the Utilities directory is
# probably a good choice), you can just leave the value unchanged. If you have
# put the rlint somewhere weird, you can set this to the correct path
# RLINT_PATH=rlint
# Add any arguments you want passed to the macro generator to this variable:
MACGENFLAGS+=
# Add any other macro libraries to include in this variable:
MACGENMACROS+=
# Add any arguments you want passed to the assembler to this variable:
ASMFLAGS+=
# Add any arguments you want passed to the linker to this variable:
LDFLAGS+=
# Uncomment the following line if you want to build against the GNO libraries
# export ORCA=$(ORCA_BINDIR)/gno
# If you want to copy one or more files or directories to the distribution disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the target disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYDIRS to dir and in your project you have
# the following files:
# dir/Icons/myIconFile
# dir/newDir/anotherFile
# Then, during the copy phase, myIconFile will be copied into the Icons
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYDIRS=
# If you want to copy one or more files or directories to the boot disk
# image, add the root directory to this variable. Any directories under
# the source directory which don't exist in the boot disk image will be
# created. All files will be copied from the source to the target using
# the same path from the source.
#
# For example, if you set COPYBOOTDIRS to dir and in your project you have
# the following files:
# dir/System/mySystemFile
# dir/newDir/anotherFile
# Then, during the copy phase, mySystemFile will be copied into the System
# folder and a folder newDir will be created and anotherFile will be copied
# into there.
COPYBOOTDIRS=
# By default, the build expects that you have GSplus in the path:
# /Applications/GSplus.app/Contents/MacOS/gsplus
# If you have it in a different location, specify that here.
# GSPLUS=/Applications/GSplus.app/Contents/MacOS/gsplus
# By default, the build uses no arguments with GSplus. If you would like to
# use different arguments, specify that here.
GSPLUSARGS=-mem 4194304
# By default, the build expects that you have GSport in the path:
# /Applications/GSport/GSport.app/Contents/MacOS/GSport
# If you have it in a different location, specify that here.
# GSPORT=/Applications/GSport/GSport.app/Contents/MacOS/GSport
# By default, the build uses no arguments with GSport. If you would like to
# use different arguments, specify that here.
# GSPORTARGS=
# By default, the build expects that you have Ample/mame in the path:
# /Applications/Ample.app/Contents/MacOS/mame64
# If you have it in a different location, specify that here.
# MAME=/Applications/Ample.app/Contents/MacOS/mame64
# By default, the build expects that you have the mame ROMs/libs in the path:
# $(HOME)/Library/Application Support/Ample
# If you have it in a different location, specify that here.
# MAMELIB=$(HOME)/Library/Application Support/Ample
# By default, the build uses these arguments with mame:
# apple2gs -skip_gameinfo -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# If you would like to use different arguments, specify that here.
MAMEARGS=apple2gs -skip_gameinfo -speed 3 -mouse -window -resolution 1408x1056 -ramsize 4M -sl7 cffa202
# For a desktop application, it can operate in 640x200 or 320x200
# resolution. This setting is used to define which horizontal
# resolution you want to use for a desktop application. Other
# target types ignore this value.
# DESKTOP_RES_MODE=640
# For a desktop application, it can support opening and printing
# files based on paths sent to it by the message center. This
# option controls if that is or is not supported in the
# application (note: only the C desktop template supports message
# center today)
# MESSAGE_CENTER=0
# Add any rules you want to execute before any compiles or assembly
# commands are called here, if any. You can generate .c, .s or .h
# files for example. You can generate data files. Whatever you
# might need. You should generate these files in the $(GENDIR)
# directory or within a subdirectory under $(GENDIR) which you create
# yourself.
#
# All of your commands associated with a rule _must_ start with a tab
# character. Xcode makes it a bit tough to type a tab character by
# default. Press option-tab within Xcode to insert a tab character.
gen:
# For any files you generated in the gen target above, you should
# add rules in genclean to remove those generated files when you
# clean your build.
genclean:
# Do not change anything else below here...
include make/tail.mk

View File

@ -13,9 +13,9 @@
#include <memory.h>
#include <textedit.h>
#include "shell/io.h"
#include "shell/main.h"
#include "shell/style.h"
#include "io.h"
#include "main.h"
#include "style.h"
// Defines

View File

@ -9,10 +9,10 @@
#include <stdio.h>
#include <stdlib.h>
#include "shell/translate.h"
#include "shell/io.h"
#include "shell/main.h"
#include "shell/style.h"
#include "translate.h"
#include "io.h"
#include "main.h"
#include "style.h"
// Typedefs