home *** CD-ROM | disk | FTP | other *** search
- /* os specific stuff which will be included in every module */
- #ifndef OS_H_READ
- # define OS_H_READ
- /*{{{}}}*/
- /*{{{ MS/PC DOS*/
- # ifdef DOS
- # include <h/dos.h>
- # endif
- /*}}} */
- /*{{{ ATARI TOS*/
- # ifdef TOS
- # include "../tos/tos_os.h"
- # endif
- /*}}} */
- /*{{{ AMIGA OS*/
- # ifdef AMIGA
- # include <origami:amiga/h/amiga.h>
- # endif
- /*}}} */
- /*{{{ operating systems*/
- # if (!(defined(TOS)||defined(DOS)||defined(AMIGA)))
- /*{{{ keybind knows all mouse ports*/
- # ifdef ALL_MICE
- # ifndef MGR
- # define MGR
- # endif
- # ifndef XTERM
- # define XTERM
- # endif
- # endif
- /*}}} */
- /*{{{ stdio-stuff*/
- # ifdef LINT
- # define NEVER (scrout-scrout)
- # else
- # define NEVER 0
- # endif
-
- # define oputs(x) do if (scrout) fputs((char*)(x),scrout); while (NEVER)
- # define oputc(x) do if (scrout) fputc((char)(x),scrout); while (NEVER)
- # define oflush do if (scrout) fflush(scrout); while (NEVER)
- # define eputs(x) fputs((char*)x,stderr)
- # define eputc(x) fputc((char)x,stderr)
- /*}}} */
- /*{{{ mouse and windowing*/
- /*{{{ xterm-support*/
- # ifdef XTERM
- # ifndef MOUSY
- # define MOUSY
- # endif
- # define XTERM_MOUSE_NAME "xterm"
- # define XTERM_MOUSE_COUNT 10
- # define XTERM_MOUSE_NAMES \
- {"Button1","Button2","Button3","Button4","Button5", \
- "Button6","Button7","Button8","Button9","Button10"}
- /* use the MIT-mouse row/column and button information, send when button
- * pressed! Switching the mouse to 'send-position' ''is done, if the
- * environment-variable TERM is set to 'xterm'.
- */
- # define XTERM_MOUSE_UP(b) 1
- # ifndef XTERM_MOUSE_LG
- # define XTERM_MOUSE_LG 3
- # endif
- # ifndef XTERM_MOUSE_CODE
- # define XTERM_MOUSE_CODE "\033[M"
- # endif
- # ifndef DEFAULT_MOUSE
- # define DEFAULT_MOUSE XTERM_MOUSE_NAME
- # endif
- /*{{{ strings to de-/activate the send-mouse-position-mode*/
- # ifndef XTERM_START_BP /* send mouse-position on click */
- # define XTERM_START_BP "\033[?9h"
- # endif
- # ifndef XTERM_END_BP /* do action on mouse-click */
- # define XTERM_END_BP "\033[?9l"
- # endif
- /*}}} */
- /*{{{ strings to get window size*/
- # define XTERM_GET_SIZE "\0337\033[r\033[999;999H\033[6n\0338"
- # define XTERM_SIZE_HEAD "\033["
- # define XTERM_SIZE_MID ";"
- # define XTERM_SIZE_END "R"
- /*}}} */
- /*{{{ xterm change title*/
- # ifndef XTERM_CHGNAME
- # define XTERM_CHGNAME(s) \
- (fputc(0x1b,stdout),fputs("]0;",stdout),fputs(s,stdout),fputc(0x7,stdout))
- # endif
- # ifndef XTERM_DEFAULT_TITLE
- # define XTERM_DEFAULT_TITLE XTERM_MOUSE_NAME
- # endif
- # ifndef WINDOW_TITLE_CHANGE
- # define WINDOW_TITLE_CHANGE
- # endif
- /*}}} */
- # endif
- /*}}} */
- /*{{{ mgr-support*/
- # ifdef MGR
- # ifndef MOUSY
- # define MOUSY
- # endif
- # ifndef MGR_MOUSE_NAME
- # define MGR_MOUSE_NAME "mgr"
- # endif
- # define MGR_MOUSE_COUNT 10
- # define MGR_MOUSE_NAMES \
- {"Button1","Button2","Button3","Button4","Button5", \
- "Button1Down","Button2Down","Button3Down","Button4Down","Button5Down"}
- # define MGR_MOUSE_UP(b) ((b)<=5)
- # ifndef XTERM
- # define MGR_MOUSE_LG 3
- # define MGR_MOUSE_CODE "\033[M"
- # else
- # define MGR_MOUSE_LG XTERM_MOUSE_LG
- # define MGR_MOUSE_CODE XTERM_MOUSE_CODE
- # endif
- # ifndef DEFAULT_MOUSE
- # define DEFAULT_MOUSE MGR_MOUSE_NAME
- # endif
- # endif
- /*}}} */
- /*{{{ OS-MOUSE-Hooks*/
- # if 0
- /* maybe add some definitions in the following style */
- # define OS_MOUSE_TAG dummy /* entry in the mouse-typ enum */
- # define OS_MOUSE_NAME "dummy" /* name for the mouse-support, *
- * for -M.. usage in keybind */
- # define OS_MOUSE_COUNT 2 /* number of mouse-buttons, *
- * needed for the bindinglist */
- # define OS_MOUSE_NAMES { "left","right" }
- /* names of the buttons, needed *
- * for the bindinglist */
- # define OS_MOUSE_UP(b) expression
- /* must evaluate to 0, if b is *
- * not a button-down-event */
- # define OS_MOUSE_CODE "\033\0" /* if your mouse sends a char- *
- # define OS_MOUSE_LG 2 * sequence to stdin, define *
- * here this header and its *
- * length. */
- /* in origami/keyboard.c you have to add the code for activating *
- * and scanning the mouse. Look at the mgr- and xterm-support, if *
- * you need a example. */
- # endif
- /*}}} */
- /*{{{ DEFAULT_MOUSE*/
- # ifndef DEFAULT_MOUSE
- # define DEFAULT_MOUSE "no-mouse"
- # endif
- /*}}} */
- /*}}} */
- /*{{{ VIRTUAL_C*/
- # ifdef VIRTUAL_C
- # ifdef VIRTUAL
- # define BLOCK_SIZE 90
- /* mininum is 4*sizeof(int) */
- /* maximum is MAX_FIELD_SIZE+sizeof(int) */
- # define FIXED 8
- /* number of secure lines in memory */
- /* the minum is 8 (number of lines needed */
- /* for internal expressions). You can use */
- /* greater values (screensize for example) */
- # endif
- # endif
- /*}}} */
- /*{{{ ORIEDT*/
- # ifdef ORIEDT_C
- # define BASIC_ELEMENTS 2048 /* number of first element's block */
- # define NEW_ELEMENT_LIMIT 16 /* minimum number of malloced */
- /* element's block. */
- /* if malloc cannot return a block */
- /* of NEW_ELEMENT_LIMIT elements, */
- /* a `not enough memory' warning */
- /* appears! */
- # define NEW_ELEMENT_MAX 128 /* maximum number of malloced */
- /* element's block (used if lines */
- /* are handled virtuell) */
- # endif
- /*}}} */
- /*{{{ scan_abort_key*/
- # define scan_abort_key()
- /*}}} */
- /*{{{ MAIN_C*/
- # ifdef MAIN_C
- # define os_init() scrout=stdout
- # define os_init_args_read()
- # define os_init_rc_read()
- # endif
- /*}}} */
- /*{{{ KEYBIND_C*/
- # ifdef KEYBIND_C
- /*{{{ SORTCMD*/
- # define SORTCMD "sort -t"REF_LIM_QUOTED_TXT" +1 -o %s"
- /*}}} */
- # endif
- /*}}} */
- /*{{{ GETTK_C*/
- # ifdef GETTK_C
- # define chartest if (ch=='\0' || ch=='\n') ch=O_NOP;
- # endif
- /*}}} */
- /*{{{ LOOP_C*/
- # ifdef LOOP_C
- # ifndef NO_MAIL
- /*{{{ maybe set up mailcommand*/
- # ifdef MAIL_SENDMAIL
- /*{{{ MAILDATA for sendmail*/
- # define MAIL_DATA FILE*mail=0;
- /*}}} */
- /*{{{ MAILOPEN for sendmail*/
- # define MAIL_OPEN(subj) \
- do { struct passwd *pw_entry; \
- mail=0; \
- if ( (pw_entry=getpwuid(getuid())) \
- && pw_entry->pw_name \
- &&(mail=popen(MAIL_SENDMAIL" -t -oi","w")) \
- ) { fputs("To: ",mail); \
- fputs(pw_entry->pw_name,mail); \
- fputs("\nSubject: ",mail); \
- fputs(subj,mail); \
- fputs("\n\n",mail); \
- } \
- } while (NEVER)
- /*}}} */
- # else
- /*{{{ MAILDATA for mail [-s]*/
- # ifndef MAILCMDSIZE
- # define MAILCMDSIZE 256
- # endif
- # define MAIL_DATA FILE*mail=0;char cmd[MAILCMDSIZE];
- /*}}} */
- /*{{{ MAILOPEN for mail [-s]*/
- # ifndef MAILCMD
- /*{{{ use default MAILCMD*/
- # ifndef MAIL_NO_S
- # define MAILCMD(buff,subj) \
- do { struct passwd *pw_entry; \
- if ((pw_entry=getpwuid(getuid())) && pw_entry->pw_name) \
- {strcpy(buff,"mail -s '");strcat(buff,subj);strcat(buff,"' "); \
- strcat(buff,pw_entry->pw_name); \
- } \
- else \
- buff[0]='\0'; \
- } while (NEVER)
- # else
- # define MAILCMD(buff,subj) \
- do { struct passwd *pw_entry; \
- if ((pw_entry=getpwuid(getuid())) && pw_entry->pw_name) \
- { strcpy(buff,"mail ");strcat(buff,pw_entry->pw_name); } \
- else \
- buff[0]='\0'; \
- } while (NEVER)
- # endif
- /*}}} */
- # endif
- # define MAIL_OPEN(subj) \
- do { MAILCMD(cmd,subj);mail=cmd[0]?popen(cmd,"w"):0; } while (NEVER)
- /*}}} */
- # endif
- # define MAIL_PUT(s) do if(mail){fputs(s,mail);fflush(mail);}while(NEVER)
- # define MAIL_CLOSE() do if(mail)pclose(mail);while(NEVER)
- /*}}} */
- # endif
- # endif
- /*}}} */
- /*{{{ READFOLDS_C*/
- # ifdef READFOLDS_C
- # define PIPE_FILENAME OS_NULL_DEVICE
- # endif
- /*}}} */
- /*{{{ SCANNER_C*/
- # ifdef SCANNER_C
- # define OS_USINGS
- # endif
- /*}}} */
- /*{{{ formats for rc/help-filenames*/
- # define STD_BASENAME ".origami"
- # define BASENAMEF ".%s"
- /*}}} */
- /*{{{ add missing prototypes for os*/
- # ifdef STRERROR_MIS
- # undef STRERROR_MIS
- char *strerror(int errno);
- # endif
- # ifdef USLEEP_MIS
- # undef USLEEP_MIS
- int usleep(unsigned long);
- # endif
- # ifdef POPEN_MIS
- # undef POPEN_MIS
- FILE *popen(const char *, const char *);
- # endif
- # ifdef PCLOSE_MIS
- # undef PCLOSE_MIS
- int pclose(FILE*);
- # endif
- # ifdef GETPWENT_MIS
- # undef GETPWENT_MIS
- # ifdef TILDE_C
- struct passwd *getpwent(void);
- # endif
- # endif
- /*}}} */
- /*{{{ dir_edit*/
- # ifdef DIREDT
- # ifndef DIR_CMD
- # define DC_OPT_F " \"-M%s%s%s%s\" \"-f%s\" \"-F%s\" -s%c -- %s"
- # define DC_OPT_ARG(na,long,ma,noma) \
- bd.f.str.open_f,bd.f.str.file_f,bd.f.str.line_f,bd.f.str.close_f, \
- ma,noma,(long?'l':' '),na
- # ifdef DIREDT_PATH
- # define DIR_CMD(name,long,match,nomatch) \
- home_expand \
- ( (char*)get_msg \
- ( MSG_ARG_FORMAT, \
- DIREDT_PATH PATH_SEP "dirfold" DC_OPT_F, \
- DC_OPT_ARG(name,long,match,nomatch) \
- ) \
- )
- # else
- # define DIR_CMD(name,long,match,nomatch) \
- (char*)get_msg \
- ( MSG_ARG_FORMAT, \
- "dirfold" DC_OPT_F, \
- DC_OPT_ARG(name,long,match,nomatch) \
- )
- # endif
- # endif
- # endif
- /*}}} */
- # endif
- /*}}} */
- #endif
-