/*--------------------------------------------------------------------------*/ /* */ /* */ /* ------------ Bit-Bucket Software, Co. */ /* \ 10001101 / Writers and Distributors of */ /* \ 011110 / Freely Available Software. */ /* \ 1011 / */ /* ------ */ /* */ /* (C) Copyright 1987-96, Bit Bucket Software Co. */ /* */ /* This module was written by Vince Perriello */ /* */ /* BinkleyTerm Language File Compiler */ /* */ /* */ /* For complete details of the licensing restrictions, please refer */ /* to the License agreement, which is published in its entirety in */ /* the MAKEFILE and BT.C, and also contained in the file LICENSE.260. */ /* */ /* USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE */ /* BINKLEYTERM LICENSING AGREEMENT. IF YOU DO NOT FIND THE TEXT OF */ /* THIS AGREEMENT IN ANY OF THE AFOREMENTIONED FILES, OR IF YOU DO */ /* NOT HAVE THESE FILES, YOU SHOULD IMMEDIATELY CONTACT BIT BUCKET */ /* SOFTWARE CO. AT ONE OF THE ADDRESSES LISTED BELOW. IN NO EVENT */ /* SHOULD YOU PROCEED TO USE THIS FILE WITHOUT HAVING ACCEPTED THE */ /* TERMS OF THE BINKLEYTERM LICENSING AGREEMENT, OR SUCH OTHER */ /* AGREEMENT AS YOU ARE ABLE TO REACH WITH BIT BUCKET SOFTWARE, CO. */ /* */ /* */ /* You can contact Bit Bucket Software Co. at any one of the following */ /* addresses: */ /* */ /* Bit Bucket Software Co. FidoNet 1:104/501, 1:343/491 */ /* P.O. Box 460398 AlterNet 7:42/1491 */ /* Aurora, CO 80046 BBS-Net 86:2030/1 */ /* Internet f491.n343.z1.fidonet.org */ /* */ /* Please feel free to contact us at any time to share your comments about */ /* our software and/or licensing policies. */ /* */ /*--------------------------------------------------------------------------*/ #include #include #include "language.h" /* * Assume average length of a string at 32 characters * */ char **pointers; short pointer_size; struct _lang_hdr LangHdr = {0, 0}; char *memory; short memory_size; struct _lang_hdr PrdctHdr = {0, 0}; char *PrdctMem; char **PrdctTbl; char *PrdctUnknown; short *TrmnlAccelAry; short TrmnlAccelCnt = 0; struct _key_fnc *TrmnlAccelTbl; short *UnattendedAccelAry; short UnattendedAccelCnt = 0; struct _key_fnc *UnattendedAccelTbl; struct _lang_hdr AnsiHdr = {0, 0}; char *AnsiMem; void main (int, char **); static void usage (void); /* * Read in a raw text file and write out a compiled BinkleyTerm * language file. * */ void main (int argc, char **argv) { char *malloc_target; int error; int Idx; /* * Print out the copyright notice. */ (void) fprintf (stderr, "BinkleyTerm Language File Compiler Version 2.60"); (void) fprintf (stderr, "\n(C) Copyright 1987-96, Bit Bucket Software, Co. ALL RIGHTS RESERVED.\n\n"); /* * Make sure we were called with the requisite number of arguments * */ if (argc != 3) usage (); /* * Allocate space for the raw character array and for the * pointer array * */ malloc_target = malloc (MAX_MEMORY); if (malloc_target == NULL) { fprintf (stderr, "Unable to allocate string memory\n"); exit (250); } memory = malloc_target; memory_size = MAX_MEMORY; malloc_target = malloc ((MAX_STRINGS + 1) * (sizeof (char *))); if (malloc_target == NULL) { fprintf (stderr, "Unable to allocate pointer array\n"); exit (250); } pointers = (char **) malloc_target; pointer_size = MAX_STRINGS; TrmnlAccelAry = calloc (MAX_KEYFNCS, sizeof (int)); TrmnlAccelTbl = calloc (MAX_KEYFNCS, sizeof (struct _key_fnc)); UnattendedAccelAry = calloc (MAX_KEYFNCS, sizeof (int)); UnattendedAccelTbl = calloc (MAX_KEYFNCS, sizeof (struct _key_fnc)); /* * Allocate space for the raw character array and for the * pointer array * */ malloc_target = malloc (MAX_PRDCTS * 32); if (malloc_target == NULL) { fprintf (stderr, "Unable to allocate product string memory\n"); exit (250); } PrdctMem = malloc_target; malloc_target = malloc ((MAX_PRDCTS + 1) * (sizeof (char *))); if (malloc_target == NULL) { fprintf (stderr, "Unable to allocate product pointer array\n"); exit (250); } PrdctTbl = (char **) malloc_target; for (Idx = 0; MAX_PRDCTS > Idx; ++Idx) PrdctTbl[Idx] = PrdctMem; PrdctHdr.ElemCnt = MAX_PRDCTS; /* * Allocate space for the ANSI array */ malloc_target = malloc (MAX_ANSI * 10); if (malloc_target == NULL) { fprintf (stderr, "Unable to allocate product string memory\n"); exit (250); } AnsiMem = malloc_target; /* * Now read the stuff into our array. * */ error = get_language (argv[1]); if (error != 0) exit (240); /* * Write our stuff out now. * */ error = put_language (argv[2]); if (error != 0) exit (230); } static void usage () { fprintf (stderr, "Usage : BTLNG language_file_name output_file_name\n"); exit (255); }