#include <nan.h>
#include "../twain.h"

using namespace v8;

void InitConstants(v8::Local<v8::Object> exports)
{
  v8::Local<v8::Object> constants = Nan::New<v8::Object>();

  /****************************************************************************
  * Generic Constants                                                        *
  ****************************************************************************/

  NODE_DEFINE_CONSTANT(constants, TWON_ARRAY);
  NODE_DEFINE_CONSTANT(constants, TWON_ENUMERATION);
  NODE_DEFINE_CONSTANT(constants, TWON_ONEVALUE);
  NODE_DEFINE_CONSTANT(constants, TWON_RANGE);

  NODE_DEFINE_CONSTANT(constants, TWON_ICONID);
  NODE_DEFINE_CONSTANT(constants, TWON_DSMID);
  NODE_DEFINE_CONSTANT(constants, TWON_DSMCODEID);

  NODE_DEFINE_CONSTANT(constants, TWON_DONTCARE8);
  NODE_DEFINE_CONSTANT(constants, TWON_DONTCARE16);
  NODE_DEFINE_CONSTANT(constants, TWON_DONTCARE32);

  /* Flags used in TW_MEMORY structure. */
  NODE_DEFINE_CONSTANT(constants, TWMF_APPOWNS);
  NODE_DEFINE_CONSTANT(constants, TWMF_DSMOWNS);
  NODE_DEFINE_CONSTANT(constants, TWMF_DSOWNS);
  NODE_DEFINE_CONSTANT(constants, TWMF_POINTER);
  NODE_DEFINE_CONSTANT(constants, TWMF_HANDLE);

  NODE_DEFINE_CONSTANT(constants, TWTY_INT8);
  NODE_DEFINE_CONSTANT(constants, TWTY_INT16);
  NODE_DEFINE_CONSTANT(constants, TWTY_INT32);

  NODE_DEFINE_CONSTANT(constants, TWTY_UINT8);
  NODE_DEFINE_CONSTANT(constants, TWTY_UINT16);
  NODE_DEFINE_CONSTANT(constants, TWTY_UINT32);

  NODE_DEFINE_CONSTANT(constants, TWTY_BOOL);

  NODE_DEFINE_CONSTANT(constants, TWTY_FIX32);

  NODE_DEFINE_CONSTANT(constants, TWTY_FRAME);

  NODE_DEFINE_CONSTANT(constants, TWTY_STR32);
  NODE_DEFINE_CONSTANT(constants, TWTY_STR64);
  NODE_DEFINE_CONSTANT(constants, TWTY_STR128);
  NODE_DEFINE_CONSTANT(constants, TWTY_STR255);
  NODE_DEFINE_CONSTANT(constants, TWTY_HANDLE);

  /****************************************************************************
  * Capability Constants                                                     *
  ****************************************************************************/

  /* CAP_ALARMS values */
  NODE_DEFINE_CONSTANT(constants, TWAL_ALARM);
  NODE_DEFINE_CONSTANT(constants, TWAL_FEEDERERROR);
  NODE_DEFINE_CONSTANT(constants, TWAL_FEEDERWARNING);
  NODE_DEFINE_CONSTANT(constants, TWAL_BARCODE);
  NODE_DEFINE_CONSTANT(constants, TWAL_DOUBLEFEED);
  NODE_DEFINE_CONSTANT(constants, TWAL_JAM);
  NODE_DEFINE_CONSTANT(constants, TWAL_PATCHCODE);
  NODE_DEFINE_CONSTANT(constants, TWAL_POWER);
  NODE_DEFINE_CONSTANT(constants, TWAL_SKEW);

  /* ICAP_AUTOSIZE values */
  NODE_DEFINE_CONSTANT(constants, TWAS_NONE);
  NODE_DEFINE_CONSTANT(constants, TWAS_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWAS_CURRENT);

  /* TWEI_BARCODEROTATION values */
  NODE_DEFINE_CONSTANT(constants, TWBCOR_ROT0);
  NODE_DEFINE_CONSTANT(constants, TWBCOR_ROT90);
  NODE_DEFINE_CONSTANT(constants, TWBCOR_ROT180);
  NODE_DEFINE_CONSTANT(constants, TWBCOR_ROT270);
  NODE_DEFINE_CONSTANT(constants, TWBCOR_ROTX);

  /* ICAP_BARCODESEARCHMODE values */
  NODE_DEFINE_CONSTANT(constants, TWBD_HORZ);
  NODE_DEFINE_CONSTANT(constants, TWBD_VERT);
  NODE_DEFINE_CONSTANT(constants, TWBD_HORZVERT);
  NODE_DEFINE_CONSTANT(constants, TWBD_VERTHORZ);

  /* ICAP_BITORDER values */
  NODE_DEFINE_CONSTANT(constants, TWBO_LSBFIRST);
  NODE_DEFINE_CONSTANT(constants, TWBO_MSBFIRST);

  /* ICAP_AUTODISCARDBLANKPAGES values */
  NODE_DEFINE_CONSTANT(constants, TWBP_DISABLE);
  NODE_DEFINE_CONSTANT(constants, TWBP_AUTO);

  /* ICAP_BITDEPTHREDUCTION values */
  NODE_DEFINE_CONSTANT(constants, TWBR_THRESHOLD);
  NODE_DEFINE_CONSTANT(constants, TWBR_HALFTONE);
  NODE_DEFINE_CONSTANT(constants, TWBR_CUSTHALFTONE);
  NODE_DEFINE_CONSTANT(constants, TWBR_DIFFUSION);
  NODE_DEFINE_CONSTANT(constants, TWBR_DYNAMICTHRESHOLD);

  /* ICAP_SUPPORTEDBARCODETYPES and TWEI_BARCODETYPE values */
  NODE_DEFINE_CONSTANT(constants, TWBT_3OF9);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5INTERLEAVED);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5NONINTERLEAVED);
  NODE_DEFINE_CONSTANT(constants, TWBT_CODE93);
  NODE_DEFINE_CONSTANT(constants, TWBT_CODE128);
  NODE_DEFINE_CONSTANT(constants, TWBT_UCC128);
  NODE_DEFINE_CONSTANT(constants, TWBT_CODABAR);
  NODE_DEFINE_CONSTANT(constants, TWBT_UPCA);
  NODE_DEFINE_CONSTANT(constants, TWBT_UPCE);
  NODE_DEFINE_CONSTANT(constants, TWBT_EAN8);
  NODE_DEFINE_CONSTANT(constants, TWBT_EAN13);
  NODE_DEFINE_CONSTANT(constants, TWBT_POSTNET);
  NODE_DEFINE_CONSTANT(constants, TWBT_PDF417);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5INDUSTRIAL);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5MATRIX);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5DATALOGIC);
  NODE_DEFINE_CONSTANT(constants, TWBT_2OF5IATA);
  NODE_DEFINE_CONSTANT(constants, TWBT_3OF9FULLASCII);
  NODE_DEFINE_CONSTANT(constants, TWBT_CODABARWITHSTARTSTOP);
  NODE_DEFINE_CONSTANT(constants, TWBT_MAXICODE);
  NODE_DEFINE_CONSTANT(constants, TWBT_QRCODE);

  /* ICAP_COMPRESSION values */
  NODE_DEFINE_CONSTANT(constants, TWCP_NONE);
  NODE_DEFINE_CONSTANT(constants, TWCP_PACKBITS);
  NODE_DEFINE_CONSTANT(constants, TWCP_GROUP31D);
  NODE_DEFINE_CONSTANT(constants, TWCP_GROUP31DEOL);
  NODE_DEFINE_CONSTANT(constants, TWCP_GROUP32D);
  NODE_DEFINE_CONSTANT(constants, TWCP_GROUP4);
  NODE_DEFINE_CONSTANT(constants, TWCP_JPEG);
  NODE_DEFINE_CONSTANT(constants, TWCP_LZW);
  NODE_DEFINE_CONSTANT(constants, TWCP_JBIG);
  NODE_DEFINE_CONSTANT(constants, TWCP_PNG);
  NODE_DEFINE_CONSTANT(constants, TWCP_RLE4);
  NODE_DEFINE_CONSTANT(constants, TWCP_RLE8);
  NODE_DEFINE_CONSTANT(constants, TWCP_BITFIELDS);
  NODE_DEFINE_CONSTANT(constants, TWCP_ZIP);
  NODE_DEFINE_CONSTANT(constants, TWCP_JPEG2000);

  /* CAP_CAMERASIDE and TWEI_PAGESIDE values */
  NODE_DEFINE_CONSTANT(constants, TWCS_BOTH);
  NODE_DEFINE_CONSTANT(constants, TWCS_TOP);
  NODE_DEFINE_CONSTANT(constants, TWCS_BOTTOM);

  /* CAP_DEVICEEVENT values */
  NODE_DEFINE_CONSTANT(constants, TWDE_CUSTOMEVENTS);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKAUTOMATICCAPTURE);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKBATTERY);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKDEVICEONLINE);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKFLASH);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKPOWERSUPPLY);
  NODE_DEFINE_CONSTANT(constants, TWDE_CHECKRESOLUTION);
  NODE_DEFINE_CONSTANT(constants, TWDE_DEVICEADDED);
  NODE_DEFINE_CONSTANT(constants, TWDE_DEVICEOFFLINE);
  NODE_DEFINE_CONSTANT(constants, TWDE_DEVICEREADY);
  NODE_DEFINE_CONSTANT(constants, TWDE_DEVICEREMOVED);
  NODE_DEFINE_CONSTANT(constants, TWDE_IMAGECAPTURED);
  NODE_DEFINE_CONSTANT(constants, TWDE_IMAGEDELETED);
  NODE_DEFINE_CONSTANT(constants, TWDE_PAPERDOUBLEFEED);
  NODE_DEFINE_CONSTANT(constants, TWDE_PAPERJAM);
  NODE_DEFINE_CONSTANT(constants, TWDE_LAMPFAILURE);
  NODE_DEFINE_CONSTANT(constants, TWDE_POWERSAVE);
  NODE_DEFINE_CONSTANT(constants, TWDE_POWERSAVENOTIFY);

  /* TW_PASSTHRU.Direction values. */
  NODE_DEFINE_CONSTANT(constants, TWDR_GET);
  NODE_DEFINE_CONSTANT(constants, TWDR_SET);

  /* TWEI_DESKEWSTATUS values. */
  NODE_DEFINE_CONSTANT(constants, TWDSK_SUCCESS);
  NODE_DEFINE_CONSTANT(constants, TWDSK_REPORTONLY);
  NODE_DEFINE_CONSTANT(constants, TWDSK_FAIL);
  NODE_DEFINE_CONSTANT(constants, TWDSK_DISABLED);

  /* CAP_DUPLEX values */
  NODE_DEFINE_CONSTANT(constants, TWDX_NONE);
  NODE_DEFINE_CONSTANT(constants, TWDX_1PASSDUPLEX);
  NODE_DEFINE_CONSTANT(constants, TWDX_2PASSDUPLEX);

  /* CAP_FEEDERALIGNMENT values */
  NODE_DEFINE_CONSTANT(constants, TWFA_NONE);
  NODE_DEFINE_CONSTANT(constants, TWFA_LEFT);
  NODE_DEFINE_CONSTANT(constants, TWFA_CENTER);
  NODE_DEFINE_CONSTANT(constants, TWFA_RIGHT);

  /* ICAP_FEEDERTYPE values*/
  NODE_DEFINE_CONSTANT(constants, TWFE_GENERAL);
  NODE_DEFINE_CONSTANT(constants, TWFE_PHOTO);

  /* ICAP_IMAGEFILEFORMAT values */
  NODE_DEFINE_CONSTANT(constants, TWFF_TIFF);
  NODE_DEFINE_CONSTANT(constants, TWFF_PICT);
  NODE_DEFINE_CONSTANT(constants, TWFF_BMP);
  NODE_DEFINE_CONSTANT(constants, TWFF_XBM);
  NODE_DEFINE_CONSTANT(constants, TWFF_JFIF);
  NODE_DEFINE_CONSTANT(constants, TWFF_FPX);
  NODE_DEFINE_CONSTANT(constants, TWFF_TIFFMULTI);
  NODE_DEFINE_CONSTANT(constants, TWFF_PNG);
  NODE_DEFINE_CONSTANT(constants, TWFF_SPIFF);
  NODE_DEFINE_CONSTANT(constants, TWFF_EXIF);
  NODE_DEFINE_CONSTANT(constants, TWFF_PDF);
  NODE_DEFINE_CONSTANT(constants, TWFF_JP2);
  NODE_DEFINE_CONSTANT(constants, TWFF_JPX);
  NODE_DEFINE_CONSTANT(constants, TWFF_DEJAVU);
  NODE_DEFINE_CONSTANT(constants, TWFF_PDFA);
  NODE_DEFINE_CONSTANT(constants, TWFF_PDFA2);
  NODE_DEFINE_CONSTANT(constants, TWFF_PDFRASTER);

  /* ICAP_FLASHUSED2 values */
  NODE_DEFINE_CONSTANT(constants, TWFL_NONE);
  NODE_DEFINE_CONSTANT(constants, TWFL_OFF);
  NODE_DEFINE_CONSTANT(constants, TWFL_ON);
  NODE_DEFINE_CONSTANT(constants, TWFL_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWFL_REDEYE);

  /* CAP_FEEDERORDER values */
  NODE_DEFINE_CONSTANT(constants, TWFO_FIRSTPAGEFIRST);
  NODE_DEFINE_CONSTANT(constants, TWFO_LASTPAGEFIRST);

  /* CAP_FEEDERPOCKET values*/
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKETERROR);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET1);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET2);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET3);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET4);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET5);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET6);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET7);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET8);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET9);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET10);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET11);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET12);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET13);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET14);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET15);
  NODE_DEFINE_CONSTANT(constants, TWFP_POCKET16);

  /* ICAP_FLIPROTATION values */
  NODE_DEFINE_CONSTANT(constants, TWFR_BOOK);
  NODE_DEFINE_CONSTANT(constants, TWFR_FANFOLD);

  /* ICAP_FILTER values */
  NODE_DEFINE_CONSTANT(constants, TWFT_RED);
  NODE_DEFINE_CONSTANT(constants, TWFT_GREEN);
  NODE_DEFINE_CONSTANT(constants, TWFT_BLUE);
  NODE_DEFINE_CONSTANT(constants, TWFT_NONE);
  NODE_DEFINE_CONSTANT(constants, TWFT_WHITE);
  NODE_DEFINE_CONSTANT(constants, TWFT_CYAN);
  NODE_DEFINE_CONSTANT(constants, TWFT_MAGENTA);
  NODE_DEFINE_CONSTANT(constants, TWFT_YELLOW);
  NODE_DEFINE_CONSTANT(constants, TWFT_BLACK);

  /* TW_FILESYSTEM.FileType values */
  NODE_DEFINE_CONSTANT(constants, TWFY_CAMERA);
  NODE_DEFINE_CONSTANT(constants, TWFY_CAMERATOP);
  NODE_DEFINE_CONSTANT(constants, TWFY_CAMERABOTTOM);
  NODE_DEFINE_CONSTANT(constants, TWFY_CAMERAPREVIEW);
  NODE_DEFINE_CONSTANT(constants, TWFY_DOMAIN);
  NODE_DEFINE_CONSTANT(constants, TWFY_HOST);
  NODE_DEFINE_CONSTANT(constants, TWFY_DIRECTORY);
  NODE_DEFINE_CONSTANT(constants, TWFY_IMAGE);
  NODE_DEFINE_CONSTANT(constants, TWFY_UNKNOWN);

  /* ICAP_ICCPROFILE values */
  NODE_DEFINE_CONSTANT(constants, TWIC_NONE);
  NODE_DEFINE_CONSTANT(constants, TWIC_LINK);
  NODE_DEFINE_CONSTANT(constants, TWIC_EMBED);

  /* ICAP_IMAGEFILTER values */
  NODE_DEFINE_CONSTANT(constants, TWIF_NONE);
  NODE_DEFINE_CONSTANT(constants, TWIF_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWIF_LOWPASS);
  NODE_DEFINE_CONSTANT(constants, TWIF_BANDPASS);
  NODE_DEFINE_CONSTANT(constants, TWIF_HIGHPASS);
  NODE_DEFINE_CONSTANT(constants, TWIF_TEXT);
  NODE_DEFINE_CONSTANT(constants, TWIF_FINELINE);

  /* ICAP_IMAGEMERGE values */
  NODE_DEFINE_CONSTANT(constants, TWIM_NONE);
  NODE_DEFINE_CONSTANT(constants, TWIM_FRONTONTOP);
  NODE_DEFINE_CONSTANT(constants, TWIM_FRONTONBOTTOM);
  NODE_DEFINE_CONSTANT(constants, TWIM_FRONTONLEFT);
  NODE_DEFINE_CONSTANT(constants, TWIM_FRONTONRIGHT);

  /* CAP_JOBCONTROL values  */
  NODE_DEFINE_CONSTANT(constants, TWJC_NONE);
  NODE_DEFINE_CONSTANT(constants, TWJC_JSIC);
  NODE_DEFINE_CONSTANT(constants, TWJC_JSIS);
  NODE_DEFINE_CONSTANT(constants, TWJC_JSXC);
  NODE_DEFINE_CONSTANT(constants, TWJC_JSXS);

  /* ICAP_JPEGQUALITY values */
  NODE_DEFINE_CONSTANT(constants, TWJQ_UNKNOWN);
  NODE_DEFINE_CONSTANT(constants, TWJQ_LOW);
  NODE_DEFINE_CONSTANT(constants, TWJQ_MEDIUM);
  NODE_DEFINE_CONSTANT(constants, TWJQ_HIGH);

  /* ICAP_LIGHTPATH values */
  NODE_DEFINE_CONSTANT(constants, TWLP_REFLECTIVE);
  NODE_DEFINE_CONSTANT(constants, TWLP_TRANSMISSIVE);

  /* ICAP_LIGHTSOURCE values */
  NODE_DEFINE_CONSTANT(constants, TWLS_RED);
  NODE_DEFINE_CONSTANT(constants, TWLS_GREEN);
  NODE_DEFINE_CONSTANT(constants, TWLS_BLUE);
  NODE_DEFINE_CONSTANT(constants, TWLS_NONE);
  NODE_DEFINE_CONSTANT(constants, TWLS_WHITE);
  NODE_DEFINE_CONSTANT(constants, TWLS_UV);
  NODE_DEFINE_CONSTANT(constants, TWLS_IR);

  /* TWEI_MAGTYPE values */
  NODE_DEFINE_CONSTANT(constants, TWMD_MICR);
  NODE_DEFINE_CONSTANT(constants, TWMD_RAW);
  NODE_DEFINE_CONSTANT(constants, TWMD_INVALID);

  /* ICAP_NOISEFILTER values */
  NODE_DEFINE_CONSTANT(constants, TWNF_NONE);
  NODE_DEFINE_CONSTANT(constants, TWNF_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWNF_LONEPIXEL);
  NODE_DEFINE_CONSTANT(constants, TWNF_MAJORITYRULE);

  /* ICAP_ORIENTATION values */
  NODE_DEFINE_CONSTANT(constants, TWOR_ROT0);
  NODE_DEFINE_CONSTANT(constants, TWOR_ROT90);
  NODE_DEFINE_CONSTANT(constants, TWOR_ROT180);
  NODE_DEFINE_CONSTANT(constants, TWOR_ROT270);
  NODE_DEFINE_CONSTANT(constants, TWOR_PORTRAIT);
  NODE_DEFINE_CONSTANT(constants, TWOR_LANDSCAPE);
  NODE_DEFINE_CONSTANT(constants, TWOR_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWOR_AUTOTEXT);
  NODE_DEFINE_CONSTANT(constants, TWOR_AUTOPICTURE);

  /* ICAP_OVERSCAN values */
  NODE_DEFINE_CONSTANT(constants, TWOV_NONE);
  NODE_DEFINE_CONSTANT(constants, TWOV_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWOV_TOPBOTTOM);
  NODE_DEFINE_CONSTANT(constants, TWOV_LEFTRIGHT);
  NODE_DEFINE_CONSTANT(constants, TWOV_ALL);

  /* Palette types for TW_PALETTE8 */
  NODE_DEFINE_CONSTANT(constants, TWPA_RGB);
  NODE_DEFINE_CONSTANT(constants, TWPA_GRAY);
  NODE_DEFINE_CONSTANT(constants, TWPA_CMY);

  /* ICAP_PLANARCHUNKY values */
  NODE_DEFINE_CONSTANT(constants, TWPC_CHUNKY);
  NODE_DEFINE_CONSTANT(constants, TWPC_PLANAR);

  /* TWEI_PATCHCODE values*/
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCH1);
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCH2);
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCH3);
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCH4);
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCH6);
  NODE_DEFINE_CONSTANT(constants, TWPCH_PATCHT);

  /* ICAP_PIXELFLAVOR values */
  NODE_DEFINE_CONSTANT(constants, TWPF_CHOCOLATE);
  NODE_DEFINE_CONSTANT(constants, TWPF_VANILLA);

  /* CAP_PRINTERMODE values */
  NODE_DEFINE_CONSTANT(constants, TWPM_SINGLESTRING);
  NODE_DEFINE_CONSTANT(constants, TWPM_MULTISTRING);
  NODE_DEFINE_CONSTANT(constants, TWPM_COMPOUNDSTRING);

  /* CAP_PRINTER values */
  NODE_DEFINE_CONSTANT(constants, TWPR_IMPRINTERTOPBEFORE);
  NODE_DEFINE_CONSTANT(constants, TWPR_IMPRINTERTOPAFTER);
  NODE_DEFINE_CONSTANT(constants, TWPR_IMPRINTERBOTTOMBEFORE);
  NODE_DEFINE_CONSTANT(constants, TWPR_IMPRINTERBOTTOMAFTER);
  NODE_DEFINE_CONSTANT(constants, TWPR_ENDORSERTOPBEFORE);
  NODE_DEFINE_CONSTANT(constants, TWPR_ENDORSERTOPAFTER);
  NODE_DEFINE_CONSTANT(constants, TWPR_ENDORSERBOTTOMBEFORE);
  NODE_DEFINE_CONSTANT(constants, TWPR_ENDORSERBOTTOMAFTER);

  /* CAP_PRINTERFONTSTYLE Added 2.3 */
  NODE_DEFINE_CONSTANT(constants, TWPF_NORMAL);
  NODE_DEFINE_CONSTANT(constants, TWPF_BOLD);
  NODE_DEFINE_CONSTANT(constants, TWPF_ITALIC);
  NODE_DEFINE_CONSTANT(constants, TWPF_LARGESIZE);
  NODE_DEFINE_CONSTANT(constants, TWPF_SMALLSIZE);

  /* CAP_PRINTERINDEXTRIGGER Added 2.3 */
  NODE_DEFINE_CONSTANT(constants, TWCT_PAGE);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCH1);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCH2);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCH3);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCH4);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCHT);
  NODE_DEFINE_CONSTANT(constants, TWCT_PATCH6);

  /* CAP_POWERSUPPLY values */
  NODE_DEFINE_CONSTANT(constants, TWPS_EXTERNAL);
  NODE_DEFINE_CONSTANT(constants, TWPS_BATTERY);

  /* ICAP_PIXELTYPE values (PT_ means Pixel Type) */
  NODE_DEFINE_CONSTANT(constants, TWPT_BW);
  NODE_DEFINE_CONSTANT(constants, TWPT_GRAY);
  NODE_DEFINE_CONSTANT(constants, TWPT_RGB);
  NODE_DEFINE_CONSTANT(constants, TWPT_PALETTE);
  NODE_DEFINE_CONSTANT(constants, TWPT_CMY);
  NODE_DEFINE_CONSTANT(constants, TWPT_CMYK);
  NODE_DEFINE_CONSTANT(constants, TWPT_YUV);
  NODE_DEFINE_CONSTANT(constants, TWPT_YUVK);
  NODE_DEFINE_CONSTANT(constants, TWPT_CIEXYZ);
  NODE_DEFINE_CONSTANT(constants, TWPT_LAB);
  NODE_DEFINE_CONSTANT(constants, TWPT_SRGB);
  NODE_DEFINE_CONSTANT(constants, TWPT_SCRGB);
  NODE_DEFINE_CONSTANT(constants, TWPT_INFRARED);

  /* CAP_SEGMENTED values */
  NODE_DEFINE_CONSTANT(constants, TWSG_NONE);
  NODE_DEFINE_CONSTANT(constants, TWSG_AUTO);
  NODE_DEFINE_CONSTANT(constants, TWSG_MANUAL);

  /* ICAP_FILMTYPE values */
  NODE_DEFINE_CONSTANT(constants, TWFM_POSITIVE);
  NODE_DEFINE_CONSTANT(constants, TWFM_NEGATIVE);

  /* CAP_DOUBLEFEEDDETECTION */
  NODE_DEFINE_CONSTANT(constants, TWDF_ULTRASONIC);
  NODE_DEFINE_CONSTANT(constants, TWDF_BYLENGTH);
  NODE_DEFINE_CONSTANT(constants, TWDF_INFRARED);

  /* CAP_DOUBLEFEEDDETECTIONSENSITIVITY */
  NODE_DEFINE_CONSTANT(constants, TWUS_LOW);
  NODE_DEFINE_CONSTANT(constants, TWUS_MEDIUM);
  NODE_DEFINE_CONSTANT(constants, TWUS_HIGH);

  /* CAP_DOUBLEFEEDDETECTIONRESPONSE */
  NODE_DEFINE_CONSTANT(constants, TWDP_STOP);
  NODE_DEFINE_CONSTANT(constants, TWDP_STOPANDWAIT);
  NODE_DEFINE_CONSTANT(constants, TWDP_SOUND);
  NODE_DEFINE_CONSTANT(constants, TWDP_DONOTIMPRINT);

  /* ICAP_MIRROR values */
  NODE_DEFINE_CONSTANT(constants, TWMR_NONE);
  NODE_DEFINE_CONSTANT(constants, TWMR_VERTICAL);
  NODE_DEFINE_CONSTANT(constants, TWMR_HORIZONTAL);

  /* ICAP_JPEGSUBSAMPLING values */
  NODE_DEFINE_CONSTANT(constants, TWJS_444YCBCR);
  NODE_DEFINE_CONSTANT(constants, TWJS_444RGB);
  NODE_DEFINE_CONSTANT(constants, TWJS_422);
  NODE_DEFINE_CONSTANT(constants, TWJS_421);
  NODE_DEFINE_CONSTANT(constants, TWJS_411);
  NODE_DEFINE_CONSTANT(constants, TWJS_420);
  NODE_DEFINE_CONSTANT(constants, TWJS_410);
  NODE_DEFINE_CONSTANT(constants, TWJS_311);

  /* CAP_PAPERHANDLING values */
  NODE_DEFINE_CONSTANT(constants, TWPH_NORMAL);
  NODE_DEFINE_CONSTANT(constants, TWPH_FRAGILE);
  NODE_DEFINE_CONSTANT(constants, TWPH_THICK);
  NODE_DEFINE_CONSTANT(constants, TWPH_TRIFOLD);
  NODE_DEFINE_CONSTANT(constants, TWPH_PHOTOGRAPH);

  /* CAP_INDICATORSMODE values */
  NODE_DEFINE_CONSTANT(constants, TWCI_INFO);
  NODE_DEFINE_CONSTANT(constants, TWCI_WARNING);
  NODE_DEFINE_CONSTANT(constants, TWCI_ERROR);
  NODE_DEFINE_CONSTANT(constants, TWCI_WARMUP);

  /* ICAP_SUPPORTEDSIZES values (SS_ means Supported Sizes) */
  NODE_DEFINE_CONSTANT(constants, TWSS_NONE);
  NODE_DEFINE_CONSTANT(constants, TWSS_A4);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB5);
  NODE_DEFINE_CONSTANT(constants, TWSS_USLETTER);
  NODE_DEFINE_CONSTANT(constants, TWSS_USLEGAL);
  NODE_DEFINE_CONSTANT(constants, TWSS_A5);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB4);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB6);
  NODE_DEFINE_CONSTANT(constants, TWSS_USLEDGER);
  NODE_DEFINE_CONSTANT(constants, TWSS_USEXECUTIVE);
  NODE_DEFINE_CONSTANT(constants, TWSS_A3);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB3);
  NODE_DEFINE_CONSTANT(constants, TWSS_A6);
  NODE_DEFINE_CONSTANT(constants, TWSS_C4);
  NODE_DEFINE_CONSTANT(constants, TWSS_C5);
  NODE_DEFINE_CONSTANT(constants, TWSS_C6);
  NODE_DEFINE_CONSTANT(constants, TWSS_4A0);
  NODE_DEFINE_CONSTANT(constants, TWSS_2A0);
  NODE_DEFINE_CONSTANT(constants, TWSS_A0);
  NODE_DEFINE_CONSTANT(constants, TWSS_A1);
  NODE_DEFINE_CONSTANT(constants, TWSS_A2);
  NODE_DEFINE_CONSTANT(constants, TWSS_A7);
  NODE_DEFINE_CONSTANT(constants, TWSS_A8);
  NODE_DEFINE_CONSTANT(constants, TWSS_A9);
  NODE_DEFINE_CONSTANT(constants, TWSS_A10);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB0);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB1);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB2);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB5);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB7);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB8);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB9);
  NODE_DEFINE_CONSTANT(constants, TWSS_ISOB10);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB0);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB1);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB2);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB3);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB4);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB6);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB7);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB8);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB9);
  NODE_DEFINE_CONSTANT(constants, TWSS_JISB10);
  NODE_DEFINE_CONSTANT(constants, TWSS_C0);
  NODE_DEFINE_CONSTANT(constants, TWSS_C1);
  NODE_DEFINE_CONSTANT(constants, TWSS_C2);
  NODE_DEFINE_CONSTANT(constants, TWSS_C3);
  NODE_DEFINE_CONSTANT(constants, TWSS_C7);
  NODE_DEFINE_CONSTANT(constants, TWSS_C8);
  NODE_DEFINE_CONSTANT(constants, TWSS_C9);
  NODE_DEFINE_CONSTANT(constants, TWSS_C10);
  NODE_DEFINE_CONSTANT(constants, TWSS_USSTATEMENT);
  NODE_DEFINE_CONSTANT(constants, TWSS_BUSINESSCARD);
  NODE_DEFINE_CONSTANT(constants, TWSS_MAXSIZE);

  /* ICAP_XFERMECH values (SX_ means Setup XFer) */
  NODE_DEFINE_CONSTANT(constants, TWSX_NATIVE);
  NODE_DEFINE_CONSTANT(constants, TWSX_FILE);
  NODE_DEFINE_CONSTANT(constants, TWSX_MEMORY);
  NODE_DEFINE_CONSTANT(constants, TWSX_MEMFILE);

  /* ICAP_UNITS values (UN_ means UNits) */
  NODE_DEFINE_CONSTANT(constants, TWUN_INCHES);
  NODE_DEFINE_CONSTANT(constants, TWUN_CENTIMETERS);
  NODE_DEFINE_CONSTANT(constants, TWUN_PICAS);
  NODE_DEFINE_CONSTANT(constants, TWUN_POINTS);
  NODE_DEFINE_CONSTANT(constants, TWUN_TWIPS);
  NODE_DEFINE_CONSTANT(constants, TWUN_PIXELS);
  NODE_DEFINE_CONSTANT(constants, TWUN_MILLIMETERS);

  /****************************************************************************
  * Country Constants                                                        *
  ****************************************************************************/

  NODE_DEFINE_CONSTANT(constants, TWCY_AFGHANISTAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_ALGERIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_AMERICANSAMOA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ANDORRA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ANGOLA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ANGUILLA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ANTIGUA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ARGENTINA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ARUBA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ASCENSIONI);
  NODE_DEFINE_CONSTANT(constants, TWCY_AUSTRALIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_AUSTRIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BAHAMAS);
  NODE_DEFINE_CONSTANT(constants, TWCY_BAHRAIN);
  NODE_DEFINE_CONSTANT(constants, TWCY_BANGLADESH);
  NODE_DEFINE_CONSTANT(constants, TWCY_BARBADOS);
  NODE_DEFINE_CONSTANT(constants, TWCY_BELGIUM);
  NODE_DEFINE_CONSTANT(constants, TWCY_BELIZE);
  NODE_DEFINE_CONSTANT(constants, TWCY_BENIN);
  NODE_DEFINE_CONSTANT(constants, TWCY_BERMUDA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BHUTAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_BOLIVIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BOTSWANA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BRITAIN);
  NODE_DEFINE_CONSTANT(constants, TWCY_BRITVIRGINIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_BRAZIL);
  NODE_DEFINE_CONSTANT(constants, TWCY_BRUNEI);
  NODE_DEFINE_CONSTANT(constants, TWCY_BULGARIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BURKINAFASO);
  NODE_DEFINE_CONSTANT(constants, TWCY_BURMA);
  NODE_DEFINE_CONSTANT(constants, TWCY_BURUNDI);
  NODE_DEFINE_CONSTANT(constants, TWCY_CAMAROON);
  NODE_DEFINE_CONSTANT(constants, TWCY_CANADA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CAPEVERDEIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_CAYMANIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_CENTRALAFREP);
  NODE_DEFINE_CONSTANT(constants, TWCY_CHAD);
  NODE_DEFINE_CONSTANT(constants, TWCY_CHILE);
  NODE_DEFINE_CONSTANT(constants, TWCY_CHINA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CHRISTMASIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_COCOSIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_COLOMBIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_COMOROS);
  NODE_DEFINE_CONSTANT(constants, TWCY_CONGO);
  NODE_DEFINE_CONSTANT(constants, TWCY_COOKIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_COSTARICA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CUBA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CYPRUS);
  NODE_DEFINE_CONSTANT(constants, TWCY_CZECHOSLOVAKIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_DENMARK);
  NODE_DEFINE_CONSTANT(constants, TWCY_DJIBOUTI);
  NODE_DEFINE_CONSTANT(constants, TWCY_DOMINICA);
  NODE_DEFINE_CONSTANT(constants, TWCY_DOMINCANREP);
  NODE_DEFINE_CONSTANT(constants, TWCY_EASTERIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_ECUADOR);
  NODE_DEFINE_CONSTANT(constants, TWCY_EGYPT);
  NODE_DEFINE_CONSTANT(constants, TWCY_ELSALVADOR);
  NODE_DEFINE_CONSTANT(constants, TWCY_EQGUINEA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ETHIOPIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_FALKLANDIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_FAEROEIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_FIJIISLANDS);
  NODE_DEFINE_CONSTANT(constants, TWCY_FINLAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_FRANCE);
  NODE_DEFINE_CONSTANT(constants, TWCY_FRANTILLES);
  NODE_DEFINE_CONSTANT(constants, TWCY_FRGUIANA);
  NODE_DEFINE_CONSTANT(constants, TWCY_FRPOLYNEISA);
  NODE_DEFINE_CONSTANT(constants, TWCY_FUTANAIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_GABON);
  NODE_DEFINE_CONSTANT(constants, TWCY_GAMBIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GERMANY);
  NODE_DEFINE_CONSTANT(constants, TWCY_GHANA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GIBRALTER);
  NODE_DEFINE_CONSTANT(constants, TWCY_GREECE);
  NODE_DEFINE_CONSTANT(constants, TWCY_GREENLAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_GRENADA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GRENEDINES);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUADELOUPE);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUAM);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUANTANAMOBAY);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUATEMALA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUINEA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUINEABISSAU);
  NODE_DEFINE_CONSTANT(constants, TWCY_GUYANA);
  NODE_DEFINE_CONSTANT(constants, TWCY_HAITI);
  NODE_DEFINE_CONSTANT(constants, TWCY_HONDURAS);
  NODE_DEFINE_CONSTANT(constants, TWCY_HONGKONG);
  NODE_DEFINE_CONSTANT(constants, TWCY_HUNGARY);
  NODE_DEFINE_CONSTANT(constants, TWCY_ICELAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_INDIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_INDONESIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_IRAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_IRAQ);
  NODE_DEFINE_CONSTANT(constants, TWCY_IRELAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_ISRAEL);
  NODE_DEFINE_CONSTANT(constants, TWCY_ITALY);
  NODE_DEFINE_CONSTANT(constants, TWCY_IVORYCOAST);
  NODE_DEFINE_CONSTANT(constants, TWCY_JAMAICA);
  NODE_DEFINE_CONSTANT(constants, TWCY_JAPAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_JORDAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_KENYA);
  NODE_DEFINE_CONSTANT(constants, TWCY_KIRIBATI);
  NODE_DEFINE_CONSTANT(constants, TWCY_KOREA);
  NODE_DEFINE_CONSTANT(constants, TWCY_KUWAIT);
  NODE_DEFINE_CONSTANT(constants, TWCY_LAOS);
  NODE_DEFINE_CONSTANT(constants, TWCY_LEBANON);
  NODE_DEFINE_CONSTANT(constants, TWCY_LIBERIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_LIBYA);
  NODE_DEFINE_CONSTANT(constants, TWCY_LIECHTENSTEIN);
  NODE_DEFINE_CONSTANT(constants, TWCY_LUXENBOURG);
  NODE_DEFINE_CONSTANT(constants, TWCY_MACAO);
  NODE_DEFINE_CONSTANT(constants, TWCY_MADAGASCAR);
  NODE_DEFINE_CONSTANT(constants, TWCY_MALAWI);
  NODE_DEFINE_CONSTANT(constants, TWCY_MALAYSIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MALDIVES);
  NODE_DEFINE_CONSTANT(constants, TWCY_MALI);
  NODE_DEFINE_CONSTANT(constants, TWCY_MALTA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MARSHALLIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_MAURITANIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MAURITIUS);
  NODE_DEFINE_CONSTANT(constants, TWCY_MEXICO);
  NODE_DEFINE_CONSTANT(constants, TWCY_MICRONESIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MIQUELON);
  NODE_DEFINE_CONSTANT(constants, TWCY_MONACO);
  NODE_DEFINE_CONSTANT(constants, TWCY_MONGOLIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MONTSERRAT);
  NODE_DEFINE_CONSTANT(constants, TWCY_MOROCCO);
  NODE_DEFINE_CONSTANT(constants, TWCY_MOZAMBIQUE);
  NODE_DEFINE_CONSTANT(constants, TWCY_NAMIBIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_NAURU);
  NODE_DEFINE_CONSTANT(constants, TWCY_NEPAL);
  NODE_DEFINE_CONSTANT(constants, TWCY_NETHERLANDS);
  NODE_DEFINE_CONSTANT(constants, TWCY_NETHANTILLES);
  NODE_DEFINE_CONSTANT(constants, TWCY_NEVIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_NEWCALEDONIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_NEWZEALAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_NICARAGUA);
  NODE_DEFINE_CONSTANT(constants, TWCY_NIGER);
  NODE_DEFINE_CONSTANT(constants, TWCY_NIGERIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_NIUE);
  NODE_DEFINE_CONSTANT(constants, TWCY_NORFOLKI);
  NODE_DEFINE_CONSTANT(constants, TWCY_NORWAY);
  NODE_DEFINE_CONSTANT(constants, TWCY_OMAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_PAKISTAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_PALAU);
  NODE_DEFINE_CONSTANT(constants, TWCY_PANAMA);
  NODE_DEFINE_CONSTANT(constants, TWCY_PARAGUAY);
  NODE_DEFINE_CONSTANT(constants, TWCY_PERU);
  NODE_DEFINE_CONSTANT(constants, TWCY_PHILLIPPINES);
  NODE_DEFINE_CONSTANT(constants, TWCY_PITCAIRNIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_PNEWGUINEA);
  NODE_DEFINE_CONSTANT(constants, TWCY_POLAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_PORTUGAL);
  NODE_DEFINE_CONSTANT(constants, TWCY_QATAR);
  NODE_DEFINE_CONSTANT(constants, TWCY_REUNIONI);
  NODE_DEFINE_CONSTANT(constants, TWCY_ROMANIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_RWANDA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SAIPAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_SANMARINO);
  NODE_DEFINE_CONSTANT(constants, TWCY_SAOTOME);
  NODE_DEFINE_CONSTANT(constants, TWCY_SAUDIARABIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SENEGAL);
  NODE_DEFINE_CONSTANT(constants, TWCY_SEYCHELLESIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_SIERRALEONE);
  NODE_DEFINE_CONSTANT(constants, TWCY_SINGAPORE);
  NODE_DEFINE_CONSTANT(constants, TWCY_SOLOMONIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_SOMALI);
  NODE_DEFINE_CONSTANT(constants, TWCY_SOUTHAFRICA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SPAIN);
  NODE_DEFINE_CONSTANT(constants, TWCY_SRILANKA);
  NODE_DEFINE_CONSTANT(constants, TWCY_STHELENA);
  NODE_DEFINE_CONSTANT(constants, TWCY_STKITTS);
  NODE_DEFINE_CONSTANT(constants, TWCY_STLUCIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_STPIERRE);
  NODE_DEFINE_CONSTANT(constants, TWCY_STVINCENT);
  NODE_DEFINE_CONSTANT(constants, TWCY_SUDAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_SURINAME);
  NODE_DEFINE_CONSTANT(constants, TWCY_SWAZILAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_SWEDEN);
  NODE_DEFINE_CONSTANT(constants, TWCY_SWITZERLAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_SYRIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_TAIWAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_TANZANIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_THAILAND);
  NODE_DEFINE_CONSTANT(constants, TWCY_TOBAGO);
  NODE_DEFINE_CONSTANT(constants, TWCY_TOGO);
  NODE_DEFINE_CONSTANT(constants, TWCY_TONGAIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_TRINIDAD);
  NODE_DEFINE_CONSTANT(constants, TWCY_TUNISIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_TURKEY);
  NODE_DEFINE_CONSTANT(constants, TWCY_TURKSCAICOS);
  NODE_DEFINE_CONSTANT(constants, TWCY_TUVALU);
  NODE_DEFINE_CONSTANT(constants, TWCY_UGANDA);
  NODE_DEFINE_CONSTANT(constants, TWCY_USSR);
  NODE_DEFINE_CONSTANT(constants, TWCY_UAEMIRATES);
  NODE_DEFINE_CONSTANT(constants, TWCY_UNITEDKINGDOM);
  NODE_DEFINE_CONSTANT(constants, TWCY_USA);
  NODE_DEFINE_CONSTANT(constants, TWCY_URUGUAY);
  NODE_DEFINE_CONSTANT(constants, TWCY_VANUATU);
  NODE_DEFINE_CONSTANT(constants, TWCY_VATICANCITY);
  NODE_DEFINE_CONSTANT(constants, TWCY_VENEZUELA);
  NODE_DEFINE_CONSTANT(constants, TWCY_WAKE);
  NODE_DEFINE_CONSTANT(constants, TWCY_WALLISIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_WESTERNSAHARA);
  NODE_DEFINE_CONSTANT(constants, TWCY_WESTERNSAMOA);
  NODE_DEFINE_CONSTANT(constants, TWCY_YEMEN);
  NODE_DEFINE_CONSTANT(constants, TWCY_YUGOSLAVIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ZAIRE);
  NODE_DEFINE_CONSTANT(constants, TWCY_ZAMBIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ZIMBABWE);
  NODE_DEFINE_CONSTANT(constants, TWCY_ALBANIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ARMENIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_AZERBAIJAN);
  NODE_DEFINE_CONSTANT(constants, TWCY_BELARUS);
  NODE_DEFINE_CONSTANT(constants, TWCY_BOSNIAHERZGO);
  NODE_DEFINE_CONSTANT(constants, TWCY_CAMBODIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CROATIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_CZECHREPUBLIC);
  NODE_DEFINE_CONSTANT(constants, TWCY_DIEGOGARCIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ERITREA);
  NODE_DEFINE_CONSTANT(constants, TWCY_ESTONIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_GEORGIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_LATVIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_LESOTHO);
  NODE_DEFINE_CONSTANT(constants, TWCY_LITHUANIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MACEDONIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MAYOTTEIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_MOLDOVA);
  NODE_DEFINE_CONSTANT(constants, TWCY_MYANMAR);
  NODE_DEFINE_CONSTANT(constants, TWCY_NORTHKOREA);
  NODE_DEFINE_CONSTANT(constants, TWCY_PUERTORICO);
  NODE_DEFINE_CONSTANT(constants, TWCY_RUSSIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SERBIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SLOVAKIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SLOVENIA);
  NODE_DEFINE_CONSTANT(constants, TWCY_SOUTHKOREA);
  NODE_DEFINE_CONSTANT(constants, TWCY_UKRAINE);
  NODE_DEFINE_CONSTANT(constants, TWCY_USVIRGINIS);
  NODE_DEFINE_CONSTANT(constants, TWCY_VIETNAM);

  /****************************************************************************
  * Language Constants                                                       *
  ****************************************************************************/
  NODE_DEFINE_CONSTANT(constants, TWLG_USERLOCALE);
  NODE_DEFINE_CONSTANT(constants, TWLG_DAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_DUT);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENG);
  NODE_DEFINE_CONSTANT(constants, TWLG_FCF);
  NODE_DEFINE_CONSTANT(constants, TWLG_FIN);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRN);
  NODE_DEFINE_CONSTANT(constants, TWLG_GER);
  NODE_DEFINE_CONSTANT(constants, TWLG_ICE);
  NODE_DEFINE_CONSTANT(constants, TWLG_ITN);
  NODE_DEFINE_CONSTANT(constants, TWLG_NOR);
  NODE_DEFINE_CONSTANT(constants, TWLG_POR);
  NODE_DEFINE_CONSTANT(constants, TWLG_SPA);
  NODE_DEFINE_CONSTANT(constants, TWLG_SWE);
  NODE_DEFINE_CONSTANT(constants, TWLG_USA);
  NODE_DEFINE_CONSTANT(constants, TWLG_AFRIKAANS);
  NODE_DEFINE_CONSTANT(constants, TWLG_ALBANIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_ALGERIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_BAHRAIN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_EGYPT);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_IRAQ);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_JORDAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_KUWAIT);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_LEBANON);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_LIBYA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_MOROCCO);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_OMAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_QATAR);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_SAUDIARABIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_SYRIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_TUNISIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_UAE);
  NODE_DEFINE_CONSTANT(constants, TWLG_ARABIC_YEMEN);
  NODE_DEFINE_CONSTANT(constants, TWLG_BASQUE);
  NODE_DEFINE_CONSTANT(constants, TWLG_BYELORUSSIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_BULGARIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_CATALAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_HONGKONG);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_PRC);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_SINGAPORE);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_SIMPLIFIED);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_TAIWAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_CHINESE_TRADITIONAL);
  NODE_DEFINE_CONSTANT(constants, TWLG_CROATIA);
  NODE_DEFINE_CONSTANT(constants, TWLG_CZECH);
  NODE_DEFINE_CONSTANT(constants, TWLG_DANISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_DUTCH);
  NODE_DEFINE_CONSTANT(constants, TWLG_DUTCH_BELGIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_AUSTRALIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_CANADIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_IRELAND);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_NEWZEALAND);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_SOUTHAFRICA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_UK);
  NODE_DEFINE_CONSTANT(constants, TWLG_ENGLISH_USA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ESTONIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_FAEROESE);
  NODE_DEFINE_CONSTANT(constants, TWLG_FARSI);
  NODE_DEFINE_CONSTANT(constants, TWLG_FINNISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRENCH);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRENCH_BELGIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRENCH_CANADIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRENCH_LUXEMBOURG);
  NODE_DEFINE_CONSTANT(constants, TWLG_FRENCH_SWISS);
  NODE_DEFINE_CONSTANT(constants, TWLG_GERMAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_GERMAN_AUSTRIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_GERMAN_LUXEMBOURG);
  NODE_DEFINE_CONSTANT(constants, TWLG_GERMAN_LIECHTENSTEIN);
  NODE_DEFINE_CONSTANT(constants, TWLG_GERMAN_SWISS);
  NODE_DEFINE_CONSTANT(constants, TWLG_GREEK);
  NODE_DEFINE_CONSTANT(constants, TWLG_HEBREW);
  NODE_DEFINE_CONSTANT(constants, TWLG_HUNGARIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ICELANDIC);
  NODE_DEFINE_CONSTANT(constants, TWLG_INDONESIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ITALIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ITALIAN_SWISS);
  NODE_DEFINE_CONSTANT(constants, TWLG_JAPANESE);
  NODE_DEFINE_CONSTANT(constants, TWLG_KOREAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_KOREAN_JOHAB);
  NODE_DEFINE_CONSTANT(constants, TWLG_LATVIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_LITHUANIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_NORWEGIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_NORWEGIAN_BOKMAL);
  NODE_DEFINE_CONSTANT(constants, TWLG_NORWEGIAN_NYNORSK);
  NODE_DEFINE_CONSTANT(constants, TWLG_POLISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_PORTUGUESE);
  NODE_DEFINE_CONSTANT(constants, TWLG_PORTUGUESE_BRAZIL);
  NODE_DEFINE_CONSTANT(constants, TWLG_ROMANIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_RUSSIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_SERBIAN_LATIN);
  NODE_DEFINE_CONSTANT(constants, TWLG_SLOVAK);
  NODE_DEFINE_CONSTANT(constants, TWLG_SLOVENIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_SPANISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_SPANISH_MEXICAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_SPANISH_MODERN);
  NODE_DEFINE_CONSTANT(constants, TWLG_SWEDISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_THAI);
  NODE_DEFINE_CONSTANT(constants, TWLG_TURKISH);
  NODE_DEFINE_CONSTANT(constants, TWLG_UKRANIAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_ASSAMESE);
  NODE_DEFINE_CONSTANT(constants, TWLG_BENGALI);
  NODE_DEFINE_CONSTANT(constants, TWLG_BIHARI);
  NODE_DEFINE_CONSTANT(constants, TWLG_BODO);
  NODE_DEFINE_CONSTANT(constants, TWLG_DOGRI);
  NODE_DEFINE_CONSTANT(constants, TWLG_GUJARATI);
  NODE_DEFINE_CONSTANT(constants, TWLG_HARYANVI);
  NODE_DEFINE_CONSTANT(constants, TWLG_HINDI);
  NODE_DEFINE_CONSTANT(constants, TWLG_KANNADA);
  NODE_DEFINE_CONSTANT(constants, TWLG_KASHMIRI);
  NODE_DEFINE_CONSTANT(constants, TWLG_MALAYALAM);
  NODE_DEFINE_CONSTANT(constants, TWLG_MARATHI);
  NODE_DEFINE_CONSTANT(constants, TWLG_MARWARI);
  NODE_DEFINE_CONSTANT(constants, TWLG_MEGHALAYAN);
  NODE_DEFINE_CONSTANT(constants, TWLG_MIZO);
  NODE_DEFINE_CONSTANT(constants, TWLG_NAGA);
  NODE_DEFINE_CONSTANT(constants, TWLG_ORISSI);
  NODE_DEFINE_CONSTANT(constants, TWLG_PUNJABI);
  NODE_DEFINE_CONSTANT(constants, TWLG_PUSHTU);
  NODE_DEFINE_CONSTANT(constants, TWLG_SERBIAN_CYRILLIC);
  NODE_DEFINE_CONSTANT(constants, TWLG_SIKKIMI);
  NODE_DEFINE_CONSTANT(constants, TWLG_SWEDISH_FINLAND);
  NODE_DEFINE_CONSTANT(constants, TWLG_TAMIL);
  NODE_DEFINE_CONSTANT(constants, TWLG_TELUGU);
  NODE_DEFINE_CONSTANT(constants, TWLG_TRIPURI);
  NODE_DEFINE_CONSTANT(constants, TWLG_URDU);
  NODE_DEFINE_CONSTANT(constants, TWLG_VIETNAMESE);

  /****************************************************************************
  * Data Groups                                                              *
  ****************************************************************************/
  NODE_DEFINE_CONSTANT(constants, DG_CONTROL);
  NODE_DEFINE_CONSTANT(constants, DG_IMAGE);
  NODE_DEFINE_CONSTANT(constants, DG_AUDIO);

  /* More Data Functionality may be added in the future.
  * These are for items that need to be determined before DS is opened.
  * NOTE: Supported Functionality constants must be powers of 2 as they are
  *       used as bitflags when Application asks DSM to present a list of DSs.
  *       to support backward capability the App and DS will not use the fields
  */
  NODE_DEFINE_CONSTANT(constants, DF_DSM2);
  NODE_DEFINE_CONSTANT(constants, DF_APP2);

  NODE_DEFINE_CONSTANT(constants, DF_DS2);

  NODE_DEFINE_CONSTANT(constants, DG_MASK);

  /****************************************************************************
  *                                                        *
  ****************************************************************************/
  NODE_DEFINE_CONSTANT(constants, DAT_NULL);
  NODE_DEFINE_CONSTANT(constants, DAT_CUSTOMBASE);

  /* Data Argument Types for the DG_CONTROL Data Group. */
  NODE_DEFINE_CONSTANT(constants, DAT_CAPABILITY);
  NODE_DEFINE_CONSTANT(constants, DAT_EVENT);
  NODE_DEFINE_CONSTANT(constants, DAT_IDENTITY);
  NODE_DEFINE_CONSTANT(constants, DAT_PARENT);
  NODE_DEFINE_CONSTANT(constants, DAT_PENDINGXFERS);
  NODE_DEFINE_CONSTANT(constants, DAT_SETUPMEMXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_SETUPFILEXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_STATUS);
  NODE_DEFINE_CONSTANT(constants, DAT_USERINTERFACE);
  NODE_DEFINE_CONSTANT(constants, DAT_XFERGROUP);
  NODE_DEFINE_CONSTANT(constants, DAT_CUSTOMDSDATA);
  NODE_DEFINE_CONSTANT(constants, DAT_DEVICEEVENT);
  NODE_DEFINE_CONSTANT(constants, DAT_FILESYSTEM);
  NODE_DEFINE_CONSTANT(constants, DAT_PASSTHRU);
  NODE_DEFINE_CONSTANT(constants, DAT_CALLBACK);
  NODE_DEFINE_CONSTANT(constants, DAT_STATUSUTF8);
  NODE_DEFINE_CONSTANT(constants, DAT_CALLBACK2);
  NODE_DEFINE_CONSTANT(constants, DAT_METRICS);
  NODE_DEFINE_CONSTANT(constants, DAT_TWAINDIRECT);

  /* Data Argument Types for the DG_IMAGE Data Group. */
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGEINFO);
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGELAYOUT);
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGEMEMXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGENATIVEXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGEFILEXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_CIECOLOR);
  NODE_DEFINE_CONSTANT(constants, DAT_GRAYRESPONSE);
  NODE_DEFINE_CONSTANT(constants, DAT_RGBRESPONSE);
  NODE_DEFINE_CONSTANT(constants, DAT_JPEGCOMPRESSION);
  NODE_DEFINE_CONSTANT(constants, DAT_PALETTE8);
  NODE_DEFINE_CONSTANT(constants, DAT_EXTIMAGEINFO);
  NODE_DEFINE_CONSTANT(constants, DAT_FILTER);

  /* Data Argument Types for the DG_AUDIO Data Group. */
  NODE_DEFINE_CONSTANT(constants, DAT_AUDIOFILEXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_AUDIOINFO);
  NODE_DEFINE_CONSTANT(constants, DAT_AUDIONATIVEXFER);

  /* misplaced */
  NODE_DEFINE_CONSTANT(constants, DAT_ICCPROFILE);
  NODE_DEFINE_CONSTANT(constants, DAT_IMAGEMEMFILEXFER);
  NODE_DEFINE_CONSTANT(constants, DAT_ENTRYPOINT);

  /****************************************************************************
  * Messages                                                                 *
  ****************************************************************************/

  /* All message constants are unique.
  * Messages are grouped according to which DATs they are used with.
  */

  NODE_DEFINE_CONSTANT(constants, MSG_NULL);
  NODE_DEFINE_CONSTANT(constants, MSG_CUSTOMBASE);

  /* Generic messages may be used with any of several DATs.                   */
  NODE_DEFINE_CONSTANT(constants, MSG_GET);
  NODE_DEFINE_CONSTANT(constants, MSG_GETCURRENT);
  NODE_DEFINE_CONSTANT(constants, MSG_GETDEFAULT);
  NODE_DEFINE_CONSTANT(constants, MSG_GETFIRST);
  NODE_DEFINE_CONSTANT(constants, MSG_GETNEXT);
  NODE_DEFINE_CONSTANT(constants, MSG_SET);
  NODE_DEFINE_CONSTANT(constants, MSG_RESET);
  NODE_DEFINE_CONSTANT(constants, MSG_QUERYSUPPORT);
  NODE_DEFINE_CONSTANT(constants, MSG_GETHELP);
  NODE_DEFINE_CONSTANT(constants, MSG_GETLABEL);
  NODE_DEFINE_CONSTANT(constants, MSG_GETLABELENUM);
  NODE_DEFINE_CONSTANT(constants, MSG_SETCONSTRAINT);

  /* Messages used with DAT_NULL                                              */
  NODE_DEFINE_CONSTANT(constants, MSG_XFERREADY);
  NODE_DEFINE_CONSTANT(constants, MSG_CLOSEDSREQ);
  NODE_DEFINE_CONSTANT(constants, MSG_CLOSEDSOK);
  NODE_DEFINE_CONSTANT(constants, MSG_DEVICEEVENT);

  /* Messages used with a pointer to DAT_PARENT data                          */
  NODE_DEFINE_CONSTANT(constants, MSG_OPENDSM);
  NODE_DEFINE_CONSTANT(constants, MSG_CLOSEDSM);

  /* Messages used with a pointer to a DAT_IDENTITY structure                 */
  NODE_DEFINE_CONSTANT(constants, MSG_OPENDS);
  NODE_DEFINE_CONSTANT(constants, MSG_CLOSEDS);
  NODE_DEFINE_CONSTANT(constants, MSG_USERSELECT);

  /* Messages used with a pointer to a DAT_USERINTERFACE structure            */
  NODE_DEFINE_CONSTANT(constants, MSG_DISABLEDS);
  NODE_DEFINE_CONSTANT(constants, MSG_ENABLEDS);
  NODE_DEFINE_CONSTANT(constants, MSG_ENABLEDSUIONLY);

  /* Messages used with a pointer to a DAT_EVENT structure                    */
  NODE_DEFINE_CONSTANT(constants, MSG_PROCESSEVENT);

  /* Messages used with a pointer to a DAT_PENDINGXFERS structure             */
  NODE_DEFINE_CONSTANT(constants, MSG_ENDXFER);
  NODE_DEFINE_CONSTANT(constants, MSG_STOPFEEDER);

  /* Messages used with a pointer to a DAT_FILESYSTEM structure               */
  NODE_DEFINE_CONSTANT(constants, MSG_CHANGEDIRECTORY);
  NODE_DEFINE_CONSTANT(constants, MSG_CREATEDIRECTORY);
  NODE_DEFINE_CONSTANT(constants, MSG_DELETE);
  NODE_DEFINE_CONSTANT(constants, MSG_FORMATMEDIA);
  NODE_DEFINE_CONSTANT(constants, MSG_GETCLOSE);
  NODE_DEFINE_CONSTANT(constants, MSG_GETFIRSTFILE);
  NODE_DEFINE_CONSTANT(constants, MSG_GETINFO);
  NODE_DEFINE_CONSTANT(constants, MSG_GETNEXTFILE);
  NODE_DEFINE_CONSTANT(constants, MSG_RENAME);
  NODE_DEFINE_CONSTANT(constants, MSG_COPY);
  NODE_DEFINE_CONSTANT(constants, MSG_AUTOMATICCAPTUREDIRECTORY);

  /* Messages used with a pointer to a DAT_PASSTHRU structure                 */
  NODE_DEFINE_CONSTANT(constants, MSG_PASSTHRU);

  /* used with DAT_CALLBACK */
  NODE_DEFINE_CONSTANT(constants, MSG_REGISTER_CALLBACK);

  /* used with DAT_CAPABILITY */
  NODE_DEFINE_CONSTANT(constants, MSG_RESETALL);

  /* used with DAT_TWAINDIRECT */
  NODE_DEFINE_CONSTANT(constants, MSG_SETTASK);

  /****************************************************************************
  * Capabilities                                                             *
  ****************************************************************************/

  NODE_DEFINE_CONSTANT(constants, CAP_CUSTOMBASE); /* Base of custom capabilities */

  /* all data sources are REQUIRED to support these caps */
  NODE_DEFINE_CONSTANT(constants, CAP_XFERCOUNT);

  /* image data sources are REQUIRED to support these caps */
  NODE_DEFINE_CONSTANT(constants, ICAP_COMPRESSION);
  NODE_DEFINE_CONSTANT(constants, ICAP_PIXELTYPE);
  NODE_DEFINE_CONSTANT(constants, ICAP_UNITS);
  NODE_DEFINE_CONSTANT(constants, ICAP_XFERMECH);

  /* all data sources MAY support these caps */
  NODE_DEFINE_CONSTANT(constants, CAP_AUTHOR);
  NODE_DEFINE_CONSTANT(constants, CAP_CAPTION);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERLOADED);
  NODE_DEFINE_CONSTANT(constants, CAP_TIMEDATE);
  NODE_DEFINE_CONSTANT(constants, CAP_SUPPORTEDCAPS);
  NODE_DEFINE_CONSTANT(constants, CAP_EXTENDEDCAPS);
  NODE_DEFINE_CONSTANT(constants, CAP_AUTOFEED);
  NODE_DEFINE_CONSTANT(constants, CAP_CLEARPAGE);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDPAGE);
  NODE_DEFINE_CONSTANT(constants, CAP_REWINDPAGE);
  NODE_DEFINE_CONSTANT(constants, CAP_INDICATORS);
  NODE_DEFINE_CONSTANT(constants, CAP_PAPERDETECTABLE);
  NODE_DEFINE_CONSTANT(constants, CAP_UICONTROLLABLE);
  NODE_DEFINE_CONSTANT(constants, CAP_DEVICEONLINE);
  NODE_DEFINE_CONSTANT(constants, CAP_AUTOSCAN);
  NODE_DEFINE_CONSTANT(constants, CAP_THUMBNAILSENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_DUPLEX);
  NODE_DEFINE_CONSTANT(constants, CAP_DUPLEXENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_ENABLEDSUIONLY);
  NODE_DEFINE_CONSTANT(constants, CAP_CUSTOMDSDATA);
  NODE_DEFINE_CONSTANT(constants, CAP_ENDORSER);
  NODE_DEFINE_CONSTANT(constants, CAP_JOBCONTROL);
  NODE_DEFINE_CONSTANT(constants, CAP_ALARMS);
  NODE_DEFINE_CONSTANT(constants, CAP_ALARMVOLUME);
  NODE_DEFINE_CONSTANT(constants, CAP_AUTOMATICCAPTURE);
  NODE_DEFINE_CONSTANT(constants, CAP_TIMEBEFOREFIRSTCAPTURE);
  NODE_DEFINE_CONSTANT(constants, CAP_TIMEBETWEENCAPTURES);
  NODE_DEFINE_CONSTANT(constants, CAP_MAXBATCHBUFFERS);
  NODE_DEFINE_CONSTANT(constants, CAP_DEVICETIMEDATE);
  NODE_DEFINE_CONSTANT(constants, CAP_POWERSUPPLY);
  NODE_DEFINE_CONSTANT(constants, CAP_CAMERAPREVIEWUI);
  NODE_DEFINE_CONSTANT(constants, CAP_DEVICEEVENT);
  NODE_DEFINE_CONSTANT(constants, CAP_SERIALNUMBER);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTER);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEX);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERMODE);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERSTRING);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERSUFFIX);
  NODE_DEFINE_CONSTANT(constants, CAP_LANGUAGE);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERALIGNMENT);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERORDER);
  NODE_DEFINE_CONSTANT(constants, CAP_REACQUIREALLOWED);
  NODE_DEFINE_CONSTANT(constants, CAP_BATTERYMINUTES);
  NODE_DEFINE_CONSTANT(constants, CAP_BATTERYPERCENTAGE);
  NODE_DEFINE_CONSTANT(constants, CAP_CAMERASIDE);
  NODE_DEFINE_CONSTANT(constants, CAP_SEGMENTED);
  NODE_DEFINE_CONSTANT(constants, CAP_CAMERAENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_CAMERAORDER);
  NODE_DEFINE_CONSTANT(constants, CAP_MICRENABLED);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERPREP);
  NODE_DEFINE_CONSTANT(constants, CAP_FEEDERPOCKET);
  NODE_DEFINE_CONSTANT(constants, CAP_AUTOMATICSENSEMEDIUM);
  NODE_DEFINE_CONSTANT(constants, CAP_CUSTOMINTERFACEGUID);
  NODE_DEFINE_CONSTANT(constants, CAP_SUPPORTEDCAPSSEGMENTUNIQUE);
  NODE_DEFINE_CONSTANT(constants, CAP_SUPPORTEDDATS);
  NODE_DEFINE_CONSTANT(constants, CAP_DOUBLEFEEDDETECTION);
  NODE_DEFINE_CONSTANT(constants, CAP_DOUBLEFEEDDETECTIONLENGTH);
  NODE_DEFINE_CONSTANT(constants, CAP_DOUBLEFEEDDETECTIONSENSITIVITY);
  NODE_DEFINE_CONSTANT(constants, CAP_DOUBLEFEEDDETECTIONRESPONSE);
  NODE_DEFINE_CONSTANT(constants, CAP_PAPERHANDLING);
  NODE_DEFINE_CONSTANT(constants, CAP_INDICATORSMODE);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERVERTICALOFFSET);
  NODE_DEFINE_CONSTANT(constants, CAP_POWERSAVETIME);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERCHARROTATION);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERFONTSTYLE);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEXLEADCHAR);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEXMAXVALUE);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEXNUMDIGITS);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEXSTEP);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERINDEXTRIGGER);
  NODE_DEFINE_CONSTANT(constants, CAP_PRINTERSTRINGPREVIEW);
  NODE_DEFINE_CONSTANT(constants, CAP_SHEETCOUNT);

  /* image data sources MAY support these caps */
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOBRIGHT);
  NODE_DEFINE_CONSTANT(constants, ICAP_BRIGHTNESS);
  NODE_DEFINE_CONSTANT(constants, ICAP_CONTRAST);
  NODE_DEFINE_CONSTANT(constants, ICAP_CUSTHALFTONE);
  NODE_DEFINE_CONSTANT(constants, ICAP_EXPOSURETIME);
  NODE_DEFINE_CONSTANT(constants, ICAP_FILTER);
  NODE_DEFINE_CONSTANT(constants, ICAP_FLASHUSED);
  NODE_DEFINE_CONSTANT(constants, ICAP_GAMMA);
  NODE_DEFINE_CONSTANT(constants, ICAP_HALFTONES);
  NODE_DEFINE_CONSTANT(constants, ICAP_HIGHLIGHT);
  NODE_DEFINE_CONSTANT(constants, ICAP_IMAGEFILEFORMAT);
  NODE_DEFINE_CONSTANT(constants, ICAP_LAMPSTATE);
  NODE_DEFINE_CONSTANT(constants, ICAP_LIGHTSOURCE);
  NODE_DEFINE_CONSTANT(constants, ICAP_ORIENTATION);
  NODE_DEFINE_CONSTANT(constants, ICAP_PHYSICALWIDTH);
  NODE_DEFINE_CONSTANT(constants, ICAP_PHYSICALHEIGHT);
  NODE_DEFINE_CONSTANT(constants, ICAP_SHADOW);
  NODE_DEFINE_CONSTANT(constants, ICAP_FRAMES);
  NODE_DEFINE_CONSTANT(constants, ICAP_XNATIVERESOLUTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_YNATIVERESOLUTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_XRESOLUTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_YRESOLUTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_MAXFRAMES);
  NODE_DEFINE_CONSTANT(constants, ICAP_TILES);
  NODE_DEFINE_CONSTANT(constants, ICAP_BITORDER);
  NODE_DEFINE_CONSTANT(constants, ICAP_CCITTKFACTOR);
  NODE_DEFINE_CONSTANT(constants, ICAP_LIGHTPATH);
  NODE_DEFINE_CONSTANT(constants, ICAP_PIXELFLAVOR);
  NODE_DEFINE_CONSTANT(constants, ICAP_PLANARCHUNKY);
  NODE_DEFINE_CONSTANT(constants, ICAP_ROTATION);
  NODE_DEFINE_CONSTANT(constants, ICAP_SUPPORTEDSIZES);
  NODE_DEFINE_CONSTANT(constants, ICAP_THRESHOLD);
  NODE_DEFINE_CONSTANT(constants, ICAP_XSCALING);
  NODE_DEFINE_CONSTANT(constants, ICAP_YSCALING);
  NODE_DEFINE_CONSTANT(constants, ICAP_BITORDERCODES);
  NODE_DEFINE_CONSTANT(constants, ICAP_PIXELFLAVORCODES);
  NODE_DEFINE_CONSTANT(constants, ICAP_JPEGPIXELTYPE);
  NODE_DEFINE_CONSTANT(constants, ICAP_TIMEFILL);
  NODE_DEFINE_CONSTANT(constants, ICAP_BITDEPTH);
  NODE_DEFINE_CONSTANT(constants, ICAP_BITDEPTHREDUCTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_UNDEFINEDIMAGESIZE);
  NODE_DEFINE_CONSTANT(constants, ICAP_IMAGEDATASET);
  NODE_DEFINE_CONSTANT(constants, ICAP_EXTIMAGEINFO);
  NODE_DEFINE_CONSTANT(constants, ICAP_MINIMUMHEIGHT);
  NODE_DEFINE_CONSTANT(constants, ICAP_MINIMUMWIDTH);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTODISCARDBLANKPAGES);
  NODE_DEFINE_CONSTANT(constants, ICAP_FLIPROTATION);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODEDETECTIONENABLED);
  NODE_DEFINE_CONSTANT(constants, ICAP_SUPPORTEDBARCODETYPES);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODEMAXSEARCHPRIORITIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODESEARCHPRIORITIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODESEARCHMODE);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODEMAXRETRIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_BARCODETIMEOUT);
  NODE_DEFINE_CONSTANT(constants, ICAP_ZOOMFACTOR);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODEDETECTIONENABLED);
  NODE_DEFINE_CONSTANT(constants, ICAP_SUPPORTEDPATCHCODETYPES);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODEMAXSEARCHPRIORITIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODESEARCHPRIORITIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODESEARCHMODE);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODEMAXRETRIES);
  NODE_DEFINE_CONSTANT(constants, ICAP_PATCHCODETIMEOUT);
  NODE_DEFINE_CONSTANT(constants, ICAP_FLASHUSED2);
  NODE_DEFINE_CONSTANT(constants, ICAP_IMAGEFILTER);
  NODE_DEFINE_CONSTANT(constants, ICAP_NOISEFILTER);
  NODE_DEFINE_CONSTANT(constants, ICAP_OVERSCAN);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICBORDERDETECTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICDESKEW);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICROTATE);
  NODE_DEFINE_CONSTANT(constants, ICAP_JPEGQUALITY);
  NODE_DEFINE_CONSTANT(constants, ICAP_FEEDERTYPE);
  NODE_DEFINE_CONSTANT(constants, ICAP_ICCPROFILE);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOSIZE);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICCROPUSESFRAME);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICLENGTHDETECTION);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICCOLORENABLED);
  NODE_DEFINE_CONSTANT(constants, ICAP_AUTOMATICCOLORNONCOLORPIXELTYPE);
  NODE_DEFINE_CONSTANT(constants, ICAP_COLORMANAGEMENTENABLED);
  NODE_DEFINE_CONSTANT(constants, ICAP_IMAGEMERGE);
  NODE_DEFINE_CONSTANT(constants, ICAP_IMAGEMERGEHEIGHTTHRESHOLD);
  NODE_DEFINE_CONSTANT(constants, ICAP_SUPPORTEDEXTIMAGEINFO);
  NODE_DEFINE_CONSTANT(constants, ICAP_FILMTYPE);
  NODE_DEFINE_CONSTANT(constants, ICAP_MIRROR);
  NODE_DEFINE_CONSTANT(constants, ICAP_JPEGSUBSAMPLING);

  /* image data sources MAY support these audio caps */
  NODE_DEFINE_CONSTANT(constants, ACAP_XFERMECH);

  /***************************************************************************
  *            Extended Image Info Attributes section  Added 1.7            *
  ***************************************************************************/

  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODEX);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODEY);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODETEXT);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODETYPE);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADETOP);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADELEFT);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEHEIGHT);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWIDTH);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADESIZE);
  NODE_DEFINE_CONSTANT(constants, TWEI_SPECKLESREMOVED);
  NODE_DEFINE_CONSTANT(constants, TWEI_HORZLINEXCOORD);
  NODE_DEFINE_CONSTANT(constants, TWEI_HORZLINEYCOORD);
  NODE_DEFINE_CONSTANT(constants, TWEI_HORZLINELENGTH);
  NODE_DEFINE_CONSTANT(constants, TWEI_HORZLINETHICKNESS);
  NODE_DEFINE_CONSTANT(constants, TWEI_VERTLINEXCOORD);
  NODE_DEFINE_CONSTANT(constants, TWEI_VERTLINEYCOORD);
  NODE_DEFINE_CONSTANT(constants, TWEI_VERTLINELENGTH);
  NODE_DEFINE_CONSTANT(constants, TWEI_VERTLINETHICKNESS);
  NODE_DEFINE_CONSTANT(constants, TWEI_PATCHCODE);
  NODE_DEFINE_CONSTANT(constants, TWEI_ENDORSEDTEXT);
  NODE_DEFINE_CONSTANT(constants, TWEI_FORMCONFIDENCE);
  NODE_DEFINE_CONSTANT(constants, TWEI_FORMTEMPLATEMATCH);
  NODE_DEFINE_CONSTANT(constants, TWEI_FORMTEMPLATEPAGEMATCH);
  NODE_DEFINE_CONSTANT(constants, TWEI_FORMHORZDOCOFFSET);
  NODE_DEFINE_CONSTANT(constants, TWEI_FORMVERTDOCOFFSET);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODECOUNT);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODECONFIDENCE);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODEROTATION);
  NODE_DEFINE_CONSTANT(constants, TWEI_BARCODETEXTLENGTH);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADECOUNT);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEBLACKCOUNTOLD);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEBLACKCOUNTNEW);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEBLACKRLMIN);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEBLACKRLMAX);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWHITECOUNTOLD);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWHITECOUNTNEW);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWHITERLMIN);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWHITERLAVE);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESHADEWHITERLMAX);
  NODE_DEFINE_CONSTANT(constants, TWEI_BLACKSPECKLESREMOVED);
  NODE_DEFINE_CONSTANT(constants, TWEI_WHITESPECKLESREMOVED);
  NODE_DEFINE_CONSTANT(constants, TWEI_HORZLINECOUNT);
  NODE_DEFINE_CONSTANT(constants, TWEI_VERTLINECOUNT);
  NODE_DEFINE_CONSTANT(constants, TWEI_DESKEWSTATUS);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWORIGINALANGLE);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWFINALANGLE);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWCONFIDENCE);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWX1);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWY1);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWX2);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWY2);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWX3);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWY3);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWX4);
  NODE_DEFINE_CONSTANT(constants, TWEI_SKEWWINDOWY4);
  NODE_DEFINE_CONSTANT(constants, TWEI_BOOKNAME);
  NODE_DEFINE_CONSTANT(constants, TWEI_CHAPTERNUMBER);
  NODE_DEFINE_CONSTANT(constants, TWEI_DOCUMENTNUMBER);
  NODE_DEFINE_CONSTANT(constants, TWEI_PAGENUMBER);
  NODE_DEFINE_CONSTANT(constants, TWEI_CAMERA);
  NODE_DEFINE_CONSTANT(constants, TWEI_FRAMENUMBER);
  NODE_DEFINE_CONSTANT(constants, TWEI_FRAME);
  NODE_DEFINE_CONSTANT(constants, TWEI_PIXELFLAVOR);
  NODE_DEFINE_CONSTANT(constants, TWEI_ICCPROFILE);
  NODE_DEFINE_CONSTANT(constants, TWEI_LASTSEGMENT);
  NODE_DEFINE_CONSTANT(constants, TWEI_SEGMENTNUMBER);
  NODE_DEFINE_CONSTANT(constants, TWEI_MAGDATA);
  NODE_DEFINE_CONSTANT(constants, TWEI_MAGTYPE);
  NODE_DEFINE_CONSTANT(constants, TWEI_PAGESIDE);
  NODE_DEFINE_CONSTANT(constants, TWEI_FILESYSTEMSOURCE);
  NODE_DEFINE_CONSTANT(constants, TWEI_IMAGEMERGED);
  NODE_DEFINE_CONSTANT(constants, TWEI_MAGDATALENGTH);
  NODE_DEFINE_CONSTANT(constants, TWEI_PAPERCOUNT);
  NODE_DEFINE_CONSTANT(constants, TWEI_PRINTERTEXT);
  NODE_DEFINE_CONSTANT(constants, TWEI_TWAINDIRECTMETADATA);

  NODE_DEFINE_CONSTANT(constants, TWEJ_NONE);
  NODE_DEFINE_CONSTANT(constants, TWEJ_MIDSEPARATOR);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCH1);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCH2);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCH3);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCH4);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCH6);
  NODE_DEFINE_CONSTANT(constants, TWEJ_PATCHT);

  /***************************************************************************
  *            Return Codes and Condition Codes section                     *
  ***************************************************************************/

  NODE_DEFINE_CONSTANT(constants, TWRC_CUSTOMBASE);

  NODE_DEFINE_CONSTANT(constants, TWRC_SUCCESS);
  NODE_DEFINE_CONSTANT(constants, TWRC_FAILURE);
  NODE_DEFINE_CONSTANT(constants, TWRC_CHECKSTATUS);
  NODE_DEFINE_CONSTANT(constants, TWRC_CANCEL);
  NODE_DEFINE_CONSTANT(constants, TWRC_DSEVENT);
  NODE_DEFINE_CONSTANT(constants, TWRC_NOTDSEVENT);
  NODE_DEFINE_CONSTANT(constants, TWRC_XFERDONE);
  NODE_DEFINE_CONSTANT(constants, TWRC_ENDOFLIST);
  NODE_DEFINE_CONSTANT(constants, TWRC_INFONOTSUPPORTED);
  NODE_DEFINE_CONSTANT(constants, TWRC_DATANOTAVAILABLE);
  NODE_DEFINE_CONSTANT(constants, TWRC_BUSY);
  NODE_DEFINE_CONSTANT(constants, TWRC_SCANNERLOCKED);

  /* Condition Codes: Application gets these by doing DG_CONTROL DAT_STATUS MSG_GET.  */
  NODE_DEFINE_CONSTANT(constants, TWCC_CUSTOMBASE);

  NODE_DEFINE_CONSTANT(constants, TWCC_SUCCESS);
  NODE_DEFINE_CONSTANT(constants, TWCC_BUMMER);
  NODE_DEFINE_CONSTANT(constants, TWCC_LOWMEMORY);
  NODE_DEFINE_CONSTANT(constants, TWCC_NODS);
  NODE_DEFINE_CONSTANT(constants, TWCC_MAXCONNECTIONS);
  NODE_DEFINE_CONSTANT(constants, TWCC_OPERATIONERROR);
  NODE_DEFINE_CONSTANT(constants, TWCC_BADCAP);
  NODE_DEFINE_CONSTANT(constants, TWCC_BADPROTOCOL);
  NODE_DEFINE_CONSTANT(constants, TWCC_BADVALUE);
  NODE_DEFINE_CONSTANT(constants, TWCC_SEQERROR);
  NODE_DEFINE_CONSTANT(constants, TWCC_BADDEST);
  NODE_DEFINE_CONSTANT(constants, TWCC_CAPUNSUPPORTED);
  NODE_DEFINE_CONSTANT(constants, TWCC_CAPBADOPERATION);
  NODE_DEFINE_CONSTANT(constants, TWCC_CAPSEQERROR);
  NODE_DEFINE_CONSTANT(constants, TWCC_DENIED);
  NODE_DEFINE_CONSTANT(constants, TWCC_FILEEXISTS);
  NODE_DEFINE_CONSTANT(constants, TWCC_FILENOTFOUND);
  NODE_DEFINE_CONSTANT(constants, TWCC_NOTEMPTY);
  NODE_DEFINE_CONSTANT(constants, TWCC_PAPERJAM);
  NODE_DEFINE_CONSTANT(constants, TWCC_PAPERDOUBLEFEED);
  NODE_DEFINE_CONSTANT(constants, TWCC_FILEWRITEERROR);
  NODE_DEFINE_CONSTANT(constants, TWCC_CHECKDEVICEONLINE);
  NODE_DEFINE_CONSTANT(constants, TWCC_INTERLOCK);
  NODE_DEFINE_CONSTANT(constants, TWCC_DAMAGEDCORNER);
  NODE_DEFINE_CONSTANT(constants, TWCC_FOCUSERROR);
  NODE_DEFINE_CONSTANT(constants, TWCC_DOCTOOLIGHT);
  NODE_DEFINE_CONSTANT(constants, TWCC_DOCTOODARK);
  NODE_DEFINE_CONSTANT(constants, TWCC_NOMEDIA);

  /* bit patterns: for query the operation that are supported by the data source on a capability */
  /* Application gets these through DG_CONTROL/DAT_CAPABILITY/MSG_QUERYSUPPORT */
  NODE_DEFINE_CONSTANT(constants, TWQC_GET);
  NODE_DEFINE_CONSTANT(constants, TWQC_SET);
  NODE_DEFINE_CONSTANT(constants, TWQC_GETDEFAULT);
  NODE_DEFINE_CONSTANT(constants, TWQC_GETCURRENT);
  NODE_DEFINE_CONSTANT(constants, TWQC_RESET);
  NODE_DEFINE_CONSTANT(constants, TWQC_SETCONSTRAINT);
  NODE_DEFINE_CONSTANT(constants, TWQC_GETHELP);
  NODE_DEFINE_CONSTANT(constants, TWQC_GETLABEL);
  NODE_DEFINE_CONSTANT(constants, TWQC_GETLABELENUM);

  exports->Set(Nan::New("constants").ToLocalChecked(), constants);
}

NAN_MODULE_INIT(Init)
{
  InitConstants(target);
}

NODE_MODULE(twainh, Init);