Commits (5)
  • Robert Sprowson's avatar
    Delete some dead code · c0cefc05
    Robert Sprowson authored
    The ctl part of RISC_OSLib is long abandoned, and has been switched out as far back as CVS history goes. Delete it.
    Tagged as Edit-1_73-1, since the binary is unchanged.
    c0cefc05
  • Robert Sprowson's avatar
    Delete some redundant/switched out code · 2165052d
    Robert Sprowson authored
    Some #if FALSE's trimmed.
    Redundant check of s!=0 within a while (s!=0) removed.
    2165052d
  • Robert Sprowson's avatar
    Add Save choices menu option · 5ab12b59
    Robert Sprowson authored
    edit.c: Add save choices support code (taken from equivalent operation in SrcEdit).
    Resources/UK/Messages: Add new menu item & error message, shuffle interactive help down. Restore missing help on BASIC line increment writeable.
    
    Version 1.74. Tagged as 'EditApp-1_74'
    5ab12b59
  • Ben Avison's avatar
    Minor improvements · a99b2e7b
    Ben Avison authored
    A few misfeatures were discovered when rewriting the Makefile (see next
    commit). These fixes affect the binary outputs:
    
    * Module builds (the normal case) were disabling stack limit checks. Yet the
      code executes in USR mode with a chunked stack in application space, so this
      is potentially unsafe because it could lead to untrapped stack overflows.
    * The `Export` file was being unconditionally reinstalled in ResourceFS at
      runtime, duplicating the file that is installed via the Messages module.
    * Application (disc and debug) builds were linking with the RISC_OSLib binary
      that was intended for module targets.
    * WimpSlot size in application builds was too small to permit it to run.
    a99b2e7b
  • Ben Avison's avatar
    Modernise build structure · a82638c1
    Ben Avison authored
    Detail:
    * Rewrite `Makefile` to use shared makefile fragments
    * No longer requires `-E` switch to `amu`
    * Consolidate `.gitignore` files
    
    Admin:
      Requires BuildSys-7_50 and RISC_OSLib-6_08.
    
    Version 1.75. Tagged as 'EditApp-1_75'
    a82638c1
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
| limitations under the License. | limitations under the License.
| |
Dir <Obey$Dir> Dir <Obey$Dir>
amu_machine install INSTDIR=<Obey$Dir>.!Edit amu_machine install INSTDIR=<Obey$Dir>
/!RunImage,ff8
/!RunImage-D,fd3
/aof/
/linked/
/o/
/objs/
/od/
/oz/
/s/modulewrap
...@@ -13,177 +13,19 @@ ...@@ -13,177 +13,19 @@
# limitations under the License. # limitations under the License.
# #
# Makefile for Edit # Makefile for Edit
#
# ***********************************
# *** C h a n g e L i s t ***
# ***********************************
# Date Name Description
# ---- ---- -----------
# 25-Oct-94 AMcC Updated for Black build
# 28-Oct-94 AMcC added -zps1 flag to .c.oz rule (module version)
#
#
# Program specific options:
#
COMPONENT = Edit
APP = !Edit
MODULE = rm.Edit
ROM_MODULE = aof.Edit
RDIR = Resources
LDIR = LocalRes:
MSGVERSION = ${AWK} -f Build:AwkVers
MSGS = Resources.GenMessage
#
# Export Paths for Messages module
#
RESDIR = <resource$dir>.Resources.${COMPONENT}
RESAPP = <resource$dir>.Apps.${APP}
include StdTools
include ModuleLibs
SQZFLAGS = -f
CINCLUDES = -IC:
ASFLAGS = ${STDTOOLOPTIONS} -nocache -stamp -quit
CFLAGS = ${STDTOOLOPTIONS} ${C_WARNINGS} ${CINCLUDES} -wp
WRAPPER = RISC_OSLib:s.ModuleWrap
LIBSD = ${RLIB} ${CLIB}
# COMPONENT = Edit
# Include files: override TARGET = !RunImage
# CFLAGS += ${C_NOWARN_NON_ANSI_INCLUDES}
FILES =\ CDFLAGS = -DTRACE=1
${RDIR}.!Boot\ OBJS = edit editv message slist
${RDIR}.!Run\ LIBS = ${RLIB}
${RDIR}.!Sprites\ INSTTYPE = app
${RDIR}.!Sprites22\ INSTAPP_FILES = !Boot !Help !Run !RunImage !Sprites !Sprites22 Export Messages Templates
abs.!RunImage\ INSTAPP_VERSION = Messages
${RDIR}.Export\ RES_FILES = Export Messages Templates
${LDIR}!Help\ RESAPP_FILES = !Boot !Help !Run
${MSGS} \
${LDIR}Templates
# Include these in the ROM module
RESFILES =\
${RDIR}.Export
OBJS = o.edit o.editv o.message o.slist
OBJSZ = oz.edit oz.editv oz.message oz.slist
OBJSD = od.edit od.editv od.message od.slist
#
# Rule patterns
#
.SUFFIXES: .oz .od
.c.o:; ${CC} ${CFLAGS} -c ${C_NO_FNAMES} $<
.c.oz:; ${CC} ${CFLAGS} -c ${C_NO_FNAMES} ${C_MODULE} ${C_NO_STKCHK} -o $@ $<
.c.od:; ${CC} ${CFLAGS} -c -DTRACE=1 -g -o $@ $<
.s.o:; ${AS} ${ASFLAGS} $< $@
#
# Main rules:
#
all: ${FILES}
@echo ${COMPONENT}: Application built (Disc)
rom: ${ROM_MODULE} include CApp
@echo ${COMPONENT}: Module built (ROM)
install: ${FILES}
${MKDIR} ${INSTDIR}
${CP} ${RDIR}.!Boot ${INSTDIR}.!Boot ${CPFLAGS}
${CP} ${LDIR}!Help ${INSTDIR}.!Help ${CPFLAGS}
${CP} ${RDIR}.!Run ${INSTDIR}.!Run ${CPFLAGS}
${CP} ${RDIR}.!Sprites ${INSTDIR}.!Sprites ${CPFLAGS}
${CP} ${RDIR}.!Sprites22 ${INSTDIR}.!Sprites22 ${CPFLAGS}
${CP} abs.!RunImage ${INSTDIR}.!RunImage ${CPFLAGS}
${CP} ${RDIR}.Export ${INSTDIR}.Export ${CPFLAGS}
${CP} ${MSGS} ${INSTDIR}.Messages ${CPFLAGS}
${CP} ${LDIR}Templates ${INSTDIR}.Templates ${CPFLAGS}
Access ${INSTDIR}.!Boot lr/r
Access ${INSTDIR}.!Help lr/r
Access ${INSTDIR}.!Run lr/r
Access ${INSTDIR}.!Sprites lr/r
Access ${INSTDIR}.!Sprites22 lr/r
Access ${INSTDIR}.!RunImage lr/r
Access ${INSTDIR}.Export lr/r
Access ${INSTDIR}.Messages lr/r
Access ${INSTDIR}.Templates lr/r
@echo ${COMPONENT}: Application installed (Disc)
install_rom: ${ROM_MODULE}
${CP} ${ROM_MODULE} ${INSTDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: Module installed (ROM)
resources: ${MSGS}
${MKDIR} ${RESDIR}
${MKDIR} ${RESAPP}
${CP} ${RDIR}.ROM.!Boot ${RESAPP}.!Boot ${CPFLAGS}
${CP} ${LDIR}!Help ${RESAPP}.!Help ${CPFLAGS}
${CP} ${RDIR}.ROM.!Run ${RESAPP}.!Run ${CPFLAGS}
${CP} ${MSGS} ${RESDIR}.Messages ${CPFLAGS}
${CP} ${LDIR}Templates ${RESDIR}.Templates ${CPFLAGS}
@echo ${COMPONENT}: resource files copied to Messages module
clean:
${XWIPE} o.* ${WFLAGS}
${XWIPE} oz.* ${WFLAGS}
${XWIPE} od.* ${WFLAGS}
${XWIPE} linked.* ${WFLAGS}
${RM} abs.!RunImage
${RM} ${ROM_MODULE}
${RM} ${MODULE}
${RM} ${MSGS}
${RM} s.ModuleWrap
@echo ${COMPONENT}: cleaned
#
# Development rules:
#
mod: ${MODULE}
@echo ${COMPONENT}: Module built (RAM)
#
# Static dependencies:
#
abs.!RunImage: ${OBJS} ${RLIB} ${CLIB}
${LD} -o $@ ${OBJS} ${RLIB} ${CLIB}
${SQZ} ${SQZFLAGS} $@
${MODULE}: oz.ModuleWrap ${OBJSZ} ${RLIB} ${CLIB}
${LD} -o $@ -module oz.ModuleWrap ${OBJSZ} ${RLIB} ${CLIB}
${ROM_MODULE}: oz.ModuleWrap ${OBJSZ} ${ROMSTUBS}
${LD} -o $@ -aof oz.ModuleWrap ${OBJSZ} ${ROMSTUBS}
# final link for ROM Image (using given base address)
rom_link:
${LD} -o linked.${COMPONENT} -rmf -base ${ADDRESS} ${ROM_MODULE} ${ABSSYM}
${CP} linked.${COMPONENT} ${LINKDIR}.${COMPONENT} ${CPFLAGS}
@echo ${COMPONENT}: rom_link complete
oz.ModuleWrap: s.ModuleWrap s.AppName ${MSGS} ${RESFILES}
${AS} ${ASFLAGS} s.ModuleWrap $@
s.ModuleWrap: ${WRAPPER}
${CP} ${WRAPPER} $@ ${CPFLAGS}
${MSGS}: ${LDIR}Messages VersionNum
${MSGVERSION} ${LDIR}Messages > $@
BBETYPE = edit
bbe-edit: bbe-generic
BBE_Export_Dir Resources
#---------------------------------------------------------------------------
# Debugging version:
#
debug.${APP}.!RunImage: ${OBJSD} ${RLIB} ${CLIB}
${MKDIR} debug
${MKDIR} debug.${APP}
${LD} -o $@ -debug ${OBJSD} ${RLIB} ${CLIB}
#---------------------------------------------------------------------------
# Dynamic dependencies: # Dynamic dependencies:
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
Set Edit$Dir <Obey$Dir> Set Edit$Dir <Obey$Dir>
SetMacro Edit$Path <Edit$Dir>. SetMacro Edit$Path <Edit$Dir>.
Run Edit:!Boot Run Edit:!Boot
WimpSlot -min 188k WimpSlot -min 184k -max 184k
WimpSlot -min 150k -max 150k
Run Edit:Export Run Edit:Export
Run Edit:!RunImage %*0 Run Edit:!RunImage %*0
No preview for this file type
; ;
; This file is automatically maintained by srccommit, do not edit manually. ; This file is automatically maintained by srccommit, do not edit manually.
; Last processed by srccommit version: 1.1.
; ;
GBLS Module_MajorVersion GBLS Module_MajorVersion
GBLA Module_Version GBLA Module_Version
...@@ -10,14 +9,12 @@ ...@@ -10,14 +9,12 @@
GBLS Module_ApplicationDate GBLS Module_ApplicationDate
GBLS Module_HelpVersion GBLS Module_HelpVersion
GBLS Module_ComponentName GBLS Module_ComponentName
GBLS Module_ComponentPath Module_MajorVersion SETS "1.75"
Module_MajorVersion SETS "1.73" Module_Version SETA 175
Module_Version SETA 173
Module_MinorVersion SETS "" Module_MinorVersion SETS ""
Module_Date SETS "03 Apr 2015" Module_Date SETS "05 Sep 2020"
Module_ApplicationDate SETS "03-Apr-15" Module_ApplicationDate SETS "05-Sep-20"
Module_ComponentName SETS "Edit" Module_ComponentName SETS "EditApp"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Edit" Module_FullVersion SETS "1.75"
Module_FullVersion SETS "1.73" Module_HelpVersion SETS "1.75 (05 Sep 2020)"
Module_HelpVersion SETS "1.73 (03 Apr 2015)"
END END
/* (1.73) /* (1.75)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 1.73 #define Module_MajorVersion_CMHG 1.75
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 03 Apr 2015 #define Module_Date_CMHG 05 Sep 2020
#define Module_MajorVersion "1.73" #define Module_MajorVersion "1.75"
#define Module_Version 173 #define Module_Version 175
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "03 Apr 2015" #define Module_Date "05 Sep 2020"
#define Module_ApplicationDate "03-Apr-15" #define Module_ApplicationDate "05-Sep-20"
#define Module_ComponentName "Edit" #define Module_ComponentName "EditApp"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Edit"
#define Module_FullVersion "1.73" #define Module_FullVersion "1.75"
#define Module_HelpVersion "1.73 (03 Apr 2015)" #define Module_HelpVersion "1.75 (05 Sep 2020)"
#define Module_LibraryVersionInfo "1:73" #define Module_LibraryVersionInfo "1:75"
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
#define PRINT 1 #define PRINT 1
#define CTL FALSE
/* Not using the ctl module yet. */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -89,10 +86,6 @@ ...@@ -89,10 +86,6 @@
#include "visdelay.h" #include "visdelay.h"
#include "pointer.h" #include "pointer.h"
#if CTL
#include "ctl.h"
#endif
#if BASIC #if BASIC
static int Edit_Strip = TRUE; static int Edit_Strip = TRUE;
static int Edit_Incrm = 10; static int Edit_Incrm = 10;
...@@ -127,21 +120,19 @@ static void arcedit__clickproc(wimp_i i) { ...@@ -127,21 +120,19 @@ static void arcedit__clickproc(wimp_i i) {
i=i; i=i;
txtedit_new("",0xfff); } txtedit_new("",0xfff); }
#define MProg 1 #define MProg 1
#define MCreate 2 #define MSaveChoices 2
#define MCreate 3
#if BASIC #if BASIC
#define MOptions 3 #define MOptions 4
#define MQuit 4 #define MQuit 5
#define MStrip 1 #define MStrip 1
#define MIncrm 2 #define MIncrm 2
#else #else
#define MQuit 3 #define MQuit 4
#endif #endif
#if FALSE
#define MTask 1
#endif
#define MText 1 #define MText 1
#define MBASIC 2 #define MBASIC 2
#define MObey 3 #define MObey 3
...@@ -150,33 +141,8 @@ static void arcedit__clickproc(wimp_i i) { ...@@ -150,33 +141,8 @@ static void arcedit__clickproc(wimp_i i) {
static void arcedit__iconmenuproc(void *handle, char *hit) { static void arcedit__iconmenuproc(void *handle, char *hit) {
txtedit_state *s; txtedit_state *s;
handle=handle;
#if CTL
ctl_decode_state state;
state.index = 1;
while (ctl_decode("IconControl", wimpt_last_event(), &state))
{
#if FALSE
switch ctl_switch("IconControl", "go think find foo fum", action, TRUE) {
1: /+ go +/
... logical action for action "go" ...
break;
2: /+ think +/
... logical action for action "think" ...
... other actions ...
default:
/+ error message already produced by ctl_switch +/
};
#else
werr(FALSE, "edit: ctl suggests event %i", state.code);
#endif
};
if (state.index != 0) /* otherwise, try old handlers. */
#endif
{
handle=handle;
switch (hit[0]) { switch (hit[0]) {
case MProg: case MProg:
if (hit[1] != 0) if (hit[1] != 0)
...@@ -185,6 +151,33 @@ static void arcedit__iconmenuproc(void *handle, char *hit) { ...@@ -185,6 +151,33 @@ static void arcedit__iconmenuproc(void *handle, char *hit) {
arceditv_infoaboutprogram(); arceditv_infoaboutprogram();
} }
break; break;
case MSaveChoices:
{
/* save library options */
FILE *libopts_fp;
char libopts[80];
os_regset r;
/* create Edit folder in Choices. */
r.r[0] = 8;
r.r[1] = (int)"<Choices$Write>.Edit";
r.r[4] = 0;
os_swix(OS_File,&r);
/* save library options */
libopts_fp = fopen("<Choices$Write>.Edit.liboptions", "w");
if (libopts_fp == 0)
{
werr(FALSE, msgs_lookup("opt5"));
}
else
{
os_read_var_val("Edit$Options", libopts, sizeof(libopts));
fprintf(libopts_fp, "%s", libopts);
fclose(libopts_fp);
}
}
break;
#if BASIC #if BASIC
case MOptions: case MOptions:
switch (hit[1]) { switch (hit[1]) {
...@@ -210,15 +203,6 @@ static void arcedit__iconmenuproc(void *handle, char *hit) { ...@@ -210,15 +203,6 @@ static void arcedit__iconmenuproc(void *handle, char *hit) {
#endif #endif
case MCreate: case MCreate:
switch (hit[1]) { switch (hit[1]) {
#if FALSE
case MTask:
if (wimpt_complain(
os_cli(
"RMEnsure TaskWindow 0 RMLoad <Edit$Dir>.Task")) == 0) {
message_taskwindow("ShellCLI_Task");
};
break;
#endif
case MText: case MText:
s = txtedit_new("", 0xfff); s = txtedit_new("", 0xfff);
break; break;
...@@ -249,15 +233,9 @@ static void arcedit__iconmenuproc(void *handle, char *hit) { ...@@ -249,15 +233,9 @@ static void arcedit__iconmenuproc(void *handle, char *hit) {
break; break;
case MQuit: case MQuit:
tracef0("quit\n"); tracef0("quit\n");
#if FALSE
if (dboxquery("Quit Edit: are you sure?") == dboxquery_YES) {
exit(0);
};
#else
if (txtedit_mayquit()) exit(0); if (txtedit_mayquit()) exit(0);
#endif break;
}; }
};
} }
static menu edit__main_menu_maker(void *handle) static menu edit__main_menu_maker(void *handle)
...@@ -269,10 +247,6 @@ static menu edit__main_menu_maker(void *handle) ...@@ -269,10 +247,6 @@ static menu edit__main_menu_maker(void *handle)
if (Edit_Menu == 0) if (Edit_Menu == 0)
{ {
#if CTL
Edit_Menu = ctl_menu("IconControl");
#else
#if BASIC #if BASIC
Edit_Menu = menu_new(msgs_lookup("ED1"), msgs_lookup("ED2a")); Edit_Menu = menu_new(msgs_lookup("ED1"), msgs_lookup("ED2a"));
Edit_Options = menu_new(msgs_lookup("ED2b"), msgs_lookup("ED2c")); Edit_Options = menu_new(msgs_lookup("ED2b"), msgs_lookup("ED2c"));
...@@ -296,7 +270,6 @@ static menu edit__main_menu_maker(void *handle) ...@@ -296,7 +270,6 @@ static menu edit__main_menu_maker(void *handle)
sizeitem->iconflags &= ~wimp_IHCENTRE; sizeitem->iconflags &= ~wimp_IHCENTRE;
} }
menu_submenu(Edit_Menu, MCreate, create_submenu); menu_submenu(Edit_Menu, MCreate, create_submenu);
#endif
} }
help_register_handler(help_simplehandler, "IHELP"); help_register_handler(help_simplehandler, "IHELP");
...@@ -313,6 +286,20 @@ static void arcedit__createicon(void) ...@@ -313,6 +286,20 @@ static void arcedit__createicon(void)
event_attachmenumaker(win_ICONBAR, edit__main_menu_maker, arcedit__iconmenuproc, 0); event_attachmenumaker(win_ICONBAR, edit__main_menu_maker, arcedit__iconmenuproc, 0);
} }
static void arcedit__read_and_set_liboptions(void)
{
/* read risc_oslib options */
FILE *libopts_fp = fopen("Choices:Edit.liboptions", "r");
if (libopts_fp != 0)
{ char libopts[80], a[255];
fgets(libopts, sizeof(libopts), libopts_fp);
strcpy(a, "Set Edit$Options ");
strncat(a, libopts, sizeof(a) - strlen(a) - 1);
wimpt_complain(os_cli(a));
fclose(libopts_fp);
}
}
/* -------- Hot-key selection copy in background. -------- */ /* -------- Hot-key selection copy in background. -------- */
#if FALSE #if FALSE
...@@ -356,16 +343,10 @@ static os_error * save_desktop(int handle) ...@@ -356,16 +343,10 @@ static os_error * save_desktop(int handle)
{ {
char buffer[300]; char buffer[300];
char buffer2[256]; char buffer2[256];
char *ptr = buffer; char *ptr;
os_read_var_val("Edit$Options", buffer2, sizeof(buffer2));
if (buffer2[0] != 0) {
sprintf(ptr, "Set Edit$Options %s\n", buffer2);
ptr += strlen(ptr);
}
os_read_var_val("Edit$Dir",buffer2,sizeof(buffer2)); os_read_var_val("Edit$Dir",buffer2,sizeof(buffer2));
sprintf(ptr, "Run %s\n",buffer2); sprintf(buffer, "Run %s\n",buffer2);
for (ptr=buffer; *ptr; ptr++) { for (ptr=buffer; *ptr; ptr++) {
os_error * error = os_swi2(OS_BPut, *ptr, handle); os_error * error = os_swi2(OS_BPut, *ptr, handle);
...@@ -437,7 +418,7 @@ static void arcedit__bkg_events(wimp_eventstr *e, void *handle) { ...@@ -437,7 +418,7 @@ static void arcedit__bkg_events(wimp_eventstr *e, void *handle) {
s = txtedit_getstates(); s = txtedit_getstates();
while (s != 0) while (s != 0)
{ {
if (s != 0 && !cistrcmp(s->filename, e->data.msg.data.print.name)) if (!cistrcmp(s->filename, e->data.msg.data.print.name))
break; break;
s = s->next; s = s->next;
} }
...@@ -522,8 +503,6 @@ void edit__hotkeys(wimp_eventstr *e, void *handle) { ...@@ -522,8 +503,6 @@ void edit__hotkeys(wimp_eventstr *e, void *handle) {
if (e->e == wimp_EKEY) { if (e->e == wimp_EKEY) {
if (e->data.key.chcode == akbd_Fn + 7) { if (e->data.key.chcode == akbd_Fn + 7) {
werr(FALSE, "hot key select copy!"); /* test message. */ werr(FALSE, "hot key select copy!"); /* test message. */
#if FALSE
#endif
} else { } else {
/* not recognised: pass it on. */ /* not recognised: pass it on. */
wimpt_noerr(wimp_processkey(e->data.key.chcode)); wimpt_noerr(wimp_processkey(e->data.key.chcode));
...@@ -687,6 +666,7 @@ int main(int argc, char *argv[]) ...@@ -687,6 +666,7 @@ int main(int argc, char *argv[])
dbox_init(); dbox_init();
dboxquery_close(0); /* init */ dboxquery_close(0); /* init */
dboxquery_quit(0); dboxquery_quit(0);
arcedit__read_and_set_liboptions();
txt_init(); txt_init();
txtedit_init(); txtedit_init();
...@@ -718,11 +698,6 @@ int main(int argc, char *argv[]) ...@@ -718,11 +698,6 @@ int main(int argc, char *argv[])
} }
#endif #endif
#if CTL
trace_on();
ctl_init();
#endif
#if FALSE #if FALSE
/* Need to be able to move the hot keys template off the screen, dbox prevents /* Need to be able to move the hot keys template off the screen, dbox prevents
this at the moment... */ this at the moment... */
......
...@@ -14,6 +14,6 @@ ...@@ -14,6 +14,6 @@
; ;
; > ResFiles ; > ResFiles
; ;
ResourceFile Resources.Export, Resources.Edit.Export ; ResourceFile Resources.Export, Resources.Edit.Export
END END