Skip to content

Commit

Permalink
Disable creating writed object from Tcl
Browse files Browse the repository at this point in the history
  • Loading branch information
chpock committed May 25, 2024
1 parent 992793c commit 4dd4060
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 39 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ jobs:
- compiler: gcc
configure: " --disable-c-writer --disable-c-writerchannel --disable-c-vfs"
description: "no writer, writerchannel, vfs"
- compiler: gcc
configure: "--disable-c-writerchannel --disable-c-vfs"
description: "no writerchannel, vfs"
- compiler: gcc
configure: "--disable-c-vfs"
description: "no vfs"
name: build (${{ matrix.compiler }}, ${{ matrix.description }})
steps:
- name: Checkout
Expand Down
24 changes: 9 additions & 15 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -9048,7 +9048,12 @@ else
USECVFS="no"
fi

if test ${USECWRITER} = yes; then
# c-writer / c-writerchan / c-vfs must be enabled together
if test ${USECWRITER} = yes \
&& test ${USECWRITERCHAN} = yes \
&& test ${USECVFS} = yes
then

printf "%s\n" "#define COOKFS_USECWRITER 1" >>confdefs.h

COOKFS_PKGCONFIG_USECWRITER=1
Expand Down Expand Up @@ -9087,15 +9092,7 @@ if test ${USECWRITER} = yes; then



else
COOKFS_PKGCONFIG_USECWRITER=0
# c-vfs requires c-writer
USECVFS="no"
# c-writerchan requires c-writer
USECWRITERCHAN="no"
fi

if test ${USECWRITERCHAN} = yes; then
printf "%s\n" "#define COOKFS_USECWRITERCHAN 1" >>confdefs.h

COOKFS_PKGCONFIG_USECWRITERCHAN=1
Expand Down Expand Up @@ -9134,13 +9131,7 @@ if test ${USECWRITERCHAN} = yes; then



else
COOKFS_PKGCONFIG_USECWRITERCHAN=0
# c-vfs requires c-writerchannel
USECVFS="no"
fi

if test ${USECVFS} = yes; then
printf "%s\n" "#define COOKFS_USECVFS 1" >>confdefs.h

COOKFS_PKGCONFIG_USECVFS=1
Expand Down Expand Up @@ -9179,7 +9170,10 @@ if test ${USECVFS} = yes; then




else
COOKFS_PKGCONFIG_USECWRITER=0
COOKFS_PKGCONFIG_USECWRITERCHAN=0
COOKFS_PKGCONFIG_USECVFS=0
fi

Expand Down
24 changes: 9 additions & 15 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -223,33 +223,27 @@ else
USECVFS="no"
fi

if test ${USECWRITER} = yes; then
# c-writer / c-writerchan / c-vfs must be enabled together
if test ${USECWRITER} = yes \
&& test ${USECWRITERCHAN} = yes \
&& test ${USECVFS} = yes
then

AC_DEFINE(COOKFS_USECWRITER)
COOKFS_PKGCONFIG_USECWRITER=1
TEA_ADD_SOURCES([writer.c writerCmd.c])
else
COOKFS_PKGCONFIG_USECWRITER=0
# c-vfs requires c-writer
USECVFS="no"
# c-writerchan requires c-writer
USECWRITERCHAN="no"
fi

if test ${USECWRITERCHAN} = yes; then
AC_DEFINE(COOKFS_USECWRITERCHAN)
COOKFS_PKGCONFIG_USECWRITERCHAN=1
TEA_ADD_SOURCES([writerchannel.c writerchannelIO.c])
else
COOKFS_PKGCONFIG_USECWRITERCHAN=0
# c-vfs requires c-writerchannel
USECVFS="no"
fi

if test ${USECVFS} = yes; then
AC_DEFINE(COOKFS_USECVFS)
COOKFS_PKGCONFIG_USECVFS=1
TEA_ADD_SOURCES([vfsDriver.c vfsVfs.c vfs.c vfsCmd.c])

else
COOKFS_PKGCONFIG_USECWRITER=0
COOKFS_PKGCONFIG_USECWRITERCHAN=0
COOKFS_PKGCONFIG_USECVFS=0
fi

Expand Down
4 changes: 3 additions & 1 deletion generic/writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ int Cookfs_WriterAddFile(Cookfs_Writer *w, Tcl_Obj *pathObj,
// Check if a fatal error has occurred previously
if (w->fatalError) {
CookfsLog(printf("Cookfs_WriterAddFile: ERROR: writer in a fatal"
" error state"));
" error state: [%s]",
Tcl_GetString(Cookfs_WriterGetLastError(w))));
return TCL_ERROR;
}

Expand Down Expand Up @@ -960,6 +961,7 @@ generateSortKey: ; // empty statement
fatalError:


CookfsLog(printf("Cookfs_WriterPurge: !!! SET FATAL ERROR STATE !!!"));
w->fatalError = 1;
result = TCL_ERROR;

Expand Down
15 changes: 13 additions & 2 deletions generic/writerCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@

#include "cookfs.h"

static Tcl_ObjCmdProc CookfsWriterCmd;
// Creating a writer object from Tcl is not supported as for now
// static Tcl_ObjCmdProc CookfsWriterCmd;

static Tcl_ObjCmdProc CookfsWriterHandlerCmd;
static Tcl_CmdDeleteProc CookfsWriterHandlerCmdDeleteProc;

int Cookfs_InitWriterCmd(Tcl_Interp *interp) {

Tcl_CreateNamespace(interp, "::cookfs::c::writer", NULL, NULL);

// Creating a writer object from Tcl is not supported as for now

/*
Tcl_CreateObjCommand(interp, "::cookfs::c::writer", CookfsWriterCmd,
(ClientData) NULL, NULL);
Tcl_CreateAlias(interp, "::cookfs::writer", interp, "::cookfs::c::writer",
0, NULL);
*/

return TCL_OK;

}
Expand All @@ -47,6 +54,8 @@ Tcl_Obj *CookfsGetWriterObjectCmd(Tcl_Interp *interp, Cookfs_Writer *w) {
return rc;
}

// Creating a writer object from Tcl is not supported as for now
/*
static int CookfsWriterCmd(ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *const objv[])
{
Expand All @@ -65,14 +74,14 @@ static int CookfsWriterCmd(ClientData clientData, Tcl_Interp *interp,
return TCL_ERROR;
}
*/

static void CookfsWriterHandlerCmdDeleteProc(ClientData clientData) {
Cookfs_Writer *w = (Cookfs_Writer *)clientData;
w->commandToken = NULL;
}

static Cookfs_WriterHandleCommandProc CookfsWriterHandleCommandGetbuf;

// In headers:
// Cookfs_WriterHandleCommandProc CookfsWriterHandleCommandWrite;

Expand All @@ -99,6 +108,8 @@ static int CookfsWriterHandlerCmd(ClientData clientData, Tcl_Interp *interp,
if (Tcl_GetIndexFromObj(interp, objv[1], commands, "command", 0,
&command) != TCL_OK)
{
CookfsLog(printf("CookfsWriterHandlerCmd: ERROR: unknown command [%s]",
Tcl_GetString(objv[1])));
return TCL_ERROR;
}

Expand Down

0 comments on commit 4dd4060

Please sign in to comment.