├── COPYING ├── ChangeLog ├── INSTALL ├── INSTALL.AMIGA ├── Makefile.am ├── NEWS ├── README ├── acinclude.m4 ├── autojoe ├── charmaps └── klingon.in ├── configure.ac ├── cygbuild ├── docs ├── HACKING ├── HINTS ├── LIST └── help-system.html ├── htdocs ├── Makefile ├── capture.gif ├── cg2000.jpg ├── changelog-src.html ├── elaborate.gif ├── footer-src.html ├── hacking-src.html ├── header-src.html ├── hints-src.html ├── history-src.html ├── html.c ├── index-src.html ├── list-src.html ├── manpage-src.html ├── news-src.html ├── options-src.html └── trs80_16.jpg ├── joe ├── Makefile.am ├── TODO ├── b.c ├── b.h ├── blocks.c ├── blocks.h ├── builtin.c ├── builtin.h ├── builtins.c ├── bw.c ├── bw.h ├── charmap.c ├── charmap.h ├── cmd.c ├── cmd.h ├── config.h ├── dir.c ├── gettext.c ├── gettext.h ├── hash.c ├── hash.h ├── help.c ├── help.h ├── i18n.c ├── i18n.h ├── kbd.c ├── kbd.h ├── lattr.c ├── lattr.h ├── macro.c ├── macro.h ├── main.c ├── main.h ├── menu.c ├── menu.h ├── mouse.c ├── mouse.h ├── path.c ├── path.h ├── poshist.c ├── poshist.h ├── pw.c ├── pw.h ├── queue.c ├── queue.h ├── qw.c ├── qw.h ├── rc.c ├── rc.h ├── regex.c ├── regex.h ├── scrn.c ├── scrn.h ├── selinux.c ├── syntax.c ├── syntax.h ├── tab.c ├── tab.h ├── termcap.c ├── termcapj.h ├── termidx.c ├── tty.c ├── tty.h ├── tw.c ├── tw.h ├── types.h ├── ublock.c ├── ublock.h ├── uedit.c ├── uedit.h ├── uerror.c ├── uerror.h ├── ufile.c ├── ufile.h ├── uformat.c ├── uformat.h ├── uisrch.c ├── uisrch.h ├── umath.c ├── umath.h ├── undo.c ├── undo.h ├── usearch.c ├── usearch.h ├── ushell.c ├── ushell.h ├── utag.c ├── utag.h ├── utf8.c ├── utf8.h ├── utils.c ├── utils.h ├── va.c ├── va.h ├── vfile.c ├── vfile.h ├── vs.c ├── vs.h ├── w.c └── w.h ├── man ├── Makefile.am ├── joe.1.in └── ru │ ├── Makefile.am │ └── joe.1.in ├── po ├── HOWTO ├── Makefile.am ├── de.po ├── fr.po ├── joe.pot ├── ru.po └── uk.po ├── rc ├── Makefile.am ├── ftyperc ├── jicerc.ru.in ├── jmacsrc.in ├── joerc.in ├── jpicorc.in ├── jstarrc.in └── rjoerc.in ├── setup.hint ├── syntax ├── 4gl.jsf.in ├── Makefile.am ├── ada.jsf.in ├── asm.jsf.in ├── awk.jsf.in ├── c.jsf.in ├── classic_pascal.jsf.in ├── cobol.jsf.in ├── conf.jsf.in ├── csh.jsf.in ├── css.jsf.in ├── diff.jsf.in ├── fortran.jsf.in ├── haskell.jsf.in ├── html.jsf.in ├── java.jsf.in ├── joerc.jsf.in ├── jsf.jsf.in ├── jsf_check.jsf.in ├── lisp.jsf.in ├── lua.jsf.in ├── m4.jsf.in ├── mail.jsf.in ├── mason.jsf.in ├── matlab.jsf.in ├── ocaml.jsf.in ├── pascal.jsf.in ├── perl.jsf.in ├── php.jsf.in ├── ps.jsf.in ├── python.jsf.in ├── rexx.jsf.in ├── ruby.jsf.in ├── sed.jsf.in ├── sh.jsf.in ├── skill.jsf.in ├── sml.jsf.in ├── spec.jsf.in ├── sql.jsf.in ├── tcl.jsf.in ├── tex.jsf.in ├── troff.jsf.in ├── verilog.jsf.in ├── vhdl.jsf.in └── xml.jsf.in ├── xterm-patch └── xterm-readme /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/ChangeLog -------------------------------------------------------------------------------- /INSTALL.AMIGA: -------------------------------------------------------------------------------- 1 | 1. Introduction 2 | --------------- 3 | This file describes particular issues on AmigaOS port of JOE. 4 | 5 | 2. Requirements 6 | --------------- 7 | To compile JOE you need ncurses and termcap libraries installed. 8 | 9 | 3. Installation 10 | --------------- 11 | - Extract the archive into your GeekGadgets tree 12 | - Go to AmigaOS shell and execute "setenv TERM amiga" 13 | - Copy file ENV:TERM to your ENVARC: directory. 14 | 15 | 4. Usage 16 | -------- 17 | Unfortunately ixemul.library does not implement pseudo-terminals (ptys), so 18 | inserting shell command output (CTRL-K !) does not work. All other functions 19 | are fully implemented and work exactly in the same way as in UNIX version. 20 | 21 | 5. Compiling 22 | ------------ 23 | To recompile JOE just cd to the directory with sources and type (if you use 24 | standard Amiga shell): 25 | 26 | sh configure --prefix=/gg 27 | 28 | From UNIX shell (like ksh) you may just type: 29 | 30 | ./configure --prefix=/gg 31 | 32 | When the configuration process finishes, type: 33 | 34 | make 35 | 36 | After compiling you may install the program by using: 37 | 38 | make install 39 | 40 | To clean up the distribution (erase all binary and #?.o files) you can use: 41 | 42 | make clean 43 | 44 | 6. Known bugs 45 | ------------- 46 | AmigaOS port of JOE currently has no specific bugs 47 | 48 | 7. Port author 49 | --------- 50 | My name is Pavel Fedin, i live in Russia, and you can always reach me by 51 | E-Mail: 52 | 53 | sonic_amiga@rambler.ru -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | SUBDIRS = man rc po syntax joe 4 | 5 | EXTRA_DIST = COPYING docs/LIST docs/HACKING ChangeLog NEWS README INSTALL INSTALL.AMIGA \ 6 | docs/help-system.html charmaps/klingon.in docs/HINTS \ 7 | cygbuild setup.hint xterm-patch xterm-readme autojoe 8 | 9 | sysconf_joedir = $(sysconfdir)/joe 10 | data_joedir = $(datadir)/joe 11 | 12 | data_charmapsdir = $(data_joedir)/charmaps 13 | data_charmaps_DATA = charmaps/klingon 14 | 15 | data_docdir = $(docdir) 16 | data_doc_DATA = docs/LIST README docs/HINTS ChangeLog docs/HACKING NEWS 17 | 18 | install-exec-hook: 19 | rm -f $(DESTDIR)$(bindir)/jmacs $(DESTDIR)$(bindir)/jstar $(DESTDIR)$(bindir)/rjoe $(DESTDIR)$(bindir)/jpico 20 | rm -f $(DESTDIR)$(bindir)/jmacs.exe $(DESTDIR)$(bindir)/jstar.exe $(DESTDIR)$(bindir)/rjoe.exe $(DESTDIR)$(bindir)/jpico.exe 21 | for i in jmacs jstar rjoe jpico ; do $(LN_S) joe $(DESTDIR)$(bindir)/$$i ; done 22 | 23 | uninstall-local: 24 | rm -f $(DESTDIR)$(bindir)/jmacs $(DESTDIR)$(bindir)/jstar $(DESTDIR)$(bindir)/rjoe $(DESTDIR)$(bindir)/jpico 25 | rm -f $(DESTDIR)$(bindir)/jmacs.exe $(DESTDIR)$(bindir)/jstar.exe $(DESTDIR)$(bindir)/rjoe.exe $(DESTDIR)$(bindir)/jpico.exe 26 | -------------------------------------------------------------------------------- /acinclude.m4: -------------------------------------------------------------------------------- 1 | dnl ------------------ 2 | dnl Check for properly working isblank() 3 | dnl ------------------ 4 | AC_DEFUN([joe_ISBLANK], 5 | [AC_CACHE_CHECK([whether isblank() works correctly with side effect expressions], 6 | [joe_cv_isblank], 7 | [AC_TRY_RUN([ 8 | #include 9 | int main() { 10 | int a = 0; 11 | isblank(a++); 12 | exit(a != 1); 13 | } 14 | ], 15 | [joe_cv_isblank=yes], 16 | [joe_cv_isblank=no], 17 | [joe_cv_isblank=no]) 18 | ]) 19 | if test "$joe_cv_isblank" = yes; then 20 | AC_DEFINE([HAVE_WORKING_ISBLANK], 1, [Define if isblank() works with expressions with side effects]) 21 | fi 22 | ]) 23 | 24 | dnl ------------------ 25 | dnl Check if setpgrp must have two arguments 26 | dnl autoconf-own macro is damaged for *BSD systems 27 | dnl ------------------ 28 | AC_DEFUN([joe_SETPGRP], 29 | [AC_CACHE_CHECK([whether setpgrp() takes no arguments], 30 | [joe_cv_setpgrp_void], 31 | [AC_TRY_RUN([ 32 | #if HAVE_UNISTD_H 33 | #include 34 | #endif 35 | int main() { 36 | /* exit succesfully if setpgrp() takes two args (*BSD systems) */ 37 | exit(setpgrp(0, 0) != 0); 38 | }], 39 | [joe_cv_setpgrp_void=no], 40 | [joe_cv_setpgrp_void=yes], 41 | [joe_cv_setpgrp_void=yes]) 42 | ]) 43 | if test "$joe_cv_setpgrp_void" = yes; then 44 | AC_DEFINE([SETPGRP_VOID], 1, [Define if setpgrp() takes no arguments]) 45 | fi 46 | ]) 47 | 48 | dnl ------------------ 49 | dnl Check to see if signal handlers must be reinstalled when invoked 50 | dnl ------------------ 51 | AC_DEFUN([joe_REINSTALL_SIGHANDLERS], 52 | [AC_CACHE_CHECK([whether sighandlers must be reinstalled], 53 | [joe_cv_reinstall_sighandlers], 54 | [AC_TRY_RUN([ 55 | #if HAVE_UNISTD_H 56 | #include 57 | #endif 58 | #if HAVE_SIGNAL_H 59 | #include 60 | #endif 61 | 62 | #ifndef HAVE_SIGHANDLER_T 63 | typedef RETSIGTYPE (*sighandler_t)(int); 64 | #endif 65 | 66 | int nsigint; 67 | 68 | void set_signal(int signum, sighandler_t handler) { 69 | #if HAVE_SIGACTION 70 | struct sigaction sact; 71 | 72 | sact.sa_handler = handler; 73 | sact.sa_flags = 0; 74 | sigemptyset(&sact.sa_mask); 75 | sigaction(signum, &sact, NULL); 76 | #elif HAVE_SIGVEC 77 | struct sigvec svec; 78 | 79 | svec.sv_handler = handler; 80 | svec.sv_flags = 0; 81 | sigemptyset(&svec.sv_mask); 82 | sigvec(signum, &svec, NULL); 83 | #else 84 | signal(signum, handler); 85 | #endif 86 | } 87 | 88 | RETSIGTYPE sigint(int s) { 89 | nsigint++; 90 | } 91 | 92 | int main() { 93 | nsigint = 0; 94 | set_signal(SIGINT, sigint); 95 | kill((int)getpid(), SIGINT); 96 | kill((int)getpid(), SIGINT); 97 | /* exit succesfully if don't have to reinstall sighandler when invoked */ 98 | exit(nsigint != 2); 99 | }], 100 | [joe_cv_reinstall_sighandlers=no], 101 | [joe_cv_reinstall_sighandlers=yes], 102 | [joe_cv_reinstall_sighandlers=yes]) 103 | ]) 104 | if test "$joe_cv_reinstall_sighandlers" = yes; then 105 | AC_DEFINE([NEED_TO_REINSTALL_SIGNAL], 1, [Define if we have to reinstall signal handler when invoked]) 106 | fi 107 | ]) 108 | -------------------------------------------------------------------------------- /autojoe: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # The automake and autoconf commands which need to be run 4 | 5 | aclocal 6 | 7 | autoheader -I joe 8 | 9 | automake -a -c 10 | 11 | automake -a -c man/Makefile 12 | 13 | automake -a -c joe/Makefile 14 | 15 | automake -a -c man/ru/Makefile 16 | 17 | automake -a -c rc/Makefile 18 | 19 | automake -a -c syntax/Makefile 20 | 21 | automake -a -c po/Makefile 22 | 23 | autoconf 24 | -------------------------------------------------------------------------------- /cygbuild: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Do cygwin build 4 | 5 | # this creates: joe-3.6-1.tar.bz2 and joe-3.6-1-src.tar.bz2 6 | # you also need setup.hint 7 | 8 | JOEVERSION=3.7 9 | CYGVERSION=3.7-1 10 | 11 | ./autojoe 12 | 13 | # Force use of /etc/termcap file because Cygwin's tgoto() is broken 14 | 15 | # Install aspell first! 16 | 17 | ./configure \ 18 | --prefix=/usr \ 19 | --sysconfdir=/etc \ 20 | --libexecdir=/usr/sbin \ 21 | --localstatedir=/var \ 22 | --datadir=/usr/share \ 23 | --mandir=/usr/share/man \ 24 | --infodir=/usr/share/info \ 25 | --docdir=/usr/share/doc/joe-${JOEVERSION} \ 26 | --disable-curses \ 27 | --disable-termcap 28 | 29 | make clean 30 | 31 | make 32 | 33 | make install 34 | 35 | (cd /; tar cf - etc/joe usr/share/joe usr/share/doc/joe-${JOEVERSION} \ 36 | usr/bin/joe.exe usr/bin/jmacs usr/bin/jstar \ 37 | usr/bin/jpico usr/bin/rjoe `cd /; \ 38 | find usr/share/man -name 'joe.1'`) | bzip2 >joe-$CYGVERSION.tar.bz2 39 | 40 | make dist 41 | 42 | gunzip joe-$CYGVERSION-src.tar.bz2 43 | -------------------------------------------------------------------------------- /docs/HACKING: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/docs/HACKING -------------------------------------------------------------------------------- /docs/help-system.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | JOE 2.9.7pre3 -> Help system 4 | 5 | 6 |

JOE:: Help system

7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Name: Help system
Files: help.c, help.h
Since: 2.9.7pre1
Main authors: Joseph Allen
Marek 'marx' Grac <xgrac@fi.muni.cz>
25 |

26 | Differences between this and previous version should be hidden 27 | to users. Main changes were done in design of source code. I 28 | will try to explain what it is and why it is done this 29 | way? Main goal was to clean and minimalize source code, 30 | remove several global variables, move everything concerned with 31 | help to these files. 32 |

33 |

34 | The help system is based on bi-directional list of help screens. 35 | Each help screen has defined two variables, help text (char 36 | *hlptxt) and number of lines of help text (int 37 | hlplns). Since this version the help file can/should be 38 | separated from *rc files. Advantage of this model is that you 39 | can set help to other languages. Usage of standard method 40 | (gettext) will be very difficult here, because help has constant 41 | width which can't be overcrossed. This method has also no 42 | problem with having several help files in each language (for 43 | joe, jmacs, ...). Problematics of setting proper help file will 44 | be solved in main.c not here. 45 |

46 |

How to create a help file

47 |

48 | Help file consist of prologue, body and epilogue for each of the 49 | screens. Each help screen must begin with {%name where 50 | %name is only symbolic name of this screen and is not 51 | used in program. The body of help screen contains text which 52 | will be showed on the user screen and tags which takes care of 53 | special information (bold, flash, ...). There is list of the 54 | tags with theirs functions: 55 |

    56 |
  • \i to turn on/off inverse video
  • 57 |
  • \u to turn on/off underline
  • 58 |
  • \b to turn on/off bold
  • 59 |
  • \d to turn on/off dim
  • 60 |
  • \f to turn on/off flash
  • 61 |
62 | These tags are inserted into help screen text, but they are not 63 | visible in the help screen (visible are only their effects, but this 64 | is their purpose :)) 65 |

66 |

67 | Some hints how to write a new help screen. Standard help screens have 68 | 80 characters per line (including borders) so they are visible on text 69 | console. Sequences of keys are usually written as ^KD where 70 | ^ means CTRL + next character K and then key named D 71 | should be pressed. 72 |

73 |
74 |

75 | Any comments, ideas, questions send to me at xgrac@fi.muni.cz 76 |

77 | 78 | 79 | -------------------------------------------------------------------------------- /htdocs/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | HTDOCS = history.html news.html changelog.html manpage.html index.html hints.html hacking.html list.html options.html 4 | 5 | GIFS = capture.gif elaborate.gif cg2000.jpg trs80_16.jpg 6 | 7 | all : ${HTDOCS} 8 | 9 | publish : ${HTDOCS} ${GIFS} 10 | scp ${HTDOCS} ${GIFS} jhallen,joe-editor@web.sourceforge.net:htdocs 11 | 12 | clean : 13 | /bin/rm -f ${HTDOCS} 14 | 15 | index.html : header-src.html index-src.html footer-src.html 16 | sed "s,@title@,Joe's Own Editor," $@ 17 | 18 | manpage.html : header-src.html manpage-src.html footer-src.html 19 | sed "s,@title@,Joe's Own Editor - man page," $@ 20 | 21 | changelog.html : header-src.html changelog-src.html footer-src.html 22 | sed "s,@title@,Joe's Own Editor - Change Log," $@ 23 | 24 | news.html : header-src.html news-src.html footer-src.html 25 | sed "s,@title@,Joe's Own Editor - News," $@ 26 | 27 | history.html : header-src.html history-src.html footer-src.html 28 | sed "s,@title@,Joe's Own Editor - History," $@ 29 | 30 | hints.html : header-src.html hints-src.html footer-src.html 31 | sed "s,@title@,Joe's Own Editor - Hints," $@ 32 | 33 | hacking.html : header-src.html hacking-src.html footer-src.html 34 | sed "s,@title@,Joe's Own Editor - Hacking," $@ 35 | 36 | list.html : header-src.html list-src.html footer-src.html 37 | sed "s,@title@,Joe's Own Editor - Commands," $@ 38 | 39 | options.html : header-src.html options-src.html footer-src.html 40 | sed "s,@title@,Joe's Own Editor - Options," $@ 41 | -------------------------------------------------------------------------------- /htdocs/capture.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/capture.gif -------------------------------------------------------------------------------- /htdocs/cg2000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/cg2000.jpg -------------------------------------------------------------------------------- /htdocs/changelog-src.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/changelog-src.html -------------------------------------------------------------------------------- /htdocs/elaborate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/elaborate.gif -------------------------------------------------------------------------------- /htdocs/footer-src.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /htdocs/header-src.html: -------------------------------------------------------------------------------- 1 | 2 | @title@ 3 | 4 | joe   5 | Joe's Own Editor
6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 29 |
@title@
15 |
16 | Home page
17 | Change Log
18 | News
19 | Man page
20 | Hints
21 | Commands
22 | Options
23 | Hacking
24 | History
25 |
26 | Project page
27 | Download source
28 |
30 |
31 | -------------------------------------------------------------------------------- /htdocs/html.c: -------------------------------------------------------------------------------- 1 | /* Convert text file into html */ 2 | 3 | void fix(char *o, char *i) 4 | { 5 | for (; *i; ++i) 6 | if (*i=='&') 7 | { 8 | *o++ = '&'; 9 | *o++ = 'a'; 10 | *o++ = 'm'; 11 | *o++ = 'p'; 12 | *o++ = ';'; 13 | } 14 | else if (*i=='<') 15 | { 16 | *o++ = '&'; 17 | *o++ = 'l'; 18 | *o++ = 't'; 19 | *o++ = ';'; 20 | } 21 | else if (*i=='>') 22 | { 23 | *o++ = '&'; 24 | *o++ = 'g'; 25 | *o++ = 't'; 26 | *o++ = ';'; 27 | } 28 | else 29 | *o++ = *i; 30 | *o = 0; 31 | } 32 | 33 | main() 34 | { 35 | char buf[1024]; 36 | char fixed[1024]; 37 | int inpara = 0; 38 | while(gets(buf)) 39 | { 40 | int x; 41 | int isblank = 1; 42 | fix(fixed, buf); 43 | for (x = 0; buf[x]; ++x) 44 | if(buf[x] != ' ' && buf[x] != '\t') 45 | isblank = 0; 46 | if (!inpara) 47 | { 48 | if (isblank) 49 | { 50 | printf("\n"); 51 | } 52 | else 53 | { 54 | inpara = 1; 55 | printf("

%s\n",fixed); 56 | } 57 | } 58 | else 59 | { 60 | if (isblank) 61 | { 62 | printf("

\n"); 63 | inpara = 0; 64 | } 65 | else 66 | { 67 | printf("%s\n",fixed); 68 | } 69 | } 70 | } 71 | if (inpara) 72 | printf("

\n"); 73 | } 74 | -------------------------------------------------------------------------------- /htdocs/index-src.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/index-src.html -------------------------------------------------------------------------------- /htdocs/trs80_16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/htdocs/trs80_16.jpg -------------------------------------------------------------------------------- /joe/Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign 2 | 3 | EXTRA_DIST = TODO 4 | 5 | sysconf_joedir = $(sysconfdir)/joe 6 | data_joedir = $(datadir)/joe 7 | 8 | noinst_HEADERS = b.h blocks.h bw.h cmd.h config.h hash.h help.h kbd.h \ 9 | macro.h main.h menu.h path.h poshist.h pw.h queue.h qw.h rc.h regex.h \ 10 | scrn.h tab.h termcapj.h tty.h tw.h types.h ublock.h uedit.h uerror.h \ 11 | ufile.h uformat.h uisrch.h umath.h undo.h usearch.h ushell.h utag.h \ 12 | utils.h va.h vfile.h vs.h w.h utf8.h syntax.h i18n.h charmap.h mouse.h \ 13 | lattr.h gettext.h builtin.h 14 | 15 | bin_PROGRAMS = joe termidx 16 | INCLUDES = -DJOERC="\"$(sysconf_joedir)/\"" -DJOEDATA="\"$(data_joedir)/\"" 17 | 18 | # joe_LDADD = -lm 19 | 20 | joe_SOURCES = b.c blocks.c bw.c cmd.c hash.c help.c kbd.c macro.c main.c menu.c \ 21 | path.c poshist.c pw.c queue.c qw.c rc.c regex.c scrn.c tab.c termcap.c \ 22 | tty.c tw.c ublock.c uedit.c uerror.c ufile.c uformat.c uisrch.c umath.c \ 23 | undo.c usearch.c ushell.c utag.c va.c vfile.c vs.c w.c utils.c syntax.c \ 24 | utf8.c selinux.c i18n.c charmap.c mouse.c lattr.c gettext.c builtin.c \ 25 | builtins.c 26 | 27 | termidx_SOURCES = termidx.c 28 | 29 | distclean-local: 30 | rm -f *~ 31 | 32 | .PHONY: termcap 33 | -------------------------------------------------------------------------------- /joe/TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/joe/TODO -------------------------------------------------------------------------------- /joe/blocks.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fast block move/copy subroutines 3 | * 4 | * These exist because memmove on older UNIXs was really slow. 5 | * 6 | * Copyright 7 | * (C) 1992 Joseph H. Allen 8 | * 9 | * This file is part of JOE (Joe's Own Editor) 10 | */ 11 | #ifndef _JOE_BLOCKS_H 12 | #define _JOE_BLOCKS_H 1 13 | 14 | /* char *mmove(char *d,char *s,int sz); Copy 'sz' bytes from 's' to 'd'. 15 | * Chooses either mbkwd or mfwrd to do this such that the data won't get 16 | * clobbered. 17 | */ 18 | void *mmove PARAMS((void *d, void *s, int sz)); 19 | 20 | /* char *mset(char *d,char c,int sz); Set 'sz' bytes at 'd' to 'c'. 21 | * If 'sz'==0 nothing happens 22 | * Return original value of 'd' 23 | */ 24 | unsigned char *mset PARAMS((void *dest, unsigned char c, int sz)); 25 | 26 | /* int *msetI(int *d,int c,int sz); Set 'sz' ints at 'd' to 'c'. 27 | * If 'sz'==0 nothing happens 28 | * Returns orininal value of 'd' 29 | */ 30 | int *msetI PARAMS((void *dest, int c, int sz)); 31 | 32 | /* void **msetP(void **d,void *c,int sz); Set 'sz' pointers at 'd' to 'c'. 33 | * If 'sz'==0 nothing happens 34 | * Returns orininal value of 'd' 35 | */ 36 | void **msetP PARAMS((void **dest, void *c, int sz)); 37 | 38 | /* int mcnt(char *blk,char c,int size); 39 | * 40 | * Count the number of occurances a character appears in a block 41 | */ 42 | int mcnt PARAMS((unsigned char *blk, unsigned char c, int size)); 43 | 44 | #ifdef junk 45 | /* char *mchr(char *s,char c); 46 | * 47 | * Return address of first 'c' following 's'. 48 | */ 49 | unsigned char *mchr PARAMS(()); 50 | #endif 51 | #endif 52 | -------------------------------------------------------------------------------- /joe/builtin.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Built-in config files 3 | * Copyright 4 | * (C) 2006 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | JFILE *jfopen(unsigned char *name, char *mode) 11 | { 12 | if (name[0] == '*') { 13 | int x; 14 | for (x = 0; builtins[x]; x += 2) { 15 | if (!zcmp(builtins[x], name + 1)) { 16 | JFILE *j = (JFILE *)joe_malloc(sizeof(JFILE)); 17 | j->f = 0; 18 | j->p = builtins[x + 1]; 19 | return j; 20 | } 21 | } 22 | return 0; 23 | } else { 24 | FILE *f = fopen((char *)name, (char *)mode); 25 | if (f) { 26 | JFILE *j = (JFILE *)joe_malloc(sizeof(JFILE)); 27 | j->f = f; 28 | j->p = 0; 29 | return j; 30 | } else { 31 | return 0; 32 | } 33 | } 34 | } 35 | 36 | int jfclose(JFILE *f) 37 | { 38 | int rtn = 0; 39 | if (f->f) 40 | rtn = fclose(f->f); 41 | joe_free(f); 42 | return rtn; 43 | } 44 | 45 | unsigned char *jfgets(unsigned char *buf,int len,JFILE *f) 46 | { 47 | if (f->f) 48 | return (unsigned char *)fgets((char *)buf, len, f->f); 49 | else { 50 | if (f->p[0]) { 51 | int x; 52 | for (x = 0; f->p[x] && f->p[x] != '\n'; ++x) 53 | buf[x] = f->p[x]; 54 | if (f->p[x] == '\n') { 55 | buf[x++] = '\n'; 56 | } 57 | buf[x] = 0; 58 | f->p += x; 59 | return buf; 60 | } else 61 | return 0; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /joe/builtin.h: -------------------------------------------------------------------------------- 1 | /* Support for built-in config files */ 2 | 3 | struct jfile { 4 | FILE *f; /* Regular file, or NULL for built-in */ 5 | unsigned char *p; /* Built-in file pointer */ 6 | }; 7 | 8 | JFILE *jfopen(unsigned char *name, char *mode); 9 | unsigned char *jfgets(unsigned char *buf,int len,JFILE *f); 10 | int jfclose(JFILE *f); 11 | 12 | extern unsigned char *builtins[]; 13 | -------------------------------------------------------------------------------- /joe/builtins.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/joe/builtins.c -------------------------------------------------------------------------------- /joe/bw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Edit buffer window generation 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_BW_H 9 | #define _JOE_BW_H 1 10 | 11 | /* A buffer window: there are several kinds, depending on what is in 'object' */ 12 | 13 | struct bw { 14 | W *parent; 15 | B *b; 16 | P *top; 17 | P *cursor; 18 | long offset; 19 | Screen *t; 20 | int h, w, x, y; 21 | 22 | OPTIONS o; 23 | void *object; 24 | 25 | int linums; 26 | int top_changed; /* Top changed */ 27 | struct lattr_db *db; /* line attribute database */ 28 | }; 29 | 30 | extern int dspasis; /* Display characters above 127 as-is */ 31 | extern int mid; /* Controls how window scrolls: when set, scroll window enough so that line with cursor becomes centered */ 32 | 33 | void bwfllw PARAMS((BW *w)); 34 | void bwfllwt PARAMS((BW *w)); 35 | void bwfllwh PARAMS((BW *w)); 36 | void bwins PARAMS((BW *w, long int l, long int n, int flg)); 37 | void bwdel PARAMS((BW *w, long int l, long int n, int flg)); 38 | void bwgen PARAMS((BW *w, int linums)); 39 | void bwgenh PARAMS((BW *w)); 40 | BW *bwmk PARAMS((W *window, B *b, int prompt)); 41 | void bwmove PARAMS((BW *w, int x, int y)); 42 | void bwresz PARAMS((BW *w, int wi, int he)); 43 | void bwrm PARAMS((BW *w)); 44 | int ustat PARAMS((BW *bw)); 45 | int ucrawll PARAMS((BW *bw)); 46 | int ucrawlr PARAMS((BW *bw)); 47 | void orphit PARAMS((BW *bw)); 48 | 49 | extern int marking; /* Anchored block marking mode */ 50 | 51 | void save_file_pos PARAMS((FILE *f)); 52 | void load_file_pos PARAMS((FILE *f)); 53 | long get_file_pos PARAMS((unsigned char *name)); 54 | void set_file_pos PARAMS((unsigned char *name, long pos)); 55 | 56 | extern int restore_file_pos; 57 | 58 | void set_file_pos_all PARAMS((Screen *t)); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /joe/charmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Character sets 3 | * Copyright 4 | * (C) 2004 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | 9 | #ifndef _Icharmap 10 | #define _Icharmap 1 11 | 12 | /* For sorted from_map entries */ 13 | 14 | struct pair { 15 | int first; /* Unicode */ 16 | int last; /* Byte */ 17 | }; 18 | 19 | /* A character set */ 20 | 21 | struct charmap { 22 | struct charmap *next; /* Linked list of loaded character maps */ 23 | unsigned char *name; /* Name of this one */ 24 | 25 | int type; /* 0=byte, 1=UTF-8 */ 26 | 27 | /* Character predicate functions */ 28 | 29 | int (*is_punct)(struct charmap *map,int c); 30 | int (*is_print)(struct charmap *map,int c); 31 | int (*is_space)(struct charmap *map,int c); 32 | int (*is_alpha_)(struct charmap *map,int c); 33 | int (*is_alnum_)(struct charmap *map,int c); 34 | 35 | /* Character conversion functions */ 36 | 37 | int (*to_lower)(struct charmap *map,int c); 38 | int (*to_upper)(struct charmap *map,int c); 39 | int (*to_uni)(struct charmap *map,int c); 40 | int (*from_uni)(struct charmap *map,int c); 41 | 42 | /* Information for byte-oriented character sets */ 43 | 44 | int *to_map; /* Convert byte to unicode */ 45 | 46 | unsigned char lower_map[256]; /* Convert to lower case */ 47 | unsigned char upper_map[256]; 48 | 49 | struct pair from_map[256]; /* Convert from unicode to byte */ 50 | 51 | int from_size; /* No. paris in from_map */ 52 | 53 | unsigned char print_map[32]; /* Bit map of printable characters */ 54 | unsigned char alpha__map[32]; /* Bit map of alphabetic characters and _ */ 55 | unsigned char alnum__map[32]; /* Bit map of alphanumeric characters and _ */ 56 | }; 57 | 58 | /* Predicates */ 59 | 60 | #define joe_ispunct(map,c) ((map)->is_punct((map),(c))) 61 | #define joe_isprint(map,c) ((map)->is_print((map),(c))) 62 | #define joe_isspace(map,c) ((map)->is_space((map),(c))) 63 | #define joe_isalpha_(map,c) ((map)->is_alpha_((map),(c))) 64 | #define joe_isalnum_(map,c) ((map)->is_alnum_((map),(c))) 65 | int joe_isblank PARAMS((struct charmap *map,int c)); 66 | int joe_isspace_eof PARAMS((struct charmap *map,int c)); 67 | 68 | /* Conversion functions */ 69 | 70 | #define joe_tolower(map,c) ((map)->to_lower((map),(c))) 71 | #define joe_toupper(map,c) ((map)->to_upper((map),(c))) 72 | #define joe_to_uni(map,c) ((map)->to_uni((map),(c))) 73 | #define joe_from_uni(map,c) ((map)->from_uni((map),(c))) 74 | unsigned char *lowerize PARAMS((unsigned char *s)); 75 | 76 | /* Find (load if necessary) a character set */ 77 | struct charmap *find_charmap PARAMS((unsigned char *name)); 78 | 79 | /* Get available encodings */ 80 | unsigned char **get_encodings PARAMS((void)); 81 | 82 | int from_uni PARAMS((struct charmap *cset, int c)); 83 | int to_uni PARAMS((struct charmap *cset, int c)); 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /joe/cmd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Command execution 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_CMD_H 9 | #define _JOE_CMD_H 1 10 | 11 | /* Command entry */ 12 | 13 | struct cmd { 14 | unsigned char *name; /* Command name */ 15 | int flag; /* Execution flags */ 16 | int (*func) (); /* Function bound to name */ 17 | MACRO *m; /* Macro bound to name */ 18 | int arg; /* 0= arg is meaningless, 1= ok */ 19 | unsigned char *negarg; /* Command to use if arg was negative */ 20 | }; 21 | 22 | extern CMD cmds[]; /* Built-in commands */ 23 | extern int joe_beep; /* Enable beep on command error */ 24 | 25 | /* Command execution flags */ 26 | 27 | #define EMID 1 /* Recenter screen */ 28 | #define ECHKXCOL 2 /* Don't execute command if cursor column is wrong */ 29 | #define EFIXXCOL 4 /* Fix column position after command has executed */ 30 | #define EMINOR 8 /* Full screen update not needed */ 31 | #define EPOS 16 /* A position history command */ 32 | #define EMOVE 32 /* A movement for position history purposes */ 33 | #define EKILL 64 /* Function is a kill */ 34 | #define EMOD 128 /* Not allowed on readonly files */ 35 | /* These use same bits as TYPE* in types.h */ 36 | #define EBLOCK 0x4000 /* Finish block selection (call udropon) */ 37 | #define EMETA 0x10000 /* JM: Executes even when if flag is zero */ 38 | 39 | /* CMD *findcmd(char *s); 40 | * Return command address for given name 41 | */ 42 | CMD *findcmd PARAMS((unsigned char *s)); 43 | void addcmd PARAMS((unsigned char *s, MACRO *m)); 44 | 45 | /* Execute a command. Returns return value of command */ 46 | int execmd PARAMS((CMD *cmd, int k)); 47 | void do_auto_scroll(); 48 | 49 | extern B *cmdhist; /* Command history buffer */ 50 | 51 | int try_lock PARAMS((BW *bw,B *b)); 52 | int modify_logic PARAMS((BW *bw,B *b)); 53 | 54 | int uexecmd PARAMS((BW *bw)); 55 | 56 | extern int nolocks; /* Disable file locking */ 57 | extern int nomodcheck; /* Disable file modified check */ 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /joe/config.h: -------------------------------------------------------------------------------- 1 | /* Configuration options for JOE */ 2 | 3 | #ifndef _Iconfig 4 | #define _Iconfig 1 5 | #include "autoconf.h" 6 | #define MOUSE_XTERM 1 7 | #endif 8 | -------------------------------------------------------------------------------- /joe/dir.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Directory package for older UNIXs 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | 9 | struct direct { 10 | short d_ino; 11 | unsigned char d_name[14]; 12 | }; 13 | 14 | void *opendir(unsigned char *name) 15 | { 16 | return fopen(name, "r"); 17 | } 18 | 19 | struct direct *readdir(void *f) 20 | { 21 | static struct direct direct; 22 | 23 | while (1 == fread(&direct, sizeof(struct direct), 1, (FILE *) f)) { 24 | if (direct.d_ino) { 25 | return &direct; 26 | } 27 | } 28 | return 0; 29 | } 30 | 31 | void closedir(FILE *f) 32 | { 33 | fclose(f); 34 | } 35 | 36 | int mkdir(unsigned char *s) 37 | { 38 | unsigned char *y = NULL; 39 | int rtval; 40 | 41 | y = vsncpy(sv(y), sc("/bin/mkdir ")); 42 | y = vsncpy(sv(y), sz(s)); 43 | y = vsncpy(sv(y), sc(" 2>/dev/null")); 44 | tickoff(); 45 | rtval = system(y); 46 | tickon(); 47 | vsrm(y); 48 | return rtval; 49 | } 50 | -------------------------------------------------------------------------------- /joe/gettext.c: -------------------------------------------------------------------------------- 1 | /* JOE's gettext() library. Why? Once again we can not rely on the 2 | * system's or GNU's gettext being installed properly */ 3 | 4 | /* One modification from standard gettext: comments are allowed at 5 | * the start of strings: "|comment|comment|comment|foo". The leading 6 | * '|' is required to indicate the comment. 7 | * 8 | * Comments can be used to make two otherwise identical strings distinct. 9 | */ 10 | 11 | #include "types.h" 12 | 13 | HASH *gettext_ht; 14 | 15 | unsigned char *ignore_prefix(unsigned char *set) 16 | { 17 | unsigned char *s = zrchr(set, '|'); 18 | if (s) 19 | ++s; 20 | else 21 | s = set; 22 | return s; 23 | } 24 | 25 | unsigned char *my_gettext(unsigned char *s) 26 | { 27 | if (gettext_ht) { 28 | unsigned char *r = htfind(gettext_ht, s); 29 | if (r) 30 | s = r; 31 | } 32 | if (s[0] == '|') 33 | return ignore_prefix(s); 34 | else 35 | return s; 36 | } 37 | 38 | /* Load a .po file, convert entries to local character set and add them to 39 | * hash table */ 40 | 41 | int load_po(FILE *f) 42 | { 43 | unsigned char buf[1024]; 44 | unsigned char msgid[1024]; 45 | unsigned char msgstr[1024]; 46 | unsigned char bf[8192]; 47 | struct charmap *po_map = locale_map; 48 | int preload_flag = 0; 49 | msgid[0] = 0; 50 | msgstr[0] = 0; 51 | while (preload_flag || fgets((char *)buf,sizeof(buf)-1,f)) { 52 | unsigned char *p; 53 | preload_flag = 0; 54 | p = buf; 55 | parse_ws(&p, '#'); 56 | if (!parse_field(&p, USTR "msgid")) { 57 | int ofst = 0; 58 | int len; 59 | msgid[0] = 0; 60 | parse_ws(&p, '#'); 61 | while ((len = parse_string(&p, msgid + ofst, sizeof(msgid)-ofst)) >= 0) { 62 | preload_flag = 0; 63 | ofst += len; 64 | parse_ws(&p, '#'); 65 | if (!*p) { 66 | if (fgets((char *)buf,sizeof(buf) - 1,f)) { 67 | p = buf; 68 | preload_flag = 1; 69 | parse_ws(&p, '#'); 70 | } else { 71 | goto bye; 72 | } 73 | } 74 | } 75 | } else if (!parse_field(&p, USTR "msgstr")) { 76 | int ofst = 0; 77 | int len; 78 | msgstr[0] = 0; 79 | parse_ws(&p, '#'); 80 | while ((len = parse_string(&p, msgstr + ofst, sizeof(msgstr)-ofst)) >= 0) { 81 | preload_flag = 0; 82 | ofst += len; 83 | parse_ws(&p, '#'); 84 | if (!*p) { 85 | if (fgets((char *)buf,sizeof(buf) - 1,f)) { 86 | p = buf; 87 | preload_flag = 1; 88 | parse_ws(&p, '#'); 89 | } else { 90 | break; 91 | } 92 | } 93 | } 94 | if (msgid[0] && msgstr[0]) { 95 | /* Convert to locale character map */ 96 | my_iconv(bf,locale_map,msgstr,po_map); 97 | /* Add to hash table */ 98 | htadd(gettext_ht, zdup(msgid), zdup(bf)); 99 | } else if (!msgid[0] && msgstr[0]) { 100 | unsigned char *p = (unsigned char *)strstr((char *)msgstr, "charset="); 101 | if (p) { 102 | /* Copy character set name up to next delimiter */ 103 | int x; 104 | p += sizeof("charset=") - 1; 105 | while (*p == ' ' || *p == '\t') ++p; 106 | for (x = 0; p[x] && p[x] !='\n' && p[x] != '\r' && p[x] != ' ' && 107 | p[x] != '\t' && p[x] != ';' && p[x] != ','; ++x) 108 | msgid[x] = p[x]; 109 | msgid[x] = 0; 110 | po_map = find_charmap(msgid); 111 | if (!po_map) 112 | po_map = locale_map; 113 | } 114 | } 115 | } 116 | } 117 | bye: 118 | fclose(f); 119 | return 0; 120 | } 121 | 122 | /* Initialize my_gettext(). Call after locale_map has been set. */ 123 | 124 | void init_gettext(unsigned char *s) 125 | { 126 | FILE *f; 127 | unsigned char buf[1024]; 128 | joe_snprintf_2(buf, sizeof(buf), "%slang/%s.po",JOEDATA,s); 129 | if ((f = fopen((char *)buf, "r"))) { 130 | /* Try specific language, like en_GB */ 131 | gettext_ht = htmk(256); 132 | load_po(f); 133 | } else if (s[0] && s[1]) { 134 | /* Try generic language, like en */ 135 | joe_snprintf_3(buf, sizeof(buf), "%slang/%c%c.po",JOEDATA,s[0],s[1]); 136 | if ((f = fopen((char *)buf, "r"))) { 137 | gettext_ht = htmk(256); 138 | load_po(f); 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /joe/gettext.h: -------------------------------------------------------------------------------- 1 | unsigned char *my_gettext(unsigned char *s); 2 | void init_gettext(unsigned char *s); 3 | -------------------------------------------------------------------------------- /joe/hash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple hash table 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | static HENTRY *freentry = NULL; 11 | 12 | /* Compute hash value of string */ 13 | 14 | #define hnext(accu, c) (((accu) << 4) + ((accu) >> 28) + (c)) 15 | 16 | unsigned long hash(unsigned char *s) 17 | { 18 | unsigned long accu = 0; 19 | 20 | while (*s) { 21 | accu = hnext(accu, *s++); 22 | } 23 | return accu; 24 | } 25 | 26 | /* Create hash table */ 27 | 28 | HASH *htmk(int len) 29 | { 30 | HASH *t = (HASH *) joe_malloc(sizeof(HASH)); 31 | t->nentries = 0; 32 | t->len = len; 33 | t->tab = (HENTRY **) joe_calloc(sizeof(HENTRY *), len); 34 | return t; 35 | } 36 | 37 | /* Delete hash table. Only the hash table is deleted, not the names and values */ 38 | 39 | void htrm(HASH *ht) 40 | { 41 | int x; 42 | for (x = 0; x != ht->len; ++x) { 43 | HENTRY *p, *n; 44 | for (p = ht->tab[x]; p; p = n) { 45 | n = p->next; 46 | p->next = freentry; 47 | freentry = p; 48 | } 49 | } 50 | joe_free(ht->tab); 51 | joe_free(ht); 52 | } 53 | 54 | /* Expand hash table */ 55 | 56 | void htexpand(HASH *h) 57 | { 58 | unsigned x; 59 | /* Allocate new table */ 60 | unsigned new_size = h->len * 2; 61 | HENTRY **new_table = (HENTRY **)joe_calloc(new_size, sizeof(HENTRY *)); 62 | /* Copy entries from old table to new */ 63 | for (x = 0; x != h->len; ++x) { 64 | HENTRY *e; 65 | while ((e = h->tab[x])) { 66 | h->tab[x] = e->next; 67 | e->next = new_table[e->hash_val & (new_size - 1)]; 68 | new_table[e->hash_val & (new_size - 1)] = e; 69 | } 70 | } 71 | /* Replace old table with new */ 72 | free(h->tab); 73 | h->tab = new_table; 74 | h->len = new_size; 75 | } 76 | 77 | /* Bind a value to a name. This does not check for duplicate entries. The 78 | * name and value are not duplicated: it's up to you to keep them around for 79 | * the life of the hash table. */ 80 | 81 | void *htadd(HASH *ht, unsigned char *name, void *val) 82 | { 83 | unsigned hval = hash(name); 84 | unsigned idx = hval & (ht->len - 1); 85 | HENTRY *entry; 86 | int x; 87 | 88 | if (!freentry) { 89 | entry = (HENTRY *) joe_malloc(sizeof(HENTRY) * 64); 90 | for (x = 0; x != 64; ++x) { 91 | entry[x].next = freentry; 92 | freentry = entry + x; 93 | } 94 | } 95 | entry = freentry; 96 | freentry = entry->next; 97 | entry->next = ht->tab[idx]; 98 | ht->tab[idx] = entry; 99 | entry->name = name; 100 | entry->val = val; 101 | entry->hash_val = hval; 102 | if (++ht->nentries == (ht->len >> 1) + (ht->len >> 2)) 103 | htexpand(ht); 104 | return val; 105 | } 106 | 107 | /* Return value associated with name or NULL if there is none */ 108 | 109 | void *htfind(HASH *ht, unsigned char *name) 110 | { 111 | HENTRY *e; 112 | 113 | for (e = ht->tab[hash(name) & (ht->len - 1)]; e; e = e->next) { 114 | if (!zcmp(e->name, name)) { 115 | return e->val; 116 | } 117 | } 118 | return NULL; 119 | } 120 | -------------------------------------------------------------------------------- /joe/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Simple hash table 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_HASH_H 9 | #define _JOE_HASH_H 1 10 | 11 | struct entry { 12 | HENTRY *next; 13 | unsigned char *name; 14 | unsigned hash_val; 15 | void *val; 16 | }; 17 | 18 | struct hash { 19 | unsigned len; 20 | HENTRY **tab; 21 | unsigned nentries; 22 | }; 23 | 24 | /* Compute hash code for a string */ 25 | unsigned long hash PARAMS((unsigned char *s)); 26 | 27 | /* Create a hash table of specified size, which must be a power of 2 */ 28 | HASH *htmk PARAMS((int len)); 29 | 30 | /* Delete a hash table. HENTRIES get freed, but name/vals don't. */ 31 | void htrm PARAMS((HASH *ht)); 32 | 33 | /* Add an entry to a hash table. 34 | Note: 'name' is _not_ strdup()ed */ 35 | void *htadd PARAMS((HASH *ht, unsigned char *name, void *val)); 36 | 37 | /* Look up an entry in a hash table, returns NULL if not found */ 38 | void *htfind PARAMS((HASH *ht, unsigned char *name)); 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /joe/help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Help system 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * (C) 2001 Marek 'Marx' Grac 6 | * 7 | * This file is part of JOE (Joe's Own Editor) 8 | */ 9 | #ifndef _JOE_HELP_H 10 | #define _JOE_HELP_H 1 11 | 12 | void help_display PARAMS((Screen *t)); /* display text in help window */ 13 | int help_on PARAMS((Screen *t)); /* turn help on */ 14 | int help_init PARAMS((JFILE *fd,unsigned char *bf,int line)); /* read help from rc file */ 15 | 16 | int u_help PARAMS((BASE *base)); /* toggle help on/off */ 17 | int u_help_next PARAMS((BASE *base)); /* goto next help screen */ 18 | int u_help_prev PARAMS((BASE *base)); /* goto prev help screen */ 19 | extern int bg_help; /* Background color for help */ 20 | extern int help_is_utf8; /* Set if help text is UTF-8 */ 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /joe/i18n.h: -------------------------------------------------------------------------------- 1 | #ifndef _Ii18n 2 | #define _Ii18n 1 3 | 4 | int joe_iswupper PARAMS((struct charmap *,int c)); 5 | int joe_iswlower PARAMS((struct charmap *,int c)); 6 | 7 | int joe_iswalpha PARAMS((struct charmap *,int c)); /* or _ */ 8 | int joe_iswalpha_ PARAMS((struct charmap *,int c)); 9 | 10 | int joe_iswalnum PARAMS((struct charmap *,int c)); 11 | int joe_iswalnum_ PARAMS((struct charmap *,int c)); 12 | 13 | int joe_iswdigit PARAMS((struct charmap *,int c)); 14 | int joe_iswspace PARAMS((struct charmap *,int c)); 15 | int joe_iswctrl PARAMS((struct charmap *,int c)); 16 | int joe_iswpunct PARAMS((struct charmap *,int c)); 17 | int joe_iswgraph PARAMS((struct charmap *,int c)); 18 | int joe_iswprint PARAMS((struct charmap *,int c)); 19 | int joe_iswxdigit PARAMS((struct charmap *,int c)); 20 | int joe_iswblank PARAMS((struct charmap *,int c)); 21 | 22 | int joe_wcwidth PARAMS((int wide,int c)); 23 | /* Looking for wswidth? Take a look at scrn.c/txtwidth() */ 24 | 25 | int joe_towupper PARAMS((struct charmap *,int c)); 26 | int joe_towlower PARAMS((struct charmap *,int c)); 27 | 28 | int unictrl PARAMS((int c)); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /joe/kbd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Key-map handler 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_KBD_H 9 | #define _JOE_KBD_H 1 10 | 11 | /* A key binding */ 12 | struct key { 13 | int k; /* Flag: 0=binding, 1=submap */ 14 | union { 15 | void *bind; /* What key is bound to */ 16 | KMAP *submap; /* Sub KMAP address (for prefix keys) */ 17 | } value; 18 | }; 19 | 20 | /* A map of keycode to command/sub-map bindings */ 21 | struct kmap { 22 | KEY keys[KEYS]; /* KEYs */ 23 | }; 24 | 25 | /** A keyboard handler **/ 26 | struct kbd { 27 | KMAP *curmap; /* Current keymap */ 28 | KMAP *topmap; /* Top-level keymap */ 29 | int seq[16]; /* Current sequence of keys */ 30 | int x; /* What we're up to */ 31 | }; 32 | 33 | /* KMAP *mkkmap(void); 34 | * Create an empty keymap 35 | */ 36 | KMAP *mkkmap PARAMS((void)); 37 | 38 | /* void rmkmap(KMAP *kmap); 39 | * Free a key map 40 | */ 41 | void rmkmap PARAMS((KMAP *kmap)); 42 | 43 | /* int kadd(KMAP *kmap,char *seq,void *bind); 44 | * Add a key sequence binding to a key map 45 | * 46 | * Returns 0 for success 47 | * -1 for for invalid key sequence 48 | * 49 | * A valid key sequence is one or more keys seperated with spaces. A key 50 | * is a single character or one of the following strings: 51 | * 52 | * ^? 127 (DEL) 53 | * 54 | * ^@ - ^_ Control characters 55 | * 56 | * SP 32 (space character) 57 | * 58 | * UP, DOWN, LEFT, RIGHT, 59 | * F0 - F10, DEL, INS, HOME, 60 | * END, PGUP, PGDN termcap special characters 61 | * 62 | * In addition, the last key of a key sequence may be replaced with 63 | * a range-fill of the form: TO 64 | * 65 | * So for example, if the sequence: ^K A TO Z 66 | * is speicified, then the key sequences 67 | * ^K A, ^K B, ^K C, ... ^K Z are all bound. 68 | */ 69 | int kadd PARAMS((CAP *cap, KMAP *kmap, unsigned char *seq, void *bind)); 70 | 71 | /* void kcpy(KMAP *dest,KMAP *src); 72 | * Copy all of the entries in the 'src' keymap into the 'dest' keymap 73 | */ 74 | void kcpy PARAMS((KMAP *dest, KMAP *src)); 75 | 76 | /* int kdel(KMAP *kmap,char *seq); 77 | * Delete a binding from a keymap 78 | * 79 | * Returns 0 for success 80 | * -1 if the given key sequence was invalid 81 | * 1 if the given key sequence did not exist 82 | */ 83 | int kdel PARAMS((KMAP *kmap, unsigned char *seq)); 84 | 85 | /* KBD *mkkbd(KMAP *kmap); 86 | Create a keyboard handler which uses the given keymap 87 | */ 88 | KBD *mkkbd PARAMS((KMAP *kmap)); 89 | 90 | /* void rmkbd(KBD *); 91 | * 92 | * Eliminate a keyboard handler 93 | */ 94 | void rmkbd PARAMS((KBD *k)); 95 | 96 | /* void *dokey(KBD *kbd,int k); 97 | Handle a key for a KBD: 98 | 99 | Returns 0 for invalid or prefix keys 100 | 101 | Returns binding for a completed key sequence 102 | */ 103 | void *dokey PARAMS((KBD *kbd, int n)); 104 | 105 | /* JM - user command handler */ 106 | int ukeymap(); 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /joe/lattr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Line attribute cache 3 | * Copyright 4 | * (C) 2006 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | 9 | struct lattr_db 10 | { 11 | struct lattr_db *next; /* Linked list of attribute databases owned by a B */ 12 | struct high_syntax *syn; /* This database is for this syntax */ 13 | B *b; /* This database is for this buffer */ 14 | 15 | /* Use a gap buffer for the attribute records */ 16 | 17 | HIGHLIGHT_STATE *buffer; /* Address of buffer */ 18 | long hole; /* Offset to hole */ 19 | long ehole; /* Offset to end of hole */ 20 | long end; /* Malloc() size of buffer */ 21 | 22 | long first_invalid; /* Lines beginning with this are invalid */ 23 | long invalid_window; /* Lines beyond first_invalid+invalid_window might be valid */ 24 | /* -1 means all lines are valid */ 25 | }; 26 | 27 | struct lattr_db *mk_lattr_db PARAMS((B *new_b, struct high_syntax *new_syn)); 28 | /* Create database structure */ 29 | 30 | void rm_lattr_db PARAMS((struct lattr_db *db)); 31 | /* Delete database structure */ 32 | 33 | void rm_all_lattr_db PARAMS((struct lattr_db *db)); 34 | /* Delete linked-list of databases */ 35 | 36 | void reset_all_lattr_db PARAMS((struct lattr_db *db)); 37 | /* Delete linked-list of databases */ 38 | 39 | struct lattr_db *find_lattr_db PARAMS((B *b, struct high_syntax *y)); 40 | /* Find database for a particular syntax. If one doesn't 41 | exist, create it and add it to the list for the B */ 42 | 43 | void drop_lattr_db PARAMS((B *b, struct lattr_db *db)); 44 | /* Drop a database if it's no longer needed. This checks through all BWs on a B 45 | to see if any of them refer to db. If none, the db is dropped. */ 46 | 47 | #define lattr_size(db) ((db)->end - ((db)->ehole - (db)->hole)) 48 | 49 | void lattr_hole PARAMS((struct lattr_db *db, long pos)); 50 | /* Set hole position */ 51 | 52 | void lattr_check PARAMS((struct lattr_db *db, long size)); 53 | /* Make sure we have enough space for insert. If not, expand buffer. */ 54 | 55 | void lattr_ins PARAMS((struct lattr_db *db,long line,long size)); 56 | /* An insert occured, beginning on specified line. 'size' lines were inserted. 57 | Adjust invalid window to cover inserted area. 58 | */ 59 | 60 | void lattr_del PARAMS((struct lattr_db *db,long line,long size)); 61 | /* A deletion occured, beginning on specified line. 'size' lines were deleted. 62 | Adjust invalid window to cover deleted area. 63 | */ 64 | 65 | HIGHLIGHT_STATE lattr_get PARAMS((struct lattr_db *db,struct high_syntax *y,P *p,long line)); 66 | /* Get state for specified line. If we don't have it, compute it. 67 | Records results of any computation so that we don't have to do it again. 68 | If first_invalid is < number of lines we have, compute forward until we 69 | start matching again as this is a very common case. */ 70 | 71 | #define lattr_lvalue(db, line) ((line) >= (db)->hole ? (db)->buffer[(line) - (db)->hole + (db)->ehole] : (db)->buffer[line]) 72 | -------------------------------------------------------------------------------- /joe/macro.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/joe/macro.c -------------------------------------------------------------------------------- /joe/macro.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Keyboard macros 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_MACRO_H 9 | #define _JOE_MACRO_H 1 10 | 11 | struct macro { 12 | int k; /* Keycode */ 13 | int flg; /* Flags: bit 0: this step wants the negative arg, 14 | bit 1: ignore return value of this step, but use it as return value of macro */ 15 | CMD *cmd; /* Command address */ 16 | int n; /* Number of steps */ 17 | int size; /* Malloc size of steps */ 18 | MACRO **steps; /* Block */ 19 | }; 20 | 21 | struct recmac { 22 | struct recmac *next; 23 | int n; 24 | MACRO *m; 25 | }; 26 | 27 | extern struct recmac *recmac; /* Set when macro is recording: for status line */ 28 | 29 | /* Macro construction functions */ 30 | MACRO *mkmacro PARAMS((int k, int arg, int n, CMD *cmd)); 31 | void addmacro PARAMS((MACRO *macro, MACRO *m)); 32 | MACRO *dupmacro PARAMS((MACRO *mac)); 33 | void rmmacro PARAMS((MACRO *macro)); 34 | MACRO *macstk PARAMS((MACRO *m, int k)); 35 | MACRO *macsta PARAMS((MACRO *m, int a)); 36 | 37 | void chmac PARAMS((void)); 38 | 39 | /* Text to macro / Macro to text */ 40 | MACRO *mparse PARAMS((MACRO *m, unsigned char *buf, int *sta)); 41 | unsigned char *mtext PARAMS((unsigned char *s, MACRO *m)); 42 | 43 | /* Execute a macro */ 44 | extern MACRO *curmacro; /* Current macro being executed */ 45 | int exemac PARAMS((MACRO *m)); 46 | int exmacro PARAMS((MACRO *m, int u)); 47 | 48 | /* Keyboard macros user interface */ 49 | int uplay PARAMS((BW *bw, int c)); 50 | int ustop PARAMS((void)); 51 | int urecord PARAMS((BW *bw, int c)); 52 | int uquery PARAMS((BW *bw)); 53 | int umacros PARAMS((BW *bw)); 54 | 55 | /* Repeat prefix user command */ 56 | int uarg PARAMS((BW *bw)); 57 | int uuarg PARAMS((BW *bw, int c)); 58 | int uif PARAMS((BW *bw)); 59 | int uelsif PARAMS((BW *bw)); 60 | int uelse PARAMS((BW *bw)); 61 | int uendif PARAMS((BW *bw)); 62 | 63 | unsigned char *unescape PARAMS((unsigned char *ptr,int c)); 64 | 65 | void load_macros PARAMS((FILE *f)); 66 | void save_macros PARAMS((FILE *f)); 67 | 68 | extern int current_arg; /* Current macro repeat argument */ 69 | extern int current_arg_set; /* Set if repeat arg was given */ 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /joe/main.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Editor startup and edit loop 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_MAIN_H 9 | #define _JOE_MAIN_H 1 10 | 11 | extern unsigned char *exmsg; /* Exit message */ 12 | extern int help; /* Set to start with help on */ 13 | extern Screen *maint; /* Primary screen */ 14 | extern int usexmouse; /* Use xterm mouse support? */ 15 | void nungetc PARAMS((int c)); 16 | void dofollows PARAMS((void)); 17 | int edloop PARAMS((int flg)); 18 | void edupd PARAMS((int flg)); 19 | 20 | extern volatile int dostaupd; /* Force status line update */ 21 | extern int nonotice; /* Set to prevent copyright notice */ 22 | extern int xmouse; /* XTerm mouse mode request by user (only allowed if terminal looks like xterm) */ 23 | extern unsigned char **mainenv; /* Environment variables passed to JOE */ 24 | 25 | extern unsigned char i_msg[128]; 26 | void internal_msg PARAMS((unsigned char *)); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /joe/menu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Menu selection window 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_MENU_H 9 | #define _JOE_MENU_H 1 10 | 11 | /* A menu window */ 12 | 13 | struct menu { 14 | W *parent; /* Window we're in */ 15 | unsigned char **list; /* List of items */ 16 | int top; /* First item on screen */ 17 | int cursor; /* Item cursor is on */ 18 | int width; /* Width of widest item, up to 'w' max */ 19 | int fitline; /* Number of items we can fit on each line */ 20 | int perline; /* Number of items we place on each line */ 21 | int lines; /* Total no. of lines */ 22 | int nitems; /* No. items in list */ 23 | Screen *t; /* Screen we're on */ 24 | int h, w, x, y; 25 | int (*abrt) (); /* Abort callback function */ 26 | int (*func) (); /* Return callback function */ 27 | int (*backs) (); /* Backspace callback function */ 28 | void *object; 29 | }; 30 | 31 | /* Create a menu */ 32 | /* FIXME: ??? ---> */ 33 | MENU *mkmenu PARAMS((W *loc, W *targ, unsigned char **s, int (*func) (/* ??? */), int (*abrt) (/* ??? */), int (*backs) (/* ??? */), int cursor, void *object, int *notify)); 34 | 35 | /* Menu user functions */ 36 | 37 | int umuparw PARAMS((MENU *m)); 38 | int umdnarw PARAMS((MENU *m)); 39 | int umpgup PARAMS((MENU *m)); 40 | int umpgdn PARAMS((MENU *m)); 41 | int umscrup PARAMS((MENU *m)); 42 | int umscrdn PARAMS((MENU *m)); 43 | int umltarw PARAMS((MENU *m)); 44 | int umrtarw PARAMS((MENU *m)); 45 | int umtab PARAMS((MENU *m)); 46 | int umbof PARAMS((MENU *m)); 47 | int umeof PARAMS((MENU *m)); 48 | int umbol PARAMS((MENU *m)); 49 | int umeol PARAMS((MENU *m)); 50 | int umbacks PARAMS((MENU *m)); 51 | 52 | void ldmenu PARAMS((MENU *m, unsigned char **s, int cursor)); 53 | 54 | unsigned char *mcomplete PARAMS((MENU *m)); 55 | unsigned char *find_longest PARAMS((unsigned char **lst)); 56 | 57 | void menujump PARAMS((MENU *m, int x, int y)); 58 | 59 | extern int lines; /* Number of menu lines */ 60 | 61 | extern WATOM watommenu; /* Menu WATOM */ 62 | 63 | extern int menu_above; /* Menu position: above or below */ 64 | extern int bg_menu; /* Background color for menu */ 65 | extern int transpose; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /joe/mouse.h: -------------------------------------------------------------------------------- 1 | /* GPM/xterm mouse functions 2 | Copyright (C) 1999 Jesse McGrew 3 | 4 | This file is part of JOE (Joe's Own Editor) 5 | 6 | JOE is free software; you can redistribute it and/or modify it under the 7 | terms of the GNU General Public License as published by the Free Software 8 | Foundation; either version 1, or (at your option) any later version. 9 | 10 | JOE is distributed in the hope that it will be useful, but WITHOUT ANY 11 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 | details. 14 | 15 | You should have received a copy of the GNU General Public License along with 16 | JOE; see the file COPYING. If not, write to the Free Software Foundation, 17 | 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 | 19 | #ifndef _Imouse 20 | #define _Imouse 1 21 | 22 | /* maximum number of milliseconds that can elapse between 23 | double/triple clicks */ 24 | #define MOUSE_MULTI_THRESH 300 25 | 26 | #ifdef MOUSE_GPM 27 | int gpmopen(); /* initialize the connection. returns 0 on failure. */ 28 | void gpmclose(); /* close the connection. */ 29 | #endif 30 | 31 | void mouseopen(); /* initialize mouse */ 32 | void mouseclose(); /* de-initialize mouse */ 33 | 34 | /* mousedn(int x, int y) - handle a mouse-down event */ 35 | void mousedn PARAMS((int x, int y)); 36 | 37 | /* mouseup(int x, int y) - handle a mouse-up event */ 38 | void mouseup PARAMS((int x, int y)); 39 | 40 | /* mousedrag(int x, int y) - handle a mouse drag event */ 41 | void mousedrag PARAMS((int x, int y)); 42 | 43 | /* user command handlers */ 44 | int uxtmouse PARAMS((BW *)); /* handle an xterm mouse control sequence */ 45 | int utomouse PARAMS((BW *)); /* move the pointer to the mouse */ 46 | int udefmdown PARAMS((BW *)); /* default mouse click handlers */ 47 | int udefmup PARAMS((BW *)); 48 | int udefmdrag PARAMS((BW *)); 49 | int udefm2down PARAMS((BW *)); 50 | int udefm2up PARAMS((BW *)); 51 | int udefm2drag PARAMS((BW *)); 52 | int udefm3down PARAMS((BW *)); 53 | int udefm3up PARAMS((BW *)); 54 | int udefm3drag PARAMS((BW *)); 55 | 56 | int mnow(); 57 | void reset_trig_time(); 58 | 59 | /* options */ 60 | extern int floatmouse; /* Allow mouse to set cursor past end of lines */ 61 | extern int rtbutton; /* Use button 3 instead of button 1 */ 62 | 63 | extern int auto_scroll; /* Set for autoscroll */ 64 | extern int auto_trig_time; /* Time of next scroll */ 65 | extern int joexterm; /* Set if xterm can do base64 paste */ 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /joe/path.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Directory and path functions 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_PATH_H 9 | #define _JOE_PATH_H 1 10 | 11 | unsigned char *joesep PARAMS((unsigned char *path)); 12 | 13 | /* char *namprt(char *path); 14 | * Return name part of a path. There is no name if the last character 15 | * in the path is '/'. 16 | * 17 | * The name part of "/hello/there" is "there" 18 | * The name part of "/hello/" is "" 19 | * The name part if "/" is "" 20 | */ 21 | unsigned char *namprt PARAMS((unsigned char *path)); 22 | unsigned char *namepart PARAMS((unsigned char *tmp, unsigned char *path)); 23 | 24 | /* char *dirprt(char *path); 25 | * Return directory and drive part of a path. I.E., everything to the 26 | * left of the name part. 27 | * 28 | * The directory part of "/hello/there" is "/hello/" 29 | * The directory part of "/hello/" is "/hello/" 30 | * The directory part of "/" is "/" 31 | */ 32 | unsigned char *dirprt PARAMS((unsigned char *path)); 33 | 34 | /* char *begprt(char *path); 35 | * Return the beginning part of a path. 36 | * 37 | * The beginning part of "/hello/there" is "/hello/" 38 | * The beginning part of "/hello/" is "/" 39 | * The beginning part of "/" is "/" 40 | */ 41 | unsigned char *begprt PARAMS((unsigned char *path)); 42 | 43 | /* char *endprt(char *path); 44 | * Return the ending part of a path. 45 | * 46 | * The ending part of "/hello/there" is "there" 47 | * The ending part of "/hello/" is "hello/" 48 | * The ending part of "/" is "" 49 | */ 50 | unsigned char *endprt PARAMS((unsigned char *path)); 51 | 52 | /* int mkpath(char *path); 53 | * Make sure path exists. If it doesn't, try to create it 54 | * 55 | * Returns 1 for error or 0 for success. The current directory 56 | * and drive will be at the given path if successful, otherwise 57 | * the drive and path will be elsewhere (not necessarily where they 58 | * were before mkpath was called). 59 | */ 60 | int mkpath PARAMS((unsigned char *path)); 61 | 62 | /* char *mktmp(char *); 63 | * Create an empty temporary file. The file name created is the string passed 64 | * to this function postfixed with /joe.tmp.XXXXXX, where XXXXXX is some 65 | * string six chars long which makes this file unique. 66 | */ 67 | unsigned char *mktmp PARAMS((unsigned char *where)); 68 | 69 | /* Change drive and directory */ 70 | #define chddir chdir 71 | 72 | /* int rmatch(char *pattern,char *string); 73 | * Return true if string matches pattern 74 | * 75 | * Pattern is: 76 | * * matches 0 or more charcters 77 | * ? matches any 1 character 78 | * [...] matches 1 character in set 79 | * [^...] matches 1 character not in set 80 | * [[] matches [ 81 | * [*] matches * 82 | * [?] matches ? 83 | * any other matches self 84 | * 85 | * Ranges of characters may be specified in sets with 'A-B' 86 | * '-' may be specified in sets by placing it at the ends 87 | * '[' may be specified in sets by placing it first 88 | */ 89 | int rmatch PARAMS((unsigned char *a, unsigned char *b)); 90 | int isreg PARAMS((unsigned char *s)); 91 | 92 | /* char **rexpnd(char *path,char *pattern); 93 | * Generate array (see va.h) of file names from directory in 'path' 94 | * which match the pattern 'pattern' 95 | */ 96 | unsigned char **rexpnd PARAMS((unsigned char *word)); 97 | unsigned char **rexpnd_users PARAMS((unsigned char *word)); 98 | 99 | int chpwd PARAMS((unsigned char *path)); 100 | unsigned char *pwd PARAMS((void)); 101 | unsigned char *simplify_prefix PARAMS((unsigned char *path)); 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /joe/poshist.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Position history 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | typedef struct pos POS; 11 | 12 | struct pos { 13 | LINK(POS) link; 14 | P *p; 15 | W *w; 16 | }; 17 | 18 | POS pos = { {&pos, &pos} }; 19 | POS frpos = { {&frpos, &frpos} }; 20 | POS *curpos = &pos; 21 | int npos = 0; 22 | 23 | static void markpos(W *w, P *p) 24 | { 25 | POS *new = alitem(&frpos, sizeof(POS)); 26 | 27 | new->p = NULL; 28 | pdupown(p, &new->p, USTR "markpos"); 29 | poffline(new->p); 30 | new->w = w; 31 | enqueb(POS, link, &pos, new); 32 | if (npos == 20) { 33 | new = pos.link.next; 34 | prm(new->p); 35 | demote(POS, link, &frpos, new); 36 | } else { 37 | ++npos; 38 | } 39 | } 40 | 41 | void afterpos(void) 42 | { 43 | if (curpos != &pos) { 44 | demote(POS, link, &pos, curpos); 45 | curpos = &pos; 46 | } 47 | } 48 | 49 | void aftermove(W *w, P *p) 50 | { 51 | if (pos.link.prev != &pos && pos.link.prev->w == w && pos.link.prev->p && labs(pos.link.prev->p->line - p->line) < 3) { 52 | poffline(pset(pos.link.prev->p, p)); 53 | } else { 54 | markpos(w, p); 55 | } 56 | } 57 | 58 | void windie(W *w) 59 | { 60 | POS *n; 61 | 62 | for (n = pos.link.prev; n != &pos; n = n->link.prev) { 63 | if (n->w == w) { 64 | n->w = NULL; 65 | } 66 | } 67 | } 68 | 69 | int unextpos(BW *bw) 70 | { 71 | W *w = bw->parent; 72 | 73 | lp: 74 | if (curpos->link.next != &pos && curpos != &pos) { 75 | curpos = curpos->link.next; 76 | if (!curpos->p || !curpos->w) { 77 | goto lp; 78 | } 79 | if (w->t->curwin == curpos->w && curpos->p->byte == ((BW *) w->t->curwin->object)->cursor->byte) { 80 | goto lp; 81 | } 82 | if (w->t->curwin != curpos->w) { 83 | w->t->curwin = curpos->w; 84 | if (w->t->curwin->y == -1) { 85 | wfit(w->t); 86 | } 87 | } 88 | w = w->t->curwin; 89 | bw = (BW *) w->object; 90 | if (bw->cursor->byte != curpos->p->byte) { 91 | pset(bw->cursor, curpos->p); 92 | } 93 | return 0; 94 | } else { 95 | return -1; 96 | } 97 | } 98 | 99 | int uprevpos(BW *bw) 100 | { 101 | W *w = bw->parent; 102 | 103 | lp: 104 | if (curpos->link.prev != &pos) { 105 | curpos = curpos->link.prev; 106 | if (!curpos->p || !curpos->w) { 107 | goto lp; 108 | } 109 | if (w->t->curwin == curpos->w && curpos->p->byte == ((BW *) w->t->curwin->object)->cursor->byte) { 110 | goto lp; 111 | } 112 | if (w->t->curwin != curpos->w) { 113 | w->t->curwin = curpos->w; 114 | if (w->t->curwin->y == -1) { 115 | wfit(w->t); 116 | } 117 | } 118 | w = w->t->curwin; 119 | bw = (BW *) w->object; 120 | if (bw->cursor->byte != curpos->p->byte) { 121 | pset(bw->cursor, curpos->p); 122 | } 123 | return 0; 124 | } else { 125 | return -1; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /joe/poshist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Position history 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_POSHIST_H 9 | #define _JOE_POSHIST_H 1 10 | 11 | void afterpos PARAMS((void)); 12 | void aftermove PARAMS((W *w, P *p)); 13 | void windie PARAMS((W *w)); 14 | int uprevpos PARAMS((BW *bw)); 15 | int unextpos PARAMS((BW *bw)); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /joe/pw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Prompt windows 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_PW_H 9 | #define _JOE_PW_H 1 10 | 11 | /* Prompt window (a BW) */ 12 | 13 | struct pw { 14 | int (*pfunc) (); /* Func which gets called when RTN is hit */ 15 | int (*abrt) (); /* Func which gets called when window is aborted */ 16 | int (*tab) (); /* Func which gets called when TAB is hit */ 17 | unsigned char *prompt; /* Prompt string */ 18 | int promptlen; /* Width of prompt string */ 19 | int promptofst; /* Prompt scroll offset */ 20 | B *hist; /* History buffer */ 21 | void *object; /* Object */ 22 | int file_prompt; /* Set if this is a file name prompt, so do ~ expansion */ 23 | }; 24 | 25 | /* BW *wmkpw(BW *bw,char *prompt,int (*func)(),char *huh,int (*abrt)(), 26 | int (*tab)(),void *object,int *notify); 27 | * Create a prompt window for the given window 28 | * file_prompt flags: 29 | * bit 0: ~ expansion 30 | * bit 1: update directory 31 | * bit 2: seed with directory 32 | */ 33 | BW *wmkpw PARAMS((W *w, unsigned char *prompt, B **history, int (*func) (), unsigned char *huh, int (*abrt) (), int (*tab) (), void *object, int *notify, struct charmap *map, int file_prompt)); 34 | 35 | int ucmplt PARAMS((BW *bw, int k)); 36 | 37 | /* Function for TAB completion */ 38 | 39 | unsigned char **regsub PARAMS((unsigned char **z, int len, unsigned char *s)); 40 | 41 | void cmplt_ins PARAMS((BW *bw,unsigned char *line)); 42 | 43 | int cmplt_abrt PARAMS((BW *bw,int x, unsigned char *line)); 44 | 45 | int cmplt_rtn PARAMS((MENU *m,int x,unsigned char *line)); 46 | 47 | int simple_cmplt PARAMS((BW *bw,unsigned char **list)); 48 | 49 | void setup_history PARAMS((B **history)); 50 | void append_history PARAMS((B *hist,unsigned char *s,int len)); 51 | void promote_history PARAMS((B *hist, long line)); 52 | void set_current_dir PARAMS((unsigned char *s,int simp)); 53 | 54 | extern int bg_prompt; 55 | extern int nocurdir; 56 | 57 | extern WATOM watompw; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /joe/queue.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Doubly linked list primitives 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | void *QUEUE; 11 | void *ITEM; 12 | void *LAST; 13 | 14 | void *alitem(void *list, int itemsize) 15 | { 16 | STDITEM *freelist = (STDITEM *)list; 17 | 18 | if (qempty(STDITEM, link, freelist)) { 19 | STDITEM *i = (STDITEM *) joe_malloc(itemsize * 16); 20 | STDITEM *z = (STDITEM *) ((unsigned char *) i + itemsize * 16); 21 | 22 | while (i != z) { 23 | enquef(STDITEM, link, freelist, i); 24 | i = (STDITEM *) ((unsigned char *) i + itemsize); 25 | } 26 | } 27 | return (void *) deque_f(STDITEM, link, freelist->link.prev); 28 | } 29 | 30 | void frchn(void *list, void *ch) 31 | { 32 | STDITEM *freelist = (STDITEM *)list; 33 | STDITEM *chn = (STDITEM *)ch; 34 | STDITEM *i; 35 | 36 | if ((i = chn->link.prev) != chn) { 37 | deque(STDITEM, link, chn); 38 | splicef(STDITEM, link, freelist, i); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /joe/queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Doubly linked list primitives 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_QUEUE 9 | #define _JOE_QUEUE 1 10 | 11 | extern void *ITEM; 12 | extern void *QUEUE; 13 | extern void *LAST; 14 | struct stditem { 15 | LINK(STDITEM) link; 16 | }; 17 | 18 | /* Initialize a doubly-linked list */ 19 | 20 | #define izque(type,member,item) do { \ 21 | QUEUE = (void *)(item); \ 22 | ((type *)QUEUE)->member.prev = (type *)QUEUE; \ 23 | ((type *)QUEUE)->member.next = (type *)QUEUE; \ 24 | } while(0) 25 | 26 | /* Remove an item from a list */ 27 | 28 | #define deque(type,member,item) do { \ 29 | ITEM = (void *)(item); \ 30 | ((type *)ITEM)->member.prev->member.next = ((type *)ITEM)->member.next; \ 31 | ((type *)ITEM)->member.next->member.prev = ((type *)ITEM)->member.prev; \ 32 | } while(0) 33 | 34 | /* Remove an item from a list and return it */ 35 | 36 | #define deque_f(type,member,item) \ 37 | ( \ 38 | ITEM=(void *)(item), \ 39 | ((type *)ITEM)->member.prev->member.next=((type *)ITEM)->member.next, \ 40 | ((type *)ITEM)->member.next->member.prev=((type *)ITEM)->member.prev, \ 41 | (type *)ITEM \ 42 | ) 43 | 44 | /* Return true if doubly-linked list is empty */ 45 | 46 | #define qempty(type,member,item) \ 47 | ( \ 48 | QUEUE=(void *)(item), \ 49 | (type *)QUEUE==((type *)QUEUE)->member.next \ 50 | ) 51 | 52 | /* Insert an item at front of list */ 53 | 54 | #define enquef(type,member,queue,item) do { \ 55 | ITEM = (void *)(item); \ 56 | QUEUE = (void *)(queue); \ 57 | ((type *)ITEM)->member.next = ((type *)QUEUE)->member.next; \ 58 | ((type *)ITEM)->member.prev = (type *)QUEUE; \ 59 | ((type *)QUEUE)->member.next->member.prev = (type *)ITEM; \ 60 | ((type *)QUEUE)->member.next = (type *)ITEM; \ 61 | } while(0) 62 | 63 | /* Insert an item at back of list */ 64 | 65 | #define enqueb(type,member,queue,item) do { \ 66 | ITEM = (void *)(item); \ 67 | QUEUE = (void *)(queue); \ 68 | ((type *)ITEM)->member.next = (type *)QUEUE; \ 69 | ((type *)ITEM)->member.prev = ((type *)QUEUE)->member.prev; \ 70 | ((type *)QUEUE)->member.prev->member.next = (type *)ITEM; \ 71 | ((type *)QUEUE)->member.prev = (type *)ITEM; \ 72 | } while(0) 73 | 74 | /* Insert an item at front of list and return it */ 75 | 76 | #define enqueb_f(type,member,queue,item) \ 77 | ( \ 78 | ITEM=(void *)(item), \ 79 | QUEUE=(void *)(queue), \ 80 | ((type *)ITEM)->member.next=(type *)QUEUE, \ 81 | ((type *)ITEM)->member.prev=((type *)QUEUE)->member.prev, \ 82 | ((type *)QUEUE)->member.prev->member.next=(type *)ITEM, \ 83 | ((type *)QUEUE)->member.prev=(type *)ITEM, \ 84 | (type *)ITEM \ 85 | ) 86 | 87 | /* Promote an item to front of list */ 88 | 89 | #define promote(type,member,queue,item) \ 90 | enquef(type,member,(queue),deque_f(type,member,(item))) 91 | 92 | /* Demote an item to back of list */ 93 | 94 | #define demote(type,member,queue,item) \ 95 | enqueb(type,member,(queue),deque_f(type,member,(item))) 96 | 97 | /* Splice a chain into from of a list */ 98 | 99 | #define splicef(type,member,queue,chain) do { \ 100 | ITEM = (void *)(chain); \ 101 | LAST = (void *)((type *)ITEM)->member.prev; \ 102 | QUEUE = (void *)(queue); \ 103 | ((type *)LAST)->member.next = ((type *)QUEUE)->member.next; \ 104 | ((type *)ITEM)->member.prev = (type *)QUEUE; \ 105 | ((type *)QUEUE)->member.next->member.prev = (type *)LAST; \ 106 | ((type *)QUEUE)->member.next = (type *)ITEM; \ 107 | } while(0) 108 | 109 | /* Splice a chain into back of a list */ 110 | 111 | #define spliceb(type,member,queue,chain) do { \ 112 | ITEM = (void *)(chain); \ 113 | LAST = (void *)((type *)ITEM)->member.prev; \ 114 | QUEUE = (void *)(queue); \ 115 | ((type *)LAST)->member.next = (type *)QUEUE; \ 116 | ((type *)ITEM)->member.prev = ((type *)QUEUE)->member.prev; \ 117 | ((type *)QUEUE)->member.prev->member.next = (type *)ITEM; \ 118 | ((type *)QUEUE)->member.prev = (type *)LAST; \ 119 | } while(0) 120 | 121 | #define spliceb_f(type,member,queue,chain) \ 122 | ( \ 123 | ITEM=(void *)(chain), \ 124 | LAST=(void *)((type *)ITEM)->member.prev, \ 125 | QUEUE=(void *)(queue), \ 126 | ((type *)LAST)->member.next=(type *)QUEUE, \ 127 | ((type *)ITEM)->member.prev=((type *)QUEUE)->member.prev, \ 128 | ((type *)QUEUE)->member.prev->member.next=(type *)ITEM, \ 129 | ((type *)QUEUE)->member.prev=(type *)LAST, \ 130 | (type *)ITEM \ 131 | ) 132 | 133 | /* Remove a range of items from a list and return it as a chain for later splicing */ 134 | 135 | #define snip(type,member,first,last) \ 136 | ( \ 137 | ITEM=(void *)(first), \ 138 | LAST=(void *)(last), \ 139 | ((type *)LAST)->member.next->member.prev=((type *)ITEM)->member.prev, \ 140 | ((type *)ITEM)->member.prev->member.next=((type *)LAST)->member.next, \ 141 | ((type *)ITEM)->member.prev=(type *)LAST, \ 142 | ((type *)LAST)->member.next=(type *)ITEM, \ 143 | (type *)ITEM \ 144 | ) 145 | 146 | /* Allocate an item */ 147 | 148 | void *alitem PARAMS((void *list, int itemsize)); 149 | 150 | /* Free an item */ 151 | 152 | void frchn PARAMS((void *list, void *ch)); 153 | 154 | #endif 155 | -------------------------------------------------------------------------------- /joe/qw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Single-key query windows 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_QW_H 9 | #define _JOE_QW_H 1 10 | 11 | /* Single-key Query window */ 12 | 13 | struct query { 14 | W *parent; /* Window we're in */ 15 | int (*func) (); /* Func. which gets called when key is hit */ 16 | int (*abrt) (); 17 | void *object; 18 | unsigned char *prompt; /* Prompt string */ 19 | int promptlen; /* Width of prompt string */ 20 | int org_w; 21 | int org_h; 22 | }; 23 | 24 | /* QW *mkqw(W *w, char *prompt, int (*func)(), int (*abrt)(), void *object); 25 | * Create a query window for the given window 26 | */ 27 | /* FIXME: ??? ----> */ 28 | QW *mkqw PARAMS((W *w, unsigned char *prompt, int len, int (*func) (/* ??? */), int (*abrt) (/* ??? */), void *object, int *notify)); 29 | QW *mkqwna PARAMS((W *w, unsigned char *prompt, int len, int (*func) (/* ??? */), int (*abrt) (/* ??? */), void *object, int *notify)); 30 | QW *mkqwnsr PARAMS((W *w, unsigned char *prompt, int len, int (*func) (/* ??? */), int (*abrt) (/* ??? */), void *object, int *notify)); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /joe/rc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * *rc file parser 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen; 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_RC_H 9 | #define _JOE_RC_H 1 10 | 11 | extern OPTIONS pdefault; 12 | extern OPTIONS fdefault; 13 | void setopt PARAMS((B *b, unsigned char *name)); 14 | 15 | /* KMAP *kmap_getcontext(char *name); 16 | * Find and return the KMAP for a given context name. If none is found, an 17 | * empty kmap is created, bound to the context name, and returned. 18 | */ 19 | KMAP *kmap_getcontext PARAMS((unsigned char *name)); 20 | 21 | /* KMAP *ngetcontext(char *name); 22 | * JM - Find and return the KMAP for a given context name. If none is found, 23 | * NULL is returned. 24 | */ 25 | KMAP *ngetcontext PARAMS((unsigned char *name)); 26 | 27 | unsigned char **get_keymap_list(); 28 | 29 | /* int procrc(CAP *cap, char *name); Process an rc file 30 | Returns 0 for success 31 | -1 for file not found 32 | 1 for syntax error (errors written to stderr) 33 | */ 34 | int procrc PARAMS((CAP *cap, unsigned char *name)); 35 | 36 | int glopt PARAMS((unsigned char *s, unsigned char *arg, OPTIONS *options, int set)); 37 | 38 | int umode PARAMS((BW *bw)); 39 | int umenu PARAMS((BW *bw)); 40 | 41 | /* Save state */ 42 | void save_state(); 43 | 44 | /* Load state */ 45 | void load_state(); 46 | 47 | /* Validate rc file: return -1 if it's bad (call this after rc file has been loaded) */ 48 | int validate_rc(); 49 | 50 | /* Update options */ 51 | void lazy_opts PARAMS((B *b, OPTIONS *o)); 52 | 53 | int ucharset PARAMS((BW *bw)); 54 | int ulanguage PARAMS((BW *bw)); 55 | 56 | unsigned char *get_status(BW *bw, unsigned char *s); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /joe/regex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Regular expression subroutines 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_REGEX_H 9 | #define _JOE_REGEX_H 1 10 | 11 | int escape PARAMS((int utf8,unsigned char **a, int *b)); 12 | int pmatch PARAMS((unsigned char **pieces, unsigned char *regex, int len, P *p, int n, int icase)); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /joe/selinux.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Example code to show how to copy the security context from one file to 3 | * another. 4 | */ 5 | #include "types.h" 6 | 7 | #ifdef WITH_SELINUX 8 | #include 9 | static int selinux_enabled = -1; 10 | #endif 11 | 12 | int 13 | copy_security_context(const char *from_file, const char *to_file) 14 | { 15 | int status = 0; 16 | #ifdef WITH_SELINUX 17 | security_context_t from_context; 18 | security_context_t to_context; 19 | 20 | if (selinux_enabled == -1) 21 | selinux_enabled = (is_selinux_enabled() > 0); 22 | 23 | if (!selinux_enabled) 24 | return 0; 25 | 26 | if (getfilecon(from_file, &from_context) < 0) { 27 | /* 28 | * If the filesystem doesn't support extended 29 | * attributes, the original had no special security 30 | * context and the target cannot have one either. 31 | */ 32 | if (errno == EOPNOTSUPP) 33 | return 0; 34 | 35 | error(0, errno, (char *)joe_gettext(_("Could not get security context for %s")), 36 | from_file); 37 | return 1; 38 | } 39 | 40 | if (getfilecon(to_file, &to_context) < 0) { 41 | MSG_PUTS(_(joe_gettext(_("\nCould not get security context for ")))); 42 | msg_outtrans(to_file); 43 | msg_putchar('\n'); 44 | freecon(from_context); 45 | return 1; 46 | } 47 | 48 | if (zcmp(from_context, to_context) != 0) { 49 | if (setfilecon(to_file, from_context) < 0) { 50 | error(0, errno, 51 | (char *)joe_gettext(_("Could not set security context for %s")), 52 | to_file); 53 | status = 1; 54 | } 55 | } 56 | 57 | freecon(to_context); 58 | freecon(from_context); 59 | #endif 60 | return status; 61 | } 62 | 63 | int 64 | match_default_security_context(const char *from_file) 65 | { 66 | #ifdef WITH_SELINUX 67 | security_context_t scontext; 68 | 69 | if (selinux_enabled == -1) 70 | selinux_enabled = (is_selinux_enabled() > 0); 71 | 72 | if (!selinux_enabled) 73 | return 0; 74 | 75 | if (getfilecon(from_file, &scontext) < 0) { 76 | /* 77 | * If the filesystem doesn't support extended 78 | * attributes, the original had no special security 79 | * context and the target cannot have one either. 80 | */ 81 | if (errno == EOPNOTSUPP) 82 | return 0; 83 | 84 | error(0, errno, (char *)joe_gettext(_("Could not get security context for %s")), 85 | from_file); 86 | return 1; 87 | } 88 | 89 | if (setfscreatecon(scontext) < 0) { 90 | error(0, errno, 91 | (char *)joe_gettext(_("Could not set default security context for %s")), 92 | from_file); 93 | freecon(scontext); 94 | return 1; 95 | } 96 | freecon(scontext); 97 | #endif 98 | return 0; 99 | } 100 | 101 | 102 | int 103 | reset_default_security_context() 104 | { 105 | #ifdef WITH_SELINUX 106 | if (selinux_enabled == -1) 107 | selinux_enabled = (is_selinux_enabled() > 0); 108 | 109 | if (!selinux_enabled) 110 | return 0; 111 | 112 | if (setfscreatecon(0) < 0) { 113 | error(0, errno, (char *)joe_gettext(_("Could not reset default security context"))); 114 | return 1; 115 | } 116 | #endif 117 | return 0; 118 | } 119 | 120 | 121 | int 122 | output_security_context(char *from_file) 123 | { 124 | #ifdef WITH_SELINUX 125 | security_context_t scontext; 126 | 127 | if (selinux_enabled == -1) 128 | selinux_enabled = (is_selinux_enabled() > 0); 129 | if (!selinux_enabled) 130 | return 0; 131 | 132 | if (getfilecon(from_file, &scontext) < 0) { 133 | /* 134 | * If the filesystem doesn't support extended 135 | * attributes, the original had no special security 136 | * context and the target cannot have one either. 137 | */ 138 | if (errno == EOPNOTSUPP) 139 | return 0; 140 | 141 | error(0, errno,(char *)joe_gettext(_("Could not get security context for %s")), 142 | from_file); 143 | return 1; 144 | } 145 | 146 | error(0, 0, (char *)joe_gettext(_("%s Security Context %s")), from_file, scontext); 147 | freecon(scontext); 148 | #endif 149 | return 0; 150 | } 151 | 152 | #if 0 153 | 154 | /* 155 | Test program compile using the following command 156 | cc -o t t.c -DWITH_SELINUX -DTEST -lselinux 157 | */ 158 | 159 | #include 160 | #include 161 | main(int argc, char **argv) 162 | { 163 | 164 | printf("%d: %s\n", argc, argv[1]); 165 | if (argc == 3) { 166 | copy_security_context(argv[1], argv[2]); 167 | output_security_context(argv[2]); 168 | } 169 | if (argc == 2) { 170 | FILE *fd; 171 | char *temp; 172 | match_default_security_context(argv[1]); 173 | mkstemp(temp); 174 | printf("temp=%s", temp); 175 | fd = fopen(temp, "w"); 176 | fclose(fd); 177 | output_security_context(temp); 178 | reset_default_security_context(); 179 | } 180 | } 181 | #endif 182 | -------------------------------------------------------------------------------- /joe/syntax.h: -------------------------------------------------------------------------------- 1 | #ifndef _Isyntax 2 | #define _Isyntax 1 3 | 4 | /* 5 | * Syntax highlighting DFA interpreter 6 | * Copyright 7 | * (C) 2004 Joseph H. Allen 8 | * 9 | * This file is part of JOE (Joe's Own Editor) 10 | */ 11 | 12 | /* Color definition */ 13 | 14 | struct high_color { 15 | struct high_color *next; 16 | unsigned char *name; /* Symbolic name of color */ 17 | int color; /* Color value */ 18 | }; 19 | 20 | /* State */ 21 | 22 | struct high_state { 23 | int no; /* State number */ 24 | unsigned char *name; /* Highlight state name */ 25 | int color; /* Color for this state */ 26 | struct high_cmd *cmd[256]; /* Character table */ 27 | struct high_cmd *delim; /* Matching delimiter */ 28 | }; 29 | 30 | /* Parameter list */ 31 | 32 | struct high_param { 33 | struct high_param *next; 34 | unsigned char *name; 35 | }; 36 | 37 | /* Command (transition) */ 38 | 39 | struct high_cmd { 40 | unsigned noeat : 1; /* Set to give this character to next state */ 41 | unsigned start_buffering : 1; /* Set if we should start buffering */ 42 | unsigned stop_buffering : 1; /* Set if we should stop buffering */ 43 | unsigned save_c : 1; /* Save character */ 44 | unsigned save_s : 1; /* Save string */ 45 | unsigned ignore : 1; /* Set to ignore case */ 46 | unsigned start_mark : 1; /* Set to begin marked area including this char */ 47 | unsigned stop_mark : 1; /* Set to end marked area excluding this char */ 48 | unsigned recolor_mark : 1; /* Set to recolor marked area with new state */ 49 | unsigned rtn : 1; /* Set to return */ 50 | unsigned reset : 1; /* Set to reset the call stack */ 51 | int recolor; /* No. chars to recolor if <0. */ 52 | struct high_state *new_state; /* The new state */ 53 | HASH *keywords; /* Hash table of keywords */ 54 | struct high_cmd *delim; /* Matching delimiter */ 55 | struct high_syntax *call; /* Syntax subroutine to call */ 56 | }; 57 | 58 | /* Call stack frame */ 59 | 60 | struct high_frame { 61 | struct high_frame *parent; /* Caller's frame */ 62 | struct high_frame *child; /* First callee's frame */ 63 | struct high_frame *sibling; /* Caller's next callee's frame */ 64 | struct high_syntax *syntax; /* Current syntax subroutine */ 65 | struct high_state *return_state; /* Return state in the caller's subroutine */ 66 | }; 67 | 68 | /* Loaded form of syntax file or subroutine */ 69 | 70 | struct high_syntax { 71 | struct high_syntax *next; /* Linked list of loaded syntaxes */ 72 | unsigned char *name; /* Name of this syntax */ 73 | unsigned char *subr; /* Name of the subroutine (or NULL for whole file) */ 74 | struct high_param *params; /* Parameters defined */ 75 | struct high_state **states; /* The states of this syntax. states[0] is idle state */ 76 | HASH *ht_states; /* Hash table of states */ 77 | int nstates; /* No. states */ 78 | int szstates; /* Malloc size of states array */ 79 | struct high_color *color; /* Linked list of color definitions */ 80 | struct high_cmd default_cmd; /* Default transition for new states */ 81 | struct high_frame *stack_base; /* Root of run-time call tree */ 82 | }; 83 | 84 | /* Find a syntax. Load it if necessary. */ 85 | 86 | struct high_syntax *load_syntax PARAMS((unsigned char *name)); 87 | 88 | /* Parse a lines. Returns new state. */ 89 | 90 | extern int *attr_buf; 91 | HIGHLIGHT_STATE parse PARAMS((struct high_syntax *syntax,P *line,HIGHLIGHT_STATE state)); 92 | 93 | #define clear_state(s) (((s)->saved_s[0] = 0), ((s)->state = 0), ((s)->stack = 0)) 94 | #define invalidate_state(s) ((s)->state = -1) 95 | #define move_state(to,from) (*(to)= *(from)) 96 | #define eq_state(x,y) ((x)->state == (y)->state && (x)->stack == (y)->stack && !zcmp((x)->saved_s, (y)->saved_s)) 97 | 98 | extern struct high_color *global_colors; 99 | void parse_color_def PARAMS((struct high_color **color_list,unsigned char *p,unsigned char *name,int line)); 100 | 101 | void dump_syntax PARAMS((BW *bw)); 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /joe/tab.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File selection menu 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_TAB_H 9 | #define _JOE_TAB_H 1 10 | 11 | int cmplt PARAMS((BW *bw)); 12 | extern int menu_jump; 13 | extern int menu_explorer; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /joe/termidx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Program to generate termcap index file 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | static void gen(unsigned char *s, FILE *fd) 11 | { 12 | int c, x; 13 | long addr = 0, oaddr; 14 | 15 | loop: 16 | while (c = getc(fd), c == ' ' || c == '\t' || c == '#') 17 | do { 18 | c = getc(fd); 19 | } while (!(c == -1 || c == '\n')); 20 | if (c == -1) 21 | return; 22 | if (c == '\n') 23 | goto loop; 24 | oaddr = addr; 25 | addr = ftell(fd) - 1; 26 | ungetc(c, fd); 27 | s[x = 0] = 0; 28 | while (1) { 29 | c = getc(fd); 30 | if (c == -1 || c == '\n') { 31 | if (x != 0 && s[x - 1] == '\\') 32 | --x; 33 | if (x) { 34 | int y, z, flg; 35 | 36 | s[x] = 0; 37 | z = 0; 38 | flg = 0; 39 | do { 40 | for (y = z; s[y] && s[y] != '|' && s[y] != ':'; ++y) ; 41 | c = s[y]; 42 | s[y] = 0; 43 | if (strlen((char *)(s + z)) > 2 && !strchr((char *)(s + z), ' ') && !strchr((char *)(s + z), '\t')) { 44 | if(flg) 45 | putchar(' '); 46 | fputs((char *)(s + z), stdout); 47 | flg = 1; 48 | } 49 | s[y] = c; 50 | z = y + 1; 51 | } while (c && c != ':'); 52 | if (flg) 53 | printf(" %lx\n", addr - oaddr); 54 | } 55 | goto loop; 56 | } else if (c == '\r') 57 | /* do nothing */ ; 58 | else 59 | s[x++] = c; 60 | } 61 | } 62 | 63 | int main(int argc, char *argv[]) 64 | { 65 | unsigned char array[65536]; 66 | 67 | gen(array, stdin); 68 | return(0); 69 | } 70 | -------------------------------------------------------------------------------- /joe/tw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Text editing windows 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_TW_H 9 | #define _JOE_TW_H 1 10 | 11 | /* Text window (a BW) */ 12 | 13 | struct tw { 14 | unsigned char *stalin; /* Status line info */ 15 | unsigned char *staright; 16 | int staon; /* Set if status line was on */ 17 | long prevline; /* Previous cursor line number */ 18 | int changed; /* Previous changed value */ 19 | B *prev_b; /* Previous buffer (we need to update status line on nbuf/pbuf) */ 20 | }; 21 | 22 | BW *wmktw PARAMS((Screen *t, B *b)); 23 | 24 | int usplitw PARAMS((BW *bw)); 25 | int uduptw PARAMS((BW *bw)); 26 | int utw0 PARAMS((BASE *b)); 27 | int utw1 PARAMS((BASE *b)); 28 | int uabortbuf PARAMS((BW *bw)); 29 | int ucancel PARAMS((BW *bw, int k)); 30 | int uabort PARAMS((BW *bw, int k)); 31 | int uabort1 PARAMS((BW *bw, int k)); 32 | void setline PARAMS((B *b, long int line)); 33 | int abortit PARAMS((BW *bw)); 34 | extern int staen; 35 | extern int staupd; 36 | extern int keepup; 37 | extern int bg_stalin; 38 | 39 | extern WATOM watomtw; 40 | unsigned char *stagen(unsigned char *stalin, BW *bw, unsigned char *s, int fill); 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /joe/ublock.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/joe/ublock.c -------------------------------------------------------------------------------- /joe/ublock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Highlighted block functions 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UBLOCK_H 9 | #define _JOE_UBLOCK_H 1 10 | 11 | extern int square; /* Column / rectangular block mode */ 12 | extern int lightoff; /* Automatic turn off highlighting */ 13 | extern P *markb, *markk; /* ^KB and ^KK positions */ 14 | 15 | void pinsrect PARAMS((P *cur, B *tmp, long int width, int usetabs)); 16 | int ptabrect PARAMS((P *org, long int height, long int right)); 17 | void pclrrect PARAMS((P *org, long int height, long int right, int usetabs)); 18 | void pdelrect PARAMS((P *org, long int height, long int right)); 19 | B *pextrect PARAMS((P *org, long int height, long int right)); 20 | int markv PARAMS((int r)); 21 | int umarkb PARAMS((BW *bw)); 22 | int umarkk PARAMS((BW *bw)); 23 | int uswap PARAMS((BW *bw)); 24 | int umarkl PARAMS((BW *bw)); 25 | int utomarkb PARAMS((BW *bw)); 26 | int utomarkk PARAMS((BW *bw)); 27 | int utomarkbk PARAMS((BW *bw)); 28 | int ublkdel PARAMS((BW *bw)); 29 | int upicokill PARAMS((BW *bw)); 30 | int ublkmove PARAMS((BW *bw)); 31 | int ublkcpy PARAMS((BW *bw)); 32 | int dowrite PARAMS((BW *bw, unsigned char *s, void *object, int *notify)); 33 | int doinsf PARAMS((BW *bw, unsigned char *s, void *object, int *notify)); 34 | void setindent PARAMS((BW *bw)); 35 | int urindent PARAMS((BW *bw)); 36 | int ulindent PARAMS((BW *bw)); 37 | int ufilt PARAMS((BW *bw)); 38 | int unmark PARAMS((BW *bw)); 39 | int udrop PARAMS((BW *bw)); 40 | int utoggle_marking PARAMS((BW *bw)); 41 | int ubegin_marking PARAMS((BW *bw)); 42 | int uselect PARAMS((BW *bw)); 43 | int upsh PARAMS((BW *bw)); 44 | int upop PARAMS((BW *bw)); 45 | int ulower PARAMS((BW *bw)); 46 | int uupper PARAMS((BW *bw)); 47 | extern int nstack; /* No. block markers pushed on stack */ 48 | int blksum PARAMS((double *,double *)); 49 | unsigned char *blkget(); 50 | extern int autoswap; /* Automatically swap markb and markk if need to make a valid block */ 51 | extern int nowmarking; /* Now marking flag (so make block bigger) for Ctrl-arrow key block selection */ 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /joe/uedit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Basic user edit functions 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UEDIT_H 9 | #define _JOE_UEDIT_H 1 10 | 11 | extern int pgamnt; /* Amount of pgup/pgdn lines to keep */ 12 | 13 | /* 14 | * Movable functions 15 | * return 0 if action was done 16 | * return -1 otherwise 17 | */ 18 | int u_goto_bol PARAMS((BW *bw)); /* move cursor to beginning of line */ 19 | int u_goto_eol PARAMS((BW *bw)); /* move cursor to end of line */ 20 | int u_goto_bof PARAMS((BW *bw)); /* move cursor to beginning of file */ 21 | int u_goto_eof PARAMS((BW *bw)); /* move cursor to end of file */ 22 | int u_goto_left PARAMS((BW *bw)); /* move cursor to left (left arrow) */ 23 | int u_goto_right PARAMS((BW *bw)); /* move cursor to right (right arrow) */ 24 | int u_goto_prev PARAMS((BW *bw)); /* move cursor to prev. word, edge, 25 | or beginning of line */ 26 | int u_goto_next PARAMS((BW *bw)); /* move cursor to next word, edge, 27 | or end of line */ 28 | 29 | int utomatch PARAMS((BW *bw)); 30 | int uuparw PARAMS((BW *bw)); 31 | int udnarw PARAMS((BW *bw)); 32 | int utos PARAMS((BW *bw)); 33 | int ubos PARAMS((BW *bw)); 34 | void scrup PARAMS((BW *bw, int n, int flg)); 35 | void scrdn PARAMS((BW *bw, int n, int flg)); 36 | int upgup PARAMS((BW *bw)); 37 | int upgdn PARAMS((BW *bw)); 38 | int uupslide PARAMS((BW *bw)); 39 | int udnslide PARAMS((BW *bw)); 40 | int uline PARAMS((BW *bw)); 41 | int udelch PARAMS((BW *bw)); 42 | int ubacks PARAMS((BW *bw, int k)); 43 | int u_word_delete PARAMS((BW *bw)); 44 | int ubackw PARAMS((BW *bw)); 45 | int udelel PARAMS((BW *bw)); 46 | int udelbl PARAMS((BW *bw)); 47 | int udelln PARAMS((BW *bw)); 48 | int uinsc PARAMS((BW *bw)); 49 | int utypebw PARAMS((BW *bw, int k)); 50 | int uquote PARAMS((BW *bw)); 51 | int uquote8 PARAMS((BW *bw)); 52 | int rtntw PARAMS((BW *bw)); 53 | int uopen PARAMS((BW *bw)); 54 | int usetmark PARAMS((BW *bw, int c)); 55 | int ugomark PARAMS((BW *bw, int c)); 56 | int ufwrdc PARAMS((BW *bw, int k)); 57 | int ubkwdc PARAMS((BW *bw, int k)); 58 | int umsg PARAMS((BASE *b)); 59 | int uctrl PARAMS((BW *bw)); 60 | int unedge PARAMS((BW *bw)); 61 | int upedge PARAMS((BW *bw)); 62 | int ubyte PARAMS((BW *bw)); 63 | int ucol PARAMS((BW *bw)); 64 | int utxt PARAMS((BW *bw)); 65 | int uhome PARAMS((BW *bw)); 66 | int uname_joe PARAMS((BW *bw)); 67 | int upaste PARAMS((BW *bw, int k)); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /joe/uerror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Compiler error handler 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UERROR_H 9 | #define _JOE_UERROR_H 1 10 | 11 | int unxterr PARAMS((BW *bw)); 12 | int uprverr PARAMS((BW *bw)); 13 | int parserrb PARAMS((B *b)); 14 | int uparserr PARAMS((BW *bw)); 15 | int ujump PARAMS((BW *bw)); 16 | void inserr PARAMS((unsigned char *name, long int where, long int n, int bol)); 17 | void delerr PARAMS((unsigned char *name, long int where, long int n)); 18 | void abrerr PARAMS((unsigned char *name)); 19 | void saverr PARAMS((unsigned char *name)); 20 | B *beafter PARAMS((B *)); 21 | extern B *errbuf; /* Buffer which has error messages */ 22 | void parseone_grep PARAMS((struct charmap *map, unsigned char *s, unsigned char **rtn_name, long *rtn_line)); 23 | int ucurrent_msg PARAMS((BW *bw)); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /joe/ufile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * User file operations 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UFILE_H 9 | #define _JOE_UFILE_H 1 10 | 11 | extern int exask; /* Ask for file name during ^K X */ 12 | 13 | void genexmsg PARAMS((BW *bw, int saved, unsigned char *name)); 14 | 15 | int ublksave PARAMS((BW *bw)); 16 | int ushell PARAMS((BW *bw)); 17 | int usys PARAMS((BW *bw)); 18 | int usave PARAMS((BW *bw)); 19 | int usavenow PARAMS((BW *bw)); 20 | int uedit PARAMS((BW *bw)); 21 | int uswitch PARAMS((BW *bw)); 22 | int uscratch PARAMS((BW *bw)); 23 | int uinsf PARAMS((BW *bw)); 24 | int uexsve PARAMS((BW *bw)); 25 | int unbuf PARAMS((BW *bw)); 26 | int upbuf PARAMS((BW *bw)); 27 | int uask PARAMS((BW *bw)); 28 | int ubufed PARAMS((BW *bw)); 29 | int ulose PARAMS((BW *bw)); 30 | int okrepl PARAMS((BW *bw)); 31 | int doswitch PARAMS((BW *bw, unsigned char *s, void *obj, int *notify)); 32 | int uquerysave PARAMS((BW *bw)); 33 | int ukilljoe PARAMS((BW *bw)); 34 | int get_buffer_in_window PARAMS((BW *bw, B *b)); 35 | 36 | extern B *filehist; /* History of file names */ 37 | 38 | extern int nobackups; /* Set to disable backup files */ 39 | extern unsigned char *backpath; /* Path to backup files if not current directory */ 40 | extern int orphan; /* Set to keep orphaned buffers (buffers with no windows) */ 41 | 42 | extern unsigned char *yes_key; 43 | extern unsigned char *no_key; 44 | #define YES_CODE -10 45 | #define NO_CODE -20 46 | int yncheck PARAMS((unsigned char *string, int c)); 47 | int ynchecks PARAMS((unsigned char *string, unsigned char *s)); 48 | 49 | int ureload(BW *bw); 50 | int ureload_all(BW *bw); 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /joe/uformat.h: -------------------------------------------------------------------------------- 1 | /* 2 | * User text formatting functions 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UFORMAT_H 9 | #define _JOE_UFORMAT_H 1 10 | 11 | int ucenter PARAMS((BW *bw)); 12 | P *pbop PARAMS((BW *bw, P *p)); 13 | P *peop PARAMS((BW *bw, P *p)); 14 | int ubop PARAMS((BW *bw)); 15 | int ueop PARAMS((BW *bw)); 16 | void wrapword PARAMS((BW *bw, P *p, long int indent, int french, int no_over, unsigned char *indents)); 17 | int uformat PARAMS((BW *bw)); 18 | int ufmtblk PARAMS((BW *bw)); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /joe/uisrch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Incremental search 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UISRCH_H 9 | #define _JOE_UISRCH_H 1 10 | 11 | int uisrch PARAMS((BW *bw)); 12 | int ursrch PARAMS((BW *bw)); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /joe/umath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Math 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UMATH_H 9 | #define _JOE_UMATH_H 1 10 | 11 | extern unsigned char *merr; /* Math error message: set if calc returned an error */ 12 | double calc PARAMS((BW *bw, unsigned char *s)); 13 | int umath PARAMS((BW *bw)); 14 | 15 | extern B *mathhist; 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /joe/undo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UNDO system 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UNDO_H 9 | #define _JOE_UNDO_H 1 10 | 11 | struct undorec { 12 | LINK(UNDOREC) link; /* Doubly-linked list of undo records */ 13 | UNDOREC *unit; /* If this is first record of a unit: points to last. If this is last record of a unit: points to first. */ 14 | int min; /* Set to allow merging of undo information with this record (like to small inserts) */ 15 | int changed; /* Status of modified flag before this record */ 16 | long where; /* Buffer address of this record */ 17 | long len; /* Length of insert or delete */ 18 | int del; /* Set if this is a delete */ 19 | B *big; /* Set to buffer containing a large amount of deleted data */ 20 | unsigned char *small; /* Set to malloc block containg a small amount of deleted data */ 21 | }; 22 | 23 | struct undo { 24 | LINK(UNDO) link; 25 | B *b; 26 | int nrecs; /* Number of units */ 27 | UNDOREC recs; /* The undo records: recs.link.prev is latest */ 28 | UNDOREC *ptr; /* Pointer to latest "undone" record. */ 29 | UNDOREC *first; /* Pointers to first and last records of a group. The group is */ 30 | UNDOREC *last; /* treated as a single undo record. */ 31 | }; 32 | 33 | extern int inundo; /* Set if inserts/deletes are part of an undo operation */ 34 | extern int justkilled; /* Last edit was a delete, so store data in yank buffer */ 35 | 36 | UNDO *undomk PARAMS((B *b)); 37 | void undorm PARAMS((UNDO *undo)); 38 | int uundo PARAMS((BW *bw)); 39 | int uredo PARAMS((BW *bw)); 40 | void umclear PARAMS((void)); /* Call this to finalize current undo records. New changes will create new records. */ 41 | void undomark PARAMS((void)); 42 | void undoins PARAMS((UNDO *undo, P *p, long int size)); 43 | void undodel PARAMS((UNDO *undo, long int where, B *b)); 44 | int uyank PARAMS((BW *bw)); 45 | int uyankpop PARAMS((BW *bw)); 46 | int uyapp PARAMS((BW *bw)); 47 | int unotmod PARAMS((BW *bw)); 48 | int ucopy PARAMS((BW *bw)); 49 | 50 | void load_yank PARAMS((FILE *f)); 51 | void save_yank PARAMS((FILE *f)); 52 | void bw_unlock PARAMS((BW *bw)); 53 | 54 | extern int undo_keep; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /joe/usearch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Search & Replace system 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_USEARCH_H 9 | #define _JOE_USEARCH_H 1 10 | 11 | struct srchrec { 12 | LINK(SRCHREC) link; /* Linked list of search & replace locations */ 13 | int yn; /* Did we replace? */ 14 | int wrap_flag; /* Did we wrap? */ 15 | long addr; /* Where we were */ 16 | B *b; /* Buffer address is in */ 17 | long last_repl; 18 | }; 19 | 20 | struct search { 21 | unsigned char *pattern; /* Search pattern */ 22 | unsigned char *replacement; /* Replacement string */ 23 | int backwards; /* Set if search should go backwards */ 24 | int ignore; /* Set if we should ignore case */ 25 | int repeat; /* Set with repeat count (or -1 for no repeat count) */ 26 | int replace; /* Set if this is search & replace */ 27 | int rest; /* Set to do remainder of search & replace w/o query */ 28 | unsigned char *entire; /* Entire matched string */ 29 | unsigned char *pieces[26]; /* Peices of the matched string */ 30 | int flg; /* Set after prompted for first replace */ 31 | SRCHREC recs; /* Search & replace position history */ 32 | P *markb, *markk; /* Original marks */ 33 | P *wrap_p; /* Wrap point */ 34 | int wrap_flag; /* Set if we've wrapped */ 35 | int allow_wrap; /* Set to allow wrapping */ 36 | int valid; /* Set if original marks are a valid block */ 37 | long addr; /* Where to place cursor after failed restruct_to_block() test */ 38 | long last_repl; /* Address of last replacement (prevents infinite loops) */ 39 | int block_restrict; /* Search restricted to marked block */ 40 | int all; /* Set to continue in other windows */ 41 | B *first; /* Starting buffer */ 42 | B *current; /* Current buffer */ 43 | }; 44 | 45 | SRCH *mksrch PARAMS((unsigned char *pattern, unsigned char *replacement, int ignore, int backwards, int repeat, int replace, int rest, int all)); 46 | void rmsrch PARAMS((SRCH *srch)); 47 | 48 | int dopfnext PARAMS((BW *bw, SRCH *srch, int *notify)); 49 | 50 | int pffirst PARAMS((BW *bw)); 51 | int pfnext PARAMS((BW *bw)); 52 | 53 | int pqrepl PARAMS((BW *bw)); 54 | int prfirst PARAMS((BW *bw)); 55 | 56 | int ufinish PARAMS((BW *bw)); 57 | int dofirst PARAMS((BW *bw, int back, int repl, unsigned char *hint)); 58 | 59 | extern B *findhist; /* Search history buffer */ 60 | extern B *replhist; /* Replace history buffer */ 61 | 62 | void save_srch PARAMS((FILE *f)); 63 | void load_srch PARAMS((FILE *f)); 64 | 65 | extern int smode; 66 | extern int csmode; 67 | extern int icase; 68 | extern int wrap; 69 | extern int pico; 70 | extern unsigned char srchstr[]; 71 | extern SRCH *globalsrch; 72 | 73 | extern unsigned char *rest_key; 74 | extern unsigned char *backup_key; 75 | 76 | int fwrd_c PARAMS((unsigned char **s)); 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /joe/ushell.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Shell-window functions 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | /* Executed when shell process terminates */ 11 | 12 | static void cdone(B *b) 13 | { 14 | b->pid = 0; 15 | close(b->out); 16 | b->out = -1; 17 | } 18 | 19 | static void cdone_parse(B *b) 20 | { 21 | b->pid = 0; 22 | close(b->out); 23 | b->out = -1; 24 | parserrb(b); 25 | } 26 | 27 | /* Executed for each chunk of data we get from the shell */ 28 | 29 | static void cfollow(B *b,long byte) 30 | { 31 | W *w; 32 | if ((w = maint->topwin) != NULL) { 33 | do { 34 | if ((w->watom->what&TYPETW) && ((BW *)w->object)->b==b && ((BW *)w->object)->cursor->byte==byte) { 35 | BW *bw = (BW *)w->object; 36 | p_goto_eof(bw->cursor); 37 | bw->cursor->xcol = piscol(bw->cursor); 38 | } 39 | w = w->link.next; 40 | } while (w != maint->topwin); 41 | } 42 | } 43 | 44 | static void cdata(B *b, unsigned char *dat, int siz) 45 | { 46 | P *q = pdup(b->eof, USTR "cdata"); 47 | P *r = pdup(b->eof, USTR "cdata"); 48 | long byte = q->byte; 49 | unsigned char bf[1024]; 50 | int x, y; 51 | 52 | for (x = y = 0; x != siz; ++x) { 53 | if (dat[x] == 13 || dat[x] == 0) { 54 | ; 55 | } else if (dat[x] == 8 || dat[x] == 127) { 56 | if (y) { 57 | --y; 58 | } else { 59 | pset(q, r); 60 | prgetc(q); 61 | bdel(q, r); 62 | --byte; 63 | } 64 | } else if (dat[x] == 7) { 65 | ttputc(7); 66 | } else { 67 | bf[y++] = dat[x]; 68 | } 69 | } 70 | if (y) { 71 | binsm(r, bf, y); 72 | } 73 | prm(r); 74 | prm(q); 75 | 76 | cfollow(b,byte); 77 | undomark(); 78 | } 79 | 80 | int cstart(BW *bw, unsigned char *name, unsigned char **s, void *obj, int *notify, int build, int out_only) 81 | { 82 | #ifdef __MSDOS__ 83 | if (notify) { 84 | *notify = 1; 85 | } 86 | varm(s); 87 | msgnw(bw->parent, joe_gettext(_("Sorry, no sub-processes in DOS (yet)"))); 88 | return -1; 89 | #else 90 | MPX *m; 91 | 92 | if (notify) { 93 | *notify = 1; 94 | } 95 | if (bw->b->pid) { 96 | msgnw(bw->parent, joe_gettext(_("Program already running in this window"))); 97 | varm(s); 98 | return -1; 99 | } 100 | /* p_goto_eof(bw->cursor); */ 101 | 102 | if (!(m = mpxmk(&bw->b->out, name, s, cdata, bw->b, build ? cdone_parse : cdone, bw->b, out_only))) { 103 | varm(s); 104 | msgnw(bw->parent, joe_gettext(_("No ptys available"))); 105 | return -1; 106 | } else { 107 | bw->b->pid = m->pid; 108 | } 109 | return 0; 110 | #endif 111 | } 112 | 113 | int ubknd(BW *bw) 114 | { 115 | unsigned char **a; 116 | unsigned char *s; 117 | unsigned char *sh; 118 | 119 | if (!modify_logic(bw,bw->b)) 120 | return -1; 121 | 122 | sh=(unsigned char *)getenv("SHELL"); 123 | 124 | if (file_exists(sh) && zcmp(sh,USTR "/bin/sh")) goto ok; 125 | if (file_exists(sh=USTR "/bin/bash")) goto ok; 126 | if (file_exists(sh=USTR "/usr/bin/bash")) goto ok; 127 | if (file_exists(sh=USTR "/bin/sh")) goto ok; 128 | 129 | msgnw(bw->parent, joe_gettext(_("\"SHELL\" environment variable not defined or exported"))); 130 | return -1; 131 | 132 | ok: 133 | a = vamk(3); 134 | s = vsncpy(NULL, 0, sz(sh)); 135 | a = vaadd(a, s); 136 | s = vsncpy(NULL, 0, sc("-i")); 137 | a = vaadd(a, s); 138 | return cstart(bw, sh, a, NULL, NULL, 0, 0); 139 | } 140 | 141 | /* Run a program in a window */ 142 | 143 | static int dorun(BW *bw, unsigned char *s, void *object, int *notify) 144 | { 145 | unsigned char **a; 146 | unsigned char *cmd; 147 | 148 | if (!modify_logic(bw,bw->b)) 149 | return -1; 150 | 151 | a = vamk(10); 152 | cmd = vsncpy(NULL, 0, sc("/bin/sh")); 153 | 154 | a = vaadd(a, cmd); 155 | cmd = vsncpy(NULL, 0, sc("-c")); 156 | a = vaadd(a, cmd); 157 | a = vaadd(a, s); 158 | return cstart(bw, USTR "/bin/sh", a, NULL, notify, 0, 0); 159 | } 160 | 161 | B *runhist = NULL; 162 | 163 | int urun(BW *bw) 164 | { 165 | if (wmkpw(bw->parent, joe_gettext(_("Program to run: ")), &runhist, dorun, USTR "Run", NULL, NULL, NULL, NULL, locale_map, 1)) { 166 | return 0; 167 | } else { 168 | return -1; 169 | } 170 | } 171 | 172 | static int dobuild(BW *bw, unsigned char *s, void *object, int *notify) 173 | { 174 | unsigned char **a = vamk(10); 175 | unsigned char *cmd = vsncpy(NULL, 0, sc("/bin/sh")); 176 | 177 | a = vaadd(a, cmd); 178 | cmd = vsncpy(NULL, 0, sc("-c")); 179 | a = vaadd(a, cmd); 180 | a = vaadd(a, s); 181 | return cstart(bw, USTR "/bin/sh", a, NULL, notify, 1, 0); 182 | } 183 | 184 | B *buildhist = NULL; 185 | 186 | int ubuild(BW *bw) 187 | { 188 | if (buildhist) { 189 | if ((bw=wmkpw(bw->parent, joe_gettext(_("Build command: ")), &buildhist, dobuild, USTR "Run", NULL, NULL, NULL, NULL, locale_map, 1))) { 190 | uuparw(bw); 191 | u_goto_eol(bw); 192 | bw->cursor->xcol = piscol(bw->cursor); 193 | return 0; 194 | } else { 195 | return -1; 196 | } 197 | } else { 198 | if (wmkpw(bw->parent, joe_gettext(_("Enter build command (for example, 'make'): ")), &buildhist, dobuild, USTR "Run", NULL, NULL, NULL, NULL, locale_map, 1)) { 199 | return 0; 200 | } else { 201 | return -1; 202 | } 203 | } 204 | } 205 | 206 | B *grephist = NULL; 207 | 208 | int ugrep(BW *bw) 209 | { 210 | /* Set parser to grep */ 211 | bw->b->parseone = parseone_grep; 212 | if (grephist) { 213 | if ((bw=wmkpw(bw->parent, joe_gettext(_("Grep command: ")), &grephist, dobuild, USTR "Run", NULL, NULL, NULL, NULL, locale_map, 1))) { 214 | uuparw(bw); 215 | u_goto_eol(bw); 216 | bw->cursor->xcol = piscol(bw->cursor); 217 | return 0; 218 | } else { 219 | return -1; 220 | } 221 | } else { 222 | if (wmkpw(bw->parent, joe_gettext(_("Enter grep command (for example, 'grep -n foo *.c'): ")), &grephist, dobuild, USTR "Run", NULL, NULL, NULL, NULL, locale_map, 1)) { 223 | return 0; 224 | } else { 225 | return -1; 226 | } 227 | } 228 | } 229 | 230 | /* Kill program */ 231 | 232 | static int pidabort(BW *bw, int c, void *object, int *notify) 233 | { 234 | if (notify) { 235 | *notify = 1; 236 | } 237 | if (c != YES_CODE && !yncheck(yes_key, c)) { 238 | return -1; 239 | } 240 | if (bw->b->pid) { 241 | kill(bw->b->pid, 1); 242 | return -1; 243 | } else { 244 | return -1; 245 | } 246 | } 247 | 248 | int ukillpid(BW *bw) 249 | { 250 | if (bw->b->pid) { 251 | if (mkqw(bw->parent, sz(joe_gettext(_("Kill program (y,n,^C)?"))), pidabort, NULL, NULL, NULL)) { 252 | return 0; 253 | } else { 254 | return -1; 255 | } 256 | } else { 257 | return 0; 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /joe/ushell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Shell-window functions 3 | * Copyright (C) 1992 Joseph H. Allen 4 | * 5 | * This file is part of JOE (Joe's Own Editor) 6 | */ 7 | #ifndef _JOE_USHELL_H 8 | #define _JOE_USHELL_H 1 9 | 10 | int ubknd PARAMS((BW *bw)); 11 | int ukillpid PARAMS((BW *bw)); 12 | int urun PARAMS((BW *bw)); 13 | int ubuild PARAMS((BW *bw)); 14 | int ugrep PARAMS((BW *bw)); 15 | int cstart PARAMS((BW *bw, unsigned char *name, unsigned char **s, void *obj, int *notify, int build, int out_only)); 16 | 17 | extern B *runhist; /* Shell command history */ 18 | extern B *buildhist; /* Build command history */ 19 | extern B *grephist; /* Grep command history */ 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /joe/utag.c: -------------------------------------------------------------------------------- 1 | /* 2 | * tags file symbol lookup 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | static int dotag(BW *bw, unsigned char *s, void *obj, int *notify) 11 | { 12 | unsigned char buf[512]; 13 | unsigned char buf1[512]; 14 | FILE *f; 15 | unsigned char *t = NULL; 16 | 17 | if (notify) { 18 | *notify = 1; 19 | } 20 | if (bw->b->name) { 21 | t = vsncpy(t, 0, sz(bw->b->name)); 22 | t = vsncpy(sv(t), sc(":")); 23 | t = vsncpy(sv(t), sv(s)); 24 | } 25 | /* first try to open the tags file in the current directory */ 26 | f = fopen("tags", "r"); 27 | if (!f) { 28 | /* if there's no tags file in the current dir, then query 29 | for the environment variable TAGS. 30 | */ 31 | char *tagspath = getenv("TAGS"); 32 | if(tagspath){ 33 | f = fopen(tagspath, "r"); 34 | } 35 | if(!f){ 36 | msgnw(bw->parent, joe_gettext(_("Couldn't open tags file"))); 37 | vsrm(s); 38 | vsrm(t); 39 | return -1; 40 | } 41 | } 42 | while (fgets((char *)buf, 512, f)) { 43 | int x, y, c; 44 | 45 | for (x = 0; buf[x] && buf[x] != ' ' && buf[x] != '\t'; ++x) ; 46 | c = buf[x]; 47 | buf[x] = 0; 48 | if (!zcmp(s, buf) || (t && !zcmp(t, buf))) { 49 | buf[x] = c; 50 | while (buf[x] == ' ' || buf[x] == '\t') { 51 | ++x; 52 | } 53 | for (y = x; buf[y] && buf[y] != ' ' && buf[y] != '\t' && buf[y] != '\n'; ++y) ; 54 | if (x != y) { 55 | c = buf[y]; 56 | buf[y] = 0; 57 | if (doswitch(bw, vsncpy(NULL, 0, sz(buf + x)), NULL, NULL)) { 58 | vsrm(s); 59 | vsrm(t); 60 | fclose(f); 61 | return -1; 62 | } 63 | bw = (BW *) maint->curwin->object; 64 | p_goto_bof(bw->cursor); 65 | buf[y] = c; 66 | while (buf[y] == ' ' || buf[y] == '\t') { 67 | ++y; 68 | } 69 | for (x = y; buf[x] && buf[x] != '\n'; ++x) ; 70 | buf[x] = 0; 71 | if (x != y) { 72 | long line = 0; 73 | 74 | if (buf[y] >= '0' && buf[y] <= '9') { 75 | /* It's a line number */ 76 | sscanf((char *)(buf + y), "%ld", &line); 77 | if (line >= 1) { 78 | int omid = mid; 79 | 80 | mid = 1; 81 | pline(bw->cursor, line - 1), bw->cursor->xcol = piscol(bw->cursor); 82 | dofollows(); 83 | mid = omid; 84 | } else { 85 | msgnw(bw->parent, joe_gettext(_("Invalid line number"))); 86 | } 87 | } else { 88 | int z = 0; 89 | /* It's a search string. New versions of 90 | ctags have real regex with vi command. Old 91 | ones do not always quote / and depend on it 92 | being last char on line. */ 93 | if (buf[y] == '/' || buf[y] == '?') { 94 | int ch = buf[y++]; 95 | /* Find terminating / or ? */ 96 | for (x = y + zlen(buf + y); x != y; --x) 97 | if (buf[x] == ch) 98 | break; 99 | /* Copy characters, convert to JOE regex... */ 100 | if (buf[y] == '^') { 101 | buf1[z++] = '\\'; 102 | buf1[z++] = '^'; 103 | ++y; 104 | } 105 | while (buf[y] && buf[y] != '\n' && !(buf[y] == ch && y == x)) { 106 | if (buf[y] == '$' && buf[y+1] == ch) { 107 | ++y; 108 | buf1[z++] = '\\'; 109 | buf1[z++] = '$'; 110 | } else if (buf[y] == '\\' && buf[y+1]) { 111 | /* This is going to cause problem... 112 | old ctags did not have escape */ 113 | ++y; 114 | if (buf[y] == '\\') 115 | buf1[z++] = '\\'; 116 | buf1[z++] = buf[y++]; 117 | } else { 118 | buf1[z++] = buf[y++]; 119 | } 120 | } 121 | } 122 | if (z) { 123 | vsrm(s); 124 | vsrm(t); 125 | fclose(f); 126 | buf1[z] = 0; 127 | return dopfnext(bw, mksrch(vsncpy(NULL, 0, sz(buf1)), NULL, 0, 0, -1, 0, 0, 0), NULL); 128 | } 129 | } 130 | } 131 | vsrm(s); 132 | vsrm(t); 133 | fclose(f); 134 | return 0; 135 | } 136 | } 137 | } 138 | msgnw(bw->parent, joe_gettext(_("Not found"))); 139 | vsrm(s); 140 | vsrm(t); 141 | fclose(f); 142 | return -1; 143 | } 144 | 145 | static unsigned char **get_tag_list() 146 | { 147 | unsigned char buf[512]; 148 | unsigned char tag[512]; 149 | int i,pos; 150 | FILE *f; 151 | unsigned char **lst = NULL; 152 | 153 | f = fopen("tags", "r"); 154 | if (f) { 155 | while (fgets((char *)buf, 512, f)) { 156 | pos = 0; 157 | for (i=0; i<512; i++) { 158 | if (buf[i] == ' ' || buf[i] == '\t') { 159 | pos = i; 160 | i = 512; 161 | } 162 | } 163 | if (pos > 0) { 164 | zncpy(tag, buf, pos); 165 | tag[pos] = '\0'; 166 | } 167 | lst = vaadd(lst, vsncpy(NULL, 0, sz(tag))); 168 | } 169 | fclose(f); 170 | } 171 | return lst; 172 | } 173 | 174 | static unsigned char **tag_word_list; 175 | 176 | static int tag_cmplt(BW *bw) 177 | { 178 | /* Reload every time: we should really check date of tags file... 179 | if (tag_word_list) 180 | varm(tag_word_list); */ 181 | 182 | if (!tag_word_list) 183 | tag_word_list = get_tag_list(); 184 | 185 | if (!tag_word_list) { 186 | ttputc(7); 187 | return 0; 188 | } 189 | 190 | return simple_cmplt(bw,tag_word_list); 191 | } 192 | 193 | static B *taghist = NULL; 194 | 195 | int utag(BW *bw) 196 | { 197 | BW *pbw; 198 | 199 | pbw = wmkpw(bw->parent, joe_gettext(_("Tag search: ")), &taghist, dotag, NULL, NULL, tag_cmplt, NULL, NULL, locale_map, 0); 200 | if (pbw && joe_isalnum_(bw->b->o.charmap,brch(bw->cursor))) { 201 | P *p = pdup(bw->cursor, USTR "utag"); 202 | P *q = pdup(p, USTR "utag"); 203 | int c; 204 | 205 | while (joe_isalnum_(bw->b->o.charmap,(c = prgetc(p)))) 206 | /* do nothing */; 207 | if (c != NO_MORE_DATA) { 208 | pgetc(p); 209 | } 210 | pset(q, p); 211 | while (joe_isalnum_(bw->b->o.charmap,(c = pgetc(q)))) 212 | /* do nothing */; 213 | if (c != NO_MORE_DATA) { 214 | prgetc(q); 215 | } 216 | binsb(pbw->cursor, bcpy(p, q)); 217 | pset(pbw->cursor, pbw->b->eof); 218 | pbw->cursor->xcol = piscol(pbw->cursor); 219 | prm(p); 220 | prm(q); 221 | } 222 | if (pbw) { 223 | return 0; 224 | } else { 225 | return -1; 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /joe/utag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * tags file symbol lookup 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _JOE_UTAG_H 9 | #define _JOE_UTAG_H 1 10 | 11 | int utag PARAMS((BW *bw)); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /joe/utf8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * UTF-8 Utilities 3 | * Copyright 4 | * (C) 2004 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #ifndef _Iutf8 9 | #define _Iutf8 1 10 | 11 | /* UTF-8 Encoder 12 | * 13 | * c is unicode character. 14 | * buf is 7 byte buffer- utf-8 coded character is written to this followed by a 0 termination. 15 | * returns length (not including terminator). 16 | */ 17 | 18 | int utf8_encode PARAMS((unsigned char *buf,int c)); 19 | 20 | /* UTF-8 decoder state machine */ 21 | 22 | struct utf8_sm { 23 | unsigned char buf[8]; /* Record of sequence */ 24 | int ptr; /* Record pointer */ 25 | int state; /* Current state. 0 = idle, anything else is no. of chars left in sequence */ 26 | int accu; /* Character accumulator */ 27 | }; 28 | 29 | /* UTF-8 Decoder 30 | * 31 | * Returns 0 - 7FFFFFFF: decoded character 32 | * -1: character accepted, nothing decoded yet. 33 | * -2: incomplete sequence 34 | * -3: no sequence started, but character is between 128 - 191, 254 or 255 35 | */ 36 | 37 | int utf8_decode PARAMS((struct utf8_sm *utf8_sm,unsigned char c)); 38 | 39 | int utf8_decode_string PARAMS((unsigned char *s)); 40 | 41 | int utf8_decode_fwrd PARAMS((unsigned char **p,int *plen)); 42 | 43 | /* Initialize state machine */ 44 | 45 | void utf8_init PARAMS((struct utf8_sm *utf8_sm)); 46 | 47 | void joe_locale(); 48 | void to_utf8 PARAMS((struct charmap *map,unsigned char *s,int c)); 49 | int from_utf8 PARAMS((struct charmap *map,unsigned char *s)); 50 | 51 | int unictrl PARAMS((int ucs)); 52 | int mk_wcwidth PARAMS((int wide,int c)); 53 | 54 | extern struct charmap *locale_map; /* Default bytemap of terminal */ 55 | extern unsigned char *locale_lang; /* Locale language (like de_DE) */ 56 | extern unsigned char *locale_msgs; /* Locale language for editor messages (like de_DE) */ 57 | 58 | void my_iconv PARAMS((unsigned char *dest,struct charmap *dest_map, 59 | unsigned char *src,struct charmap *src_map)); 60 | 61 | struct charmap *guess_map PARAMS((unsigned char *buf, int len)); 62 | 63 | extern int guess_non_utf8; 64 | extern int guess_utf8; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /joe/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Various utilities 3 | * 4 | * Copyright 5 | * (C) 1992 Joseph H. Allen 6 | * (C) 2001 Marek 'Marx' Grac 7 | * 8 | * This file is part of JOE (Joe's Own Editor) 9 | */ 10 | #ifndef _JOE_UTILS_H 11 | #define _JOE_UTILS_H 1 12 | 13 | /* Destructors */ 14 | 15 | #define AUTO_DESTRUCT GC *gc = 0; 16 | 17 | typedef struct gc GC; 18 | 19 | struct gc { 20 | struct gc *next; /* List */ 21 | void **var; /* Address of pointer variable */ 22 | void (*rm)(void *val); /* Destructor which takes pointer variable */ 23 | }; 24 | 25 | /* Add a variable to GC list */ 26 | 27 | void gc_add PARAMS((GC **gc, void **var, void (*rm)(void *val))); 28 | 29 | /* Call destructors */ 30 | 31 | void gc_collect PARAMS((GC **gc)); 32 | 33 | /* Version of return which calls destructors before returning */ 34 | 35 | #define RETURN(val) do { \ 36 | if (gc) gc_collect(&gc); \ 37 | return (val); \ 38 | } while(0) 39 | 40 | /* Pool allocation functions using singly-linked lists */ 41 | 42 | extern void *ITEM; /* Temporary global variable (from queue.c) */ 43 | 44 | /* Allocate item from free-list. If free-list empty, replenish it. */ 45 | 46 | void *replenish PARAMS((void **list,int size)); 47 | 48 | #define al_single(list,type) ( \ 49 | (ITEM = *(void **)(list)) ? \ 50 | ( (*(void **)(list) = *(void **)ITEM), ITEM ) \ 51 | : \ 52 | replenish((void **)(list),sizeof(type)) \ 53 | ) 54 | 55 | /* Put item on free list */ 56 | 57 | #define fr_single(list,item) do { \ 58 | *(void **)(item) = *(void **)(list); \ 59 | *(void **)(list) = (void *)(item); \ 60 | } while(0) 61 | 62 | /* JOE uses 'unsigned char *', never 'char *'. This is that when a 63 | character is loaded into an 'int', the codes 0-255 are used, 64 | not -128 - 127. */ 65 | 66 | /* Zero terminated strings */ 67 | 68 | typedef struct zs ZS; 69 | 70 | struct zs { 71 | unsigned char *s; 72 | }; 73 | 74 | /* Create zs in local gc */ 75 | 76 | #define mk_zs(var,s,len) do { \ 77 | (var) = raw_mk_zs((s),(len)); \ 78 | gc_add(&gc, &(var), rm_zs); \ 79 | } while(0) 80 | 81 | ZS raw_mk_zs PARAMS((GC **gc,unsigned char *s,int len)); 82 | 83 | /* Destructor for zs */ 84 | 85 | void rm_zs PARAMS((ZS z)); 86 | 87 | /* Unsigned versions of regular string functions */ 88 | 89 | /* JOE uses 'unsigned char *', never 'char *'. This is so that when a 90 | character is loaded from a string into an 'int', the codes 0-255 are 91 | used, not -128 - 127. */ 92 | 93 | size_t zlen PARAMS((unsigned char *s)); 94 | int zcmp PARAMS((unsigned char *a, unsigned char *b)); 95 | int zncmp PARAMS((unsigned char *a, unsigned char *b, size_t len)); 96 | unsigned char *zdup PARAMS((unsigned char *s)); 97 | unsigned char *zcpy PARAMS((unsigned char *a, unsigned char *b)); 98 | unsigned char *zncpy PARAMS((unsigned char *a, unsigned char *b,size_t len)); 99 | unsigned char *zstr PARAMS((unsigned char *a, unsigned char *b)); 100 | unsigned char *zchr PARAMS((unsigned char *s, int c)); 101 | unsigned char *zrchr PARAMS((unsigned char *s, int c)); 102 | unsigned char *zcat PARAMS((unsigned char *a, unsigned char *b)); 103 | 104 | /* 105 | * Functions which return minimum/maximum of two numbers 106 | */ 107 | unsigned int uns_min PARAMS((unsigned int a, unsigned int b)); 108 | signed int int_min PARAMS((signed int a, int signed b)); 109 | signed long long_max PARAMS((signed long a, signed long b)); 110 | signed long long_min PARAMS((signed long a, signed long b)); 111 | 112 | /* Versions of 'read' and 'write' which automatically retry when interrupted */ 113 | ssize_t joe_read PARAMS((int fd, void *buf, size_t siz)); 114 | ssize_t joe_write PARAMS((int fd, void *buf, size_t siz)); 115 | int joe_ioctl PARAMS((int fd, int req, void *ptr)); 116 | 117 | /* wrappers to *alloc routines */ 118 | void *joe_malloc PARAMS((size_t size)); 119 | unsigned char *joe_strdup PARAMS((unsigned char *ptr)); 120 | void *joe_calloc PARAMS((size_t nmemb, size_t size)); 121 | void *joe_realloc PARAMS((void *ptr, size_t size)); 122 | void joe_free PARAMS((void *ptr)); 123 | 124 | #ifndef HAVE_SIGHANDLER_T 125 | typedef RETSIGTYPE (*sighandler_t)(int); 126 | #endif 127 | 128 | #ifdef NEED_TO_REINSTALL_SIGNAL 129 | #define REINSTALL_SIGHANDLER(sig, handler) joe_set_signal(sig, handler) 130 | #else 131 | #define REINSTALL_SIGHANDLER(sig, handler) do {} while(0) 132 | #endif 133 | 134 | /* wrapper to hide signal interface differrencies */ 135 | int joe_set_signal PARAMS((int signum, sighandler_t handler)); 136 | 137 | /* Simple parsers */ 138 | int parse_ws PARAMS((unsigned char **p,int cmt)); 139 | int parse_ident PARAMS((unsigned char **p,unsigned char *buf,int len)); 140 | int parse_kw PARAMS((unsigned char **p,unsigned char *kw)); 141 | long parse_num PARAMS((unsigned char **p)); 142 | int parse_tows PARAMS((unsigned char **p,unsigned char *buf)); 143 | int parse_field PARAMS((unsigned char **p,unsigned char *field)); 144 | int parse_char PARAMS((unsigned char **p,unsigned char c)); 145 | int parse_int PARAMS((unsigned char **p,int *buf)); 146 | int parse_long PARAMS((unsigned char **p,long *buf)); 147 | int parse_string PARAMS((unsigned char **p,unsigned char *buf,int len)); 148 | int parse_range PARAMS((unsigned char **p,int *first,int *second)); 149 | void emit_string PARAMS((FILE *f,unsigned char *s,int len)); 150 | 151 | #endif 152 | -------------------------------------------------------------------------------- /joe/va.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Variable length array of strings 3 | * Copyright 4 | * (C) 1992 Joseph H. Allen 5 | * 6 | * This file is part of JOE (Joe's Own Editor) 7 | */ 8 | #include "types.h" 9 | 10 | aELEMENT *vamk(int len) 11 | { 12 | int *new = (int *) joe_malloc((1 + len) * sizeof(aELEMENT) + 2 * sizeof(int)); 13 | 14 | new[0] = len; 15 | new[1] = 0; 16 | ((aELEMENT *)(new + 2))[0] = aterm; 17 | return (aELEMENT *)(new + 2); 18 | } 19 | 20 | void varm(aELEMENT *vary) 21 | { 22 | if (vary) { 23 | vazap(vary, 0, aLen(vary)); 24 | joe_free((int *) vary - 2); 25 | } 26 | } 27 | 28 | int alen(aELEMENT *ary) 29 | { 30 | if (ary) { 31 | aELEMENT *beg = ary; 32 | while (acmp(*ary, aterm)) 33 | ++ary; 34 | return ary - beg; 35 | } else 36 | return 0; 37 | } 38 | 39 | aELEMENT *vaensure(aELEMENT *vary, int len) 40 | { 41 | if (!vary) 42 | vary = vamk(len); 43 | else if (len > aSiz(vary)) { 44 | len += (len >> 2); 45 | vary = (aELEMENT *)(2 + (int *) joe_realloc((int *) vary - 2, (len + 1) * sizeof(aELEMENT) + 2 * sizeof(int))); 46 | 47 | aSiz(vary) = len; 48 | } 49 | return vary; 50 | } 51 | 52 | aELEMENT *vazap(aELEMENT *vary, int pos, int n) 53 | { 54 | if (vary) { 55 | int x; 56 | 57 | if (pos < aLen(vary)) { 58 | if (pos + n <= aLen(vary)) { 59 | for (x = pos; x != pos + n; ++x) 60 | adel(vary[x]); 61 | } else { 62 | for (x = pos; x != aLen(vary); ++x) 63 | adel(vary[x]); 64 | } 65 | } 66 | } 67 | return vary; 68 | } 69 | 70 | aELEMENT *vatrunc(aELEMENT *vary, int len) 71 | { 72 | if (!vary || len > aLEN(vary)) 73 | vary = vaensure(vary, len); 74 | if (len < aLen(vary)) { 75 | vary = vazap(vary, len, aLen(vary) - len); 76 | vary[len] = vary[aLen(vary)]; 77 | aLen(vary) = len; 78 | } else if (len > aLen(vary)) { 79 | vary = vafill(vary, aLen(vary), ablank, len - aLen(vary)); 80 | } 81 | return vary; 82 | } 83 | 84 | aELEMENT *vafill(aELEMENT *vary, int pos, aELEMENT el, int len) 85 | { 86 | int olen = aLEN(vary), x; 87 | 88 | if (!vary || pos + len > aSIZ(vary)) 89 | vary = vaensure(vary, pos + len); 90 | if (pos + len > olen) { 91 | vary[pos + len] = vary[olen]; 92 | aLen(vary) = pos + len; 93 | } 94 | for (x = pos; x != pos + len; ++x) 95 | vary[x] = adup(el); 96 | if (pos > olen) 97 | vary = vafill(vary, pos, ablank, pos - olen); 98 | return vary; 99 | } 100 | 101 | #ifdef junk 102 | aELEMENT *vancpy(aELEMENT *vary, int pos, aELEMENT *array, int len) 103 | { 104 | int olen = aLEN(vary); 105 | 106 | if (!vary || pos + len > aSIZ(vary)) 107 | vary = vaensure(vary, pos + len); 108 | if (pos + len > olen) { 109 | vary[pos + len] = vary[olen]; 110 | aLen(vary) = pos + len; 111 | } 112 | if (pos > olen) 113 | vary = vafill(vary, olen, ablank, pos - olen); 114 | mfwrd(vary + pos, array, len * sizeof(aELEMENT)); 115 | return vary; 116 | } 117 | #endif 118 | 119 | aELEMENT *vandup(aELEMENT *vary, int pos, aELEMENT *array, int len) 120 | { 121 | int olen = aLEN(vary), x; 122 | 123 | if (!vary || pos + len > aSIZ(vary)) 124 | vary = vaensure(vary, pos + len); 125 | if (pos + len > olen) { 126 | vary[pos + len] = vary[olen]; 127 | aLen(vary) = pos + len; 128 | } 129 | if (pos > olen) 130 | vary = vafill(vary, olen, ablank, pos - olen); 131 | for (x = 0; x != len; ++x) 132 | vary[x + pos] = adup(array[x]); 133 | return vary; 134 | } 135 | 136 | aELEMENT *vadup(aELEMENT *vary) 137 | { 138 | return vandup(NULL, 0, vary, aLEN(vary)); 139 | } 140 | 141 | aELEMENT *_vaset(aELEMENT *vary, int pos, aELEMENT el) 142 | { 143 | if (!vary || pos + 1 > aSIZ(vary)) 144 | vary = vaensure(vary, pos + 1); 145 | if (pos > aLen(vary)) { 146 | vary = vafill(vary, aLen(vary), ablank, pos - aLen(vary)); 147 | vary[pos + 1] = vary[pos]; 148 | vary[pos] = el; 149 | aLen(vary) = pos + 1; 150 | } else if (pos == aLen(vary)) { 151 | vary[pos + 1] = vary[pos]; 152 | vary[pos] = el; 153 | aLen(vary) = pos + 1; 154 | } else { 155 | adel(vary[pos]); 156 | vary[pos] = el; 157 | } 158 | return vary; 159 | } 160 | 161 | static int _acmp(aELEMENT *a, aELEMENT *b) 162 | { 163 | return acmp(*a, *b); 164 | } 165 | 166 | aELEMENT *vasort(aELEMENT *ary, int len) 167 | { 168 | if (!ary || !len) 169 | return ary; 170 | qsort(ary, len, sizeof(aELEMENT), (int (*)(const void *, const void *))_acmp); 171 | return ary; 172 | } 173 | 174 | aELEMENT *vawords(aELEMENT *a, unsigned char *s, int len, unsigned char *sep, int seplen) 175 | { 176 | int x; 177 | 178 | if (!a) 179 | a = vamk(10); 180 | else 181 | a = vatrunc(a, 0); 182 | loop: 183 | x = vsspan(s, len, sep, seplen); 184 | s += x; 185 | len -= x; 186 | if (len) { 187 | x = vsscan(s, len, sep, seplen); 188 | if (x != ~0) { 189 | a = vaadd(a, vsncpy(vsmk(x), 0, s, x)); 190 | s += x; 191 | len -= x; 192 | if (len) 193 | goto loop; 194 | } else 195 | a = vaadd(a, vsncpy(vsmk(len), 0, s, len)); 196 | } 197 | return a; 198 | } 199 | -------------------------------------------------------------------------------- /man/Makefile.am: -------------------------------------------------------------------------------- 1 | sysconf_joedir = $(sysconfdir)/joe 2 | data_joedir = $(datadir)/joe 3 | data_docdir = $(docdir) 4 | 5 | SUBDIRS = ru 6 | 7 | man_MANS = joe.1 8 | 9 | EXTRA_DIST = joe.1.in 10 | 11 | joe.1 : joe.1.in 12 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,; s,@BINDIR\@,$(bindir),' $(srcdir)/joe.1.in > $@ 13 | 14 | MOSTLYCLEANFILES = $(man_MANS) 15 | 16 | -------------------------------------------------------------------------------- /man/ru/Makefile.am: -------------------------------------------------------------------------------- 1 | sysconf_joedir = $(sysconfdir)/joe 2 | data_joedir = $(datadir)/joe 3 | data_docdir = $(docdir) 4 | 5 | 6 | man_MANS = joe.1 7 | 8 | mandir = @mandir@/ru 9 | 10 | EXTRA_DIST = joe.1.in 11 | 12 | joe.1 : joe.1.in 13 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,; s,@BINDIR\@,$(bindir),' $(srcdir)/joe.1.in > $@ 14 | 15 | MOSTLYCLEANFILES = $(man_MANS) 16 | -------------------------------------------------------------------------------- /man/ru/joe.1.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/man/ru/joe.1.in -------------------------------------------------------------------------------- /po/HOWTO: -------------------------------------------------------------------------------- 1 | To create a translation for JOE: 2 | 3 | - Create a new .po file and edit in your translations. You can 4 | start with any of the existing .po files, or with the joe.pot file. 5 | 6 | JOE's gettext() allows comments in msgid and msgstr. These look like 7 | this: "|comment|yY". These are used to distinguish between two otherwise 8 | identical strings which have different meanings, except in english. 9 | Without the comment, xgettext (which generates the joe.pot file) will 10 | merge them. 11 | 12 | Some of the strings are sets of characters which can be used as 13 | responses to single-key queries. For example: "|yes|yYoO" means 14 | y, Y, o, and O can all be used to answer yes to a yes/no question. 15 | 16 | It may be difficult to figure out the meaning of some strings- a good 17 | idea is to look at the referenced source code or ask a question 18 | in the joe-editor-general@lists.sourceforge.net mailing list. 19 | 20 | - Verify the .po file with: 21 | 22 | msgfmt --check-format de.po 23 | 24 | This verifies that the number of printf format string directives 25 | has been preserved in your translations. It also generates a binary 26 | version of the .po, but we don't need it. 27 | 28 | - If the joe.pot file has been updated since your last translation 29 | you need to merge in the updates with: msgmerge de.po joe.pot >new.po 30 | 31 | - Copy the .po file into ~/.joe/lang You should be able to try it 32 | now. Run JOE like this to set a particular language: LANG=de_DE joe 33 | 34 | - Translate the on-line help in the joerc file and call it joerc.de 35 | 36 | - If you are feeling ambitious, translate the man page. It goes 37 | here: /usr/share/man/de/man1/joe.1 38 | 39 | - Upload the files to the patch area of 40 | http://sourceforge.net/projects/joe-editor so that others can use them. I 41 | will include them in the next version of JOE. 42 | -------------------------------------------------------------------------------- /po/Makefile.am: -------------------------------------------------------------------------------- 1 | data_joedir = $(datadir)/joe 2 | 3 | data_langdir = $(data_joedir)/lang 4 | 5 | data_lang_DATA = ru.po de.po fr.po uk.po 6 | 7 | EXTRA_DIST = $(data_lang_DATA) 8 | -------------------------------------------------------------------------------- /po/fr.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/po/fr.po -------------------------------------------------------------------------------- /po/ru.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/po/ru.po -------------------------------------------------------------------------------- /po/uk.po: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/po/uk.po -------------------------------------------------------------------------------- /rc/Makefile.am: -------------------------------------------------------------------------------- 1 | sysconf_joedir = $(sysconfdir)/joe 2 | data_joedir = $(datadir)/joe 3 | data_docdir = $(docdir) 4 | 5 | sysconf_joe_built = joerc jicerc.ru jmacsrc jstarrc rjoerc jpicorc 6 | 7 | sysconf_joe_DATA = $(sysconf_joe_built) ftyperc 8 | 9 | EXTRA_DIST = joerc.in jicerc.ru.in jmacsrc.in jstarrc.in jpicorc.in rjoerc.in ftyperc 10 | 11 | joerc : joerc.in 12 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/joerc.in > $@ 13 | 14 | jicerc.ru : jicerc.ru.in 15 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/jicerc.ru.in > $@ 16 | 17 | jmacsrc : jmacsrc.in 18 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/jmacsrc.in > $@ 19 | 20 | jstarrc : jstarrc.in 21 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/jstarrc.in > $@ 22 | 23 | jpicorc : jpicorc.in 24 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/jpicorc.in > $@ 25 | 26 | rjoerc : rjoerc.in 27 | sed 's,@JOERC\@,$(sysconf_joedir),; s,@JOEDOC\@,$(data_docdir),; s,@JOEDATA\@,$(data_joedir),; s,@SPELL\@,@SPELL@,' $(srcdir)/rjoerc.in > $@ 28 | 29 | MOSTLYCLEANFILES = $(sysconf_joe_built) 30 | -------------------------------------------------------------------------------- /rc/jicerc.ru.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/jicerc.ru.in -------------------------------------------------------------------------------- /rc/jmacsrc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/jmacsrc.in -------------------------------------------------------------------------------- /rc/joerc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/joerc.in -------------------------------------------------------------------------------- /rc/jpicorc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/jpicorc.in -------------------------------------------------------------------------------- /rc/jstarrc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/jstarrc.in -------------------------------------------------------------------------------- /rc/rjoerc.in: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/saaros/joe-editor/22965a7738250f5ca7e437e7472e7cfe6f337684/rc/rjoerc.in -------------------------------------------------------------------------------- /setup.hint: -------------------------------------------------------------------------------- 1 | category: Editors 2 | requires: cygwin 3 | sdesc: "An easy to use, modeless text editor." 4 | ldesc: "JOE is a powerful, easy to use, modeless text editor. 5 | It uses the same WordStar keybindings used in Borland's development 6 | environment." 7 | -------------------------------------------------------------------------------- /syntax/4gl.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for Progress 4GL 2 | # by Gediminas http://proc.w3.lt 3 | # Version 1.04 4 | 5 | # bold inverse blink dim underline 6 | # white cyan magenta blue yellow green red black 7 | # bg_white bg_cyan bg_magenta bg_blue bg_yellow bg_green bg_red bg_black 8 | 9 | =Idle 10 | =Comment green 11 | =Constant cyan 12 | =Type magenta 13 | # conditional operators, blocks 14 | =Condition bold 15 | # buffer repositioning 16 | =KeyDB bold green 17 | # create, delete record 18 | =CreateDel bold yellow 19 | # preprocessor include, definition, reference 20 | =Include yellow 21 | =Preproc yellow 22 | =PreRef 23 | 24 | :idle Idle 25 | * idle 26 | "/" slash 27 | "{" brace 28 | "&" prep buffer 29 | "a-zA-Z" ident buffer 30 | "'" string recolor=-1 31 | "\"" string2 recolor=-1 32 | "0-9" number recolor=-1 33 | "?" question recolor=-1 34 | 35 | # Comments - 2 levels of nesting allowed 36 | 37 | :slash Idle 38 | * idle noeat 39 | "*" comment recolor=-2 40 | :comment Comment 41 | * comment 42 | "/" slash2 43 | "*" maybe_end_comment 44 | :maybe_end_comment Comment 45 | * comment 46 | "/" idle 47 | "*" maybe_end_comment 48 | 49 | :slash2 Idle 50 | * comment noeat 51 | "*" comment2 recolor=-2 52 | :comment2 Comment 53 | * comment2 54 | "*" maybe_end_comment2 55 | :maybe_end_comment2 Comment 56 | * comment2 57 | "/" comment 58 | "*" maybe_end_comment2 59 | 60 | # Preprocessor 61 | # Allow preprocessor name reference inside include file reference: 62 | # {include/trace {&FILE-NAME} {&LINE-NUMBER}} 63 | 64 | :brace Include 65 | * include noeat 66 | "&" scoped recolor=-2 67 | "}" idle 68 | 69 | :include Include 70 | * include recolor=-2 71 | "{" brace2 72 | "}" idle 73 | 74 | :brace2 Include 75 | * include2 noeat 76 | "}" idle 77 | 78 | :include2 Include 79 | * include2 recolor=-2 80 | "}" include 81 | 82 | :scoped PreRef 83 | * scoped 84 | "}" idle 85 | 86 | :prep Preproc 87 | * idle noeat istrings 88 | "&IF" predir 89 | "&THEN" predir 90 | "&ELSEIF" predir 91 | "&ELSE" predir 92 | "&ENDIF" predir 93 | "&SCOPED-DEFINE" predir 94 | "&SCOP" predir 95 | "&GLOBAL-DEFINE" predir 96 | "&GLOB" predir 97 | "&MESSAGE" predir 98 | "&UNDEFINE" predir 99 | "&UNDEF" predir 100 | done 101 | "-a-zA-Z0-9_" prep 102 | 103 | :predir Preproc 104 | * idle noeat 105 | 106 | 107 | # String constants, copied from pascal.jsf with " added 108 | 109 | :string Constant 110 | * string 111 | "\n" idle 112 | "'" maybe_end_string 113 | 114 | :maybe_end_string Constant 115 | * idle recolor=-1 noeat 116 | "'" string 117 | 118 | :string2 Constant 119 | * string2 120 | "\n" idle 121 | "\"" maybe_end_string2 122 | 123 | :maybe_end_string2 Constant 124 | * idle recolor=-1 noeat 125 | "\"" string2 126 | 127 | # Numeric constant, same as pascal.jsf 128 | 129 | :number Constant 130 | * idle noeat 131 | "0-9" number 132 | "eE" epart 133 | "." dot 134 | 135 | :dot Constant 136 | * idle noeat 137 | "0-9" float 138 | 139 | :float Constant 140 | * idle noeat 141 | "eE" epart 142 | "0-9" float 143 | 144 | :epart Constant 145 | * idle noeat 146 | "0-9+\-" enum 147 | 148 | :enum Constant 149 | * idle noeat 150 | "0-9" enum 151 | 152 | :question Constant 153 | * idle noeat 154 | 155 | # Keywords 156 | # Available jumps: operator type kw kwdb credel func 157 | 158 | :ident Idle 159 | * idle noeat istrings 160 | "assign" cond 161 | "case" cond 162 | "cha" type 163 | "char" type 164 | "character" type 165 | "create" credel 166 | "dat" type 167 | "date" type 168 | "dec" type 169 | "decimal" type 170 | "defined" predir 171 | "delete" credel 172 | "do" cond 173 | "else" cond 174 | "end" cond 175 | "find" kwdb 176 | "for" kwdb 177 | "function" cond 178 | "get" kwdb 179 | "handle" type 180 | "if" cond 181 | "int" type 182 | "integer" type 183 | "leave" cond 184 | "log" type 185 | "logical" type 186 | "memptr" type 187 | "next" cond 188 | "otherwise" cond 189 | "param" cond 190 | "parameter" cond 191 | "procedure" cond 192 | "raw" type 193 | "rec" type 194 | "repeat" cond 195 | "reposition" kwdb 196 | "return" cond 197 | "rowid" type 198 | "run" cond 199 | "then" cond 200 | "when" cond 201 | "widget-handle" type 202 | done 203 | "-a-zA-Z0-9_" ident 204 | 205 | :cond Condition 206 | * idle noeat 207 | 208 | :kwdb KeyDB 209 | * idle noeat 210 | 211 | :type Type 212 | * idle noeat 213 | 214 | :credel CreateDel 215 | * idle noeat 216 | 217 | -------------------------------------------------------------------------------- /syntax/Makefile.am: -------------------------------------------------------------------------------- 1 | data_joedir = $(datadir)/joe 2 | 3 | data_syntaxdir = $(data_joedir)/syntax 4 | 5 | data_syntax_DATA = c.jsf perl.jsf verilog.jsf conf.jsf python.jsf php.jsf sh.jsf \ 6 | mail.jsf pascal.jsf html.jsf vhdl.jsf fortran.jsf java.jsf xml.jsf tcl.jsf \ 7 | lisp.jsf csh.jsf mason.jsf diff.jsf asm.jsf tex.jsf css.jsf ocaml.jsf \ 8 | 4gl.jsf sml.jsf sql.jsf awk.jsf cobol.jsf sed.jsf ps.jsf ada.jsf \ 9 | troff.jsf haskell.jsf rexx.jsf skill.jsf lua.jsf ruby.jsf m4.jsf joerc.jsf \ 10 | spec.jsf matlab.jsf jsf.jsf jsf_check.jsf 11 | 12 | EXTRA_DIST = $(data_syntax_DATA) 13 | -------------------------------------------------------------------------------- /syntax/ada.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for ADA 2 | 3 | # Define colors 4 | 5 | =Idle 6 | =Comment green 7 | =Constant cyan 8 | =Escape bold cyan 9 | =Keyword bold 10 | =Operator bold 11 | 12 | :idle Idle 13 | * idle 14 | "-" maybe_comment 15 | "'" char recolor=-1 16 | "\"" string recolor=-1 17 | "0-9" first_digit recolor=-1 18 | "." maybe_float 19 | "\"" string recolor=-1 20 | "Bb" maybe_binary buffer 21 | "Oo" maybe_octal buffer 22 | "Xx" maybe_hex buffer 23 | "ac-np-wyzAC-NP-WYZ" ident buffer 24 | 25 | :maybe_comment Idle 26 | * idle noeat 27 | "-" comment recolor=-2 28 | 29 | :comment Comment 30 | * comment 31 | "\n" idle 32 | 33 | 34 | # Character constant 35 | 36 | :char Idle 37 | * char1 38 | 39 | :char1 Idle 40 | * idle 41 | "'" char2 recolor=-3 42 | 43 | :char2 Constant 44 | * idle noeat 45 | 46 | # Strings 47 | 48 | :maybe_binary Idle 49 | * ident noeat 50 | "\"" string recolor=-2 51 | 52 | :maybe_octal Idle 53 | * ident noeat 54 | "\"" string recolor=-2 55 | 56 | :maybe_hex Idle 57 | * ident noeat 58 | "\"" string recolor=-2 59 | 60 | :string Constant 61 | * string 62 | "\n" idle 63 | "\"" idle 64 | "\\" string_escape recolor=-1 65 | 66 | :string_escape Escape 67 | * string 68 | "\n" string recolor=-2 69 | 70 | # Integer constants 71 | 72 | :first_digit Constant 73 | * idle noeat 74 | "." float 75 | "_" first_digit 76 | "0-9" first_digit 77 | 78 | # Floating point 79 | 80 | :maybe_float Constant 81 | * idle recolor=-2 noeat 82 | "0-9" float recolor=-2 83 | 84 | :float Constant 85 | * idle noeat 86 | "eE" epart 87 | "0-9" float 88 | 89 | :epart Constant 90 | * idle noeat 91 | "0-9+\-" enum 92 | 93 | :enum Constant 94 | * idle noeat 95 | "0-9" enum 96 | 97 | # Identifiers 98 | 99 | :ident Idle 100 | * quote noeat istrings 101 | "abort" kw 102 | "abs" operator 103 | "abstract" kw 104 | "accept" kw 105 | "aliased" kw 106 | "all" kw 107 | "and" operator 108 | "array" kw 109 | "at" kw 110 | "begin" kw 111 | "body" kw 112 | "case" kw 113 | "constant" kw 114 | "declare" kw 115 | "delay" kw 116 | "delta" kw 117 | "digits" kw 118 | "do" kw 119 | "else" kw 120 | "elsif" kw 121 | "end" kw 122 | "entry" kw 123 | "exception" kw 124 | "exit" kw 125 | "for" kw 126 | "function" kw 127 | "generic" kw 128 | "goto" kw 129 | "if" kw 130 | "in" kw 131 | "interface" kw 132 | "is" kw 133 | "limited" kw 134 | "loop" kw 135 | "mod" kw 136 | "new" kw 137 | "not" operator 138 | "null" kw 139 | "of" kw 140 | "or" operator 141 | "others" kw 142 | "out" kw 143 | "overriding" kw 144 | "package" kw 145 | "pragma" kw 146 | "private" kw 147 | "procedure" kw 148 | "protected" kw 149 | "raise" kw 150 | "range" kw 151 | "record" kw 152 | "rem" operator 153 | "renames" kw 154 | "requeue" kw 155 | "return" kw 156 | "reverse" kw 157 | "select" kw 158 | "separate" kw 159 | "subtype" kw 160 | "synchronized" kw 161 | "tagged" kw 162 | "task" kw 163 | "terminate" kw 164 | "then" kw 165 | "type" kw 166 | "until" kw 167 | "use" kw 168 | "when" kw 169 | "while" kw 170 | "with" kw 171 | "xor" operator 172 | done 173 | "a-zA-Z0-9_" ident 174 | 175 | :operator Operator 176 | * idle noeat 177 | 178 | :kw Keyword 179 | * idle noeat 180 | 181 | # identifiers separated with quote ' 182 | 183 | :quote Idle 184 | * idle noeat 185 | "'" quote_word 186 | 187 | :quote_word Idle 188 | * idle noeat 189 | "a-zA-Z" ident buffer 190 | -------------------------------------------------------------------------------- /syntax/asm.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for assembly language 2 | 3 | # Highlights ';' comments, C-preprocessor stuff and C-like constants. 4 | 5 | # Some assembly languages do not use C-preprocessor and use '#' for 6 | # comments. For them, eliminate all states up to ':idle'. and change the 7 | # ";" line in 'idle' to '#'. 8 | 9 | # For UNIX assembly ';' actually separates instructions, but I've only seen 10 | # this for 'rep; movsb'. If it bothers you eliminate the ';' line in 11 | # ':idle'. 12 | 13 | # This highlighter is too strict for numeric constants. Many assembly 14 | # languages allow '000009', which looks like a bad octal constant in C/UNIX. 15 | 16 | =Idle 17 | =Bad bold red 18 | =Preproc blue 19 | =Define bold blue 20 | =Comment green 21 | =IncLocal cyan 22 | =IncSystem bold cyan 23 | =Constant cyan 24 | =Escape bold cyan 25 | =Type bold 26 | =Keyword bold 27 | =CppKeyword bold 28 | =Brace 29 | =Control 30 | 31 | :reset Idle 32 | * first noeat 33 | " \t" reset 34 | 35 | :first Idle 36 | * idle noeat 37 | "#" pre recolor=-1 38 | 39 | :pre Preproc 40 | * preproc noeat 41 | " \t" pre 42 | "a-z" preident recolor=-1 buffer 43 | 44 | :preident Preproc 45 | * preproc noeat strings 46 | "define" predef 47 | "include" preinc 48 | done 49 | "a-z" preident 50 | 51 | :preinc Preproc 52 | * preinc 53 | " \t" preinc_ws 54 | "\n" reset 55 | 56 | :preinc_ws Preproc 57 | * prebad recolor=-1 58 | " \t" preinc_ws 59 | "\"" preinc_local recolor=-1 60 | "<" preinc_system recolor=-1 61 | 62 | :preinc_local IncLocal 63 | * preinc_local 64 | "\"\n" reset 65 | 66 | :preinc_system IncSystem 67 | * preinc_system 68 | ">\n" reset 69 | 70 | :prebad Bad 71 | * prebad 72 | "\n" reset 73 | 74 | 75 | :predef Preproc 76 | * predef 77 | " \t" predef_ws 78 | "\n" reset 79 | 80 | :predef_ws Preproc 81 | * prebad recolor=-1 82 | " \t" predef_ws 83 | "a-zA-Z0-9_" predef_ident recolor=-1 84 | 85 | :predef_ident Define 86 | * idle noeat 87 | "a-zA-Z0-9_" predef_ident 88 | 89 | 90 | :preproc Preproc 91 | * preproc 92 | "\n" reset 93 | "\\" preproc_cont 94 | "/" preproc_slash 95 | 96 | :preproc_slash Preproc 97 | * preproc noeat 98 | "*" comment recolor=-2 99 | "/" line_comment recolor=-2 100 | 101 | :preproc_cont Preproc 102 | * preproc_cont 103 | "\n" preproc 104 | 105 | # All following states are for when we're not in a preprocessor line 106 | 107 | :idle Idle 108 | * idle 109 | ";" line_comment recolor=-1 110 | "\n" reset 111 | "/" slash 112 | "0" first_digit recolor=-1 113 | "1-9" decimal recolor=-1 114 | "." maybe_float 115 | "\"" string recolor=-1 116 | "'" char recolor=-1 117 | "a-zA-Z_" ident buffer 118 | "{}" brace recolor=-1 119 | ",:=()><[]*&|!~+\-%^" control recolor=-1 120 | 121 | :brace Brace 122 | * idle noeat 123 | 124 | :control Control 125 | * idle noeat 126 | 127 | :slash Idle 128 | * idle noeat recolor=-2 # Not sure about this 129 | "*" comment recolor=-2 130 | "/" line_comment recolor=-2 131 | 132 | :comment Comment 133 | * comment 134 | "*" maybe_end_comment 135 | 136 | :maybe_end_comment Comment 137 | * comment 138 | "/" idle 139 | "*" maybe_end_comment 140 | 141 | :line_comment Comment 142 | * line_comment 143 | "\n" reset 144 | 145 | :first_digit Constant 146 | * idle noeat 147 | "xX" hex 148 | "." float 149 | "eE" epart 150 | "0-7" octal 151 | "89" bad_number recolor=-1 152 | 153 | :bad_number Bad 154 | * idle noeat 155 | "0-9" bad_number 156 | 157 | :octal Constant 158 | * idle noeat 159 | "0-7" octal 160 | "89" bad_number recolor=-1 161 | 162 | :hex Constant 163 | * idle noeat 164 | "0-9A-Fa-f" hex 165 | 166 | :decimal Constant 167 | * idle noeat 168 | "0-9" decimal 169 | "eE" epart 170 | "." float 171 | 172 | :maybe_float Constant 173 | * idle recolor=-2 noeat 174 | "0-9" float recolor=-2 175 | 176 | :float Constant 177 | * idle noeat 178 | "eE" epart 179 | "0-9" float 180 | 181 | :epart Constant 182 | * idle noeat 183 | "0-9+\-" enum 184 | 185 | :enum Constant 186 | * idle noeat 187 | "0-9" enum 188 | 189 | :string Constant 190 | * string 191 | "\"" idle 192 | "\\" string_escape recolor=-1 193 | "%" string_control recolor=-1 194 | 195 | :string_escape Escape 196 | * string 197 | "x" string_hex1 198 | "0-7" string_octal2 199 | "\n" string recolor=-2 200 | 201 | :string_hex1 Escape 202 | * string noeat 203 | "0-9a-fA-F" string_hex2 204 | 205 | :string_hex2 Escape 206 | * string noeat 207 | "0-9a-fA-F" string 208 | 209 | :string_octal2 Escape 210 | * string noeat 211 | "0-7" string_octal3 212 | 213 | :string_octal3 Escape 214 | * string noeat 215 | "0-7" string 216 | 217 | :string_control Escape 218 | * string_control 219 | "\n" reset 220 | "diouxXeEfFgGaAcspn%SC" string 221 | 222 | :char Constant 223 | * char 224 | "\n" reset 225 | "'" idle 226 | "\\" char_escape recolor=-1 227 | 228 | :char_escape Escape 229 | * char 230 | "x" char_hex1 231 | "0-7" char_octal2 232 | "\n" char recolor=-2 233 | 234 | :char_hex1 Escape 235 | * char noeat 236 | "0-9a-fA-F" char_hex2 237 | 238 | :char_hex2 Escape 239 | * char noeat 240 | "0-9a-fA-F" char 241 | 242 | :char_octal2 Escape 243 | * char noeat 244 | "0-7" char_octal3 245 | 246 | :char_octal3 Escape 247 | * char noeat 248 | "0-7" char 249 | 250 | :ident Idle 251 | * idle noeat 252 | "a-zA-Z0-9_" ident 253 | -------------------------------------------------------------------------------- /syntax/awk.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for AWK 2 | 3 | # Resync whole file 4 | - 5 | 6 | =Idle 7 | =Bad bold red 8 | =Preproc blue 9 | =Define bold blue 10 | =Comment green 11 | =IncLocal cyan 12 | =IncSystem bold cyan 13 | =Constant cyan 14 | =Escape bold cyan 15 | =Type bold 16 | =Keyword bold 17 | =CppKeyword bold 18 | =Brace magenta 19 | =Control 20 | 21 | :reset Idle 22 | * first noeat 23 | " \t" reset 24 | 25 | :first Idle 26 | * idle noeat 27 | "/" regex 28 | "#" reset_line_comment recolor=-1 29 | 30 | :regex Idle 31 | * regex 32 | "/" idle 33 | "\\" regex_skip 34 | 35 | :regex_skip Idle 36 | * regex 37 | 38 | :reset_line_comment Comment 39 | * reset_line_comment 40 | "\n" reset 41 | 42 | :idle Idle 43 | * idle 44 | "\n" reset 45 | "#" line_comment recolor=-1 46 | "0" first_digit recolor=-1 47 | "1-9" decimal recolor=-1 48 | "." maybe_float 49 | "\"" string recolor=-1 50 | "'" char recolor=-1 51 | "a-zA-Z_" ident buffer 52 | "{}" brace recolor=-1 53 | "/,:;=()><[]*&|!~+\-%^" control recolor=-1 54 | 55 | :brace Brace 56 | * idle noeat 57 | 58 | :control Control 59 | * idle noeat 60 | 61 | :line_comment Comment 62 | * line_comment 63 | "\n" reset 64 | 65 | :first_digit Constant 66 | * idle noeat 67 | "xX" hex 68 | "." float 69 | "eE" epart 70 | "0-7" octal 71 | "89" bad_number recolor=-1 72 | 73 | :bad_number Bad 74 | * idle noeat 75 | "0-9" bad_number 76 | 77 | :octal Constant 78 | * idle noeat 79 | "0-7" octal 80 | "89" bad_number recolor=-1 81 | 82 | :hex Constant 83 | * idle noeat 84 | "0-9A-Fa-f" hex 85 | 86 | :decimal Constant 87 | * idle noeat 88 | "0-9" decimal 89 | "eE" epart 90 | "." float 91 | 92 | :maybe_float Constant 93 | * idle recolor=-2 noeat 94 | "0-9" float recolor=-2 95 | 96 | :float Constant 97 | * idle noeat 98 | "eE" epart 99 | "0-9" float 100 | 101 | :epart Constant 102 | * idle noeat 103 | "0-9+\-" enum 104 | 105 | :enum Constant 106 | * idle noeat 107 | "0-9" enum 108 | 109 | :string Constant 110 | * string 111 | "\"" idle 112 | "\\" string_escape recolor=-1 113 | "%" string_control recolor=-1 114 | 115 | :string_escape Escape 116 | * string 117 | "x" string_hex1 118 | "0-7" string_octal2 119 | "\n" string recolor=-2 120 | 121 | :string_hex1 Escape 122 | * string noeat 123 | "0-9a-fA-F" string_hex2 124 | 125 | :string_hex2 Escape 126 | * string noeat 127 | "0-9a-fA-F" string 128 | 129 | :string_octal2 Escape 130 | * string noeat 131 | "0-7" string_octal3 132 | 133 | :string_octal3 Escape 134 | * string noeat 135 | "0-7" string 136 | 137 | :string_control Escape 138 | * string 139 | "\"" string noeat 140 | "\n" reset 141 | "0-9.\-+ #hjILtz$" string_control 142 | 143 | :char Constant 144 | * char 145 | "\n" reset 146 | "'" idle 147 | "\\" char_escape recolor=-1 148 | 149 | :char_escape Escape 150 | * char 151 | "x" char_hex1 152 | "0-7" char_octal2 153 | "\n" char recolor=-2 154 | 155 | :char_hex1 Escape 156 | * char noeat 157 | "0-9a-fA-F" char_hex2 158 | 159 | :char_hex2 Escape 160 | * char noeat 161 | "0-9a-fA-F" char 162 | 163 | :char_octal2 Escape 164 | * char noeat 165 | "0-7" char_octal3 166 | 167 | :char_octal3 Escape 168 | * char noeat 169 | "0-7" char 170 | 171 | :ident Idle 172 | * idle noeat strings 173 | "if" kw 174 | "else" kw 175 | "while" kw 176 | "do" kw 177 | "for" kw 178 | "break" kw 179 | "continue" kw 180 | "delete" kw 181 | "exit" kw 182 | "close" kw 183 | "getline" kw 184 | "next" kw 185 | "nextfile" kw 186 | "print" kw 187 | "printf" kw 188 | "system" kw 189 | "fflush" kw 190 | "atan2" kw 191 | "cos" kw 192 | "exp" kw 193 | "int" kw 194 | "log" kw 195 | "rand" kw 196 | "sin" kw 197 | "sqrt" kw 198 | "srand" kw 199 | "asort" kw 200 | "asorti" kw 201 | "gensub" kw 202 | "gsub" kw 203 | "index" kw 204 | "length" kw 205 | "match" kw 206 | "split" kw 207 | "sprintf" kw 208 | "strtonum" kw 209 | "sub" kw 210 | "substr" kw 211 | "tolower" kw 212 | "toupper" kw 213 | "mktime" kw 214 | "strftime" kw 215 | "systime" kw 216 | "and" kw 217 | "compl" kw 218 | "lshift" kw 219 | "or" kw 220 | "rshift" kw 221 | "xor" kw 222 | "bindtextdomain" kw 223 | "dcgettext" kw 224 | "dcngettext" kw 225 | "function" kw 226 | "return" kw 227 | done 228 | "a-zA-Z0-9_" ident 229 | 230 | :kw Keyword 231 | * idle noeat 232 | -------------------------------------------------------------------------------- /syntax/classic_pascal.jsf.in: -------------------------------------------------------------------------------- 1 | # PASCAL highlighter for JOE 2 | 3 | =Idle 4 | =Comment green 5 | =Constant cyan 6 | =Type bold 7 | =Keyword bold 8 | =Operator bold 9 | =Function bold 10 | 11 | :idle Idle 12 | * idle 13 | "a-zA-Z" ident buffer 14 | "(" maybe_comment 15 | "{" comment recolor=-1 16 | "'" string recolor=-1 17 | "0-9" number recolor=-1 18 | 19 | # Comments 20 | 21 | :maybe_comment Idle 22 | * idle noeat 23 | "*" comment recolor=-2 24 | 25 | :comment Comment 26 | * comment 27 | "*" maybe_end_comment 28 | "}" idle 29 | 30 | :maybe_end_comment Comment 31 | * comment noeat 32 | ")" idle 33 | 34 | 35 | # String constant 36 | 37 | :string Constant 38 | * string 39 | "\n" idle 40 | "'" maybe_end_string 41 | 42 | :maybe_end_string Constant 43 | * idle recolor=-1 noeat 44 | "'" string 45 | 46 | # Numeric constant 47 | 48 | :number Constant 49 | * idle noeat 50 | "0-9" number 51 | "eE" epart 52 | "." dot 53 | 54 | :dot Constant 55 | * idle noeat 56 | "0-9" float 57 | 58 | :float Constant 59 | * idle noeat 60 | "eE" epart 61 | "0-9" float 62 | 63 | :epart Constant 64 | * idle noeat 65 | "0-9+\-" enum 66 | 67 | :enum Constant 68 | * idle noeat 69 | "0-9" enum 70 | 71 | 72 | # Keywords 73 | 74 | :ident Idle 75 | * idle noeat istrings 76 | "and" operator 77 | "array" type 78 | "begin" kw 79 | "case" kw 80 | "const" kw 81 | "div" operator 82 | "do" kw 83 | "downto" kw 84 | "else" kw 85 | "end" kw 86 | "file" kw 87 | "for" kw 88 | "function" kw 89 | "goto" kw 90 | "if" kw 91 | "in" kw 92 | "label" kw 93 | "mod" operator 94 | "nil" word_constant 95 | "not" operator 96 | "of" kw 97 | "or" operator 98 | "packed" kw 99 | "procedure" kw 100 | "program" kw 101 | "record" kw 102 | "repeat" kw 103 | "set" kw 104 | "then" kw 105 | "to" kw 106 | "type" kw 107 | "until" kw 108 | "var" kw 109 | "while" kw 110 | "with" kw 111 | "integer" type 112 | "boolean" type 113 | "real" type 114 | "char" type 115 | "string" type 116 | "text" type 117 | "abs" function 118 | "atan" function 119 | "arctan" function 120 | "concat" function 121 | "cos" function 122 | "eof" function 123 | "eoln" function 124 | "exp" function 125 | "insert" function 126 | "length" function 127 | "ln" function 128 | "log" function 129 | "odd" function 130 | "ord" function 131 | "page" function 132 | "pred" function 133 | "round" function 134 | "sin" function 135 | "sqr" function 136 | "sqrt" function 137 | "succ" function 138 | "trun" function 139 | done 140 | "a-zA-Z0-9_" ident 141 | 142 | :kw Keyword 143 | * idle noeat 144 | 145 | :type Type 146 | * idle noeat 147 | 148 | :operator Operator 149 | * idle noeat 150 | 151 | :word_constant Constant 152 | * idle noeat 153 | 154 | :function Function 155 | * idle noeat 156 | -------------------------------------------------------------------------------- /syntax/conf.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for typical UNIX configuration files 2 | 3 | =Idle 4 | =Comment green 5 | =String cyan 6 | =Escape bold red 7 | =Backtick blue 8 | 9 | :idle Idle 10 | * idle 11 | "#" comment recolor=-1 12 | "\"" string recolor=-1 13 | "'" single recolor=-1 14 | "\`" backtick recolor=-1 15 | "\\" escape recolor=-1 16 | 17 | :escape Escape 18 | * idle 19 | 20 | :comment Comment 21 | * comment 22 | "\n" idle 23 | 24 | 25 | :string String 26 | * string 27 | "\"" idle 28 | "\`" backtick_in_str recolor=-1 29 | "\\" string_escape recolor=-1 30 | 31 | :string_escape Escape 32 | * string 33 | "\n" string recolor=-2 34 | 35 | :backtick_in_str Backtick 36 | * backtick_in_str 37 | "\`" string 38 | "\\" bt_escape_2 recolor=-1 39 | 40 | :bt_escape_2 Escape 41 | * backtick_in_str 42 | "\n" backtick_in_str recolor=-2 43 | 44 | 45 | :single String 46 | * single 47 | "'" idle 48 | "\\" single_escape recolor=-1 49 | 50 | :single_escape Escape 51 | * single 52 | "\n" single recolor=-2 53 | 54 | 55 | :backtick Backtick 56 | * backtick 57 | "\`" idle 58 | "\"" string_in_bt recolor=-1 59 | "'" single_in_bt recolor=-1 60 | "\\" bt_escape recolor=-1 61 | 62 | :bt_escape Escape 63 | * backtick 64 | "\n" backtick recolor=-2 65 | 66 | 67 | :string_in_bt String 68 | * string_in_bt 69 | "\"" backtick 70 | "\\" string_escape_b recolor=-1 71 | 72 | :string_escape_b Escape 73 | * string_in_bt 74 | "\n" string_in_bt recolor=-2 75 | 76 | 77 | :single_in_bt String 78 | * single_in_bt 79 | "'" backtick 80 | "\\" single_escape_b recolor=-1 81 | 82 | :single_escape_b Escape 83 | * single_in_bt 84 | "\n" single_in_bt recolor=-2 85 | 86 | -------------------------------------------------------------------------------- /syntax/csh.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for csh 2 | 3 | # needs work: I just copied this from sh and 4 | # changed the keywords. 5 | 6 | # Colors 7 | 8 | =Idle 9 | =Comment green 10 | =Constant cyan 11 | =Escape bold cyan 12 | =Keyword bold 13 | =Var magenta 14 | 15 | # Syntax 16 | 17 | :idle Idle 18 | * idle 19 | "#" comment recolor=-1 20 | "\\" escape recolor=-1 21 | "$" subst recolor=-1 22 | "'" string_sq recolor=-1 23 | "\"" string_dq recolor=-1 24 | "\`" string_bq recolor=-1 25 | "a-zA-Z{}![" ident buffer 26 | 27 | :comment Comment 28 | * comment 29 | "\n" idle 30 | 31 | :escape Escape 32 | * idle 33 | 34 | :subst Var 35 | * idle 36 | "{" subst_brack 37 | "a-zA-Z_" subst_name 38 | "0-9*@?\-$_!" idle 39 | 40 | :subst_name Var 41 | * idle noeat recolor=-1 42 | "a-zA-Z0-9_" subst_name 43 | 44 | :subst_brack Var 45 | * subst_brack 46 | "}" idle 47 | 48 | # Simplest case: no quoting allowed 49 | :string_sq Constant 50 | * string_sq 51 | "\'" idle 52 | 53 | 54 | # double-quote: quoting, backqoutes and substitution allowed 55 | :string_dq Constant 56 | * string_dq 57 | "$" string_dq_subst recolor=-1 58 | "\"" idle 59 | "\\" string_dq_esc recolor=-1 60 | "`" string_dq_bq recolor=-1 61 | 62 | :string_dq_subst Var 63 | * string_dq noeat recolor=-2 64 | "$0-9!_\-?*@" string_dq 65 | "a-zA-Z_" string_dq_subst_name 66 | "{" string_dq_subst_brack 67 | 68 | :string_dq_subst_name Var 69 | * string_dq recolor=-1 noeat 70 | "a-zA-Z0-9_" string_dq_subst_name 71 | 72 | :string_dq_subst_brack Var 73 | * string_dq_subst_brack 74 | "}" string_dq 75 | 76 | :string_dq_esc Escape 77 | * string_dq recolor=-2 78 | "$`\"\\" string_dq 79 | "\n" string_dq recolor=-2 80 | 81 | :string_dq_bq Constant 82 | * string_dq_bq 83 | "$" string_dq_bq_subst recolor=-1 84 | "\`" string_dq 85 | "\\" string_dq_bq_esc recolor=-1 86 | 87 | :string_dq_bq_subst Var 88 | * string_dq_bq noeat recolor=-2 89 | "$0-9!_\-?*@" string_dq_bq 90 | "a-zA-Z_" string_dq_bq_subst_name 91 | "{" string_dq_bq_subst_brack 92 | 93 | :string_dq_bq_subst_name Var 94 | * string_dq_bq recolor=-1 noeat 95 | "a-zA-Z0-9_" string_dq_bq_subst_name 96 | 97 | :string_dq_bq_subst_brack Var 98 | * string_dq_bq_subst_brack 99 | "}" string_dq_bq 100 | 101 | :string_dq_bq_esc Escape 102 | * string_dq_bq recolor=-2 103 | "$`\"\\" string_dq_bq 104 | "\n" string_dq_bq recolor=-2 105 | 106 | 107 | # backquote 108 | :string_bq Constant 109 | * string_bq 110 | "$" string_bq_subst recolor=-1 111 | "\`" idle 112 | "\\" string_bq_esc recolor=-1 113 | 114 | # escape in backquote 115 | :string_bq_esc Escape 116 | * string_bq recolor=-2 117 | "$`\"\\" string_bq 118 | "\n" string_bq recolor=-2 119 | 120 | # Substitution in a backquote 121 | :string_bq_subst Var 122 | * string_bq noeat recolor=-2 123 | "$0-9!_\-?*@" string_bq 124 | "a-zA-Z_" string_bq_subst_name 125 | "{" string_bq_subst_brack 126 | 127 | :string_bq_subst_name Var 128 | * string_bq recolor=-1 noeat 129 | "a-zA-Z0-9_" string_bq_subst_name 130 | 131 | :string_bq_subst_brack Var 132 | * string_bq_subst_brack 133 | "}" string_bq 134 | 135 | 136 | :ident Idle 137 | * idle noeat strings 138 | "!" kw 139 | "{" kw 140 | "}" kw 141 | "[" kw 142 | "]" kw 143 | "alias" kw 144 | "alloc" kw 145 | "bg" kw 146 | "bindkey" kw 147 | "break" kw 148 | "breaksw" kw 149 | "builtins" kw 150 | "bye" kw 151 | "case" kw 152 | "cd" kw 153 | "chdir" kw 154 | "complete" kw 155 | "continue" kw 156 | "default" kw 157 | "dirs" kw 158 | "echo" kw 159 | "echotc" kw 160 | "else" kw 161 | "end" kw 162 | "endif" kw 163 | "endsw" kw 164 | "eval" kw 165 | "exec" kw 166 | "exit" kw 167 | "fg" kw 168 | "filetest" kw 169 | "foreach" kw 170 | "getspath" kw 171 | "getxvers" kw 172 | "glob" kw 173 | "goto" kw 174 | "hashstat" kw 175 | "history" kw 176 | "hup" kw 177 | "if" kw 178 | "inlib" kw 179 | "jobs" kw 180 | "kill" kw 181 | "limit" kw 182 | "log" kw 183 | "login" kw 184 | "logout" kw 185 | "ls-F" kw 186 | "migrate" kw 187 | "newgrp" kw 188 | "nice" kw 189 | "nohup" kw 190 | "notify" kw 191 | "onintr" kw 192 | "popd" kw 193 | "printenv" kw 194 | "pushd" kw 195 | "rehash" kw 196 | "repeat" kw 197 | "rootnode" kw 198 | "sched" kw 199 | "set" kw 200 | "setenv" kw 201 | "setpath" kw 202 | "setspath" kw 203 | "settc" kw 204 | "setty" kw 205 | "setxvers" kw 206 | "shift" kw 207 | "source" kw 208 | "stop" kw 209 | "suspend" kw 210 | "switch" kw 211 | "case" kw 212 | "telltc" kw 213 | "time" kw 214 | "umask" kw 215 | "unalias" kw 216 | "uncomplete" kw 217 | "unhash" kw 218 | "universe" kw 219 | "unlimit" kw 220 | "unset" kw 221 | "unsetenv" kw 222 | "ver" kw 223 | "wait" kw 224 | "warp" kw 225 | "watchdog" kw 226 | "where" kw 227 | "which" kw 228 | "while" kw 229 | done 230 | "a-zA-Z0-9\-" ident 231 | 232 | :kw Keyword 233 | * idle noeat 234 | -------------------------------------------------------------------------------- /syntax/css.jsf.in: -------------------------------------------------------------------------------- 1 | # JOE syntax highlight file for CSS 2 | # by Eric Lin 3 | 4 | - 5 | 6 | # Define colors 7 | 8 | =Idle 9 | =Comment green 10 | =Class cyan 11 | =Id red 12 | =Tag magenta 13 | =Keyword bold 14 | =HTML 15 | 16 | :begin Idle 17 | * begin noeat call=.css() 18 | 19 | # 20 | # For