-
Notifications
You must be signed in to change notification settings - Fork 2
/
commset1.c
6861 lines (6261 loc) · 191 KB
/
commset1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***********************************************************************/
/* COMMSET1.C - SET commands A-N */
/***********************************************************************/
/*
* THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
* Copyright (C) 1991-2013 Mark Hessling
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to:
*
* The Free Software Foundation, Inc.
* 675 Mass Ave,
* Cambridge, MA 02139 USA.
*
*
* If you make modifications to this software that you feel increases
* it usefulness for the rest of the community, please email the
* changes, enhancements, bug fixes as well as any and all ideas to me.
* This software is going to be maintained and enhanced as deemed
* necessary by the community.
*
* Mark Hessling, [email protected] http://www.rexx.org/
*/
#include <the.h>
#include <proto.h>
the_header_mapping thm[] =
{
{"NUMBER", 6, HEADER_NUMBER },
{"COMMENT", 7, HEADER_COMMENT },
{"STRING", 6, HEADER_STRING },
{"KEYWORD", 7, HEADER_KEYWORD },
{"FUNCTION", 8, HEADER_FUNCTION },
{"HEADER", 6, HEADER_HEADER },
{"LABEL", 5, HEADER_LABEL },
{"MATCH", 5, HEADER_MATCH },
{"COLUMN", 6, HEADER_COLUMN },
{"POSTCOMPARE", 11, HEADER_POSTCOMPARE },
{"MARKUP", 6, HEADER_MARKUP },
{"DIRECTORY", 3, HEADER_DIRECTORY },
{"*", 1, HEADER_ALL }, /* this should be last */
{NULL, 0, 0 },
};
/*#define DEBUG 1*/
/***********************************************************************/
#ifdef HAVE_PROTO
static short set_active_colour( short area )
#else
static short set_active_colour( area )
short area;
#endif
/***********************************************************************/
{
int i;
COLOUR_ATTR attr;
chtype ch=0L,nondisp_attr=0L;
TRACE_FUNCTION("commset1.c:set_active_colour");
memcpy( &attr, CURRENT_FILE->attr+area, sizeof(COLOUR_ATTR) );
/*
* Special handling required for NONDISP...
*/
if (area == ATTR_NONDISP )
{
nondisp_attr = set_colour( &attr );
for ( i = 0 ; i < 256; i++ )
{
if (etmode_flag[i])
{
#ifdef VMS
ch = etmode_table[i];
#else
ch = etmode_table[i] & A_CHARTEXT;
#endif
etmode_table[i] = ch | nondisp_attr;
}
}
}
/*
* If we haven't started curses (in profile first time) exit now...
*/
if (!curses_started)
{
TRACE_RETURN();
return(RC_OK);
}
#if ( defined(USE_XCURSES) || defined(USE_SDLCURSES) || defined(USE_WINGUICURSES) ) && PDC_BUILD >= 2501
/*
* For the special BOUNDMARK colour, set the curses global colour
* to the foreground and return
*/
if ( area == ATTR_BOUNDMARK)
{
PDC_set_line_color(FOREFROMPAIR(attr.pair));
build_screen(current_screen);
display_screen(current_screen);
TRACE_RETURN();
return(RC_OK);
}
#endif
/*
* Update the appropriate window with the new colour combination...
*/
switch (valid_areas[area].area_window)
{
case WINDOW_FILEAREA:
if (area == ATTR_FILEAREA)
wattrset(CURRENT_WINDOW_FILEAREA,set_colour(CURRENT_FILE->attr+area));
build_screen(current_screen);
display_screen(current_screen);
#if ( defined(USE_XCURSES) || defined(USE_SDLCURSES) || defined(USE_WINGUICURSES) ) && PDC_BUILD >= 2501
if ( area == ATTR_BOUNDMARK)
{
redraw_window(CURRENT_WINDOW_FILEAREA);
touchwin(CURRENT_WINDOW_FILEAREA);
wnoutrefresh(CURRENT_WINDOW_FILEAREA);
}
#endif
break;
case WINDOW_PREFIX:
if (CURRENT_WINDOW_PREFIX != NULL)
{
wattrset(CURRENT_WINDOW_PREFIX,set_colour(CURRENT_FILE->attr+area));
build_screen(current_screen);
display_screen(current_screen);
}
break;
case WINDOW_COMMAND:
if (CURRENT_WINDOW_COMMAND != NULL)
{
wattrset(CURRENT_WINDOW_COMMAND,set_colour(CURRENT_FILE->attr+area));
redraw_window(CURRENT_WINDOW_COMMAND);
touchwin(CURRENT_WINDOW_COMMAND);
wnoutrefresh(CURRENT_WINDOW_COMMAND);
}
break;
case WINDOW_ARROW:
if (CURRENT_WINDOW_ARROW != NULL)
{
wattrset(CURRENT_WINDOW_ARROW,set_colour(CURRENT_FILE->attr+area));
redraw_window(CURRENT_WINDOW_ARROW);
touchwin(CURRENT_WINDOW_ARROW);
wnoutrefresh(CURRENT_WINDOW_ARROW);
}
break;
case WINDOW_IDLINE:
if (CURRENT_WINDOW_IDLINE != NULL)
{
wattrset(CURRENT_WINDOW_IDLINE,set_colour(CURRENT_FILE->attr+area));
redraw_window(CURRENT_WINDOW_IDLINE);
touchwin(CURRENT_WINDOW_IDLINE);
wnoutrefresh(CURRENT_WINDOW_IDLINE);
}
break;
case WINDOW_STATAREA:
if (statarea != NULL)
{
wattrset(statarea,set_colour(CURRENT_FILE->attr+area));
redraw_window(statarea);
touchwin(statarea);
wnoutrefresh(statarea);
}
break;
case WINDOW_FILETABS:
if (filetabs != NULL)
{
wattrset(filetabs,set_colour(CURRENT_FILE->attr+area));
redraw_window(filetabs);
touchwin(filetabs);
wnoutrefresh(filetabs);
}
break;
case WINDOW_DIVIDER:
if (divider != (WINDOW *)NULL)
{
wattrset(divider,set_colour(CURRENT_FILE->attr+area));
if (display_screens > 1
&& !horizontal)
{
draw_divider();
touchwin(divider);
wnoutrefresh(divider);
}
}
break;
case WINDOW_SLK:
#if defined(HAVE_SLK_INIT)
if ( max_slk_labels )
{
#if defined(HAVE_SLK_ATTRSET)
slk_attrset(set_colour(CURRENT_FILE->attr+area));
#else
display_error(61,(CHARTYPE *)"slk_attrset not in curses library",FALSE);
#endif
slk_touch();
slk_noutrefresh();
}
#endif
break;
default:
break;
}
TRACE_RETURN();
return(RC_OK);
}
/*man-start*********************************************************************
========================================================================
SET COMMAND REFERENCE
========================================================================
**man-end**********************************************************************/
/*man-start*********************************************************************
COMMAND
set alt - change alteration counts
SYNTAX
[SET] ALT [n] [m]
DESCRIPTION
The SET ALT command allows the user to change the alteration counts.
This command is usually called from within a macro.
The first number; 'n' sets the number of changes since the last
AUTOSAVE was issued.
The second number; 'm' sets the number of changes since the last
SAVE or SSAVE command was issued.
All options can be specified as the current EQUIVCHAR to retain the
existing value.
COMPATIBILITY
XEDIT: Compatible.
KEDIT: Compatible.
DEFAULT
OFF
SEE ALSO
<SET EQUIVCHAR>
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Alt(CHARTYPE *params)
#else
short Alt(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define ALT_PARAMS 2
CHARTYPE strip[ALT_PARAMS];
CHARTYPE *word[ALT_PARAMS+1];
unsigned short num_params=0;
unsigned short autosave_alt=CURRENT_FILE->autosave_alt;
unsigned short save_alt=CURRENT_FILE->save_alt;
TRACE_FUNCTION("commset1.c:Alt");
strip[0]=STRIP_BOTH;
num_params = param_split(params,word,ALT_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
if (num_params == 0)
{
display_error(3,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if (num_params > 2)
{
display_error(2,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if ( equal( word[0], EQUIVCHARstr, 1 ) )
autosave_alt = CURRENT_FILE->autosave_alt;
else
{
if (!valid_positive_integer(word[0]))
{
display_error(1,word[0],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
autosave_alt = atoi((DEFCHAR *)word[0]);
}
if (num_params == 2)
{
if ( equal( word[1], EQUIVCHARstr, 1 ) )
save_alt = CURRENT_FILE->save_alt;
else
{
if (!valid_positive_integer(word[1]))
{
display_error(1,word[1],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
save_alt = atoi((DEFCHAR *)word[1]);
}
}
CURRENT_FILE->autosave_alt = autosave_alt;
CURRENT_FILE->save_alt = save_alt;
TRACE_RETURN();
return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
set arbchar - set arbitrary character(s) for targets
SYNTAX
[SET] ARBchar ON|OFF [char1] [char2]
DESCRIPTION
Set the character to use as an 'arbitrary character' in string
targets. The first arbitrary character matches a group of zero
or more characters, the second will match exactly one character.
All options can be specified as the current EQUIVCHAR to retain the
existing value.
COMPATIBILITY
XEDIT: Compatible.
Single arbitrary character not supported.
KEDIT: Compatible.
Arbitrary character not supported in <CHANGE> or <SCHANGE> commands.
DEFAULT
Off $ ?
SEE ALSO
<SET EQUIVCHAR>
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Arbchar(CHARTYPE *params)
#else
short Arbchar(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define ARB_PARAMS 4
CHARTYPE *word[ARB_PARAMS+1];
CHARTYPE strip[ARB_PARAMS];
unsigned short num_params=0;
short rc=RC_INVALID_OPERAND;
bool arbsts=CURRENT_VIEW->arbchar_status;
CHARTYPE arbchr_single=CURRENT_VIEW->arbchar_single;
CHARTYPE arbchr_multiple=CURRENT_VIEW->arbchar_multiple;
TRACE_FUNCTION("commset1.c:Arbchar");
/*
* Validate the parameters that have been supplied.
*/
strip[0]=STRIP_BOTH;
strip[1]=STRIP_BOTH;
strip[2]=STRIP_BOTH;
strip[3]=STRIP_BOTH;
num_params = param_split(params,word,ARB_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
switch(num_params)
{
case 0:
/*
* No parameters, error.
*/
display_error(3,(CHARTYPE *)"",FALSE);
break;
case 1:
/*
* 1 or 2 parameters, validate them...
*/
if ( equal( word[0], EQUIVCHARstr, 1 ) )
;
else
rc = execute_set_on_off(word[0],&arbsts, TRUE );
break;
case 2:
case 3:
if ( equal( word[0], EQUIVCHARstr, 1 ) )
;
else
{
rc = execute_set_on_off(word[0],&arbsts, TRUE );
if (rc != RC_OK)
break;
}
rc = RC_INVALID_OPERAND;
/*
* For 2 parameters, check that a single character has been supplied...
*/
if ( equal( word[1], EQUIVCHARstr, 1 ) )
;
else
{
if (strlen((DEFCHAR *)word[1]) != 1)
{
display_error(1,word[1],FALSE);
break;
}
arbchr_multiple = word[1][0];
}
rc = RC_OK;
/*
* For 2 parameters, don't check any more.
*/
if (num_params == 2)
break;
rc = RC_INVALID_OPERAND;
/*
* For 3 parameters, check that a single character has been supplied...
*/
if ( equal( word[2], EQUIVCHARstr, 1 ) )
;
else
{
if (strlen((DEFCHAR *)word[2]) != 1)
{
display_error(1,word[2],FALSE);
break;
}
arbchr_single = word[2][0];
}
rc = RC_OK;
break;
default:
/*
* Too many parameters...
*/
display_error(2,(CHARTYPE *)"",FALSE);
break;
}
/*
* If valid parameters, change the settings...
*/
if (rc == RC_OK)
{
CURRENT_VIEW->arbchar_single = arbchr_single;
CURRENT_VIEW->arbchar_multiple = arbchr_multiple;
CURRENT_VIEW->arbchar_status = arbsts;
}
TRACE_RETURN();
return(rc);
}
/*man-start*********************************************************************
COMMAND
set autocolor - specifies which parser to use for syntax highlighting
SYNTAX
[SET] AUTOCOLOR mask parser [MAGIC]
DESCRIPTION
The SET AUTOCOLOR command allows the user to specify which syntax
highlighting <parser> is to be used for which file masks.
The 'parser' argument specifies a syntax highlighting <parser> that
already exists, either as a default <parser>, or added by the user
with <SET PARSER>. The special parser name of '*NULL' can be
specified; this will effectively remove the association between
the <parser> and the file mask.
The 'mask' argument specifies the file mask (or <magic number>) to
associate with the specified parser. The 'mask' can be any valid
file mask for the operating system. eg *.c fred.* joe.?
If the 'magic' option is specified, the 'mask' argument refers to
the last element of the <magic number> that is specified in the
first line of a Unix shell script comment. eg if the first line of
a shell script contains:
#!/usr/local/bin/rexx
then the file mask argument would be specified as "rexx".
COMPATIBILITY
XEDIT: N/A
KEDIT: Similar. KEDIT does not have MAGIC option.
DEFAULT
See <QUERY> AUTOCOLOR
SEE ALSO
<SET COLORING>, <SET ECOLOUR>, <SET PARSER>
STATUS
Complete.
**man-end**********************************************************************/
/*man-start*********************************************************************
COMMAND
set autocolour - specifies which parser to use for syntax highlighting
SYNTAX
[SET] AUTOCOLOUR mask parser [MAGIC]
DESCRIPTION
The SET AUTOCOLOUR command is a synonym for the <SET AUTOCOLOR> command.
COMPATIBILITY
XEDIT: N/A
KEDIT: Similar. KEDIT does not have MAGIC option.
DEFAULT
See <QUERY> AUTOCOLOR
SEE ALSO
<SET AUTOCOLOR>
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Autocolour(CHARTYPE *params)
#else
short Autocolour(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define AUCO_PARAMS 3
CHARTYPE *word[AUCO_PARAMS+1];
CHARTYPE strip[AUCO_PARAMS];
unsigned short num_params=0;
short rc=RC_OK;
PARSER_DETAILS *parser=NULL;
PARSER_MAPPING *mapping=NULL,*curr=NULL,*tmp_mapping;
CHARTYPE *filemask=NULL,*magic_number=NULL;
VIEW_DETAILS *curr_view=vd_first;
bool redisplay_current=FALSE,redisplay_other=FALSE;
int i,change=0;
TRACE_FUNCTION("commset1.c:Autocolour");
/*
* Validate the parameters that have been supplied.
*/
strip[0]=STRIP_BOTH;
strip[1]=STRIP_BOTH;
strip[2]=STRIP_BOTH;
num_params = param_split(params,word,AUCO_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
if (num_params < 2)
{
display_error(3,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
filemask = word[0];
if (num_params == 3)
{
if (equal((CHARTYPE *)"magic",word[2],5))
{
magic_number = word[0];
filemask = NULL;
}
else
{
display_error(1,word[2],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
}
/*
* Find a parser equal to the first parameter...
*/
if (!equal((CHARTYPE *)"*null",word[1],5))
{
parser = parserll_find(first_parser,word[1]);
if (parser == NULL)
{
display_error(199,word[1],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
}
/*
* Now check if we already have a mapping for the mask/magic number
*/
mapping = mappingll_find(first_parser_mapping,filemask,magic_number);
if (mapping)
curr = mapping;
/*
* Add the new mapping if it is a "real" parser.
*/
if (parser)
{
curr = last_parser_mapping = mappingll_add(first_parser_mapping,last_parser_mapping,sizeof(PARSER_MAPPING));
if (first_parser_mapping == NULL)
first_parser_mapping = curr;
if (filemask)
{
curr->filemask = (CHARTYPE *)(*the_malloc)(1+strlen((DEFCHAR *)filemask)*sizeof(CHARTYPE));
if (curr->filemask == NULL)
{
display_error(30,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_OUT_OF_MEMORY);
}
strcpy((DEFCHAR *)curr->filemask,(DEFCHAR *)filemask);
}
if (magic_number)
{
curr->magic_number = (CHARTYPE *)(*the_malloc)(1+strlen((DEFCHAR *)magic_number)*sizeof(CHARTYPE));
if (curr->magic_number == NULL)
{
display_error(30,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_OUT_OF_MEMORY);
}
strcpy((DEFCHAR *)curr->magic_number,(DEFCHAR *)magic_number);
curr->magic_number_length = strlen((DEFCHAR *)magic_number);
}
curr->parser = parser;
}
/*
* Check all files in the ring and apply the new mapping. If the current
* file or the file in the other screen now match the new mapping,
* redisplay them.
*/
for (i=0;i<number_of_files;)
{
if (curr
&& find_parser_mapping(curr_view->file_for_view,curr))
{
curr_view->file_for_view->parser = parser;
if (curr_view->file_for_view == SCREEN_FILE(current_screen))
redisplay_current = TRUE;
if (display_screens > 1
&& curr_view->file_for_view == SCREEN_FILE( (CHARTYPE)(other_screen) ))
redisplay_other = TRUE;
}
curr_view = curr_view->next;
if (curr_view == NULL)
break;
}
/*
* Now delete the old mapping if we found one earlier...
*/
if (mapping)
{
mappingll_del(&first_parser_mapping,&last_parser_mapping,mapping,DIRECTION_FORWARD);
change--;
}
if (parser)
{
change++;
}
if (rexx_support)
{
if (change > 0)
{
CHARTYPE tmp[20];
/*
* As this is a new mapping, then register another implied extract
* function for the number of mappings we now have.
*/
for(i=0,tmp_mapping=first_parser_mapping;tmp_mapping!=NULL;tmp_mapping=tmp_mapping->next,i++);
sprintf((DEFCHAR *)tmp,"autocolour.%d",i);
MyRexxRegisterFunctionExe(tmp);
sprintf((DEFCHAR *)tmp,"autocolor.%d",i);
MyRexxRegisterFunctionExe(tmp);
}
if (change < 0)
{
CHARTYPE tmp[20];
/*
* As this is a removal of a mapping, then deregister the implied extract
* function for the number of mappings we had before.
*/
for(i=0,tmp_mapping=first_parser_mapping;tmp_mapping!=NULL;tmp_mapping=tmp_mapping->next,i++);
sprintf((DEFCHAR *)tmp,"autocolour.%d",i-1);
MyRexxDeregisterFunction(tmp);
sprintf((DEFCHAR *)tmp,"autocolor.%d",i-1);
MyRexxDeregisterFunction(tmp);
}
}
if (redisplay_other)
display_screen( (CHARTYPE)(other_screen) );
if (redisplay_current)
display_screen(current_screen);
TRACE_RETURN();
return(rc);
}
/*man-start*********************************************************************
COMMAND
set autosave - set autosave period
SYNTAX
[SET] AUtosave n|OFF
DESCRIPTION
The SET AUTOSAVE command sets the interval between automatic saves
of the file, or turns it off altogether. The interval 'n' refers
to the number of alterations made to the file. Hence a value of
10 for 'n' would result in the file being automatically saved after
each 10 alterations have been made to the file.
It is not possible to set AUTOSAVE for 'pseudo' files such as the
directory listing 'file', Rexx output 'file' and the key definitions
'file'
COMPATIBILITY
XEDIT: Does not support [mode] option.
KEDIT: Compatible.
DEFAULT
OFF
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Autosave(CHARTYPE *params)
#else
short Autosave(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define AUS_PARAMS 1
CHARTYPE strip[AUS_PARAMS];
CHARTYPE *word[AUS_PARAMS+1];
unsigned short num_params=0;
TRACE_FUNCTION("commset1.c:Autosave");
strip[0]=STRIP_BOTH;
num_params = param_split(params,word,AUS_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
if (num_params == 0)
{
display_error(3,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if (num_params != 1)
{
display_error(2,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if (equal((CHARTYPE *)"off",word[0],3))
{
CURRENT_FILE->autosave = 0;
TRACE_RETURN();
return(RC_OK);
}
if (!valid_positive_integer(word[0]))
{
display_error(4,(CHARTYPE *)word[0],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
CURRENT_FILE->autosave = (CHARTYPE)atoi((DEFCHAR *)word[0]);
TRACE_RETURN();
return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
set autoscroll - set rate of automatic horizontal scrolling
SYNTAX
[SET] AUTOSCroll n|OFF|Half
DESCRIPTION
The SET AUTOSCROLL allows the user to set the rate at which automatic
horizontal scrolling occurs.
When the cursor reaches the last (or first) column of the <filearea>
the <filearea> can automatically scroll if AUTOSCROLL is not 'OFF' and
a <CURSOR> RIGHT or <CURSOR> LEFT command is issued.
How many columns are scrolled is determined by the setting of AUTOSCROLL.
If AUTOSCROLL is set to 'HALF', then half the number of columns in the
<filearea> window are scrolled. Any other value will result in that
many columns scrolled, or the full width of the <filearea> window if
the set number of columns is larger.
Autoscrolling does not occur if the key pressed is assigned to
<CURSOR> SCREEN LEFT or RIGHT, which is the case if <SET COMPAT> XEDIT
key definitions are active.
COMPATIBILITY
XEDIT: N/A
KEDIT: Compatible.
DEFAULT
HALF
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Autoscroll(CHARTYPE *params)
#else
short Autoscroll(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
#define AUL_PARAMS 1
CHARTYPE strip[AUL_PARAMS];
CHARTYPE *word[AUL_PARAMS+1];
unsigned short num_params=0;
TRACE_FUNCTION("commset1.c:Autoscroll");
strip[0]=STRIP_BOTH;
num_params = param_split(params,word,AUL_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
if (num_params == 0)
{
display_error(3,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if (num_params != 1)
{
display_error(2,(CHARTYPE *)"",FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if (equal((CHARTYPE *)"off",word[0],3))
{
CURRENT_VIEW->autoscroll = 0;
TRACE_RETURN();
return(RC_OK);
}
if (equal((CHARTYPE *)"half",word[0],1))
{
CURRENT_VIEW->autoscroll = (-1);
TRACE_RETURN();
return(RC_OK);
}
if (!valid_positive_integer(word[0]))
{
display_error(4,(CHARTYPE *)word[0],FALSE);
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
CURRENT_VIEW->autoscroll = (CHARTYPE)atol((DEFCHAR *)word[0]);
TRACE_RETURN();
return(RC_OK);
}
/*man-start*********************************************************************
COMMAND
set backup - indicate if a backup copy of the file is to be kept
SYNTAX
[SET] BACKup OFF|TEMP|KEEP|ON|INPLACE [suffix]
DESCRIPTION
The SET BACKUP command allows the user to determine if a backup copy
of the original file is to be kept when the file being edited is
saved or filed.
'KEEP' and 'ON' options are the same. 'ON' is
kept for compatibility with previous versions of THE.
With 'OFF', the file being written to disk will replace an
existing file. There is a chance that you will end up with neither
the old version of the file or the new one if problems occur
while the file is being written.
With 'TEMP' or 'KEEP' options, the file being written is first
renamed to the filename with a .bak extension. The file in memory
is then written to disk. If 'TEMP' is in effect, the backup
file is then deleted.
With 'INPLACE', the file being written is first copied to a file
with a .bak extension. The file in memory is then written to disk
in place of the original. This option ensures that all operating
system file attributes are retained.
The optional 'suffix' specifies the string to append to the file name
of the backup copy including a period if required. The maximum length
of 'suffix' is 100 characters.
By default this is ".bak".
COMPATIBILITY
XEDIT: N/A
KEDIT: Compatible.
'suffix' is a THE extension
DEFAULT
KEEP
SEE ALSO
<FILE>, <FFILE>, <SAVE>, <SSAVE>
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short Backup(CHARTYPE *params)
#else
short Backup(params)
CHARTYPE *params;
#endif
/***********************************************************************/
{
short rc=RC_OK;
#define BAC_PARAMS 2
CHARTYPE *word[BAC_PARAMS+1];
CHARTYPE strip[BAC_PARAMS];
short num_params=0;
TRACE_FUNCTION( "commset1.c:Backup" );
strip[0]=STRIP_BOTH;
strip[1]=STRIP_BOTH;
num_params = param_split( params, word, BAC_PARAMS, WORD_DELIMS, TEMP_PARAM, strip, FALSE );
if ( num_params == 0 )
{
display_error( 3, (CHARTYPE *)"", FALSE );
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
if ( num_params > 2 )
{
display_error( 2, (CHARTYPE *)"", FALSE );
TRACE_RETURN();
return(RC_INVALID_OPERAND);
}
/*
* Validate the first parameter
*/
if ( equal( (CHARTYPE *)"off", word[0], 3 ) )
CURRENT_FILE->backup = BACKUP_OFF;
else if ( equal( (CHARTYPE *)"on", word[0], 2 ) )
CURRENT_FILE->backup = BACKUP_ON;
else if ( equal( (CHARTYPE *)"keep", word[0], 4 ) )
CURRENT_FILE->backup = BACKUP_KEEP;
else if ( equal( (CHARTYPE *)"temp", word[0], 4 ) )
CURRENT_FILE->backup = BACKUP_TEMP;
else if ( equal( (CHARTYPE *)"inplace", word[0], 2 ) )
CURRENT_FILE->backup = BACKUP_INPLACE;
else
{
display_error( 1, word[0], FALSE );
rc = RC_INVALID_OPERAND;
}
if ( num_params == 2 )
{
/*
* Save the second arg as the backup suffix
*/
if ( strlen( (DEFCHAR *)word[1] ) > 100 )
{
display_error( 37, word[1], FALSE );
rc = RC_INVALID_OPERAND;
}
else
{
strcpy( (DEFCHAR *)BACKUP_SUFFIXx, (DEFCHAR *)word[1] );
}
}
TRACE_RETURN();
return(rc);
}
/*man-start*********************************************************************
COMMAND
set beep - turn on or off the audible alarm when displaying errors
SYNTAX
[SET] BEEP ON|OFF
DESCRIPTION
The SET BEEP command allows the user to determine if an audible
alarm is sounded when an error is displayed.
COMPATIBILITY
XEDIT: N/A
KEDIT: Compatible.
DEFAULT
OFF
STATUS
Complete.
**man-end**********************************************************************/
#ifdef HAVE_PROTO
short BeepSound(CHARTYPE *params)
#else
short BeepSound(params)
CHARTYPE *params;