mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
tcl: use the system version, initial work only on linux for now
This commit is contained in:
parent
bf0b602b9a
commit
68559d4f76
5 changed files with 44 additions and 51 deletions
|
@ -2,10 +2,10 @@ XCOMM $XConsortium: Imakefile /main/6 1996/11/29 11:06:09 rswiston $
|
|||
|
||||
XLATESRC = $(DTSVCSRC)/DtUtil2
|
||||
|
||||
INCLUDES = -I../lib/tptregexp -I../tcl -I$(XLATESRC)
|
||||
INCLUDES = -I../lib/tptregexp -I$(XLATESRC) -I/usr/include/tcl
|
||||
DEPLIBS = $(DEPDTSVCLIB)
|
||||
LOCAL_LIBRARIES = $(DTSVCLIB) $(TTLIB) $(XMLIB) $(XTOOLLIB) $(XLIB) \
|
||||
-L../lib/tptregexp -ltptregexp ../tcl/libtcl.a
|
||||
-L../lib/tptregexp -ltptregexp -ltcl
|
||||
#if defined(SunArchitecture)
|
||||
EXTRA_LIBRARIES = -lsocket -lnsl -lgen -lm
|
||||
#else
|
||||
|
|
|
@ -324,9 +324,3 @@ void PrintElemTree(Element_t *);
|
|||
void PrintStats(Element_t *);
|
||||
void PrintIDList();
|
||||
|
||||
/* ----- other declarations ----- */
|
||||
|
||||
#ifdef ultrix
|
||||
#define strdup(s) strcpy((char *)malloc(strlen(s)+1), s)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -111,19 +111,19 @@ extern void Browse();
|
|||
static int TclPrintLocation(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[]);
|
||||
const char *argv[]);
|
||||
static int DefaultOutputString(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[]);
|
||||
const char *argv[]);
|
||||
static int CompareI18NStrings(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[]);
|
||||
const char *argv[]);
|
||||
static int TclReadLocaleStrings(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[]);
|
||||
const char *argv[]);
|
||||
char *GetOutFileBaseName();
|
||||
|
||||
char *
|
||||
|
@ -356,12 +356,11 @@ static char *UnEscapeI18NChars(
|
|||
static int DefaultOutputString(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[])
|
||||
const char *argv[])
|
||||
{
|
||||
#define LOCAL_BUFFER_LENGTH 128
|
||||
char *string, *pString, *pArgv;
|
||||
char localBuffer[LOCAL_BUFFER_LENGTH];
|
||||
int retCode, stringLength;
|
||||
char *string = NULL, *pString = NULL;
|
||||
const char *pArgv = NULL;
|
||||
int retCode = 0, stringLength = 0;
|
||||
|
||||
if (argc < 2) {
|
||||
Tcl_SetResult(interpreter, "Missing string to output", TCL_VOLATILE);
|
||||
|
@ -377,12 +376,8 @@ static int DefaultOutputString(ClientData clientData,
|
|||
pArgv = argv[1];
|
||||
stringLength = (2 * strlen(pArgv)) + 3;
|
||||
|
||||
/* try to use automatic buffer; use malloc if string is too large */
|
||||
if (stringLength <= LOCAL_BUFFER_LENGTH) {
|
||||
string = localBuffer;
|
||||
} else {
|
||||
string = malloc(stringLength);
|
||||
}
|
||||
string = malloc(stringLength);
|
||||
memset(string, 0, stringLength);
|
||||
pString = string;
|
||||
|
||||
|
||||
|
@ -409,10 +404,7 @@ static int DefaultOutputString(ClientData clientData,
|
|||
/* put the string to the output */
|
||||
retCode = Tcl_VarEval(interpreter, "puts -nonewline ", string, 0);
|
||||
|
||||
/* free the string if we're not using the automatic buffer */
|
||||
if (string != localBuffer) {
|
||||
free(string);
|
||||
}
|
||||
free(string);
|
||||
|
||||
/* and ripple up any error code we got from the "puts" */
|
||||
return retCode;
|
||||
|
@ -422,7 +414,7 @@ static int DefaultOutputString(ClientData clientData,
|
|||
static int CompareI18NStrings(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[])
|
||||
const char *argv[])
|
||||
{
|
||||
int ret_val, len;
|
||||
char *ret_string, *cp;
|
||||
|
@ -492,7 +484,7 @@ static int CompareI18NStrings(ClientData clientData,
|
|||
static int TclPrintLocation(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[])
|
||||
const char *argv[])
|
||||
{
|
||||
if (argc > 1) {
|
||||
Tcl_SetResult(interpreter, "Too many arguments", TCL_VOLATILE);
|
||||
|
@ -918,26 +910,26 @@ EscapeI18NChars(
|
|||
|
||||
static char *
|
||||
ReadLocaleStrings(char *file_name, int *ret_code) {
|
||||
int fd;
|
||||
char *pBuf;
|
||||
char *i18nBuf;
|
||||
off_t size;
|
||||
struct stat stat_buf;
|
||||
int fd;
|
||||
char *pBuf;
|
||||
char *i18nBuf;
|
||||
off_t size;
|
||||
struct stat stat_buf;
|
||||
|
||||
fd = open(file_name, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
*ret_code = 1;
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fstat(fd, &stat_buf);
|
||||
size = stat_buf.st_size;
|
||||
pBuf = malloc(size+1);
|
||||
pBuf[size] = 0;
|
||||
pBuf = Tcl_Alloc(size+1);
|
||||
memset(pBuf, 0, size+1);
|
||||
|
||||
if (read(fd, pBuf, size) != size) {
|
||||
*ret_code = 2;
|
||||
return "";
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i18nBuf = EscapeI18NChars(pBuf);
|
||||
|
@ -952,10 +944,10 @@ struct stat stat_buf;
|
|||
static int TclReadLocaleStrings(ClientData clientData,
|
||||
Tcl_Interp *interp,
|
||||
int argc,
|
||||
char *argv[]) {
|
||||
char *pBuf;
|
||||
int ret_code;
|
||||
char errorBuf[512];
|
||||
const char *argv[]) {
|
||||
char *pBuf;
|
||||
int ret_code;
|
||||
char errorBuf[512];
|
||||
|
||||
if (argc > 2) {
|
||||
Tcl_SetResult(interpreter, "Too many arguments", TCL_VOLATILE);
|
||||
|
|
|
@ -207,7 +207,7 @@ ExpandVariables(
|
|||
if (*ip == VDELIM && *(ip+1) == L_CURLY && *(ip+2) != '_') {
|
||||
ip++;
|
||||
ip++; /* point at variable name */
|
||||
len + 2;
|
||||
len += 2;
|
||||
vp = vbuf;
|
||||
/* Look for matching (closing) curly. (watch for nesting)
|
||||
* We store the variable content in a tmp buffer, so we don't
|
||||
|
@ -294,9 +294,16 @@ CallInterpreter(
|
|||
)
|
||||
{
|
||||
int result;
|
||||
char line[20];
|
||||
int recursive;
|
||||
|
||||
#if 0
|
||||
if (ib)
|
||||
{
|
||||
fprintf(stderr, "JET: %s: IB = '%s'\n", __FUNCTION__,
|
||||
ib);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* save the value of this "e" to be used by Tcl_PrintLocation in
|
||||
* the case of a user error
|
||||
*/
|
||||
|
|
|
@ -525,7 +525,7 @@ OutputString(
|
|||
int track_pos
|
||||
)
|
||||
{
|
||||
char c, *sdata, *cp;
|
||||
char c = 0, *sdata, *cp;
|
||||
static int char_pos; /* remembers our character position */
|
||||
static int interp_pos; /* like char_pos but when output is to interp */
|
||||
int *ppos; /* points to appropriate line position var */
|
||||
|
@ -678,8 +678,8 @@ static int CheckOutputBuffer(
|
|||
*/
|
||||
int FFlush(FILE *stream)
|
||||
{
|
||||
if (stream) return fflush(stream);
|
||||
return 0;
|
||||
if (stream) return fflush(stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -722,8 +722,8 @@ int Putc(
|
|||
if (result != TCL_OK) {
|
||||
fprintf(stderr,
|
||||
"interpreter error \"%s\" at line %d executing:\n",
|
||||
interpreter->result,
|
||||
interpreter->errorLine);
|
||||
Tcl_GetStringResult(interpreter),
|
||||
Tcl_GetErrorLine(interpreter));
|
||||
fprintf(stderr, "\"%s\"\n", commandBuf);
|
||||
return EOF;
|
||||
}
|
||||
|
@ -787,8 +787,8 @@ int FPuts(
|
|||
if (result != TCL_OK) {
|
||||
fprintf(stderr,
|
||||
"interpreter error \"%s\" at line %d executing:\n",
|
||||
interpreter->result,
|
||||
interpreter->errorLine);
|
||||
Tcl_GetStringResult(interpreter),
|
||||
Tcl_GetErrorLine(interpreter));
|
||||
fprintf(stderr, "\"%s\"\n", pBuff);
|
||||
if (pBuff != commandBuf) free(pBuff);
|
||||
return EOF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue