home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
wp_dtp
/
xdme1820.lha
/
XDME
/
mikro.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-09
|
9KB
|
422 lines
/******************************************************************************
MODUL
mikro.c
DESCRIPTION
hier ist alles, was zu klein war fuer einen vernuenftigen Oberbegriff
NOTES
BUGS
TODO
EXAMPLES
SEE ALSO
INDEX
HISTORY
******************************************************************************/
/**************************************
Includes
**************************************/
#include "defs.h"
/**************************************
Globale Variable
**************************************/
/**************************************
Interne Defines & Strukturen
**************************************/
/**************************************
Interne Variable
**************************************/
/**************************************
Interne Prototypes
**************************************/
Prototype void do_viewmode (void);
Prototype void do_eval (void);
Prototype void do_unfail (void);
Prototype void do_quiet (void);
Prototype void do_untitle (void);
Prototype void do_force (void);
Prototype void do_abort (void);
Prototype void do_unabort (void);
Prototype void do_insertwrite(void);
Prototype void do_break (void);
Prototype void do_continue (void);
Prototype void clearcont (void);
Prototype void clearbreak (void);
Prototype void clearbreaks (void);
Prototype void do_simpletabs (void);
Prototype void do_activefront (void);
Prototype void do_sourcebreak (void);
Prototype void do_windowcyc (void);
void
do_viewmode(void)
{
Ep->viewmode = test_arg(av[1], Ep->viewmode);
if (Ep->viewmode)
{
title ("Viewmode ON");
} else
{
title ("Viewmode OFF");
} /* if */
} /* do_viewmode */
/*
*! >ABORT
*! >UNABORT
*! they toggle a flag which controlles macro-executing
*! ABORT sets the break-flag which causes e.g. immediately macro-abortion at keys
*! or terminates line-execution
*! UNABORT allows to reset this flag in a AREXX-script,
*! is the last line produced an error, you may clear the error-flag
*! if UNABORT is the first (or only) command of a line
*!
*/
void
do_abort ( void )
{
globalflags.Abortcommand = 1;
} /* do_abort */
void
do_unabort ( void )
{
globalflags.Abortcommand = 0;
} /* do_unabort */
BOOLEAN
is_aborted ( void )
{
return(globalflags.Abortcommand);
} /* is_aborted */
/* PATCH_NULL - missing in 180 */
void do_break (void)
{
LoopBreak++;
} /* do_break */
void do_continue (void)
{
LoopCont++;
} /* do_continue */
#ifdef NOT_DEF
void clearcont (void) { LoopCont = 0; } /* clearcont */
void clearbreak (void) { LoopBreak = 0; } /* clearbreak */
#endif
void clearbreaks (void)
{
LoopCont = 0;
LoopBreak = 0;
globalflags.Abortcommand = 0;
} /* clearbreaks */
/* PATCH_NULL - missing in 180 */
/*
*! >EVAL com
*!
*! to split longer commandsequences to fit their length down to MAXIA
*! so MAXIA may stay "small" and anybody can avoid "expression too complex"
*!
*/
void
do_eval(void)
{
CHAR* buffer = (CHAR*)malloc(LINE_LENGTH); /* allocate a buffer */
if (buffer)
{
strcpy(buffer, av[1]); /* copy the command into that buffer */
do_command(buffer); /* execute the buffer */
free(buffer); /* and then free it again */
} else
{
nomemory();
globalflags.Abortcommand = 1;
} /* if */
} /* do_eval */
/*
*! >UNFAIL com
*!
*! That's really like EVAL, but it ignore's failures
*! Very useful if U try to call an Command but U don't
*! know if it is one, or if you don't want a failure to break your macro
*!
*/
void
do_unfail(void)
{
do_eval();
globalflags.Abortcommand = 0;
// do_clearallbreaks(); /* simply cancel all breaks after evaluation */
} /* do_unfail */
/*
*! >QUIET com
*!
*! That's like EVAL, but during execution no window
*! should be refreshed
*! as _No_Screen_Update is increased during operation
*!
*/
void
do_quiet()
{
int inter = Nsu; /* extern Nsu controlles screen updates */
Nsu = 1; /* buffer that value and change it for evaluation, then restore it */
do_eval();
Nsu = inter;
} /* do_quiet */
/*
*! >UNTITLE com
*!
*! That's also like EVAL, except for the feature, that
*! No Title is shown during the macrocall
*!
*/
void
do_untitle()
{
char inter = globalflags.Showtitle; /* extern showtitle controlles changes in window-titling */
globalflags.Showtitle = 0; /* buffer that value and change it for evaluation, then restore it */
do_eval();
globalflags.Showtitle = inter;
} /* do_untitle */
/*
*! >FORCE [T|S|F|R|D] command
*!
*! Thats a command that means conjunction
*! of EVAL, QUIET, UNFAIL and UNTITLE
*!
*! T == unTitle
*! S == quiet (no Screen updating)
*! F == unFail
*! R == no Requestors
*! D == enable debugging mode
*! <no flags> -> simple eval
*!
*/
void do_force (void)
{
char inter_screen = Nsu; /* extern Nsu controlles screen updates */
char inter_title = globalflags.Showtitle; /* extern showtitle controlles changes in window-titling */
char inter_request = globalflags.NoRequest; /* Disable flag for requestors */
char inter_debug = globalflags.debug; /* Debugging mode */
int failures = 0;
CHAR* typer = av[1];
CHAR* av1 = av[1];
CHAR* av2 = av[2];
av[1] = av[2];
av[2] = NULL;
if (typer)
{ /* check for any set flags */
while (*typer)
{
switch ((*typer)|32)
{
case 't':
globalflags.Showtitle = 0;
break;
case 's':
Nsu = 1;
break;
case 'f':
failures = 1;
break;
/* PATCH_NULL - missing in 180 */
case 'r':
globalflags.NoRequest = 1;
break;
case 'd':
globalflags.debug = 1;
break;
/* PATCH_NULL - missing in 180 */
default:
error ("%s:\nInvalid flags '%s'", av[0], typer);
goto df_quit;
} /* switch */
typer++;
} /* while */
} /* if */
do_eval(); /* do the evaluation */
if (failures)
{ /* (...) cancel all breaks */
extern char MacroBreak; /* PATCH_NULL [08 Mar 1993] : added */
if (MacroBreak != 1) /* PATCH_NULL [08 Mar 1993] : added */
globalflags.Abortcommand = 0;
/* do_unbreak(); */
} /* if */
df_quit:
Nsu = inter_screen; /* (if necessary) restore old values */
globalflags.Showtitle = inter_title;
globalflags.NoRequest = inter_request;
globalflags.debug = inter_debug;
av[2] = av2;
av[1] = av1;
return;
} /* do_force */
/*
*! >INSERT text
*! >OVERWRITE text
*!
*! insert or overwrite text in the current line without respect
*! to the specialflag INSERTMODE
*!
*! note that it is possible to define that ^-combinations
*! can be interpreted like commands or like ctrl-keystrokes
*! when they are INSERTed (not in overwrite mode)
*! that patch is switched with the specialvar TEXTCOM
*!
*/
void
do_insertwrite()
{
char insertbackup = Ep->config.insertmode;
Ep->config.insertmode = av[0][0] == 'i';
text_write(av[1]);
Ep->config.insertmode = insertbackup;
} /* do_insertwrite */
/*
** The following commands should be placed into prefs.c
**
*!
*! ActivateToFront
*! Windowcycling
*!
*! These two flags refer to SELECT:
*!
*! ActivateToFront invokes a "WindowToFront()" every
*! time, windows are switched
*! Windowcycling enables the possibility to switch
*! to the other end of Textlist, if
*! one end is reacjed with SELECT next/prev
*!
*!
*! SourceBreaks
*! That flag refers to SOURCE
*! if an abortcommand or a break occurs on
*! sourcing level, the operation is aborted
*!
*! SimpleTabs
*! That flag is an add to SAVETABS and SAVE[old|as]
*! if Savetabs is set, SimpleTabs decides to optimize
*! TAB-Optimisation until the first non-blank only
*!
*/
void do_activefront (void)
{
globalflags.ActivateToFront = test_arg (av[1], globalflags.ActivateToFront);
if (globalflags.ActivateToFront)
title ("Activated Windows are moved to front now");
else
title ("Activated Windows are NOT moved front now");
} /* do_activefront */
void do_windowcyc (void)
{
globalflags.Windowcycling = test_arg (av[1], globalflags.Windowcycling);
if (globalflags.Windowcycling)
title ("Windowcycling is now ON");
else
title ("Windowcycling is now OFF");
} /* do_windowcyc */
void do_sourcebreak (void)
{
globalflags.SourceBreaks = test_arg (av[1], globalflags.SourceBreaks);
if (globalflags.SourceBreaks)
title ("Source - Breaks are Enabled");
else
title ("Source - Breaks are Ignored");
} /* do_sourcebreak */
void do_simpletabs (void)
{
globalflags.SimpleTabs = test_arg (av[1], globalflags.SimpleTabs);
if (globalflags.SimpleTabs && globalflags.Savetabs)
title ("Tabsaving up to forstnb");
else if (globalflags.Savetabs)
title ("Tabsaving full");
else
title ("Tabsaving off");
} /* do_simpletabs */
/******************************************************************************
***** ENDE mikro.c
******************************************************************************/