1 /* unix-lib.c - make the newlisp shared newlisp library
3 Copyright (C) 2008 Lutz Mueller
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 extern void setupAllSignals(void);
24 extern int evalSilent
;
26 extern SYMBOL
* mainArgsSymbol
;
28 int libInitialized
= 0;
30 void initializeMain(void)
41 mainArgsSymbol
->contents
= (UINT
)getCell(CELL_EXPRESSION
);
51 extern STREAM errorStream
;
55 /* ---- imported and called from a client using newlisp.so ---- */
57 char * newlispEvalStr(char * cmd
)
59 if(!libInitialized
) initializeMain();
70 executeSymbol(errorEvent
, NULL
);
71 return(libStrStream
.buffer
);
74 return(errorStream
.buffer
);
77 openStrStream(&libStrStream
, MAX_STRING
, 1);
78 executeCommandLine(cmd
, OUT_CONSOLE
, NULL
);
80 if(evalSilent
) evalSilent
= 0;
82 return(libStrStream
.buffer
);