src/goosebump.c
author agaric <agaric@protonmail.com>
Tue, 09 Mar 2021 07:18:07 +0000
changeset 0 5f04caa7212d
permissions -rw-r--r--
git import
0
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     1
#include <tcl.h>
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     2
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     3
#define USE_TCL_STUBS
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     4
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     5
static int
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     6
Hello_Cmd(ClientData data, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[])
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     7
{
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     8
  Tcl_SetObjResult(interp, Tcl_NewStringObj("Hello, World!", -1));
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
     9
  return TCL_OK;
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    10
}
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    11
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    12
int DLLEXPORT
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    13
Goosebump_Init(Tcl_Interp* interp)
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    14
{
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    15
  if (Tcl_InitStubs(interp, TCL_VERSION, 0) == NULL
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    16
      || Tcl_PkgProvide(interp, "Hello", "1.0") == TCL_ERROR) {
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    17
    return TCL_ERROR;
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    18
  }
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    19
  Tcl_CreateObjCommand(interp, "hello", Hello_Cmd, NULL, NULL);
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    20
  return TCL_OK;
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    21
}
5f04caa7212d git import
agaric <agaric@protonmail.com>
parents:
diff changeset
    22