Пример #1
0
/**
 * Prints the contents of a ContextDescriptor either to stdout or a pager
 * (NB this uses its own internal stream).
 */
void
PrintContextDescriptor(ContextDescriptor *cdp)
{
  FILE *fd;
  struct Redir rd = { NULL, NULL, NULL, 0, 0 };        /* for paging (with open_stream()) */
  int stream_ok;

  if (cdp) {
    stream_ok = open_stream(&rd, ascii);
    fd = (stream_ok) ? rd.stream : NULL; /* use pager, or simply print to stdout if it fails */

    if (pretty_print) {
      fprintf(fd, "===Context Descriptor=======================================\n");
      fprintf(fd, "\n");
      fprintf(fd, "left context:     %d ", cdp->left_width);
      switch (cdp->left_type) {
      case CHAR_CONTEXT: 
        fprintf(fd, "characters\n"); break;
      case WORD_CONTEXT: 
        fprintf(fd, "tokens\n"); break;
      case STRUC_CONTEXT: 
      case ALIGN_CONTEXT:
        fprintf(fd, "%s\n",
                cdp->left_structure_name ? cdp->left_structure_name : "???");
      }
      fprintf(fd, "right context:    %d ", cdp->right_width);
      switch (cdp->right_type) {
      case CHAR_CONTEXT: 
        fprintf(fd, "characters\n"); break;
      case WORD_CONTEXT: 
        fprintf(fd, "tokens\n"); break;
      case STRUC_CONTEXT: 
      case ALIGN_CONTEXT:
        fprintf(fd, "%s\n",
                cdp->right_structure_name ? cdp->right_structure_name : "???");
      }
      fprintf(fd, "corpus position:  %s\n", cdp->print_cpos ? "shown" : "not shown");
      fprintf(fd, "target anchors:   %s\n", show_targets ? "shown" : "not shown");
      fprintf(fd, "\n");
      PrintAttributes(fd, "Positional Attributes:", cdp->attributes, 0);
      fprintf(fd, "\n");
      PrintAttributes(fd, "Structural Attributes:", cdp->strucAttributes, 1);
      fprintf(fd, "\n");
      /*     PrintAttributes(fd, "Structure Values:     ", cdp->printStructureTags); */
      /*     fprintf(fd, "\n"); */
      PrintAttributes(fd, "Aligned Corpora:      ", cdp->alignedCorpora, 0);
      fprintf(fd, "\n");
      fprintf(fd, "============================================================\n");
    }
    else {
      PrintAttributesSimple(fd, "p-Att", cdp->attributes, 0);
      PrintAttributesSimple(fd, "s-Att", cdp->strucAttributes, 1);
      PrintAttributesSimple(fd, "a-Att", cdp->alignedCorpora, 0);
    }

    if (stream_ok) 
      close_stream(&rd);        /* close pipe to pager if we were using it */
  }
}
Пример #2
0
bool Init(void)
{
	// platform-specific initialization
	Platform::Init();

	// create window
	OpenWindow();

	// hide the mouse cursor
	Platform::ShowCursor(false);

	// grab input
	Platform::GrabInput(true);

	// print OpenGL attributes
	PrintAttributes();

	// initialize console
	console = new Console(cmdCB);

	// initialize sound system
	Sound::Init();

	// pause audio
	Sound::Pause();

	// success!
	return true;    
}
Пример #3
0
void CIwGameXmlNode::PrintTree(int level)
{
	for (int t = 0; t < level; t++)
	{
		s3eDebugOutputString("\t");
	}
	s3eDebugOutputString("<");
	s3eDebugOutputString(Name.c_str());
	PrintAttributes();
	if (HasValue)
	{
		if (Value.GetLength() == 0)
			s3eDebugOutputString(" />\n");
		else
		{
			s3eDebugOutputString(">");
			s3eDebugOutputString(Value.c_str());
		}
	}
	else
	{
		s3eDebugOutputString(">\n");
		for (CIwGameXmlNodeList::iterator i = Children.begin(); i != Children.end(); ++i)
			(*i)->PrintTree(level + 1);
		for (int t = 0; t < level; t++)
			s3eDebugOutputString("\t");
	}
//	if (Value.GetLength() > 0 || Value.c_str() == NULL)
	if (Value.GetLength() > 0 || !HasValue)
	{
		s3eDebugOutputString("</");
		s3eDebugOutputString(Name.c_str());
		s3eDebugOutputString(">\n");
	}
}
Пример #4
0
	bool Init(void)
	{
		// initialize SDL
		if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
			return false;    

		// Check for joystick
		if (SDL_NumJoysticks() > 0)
		{
			// Open joystick
			SDL_Joystick *joy = SDL_JoystickOpen(0);
			if(joy)
			{
				DebugPrint("Opened Joystick 0\n");
				DebugPrint("Name: %s\n", SDL_JoystickName(0));
			}
		}

		// enable unicode
		SDL_EnableUNICODE(1);

		// create the window
		OpenWindow();

		// set window title
		SDL_WM_SetCaption( "Shmup!", NULL );

		// platform-specific attributes
		PrintAttributes();

		// success!
		return true;    
	}
Пример #5
0
void CzXmlNode::PrintTree(CzString& out, int level)
{
	for (int t = 0; t < level; t++)
	{
		out += "\t";
	}
	out += "<";
	out += Name.c_str();
	PrintAttributes(out);
	if (HasValue)
	{
		if (Value.getLength() == 0)
			out += " />\n";
		else
		{
			out += ">";
			out += Value.c_str();
		}
	}
	else
	{
		out += ">\n";
		CzXmlNode* node;
		for (CzXmlNodeList::iterator it = Children.begin(); it != Children.end(); it++)
		{
			node = *it;
			node->PrintTree(out, level + 1);
		}
		for (int t = 0; t < level; t++)
			out += "\t";
	}
//	if (Value.getLength() > 0 || Value.c_str() == NULL)
	if (Value.getLength() > 0 || !HasValue)
	{
		out += "</";
		out += Name.c_str();
		out += ">\n";
	}
}
//------------------------------------------------------------------------------------------------
// Name:  CreateTerrainMesh
// Desc:  
//------------------------------------------------------------------------------------------------
bool CreateTerrainMesh(LPDIRECT3DDEVICE9 d3dDevice, LPD3DXMESH* terrainMesh)
{
    // Calculate the number of faces and vertices required
    const unsigned int faces = (TMS_COUNT + 3) * 2;
    const unsigned int vertices = (TMS_COUNT + 3) * 4;

    // The internal terrain mesh
    LPD3DXMESH internalTerrainMesh;

    // Create the mesh
    HRESULT hr = D3DXCreateMeshFVF(faces, vertices, D3DXMESH_MANAGED, D3DFVF_GEOMETRYVERTEX, d3dDevice, &internalTerrainMesh);
    if (APP_ERROR(FAILED(hr))("Unable to create the terrain mesh"))
        return false;

    // Lock the mesh buffers
    GeometryVertex* lockedVertices = 0;
    WORD* lockedIndices = 0;
    DWORD* lockedAttributes = 0;
    if (APP_ERROR(FAILED(internalTerrainMesh->LockAttributeBuffer(0, &lockedAttributes)) ||
                   FAILED(internalTerrainMesh->LockVertexBuffer(0, (VOID**)&lockedVertices)) ||
                   FAILED(internalTerrainMesh->LockIndexBuffer(0, (VOID**)&lockedIndices)))("Unable to lock terrain mesh"))
    {
        // Deallocate the mesh
        SAFE_RELEASE(internalTerrainMesh);

        // Exit the method
        return false;
    }

    // Vertices that will be rotated 4x about Y at
    // 90-degree intervals to produce the wall mesh
    GeometryVertex wallSide[] = {
        { -0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f, -1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { -0.5f, -1.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // The flat square with unit size
    GeometryVertex flat[] = {
        { -0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // Geometry template for the high-corner meshes,
    // with the high corner in the north-west
    GeometryVertex highCorner[] = {
        { -0.5f, +1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // Geometry template for the low-corner meshes,
    // with the low corner in the north-west
    GeometryVertex lowCorner[] = {
        { -0.5f, -1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // Geometry template for the high-side meshes,
    // with the high side to the north
    GeometryVertex highSide[] = {
        { -0.5f, +1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f, +1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // Geometry template for the low-corner meshes,
    // with the low corner in the north-west
    GeometryVertex raisedLowCorner[] = {
        { -0.5f,  0.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f, +1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f, +1.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f, +1.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // Geometry template for the low-side meshes,
    // with the low side to the north
    GeometryVertex lowSide[] = {
        { -0.5f, -1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f },
        { +0.5f, -1.0f, -0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f },
        { -0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
        { +0.5f,  0.0f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f },
    };

    // The subset that is currently being written
    unsigned int currentSubset = TMS_WALL_SIDES;

    // Copy the wall first--it does not have any texture rotations
    lockedVertices = CopyYRotatedGeometry(lockedVertices, wallSide, 4, 0.0f * D3DX_PI / 2.0f);
    lockedVertices = CopyYRotatedGeometry(lockedVertices, wallSide, 4, 1.0f * D3DX_PI / 2.0f);
    lockedVertices = CopyYRotatedGeometry(lockedVertices, wallSide, 4, 2.0f * D3DX_PI / 2.0f);
    lockedVertices = CopyYRotatedGeometry(lockedVertices, wallSide, 4, 3.0f * D3DX_PI / 2.0f);

    // Copy four sets of squares
    lockedIndices = PrintSquareIndices(lockedIndices, 0, 4);
    lockedAttributes = PrintAttributes(lockedAttributes, currentSubset, 4);

    // Move to the next subset
    currentSubset++;

    // Write the flat mesh first, since it only has texture rotations
    for (unsigned int textureDirection = 0; textureDirection < 4; ++textureDirection, ++currentSubset)
    {
        SetTerrainTexcoords(flat, textureDirection);
        lockedVertices = CopyYRotatedGeometry(lockedVertices, flat, 4, 0.0f);
        lockedIndices = PrintSquareIndices(lockedIndices, 4 + currentSubset - 1, 1);
        lockedAttributes = PrintAttributes(lockedAttributes, currentSubset, 1);
    }

    // Repeat for all combinations of texture direction and rotation for the remaining types
    for (int type = 0; type < 5; ++type)
    {
        GeometryVertex* sourceGeometry;
        switch(type)
        {
            case 0: sourceGeometry = highCorner; break;
            case 1: sourceGeometry = lowCorner;  break;
            case 2: sourceGeometry = highSide;   break;
            case 3: sourceGeometry = raisedLowCorner; break;
            case 4: sourceGeometry = lowSide;    break;
        }

        // Repeat for all rotations
        for (int rotation = 0; rotation < 4; ++rotation)
        {
            // Calculate the rotation angle
            float rotationAngle = D3DX_PI / 2.0f * rotation;

            // Repeat for all texture directions
            for (unsigned int textureDirection = 0; textureDirection < 4; ++textureDirection, ++currentSubset)
            {
                // Reverse the rotation of the texture by the rotation of the element so that we get
                // consistent texture directions (i.e. north is texture-up on all tiles)
                SetTerrainTexcoords(sourceGeometry, (textureDirection - rotation + 4) % 4);
                lockedVertices = CopyYRotatedGeometry(lockedVertices, sourceGeometry, 4, rotationAngle);
                lockedIndices = PrintSquareIndices(lockedIndices, 4 + currentSubset - 1, 1);
                lockedAttributes = PrintAttributes(lockedAttributes, currentSubset, 1);
            }
        }
    }

    // Unlock the buffers
    internalTerrainMesh->UnlockVertexBuffer();
    internalTerrainMesh->UnlockIndexBuffer();
    internalTerrainMesh->UnlockAttributeBuffer();

    // Normalize
    //CONFIRM(SUCCEEDED(D3DXComputeNormals(internalTerrainMesh, NULL)));

    // Assign the output mesh
    *terrainMesh = internalTerrainMesh;

    // Success
    return true;
}
Пример #7
0
/* Outputs requested data */
int NXBread(NXhandle fileId, NXname dataName, char *dimensions)
{
    int dataRank, dataDimensions[NX_MAXRANK], dataType, start[NX_MAXRANK],
        size[NX_MAXRANK], i, j, total_size;
    char dimString[80], *subString;
    void *dataBuffer;

    /* Check the specified data item exists */
    if (FindData(fileId, dataName) != NX_OK)
        return NX_ERROR;
    /* Open the data and obtain its type and rank details */
    if (NXopendata(fileId, dataName) != NX_OK)
        return NX_ERROR;
    if (NXgetinfo(fileId, &dataRank, dataDimensions, &dataType) != NX_OK)
        return NX_ERROR;
    /* Check if a single element has been specified */
    /* If so, read in the indices */
    if (dimensions != NULL) {
        strcpy(dimString, dimensions);
        subString = strtok(dimString, ",");
        for (i = 0; subString != NULL && i < NX_MAXRANK; i++) {
            if (i >= dataRank) {
                printf("NX_ERROR: Data rank = %d\n", dataRank);
                return NX_ERROR;
            }
            sscanf(subString, "%d", &j);
            if (j > dataDimensions[i] || j < 1) {
                printf("NX_ERROR: Data dimension %d = %d\n",
                       (i + 1), dataDimensions[i]);
                return NX_ERROR;
            }
            start[i] = j - 1;
            size[i] = 1;
            subString = strtok(NULL, ",");
        }
        if (i != dataRank) {
            printf("NX_ERROR: Data rank = %d\n", dataRank);
            return NX_ERROR;
        }
    } else {
        /* Otherwise, allocate enough space for the first 3 elements of each dimension */
        for (i = 0; i < dataRank; i++) {
            if (dataDimensions[i] > 3 && dataType != NX_CHAR) {
                start[i] = 0;
                size[i] = 3;
            } /* unless it's a character string */
            else {
                start[i] = 0;
                size[i] = dataDimensions[i];
            }
        }
    }
    total_size = 1;
    for (i = 0; i < dataRank; i++) {
        total_size *= dataDimensions[i];
    }
    if (NXmalloc((void **)&dataBuffer, dataRank, size, dataType) != NX_OK)
        return NX_ERROR;
    /* Read in the data with NXgetslab */
    if (dataType == NX_CHAR) {
        if (NXgetdata(fileId, dataBuffer) != NX_OK)
            return NX_ERROR;
    } else {
        if (NXgetslab(fileId, dataBuffer, start, size) != NX_OK)
            return NX_ERROR;
    }
    /* Output data name, dimensions and type */
    printf("  %s", dataName);
    if (dimensions == NULL)
        PrintDimensions(dataRank, dataDimensions);
    else
        printf("[%s]", dimensions);
    printf(" ");
    PrintType(dataType);
    printf(" = ");
    /* Output the data according to data type */
    if (dimensions == NULL) {	/* Print the first few values (max 3) */
        if (dataType == NX_CHAR) {	/* If the data is a string, output the whole buffer */
            /* this prints the first line of an array; could print more */
            for (i = 0;
                    i < total_size / dataDimensions[dataRank - 1];
                    i++) {
                PrintData((char *)dataBuffer +
                          i * dataDimensions[dataRank - 1],
                          dataType,
                          dataDimensions[dataRank - 1]);
                PrintData("\n", NX_CHAR, 1);
            }
        } else {
            if (dataRank == 1 && dataDimensions[0] == 1) {	/* It's a scalar */
                PrintData(dataBuffer, dataType, 1);
            } else {	/* It's an array */
                printf("[ ");
                /* Determine total size of input buffer */
                for (i = 0, j = 0; i < dataRank; i++)
                    j += dataDimensions[i];
                /* Output at least 3 values */
                if (j > 3) {
                    PrintData(dataBuffer, dataType, 3);
                    printf("...");
                }
                /* unless the total size is smaller */
                else {
                    PrintData(dataBuffer, dataType, j);
                }
                printf("]");
            }
        }
    } else {		/* Print the requested item */
        PrintData(dataBuffer, dataType, 1);
    }
    printf("\n");
    if (NXfree((void **)&dataBuffer) != NX_OK)
        return NX_ERROR;

    /* Check for attributes unless a single element is specified */
    if (dimensions == NULL)
        PrintAttributes(fileId);

    /* Close data set */
    if (NXclosedata(fileId) != NX_OK)
        return NX_ERROR;

    return NX_OK;
}
Пример #8
0
int main(int argc, char *argv[])
{
    char fileName[256], oldwd[256], *command, *dimensions, *stringPtr;
    char prompt[512];
    char *inputText;
    NXname dataName;
    int status;

#if HAVE_LIBREADLINE
    rl_readline_name = "NXbrowse";
    rl_attempted_completion_function = nxbrowse_complete;
#if READLINE_VERSION >= 0x500
    rl_catch_signals = 0;
#else
#define rl_crlf() fprintf(rl_outstream, "\r\n");
#define rl_on_new_line() 1
#endif
    using_history();
#else
#define rl_crlf()
#define rl_on_new_line()
#define add_history(a)
#endif

    printf("NXBrowse %s Copyright (C) 2009-2014 NeXus Data Format\n",
           NEXUS_VERSION);
#if HAVE_LIBREADLINE
    printf
    ("Built with readline support - use <TAB> to complete commands and paths\n");
#endif				/* HAVE_LIBREADLINE */

    /* if there is a filename given on the command line use that,
          else ask for a filename */
    if (argc < 2) {
        printf("Give name of NeXus file : ");
        if (fgets(fileName, sizeof(fileName), stdin) == NULL) {
            printf("Failed to open %s\n", fileName);
            return NX_ERROR;
        }
        if ((stringPtr = strchr(fileName, '\n')) != NULL)
            *stringPtr = '\0';
    } else {
        strcpy(fileName, argv[1]);
    }
    strcpy(nxFile, fileName);

    /* Open input file and output global attributes */
    if (NXopen(fileName, NXACC_READ, &the_fileId) != NX_OK) {
        printf("NX_ERROR: Can't open %s\n", fileName);
        return NX_ERROR;
    }
    PrintAttributes(the_fileId);
    iByteAsChar = 0;	/* Display remaining NX_INT8 and NX_UINT8 variables as integers by default */
    /* Input commands until the EXIT command is given */
    strcpy(oldwd, "/");
    strcpy(path, "/");
    do {
        sprintf(prompt, "NX%s> ", path);
        if (getenv("NO_READLINE") != NULL) {
            inputText = my_readline(prompt);
        } else {
            inputText = readline(prompt);
        }
        if (inputText == NULL) {
            inputText = strdup("EXIT");
        }
        if (*inputText) {
            add_history(inputText);
        }
        command = strtok(inputText, " ");
        /* Check if a command has been given */
        if (command == NULL)
            command = " ";
        /* Convert it to upper case characters */
        ConvertUpperCase(command);

        if (StrEq(command, "PWD")) {
            fprintf(rl_outstream, "%s\n", path);
        }

        if (StrEq(command, "TEST")) {
            char a[256], b[256];
            stringPtr = strtok(NULL, " ");
            if (stringPtr != NULL) {
                parsepath(stringPtr, a, b);
                fprintf(rl_outstream," you entered >%s< - i think the full path is >%s< and the final component looks like this >%s<.\n", stringPtr, a, b);
            } else {
                fprintf(rl_outstream," you entered nothing\n");
            }
        }

        /* Command is to print a directory of the current group */
        if (StrEq(command, "DIR") || StrEq(command, "LS")) {
            stringPtr = strtok(NULL, " ");
            if (stringPtr != NULL) {
                char a[256], b[256];
                parsepath(stringPtr, a, b);
                strcat(a, "/");
                strcat(a, b);
                NXopengrouppath(the_fileId, a);
                NXBdir(the_fileId);
                NXopengrouppath(the_fileId, path);
            } else {
                NXBdir(the_fileId);
            }
        }

        /* Command is to open the specified group */
        if (StrEq(command, "OPEN") || StrEq(command, "CD")) {
            stringPtr = strtok(NULL, " ");
            if (stringPtr != NULL) {
                char a[256], b[256];

                if (StrEq(stringPtr, "-")) {
                    stringPtr = oldwd;
                }

                parsepath(stringPtr, a, b);
                strcat(a, "/");
                strcat(a, b);

                status = NXopengrouppath(the_fileId, a);

                if (status == NX_OK) {
                    strcpy(oldwd, path);
                    strcpy(path, a);
                } else {
                    fprintf(rl_outstream, "NX_ERROR: cannot change into %s\n", stringPtr);
                    NXopengrouppath(the_fileId, path); /* to be sure */
                }

            } else {
                fprintf(rl_outstream, "NX_ERROR: Specify a group\n");
            }
        }

        /* Command is to dump data values to a file */
        if (StrEq(command, "DUMP")) {
            stringPtr = strtok(NULL, " ");
            if (stringPtr != NULL) {
                strcpy(dataName, stringPtr);
                stringPtr = strtok(NULL, " ");
                if (stringPtr != NULL) {
                    strcpy(fileName, stringPtr);
                    status = NXBdump(the_fileId, dataName, fileName);
                } else {
                    fprintf(rl_outstream, "NX_ERROR: Specify a dump file name \n");
                }
            } else {
                fprintf(rl_outstream, "NX_ERROR: Specify a data item\n");
            }
        }
        /* Command is to print the values of the data */
        if (StrEq(command, "READ") || StrEq(command, "CAT")) {
            stringPtr = strtok(NULL, " [");
            if (stringPtr != NULL) {
                strcpy(dataName, stringPtr);
                dimensions = strtok(NULL, "[]");
                status =
                    NXBread(the_fileId, dataName, dimensions);
            } else {
                fprintf(rl_outstream,
                        "NX_ERROR: Specify a data item\n");
            }
        }
        /* Command is to close the current group */
        if (StrEq(command, "CLOSE")) {
            if (strlen(path) > 1) {
                if (NXclosegroup(the_fileId) == NX_OK) {
                    /* Remove the group from the prompt string */
                    strcpy(oldwd, path);
                    stringPtr = strrchr(path, '/');	/* position of last group delimiter */
                    if (stringPtr != NULL)
                        *stringPtr = '\0';	/* terminate the string there */
                }
            } else {
                fprintf(rl_outstream,
                        "NX_WARNING: Already at root level of file\n");
            }
        }
        /* Command is to print help information */
        if (StrEq(command, "HELP") || StrEq(command, "INFO")) {
            printf("NXbrowse commands : DIR\n");
            printf("                    LS\n");
            printf("                    OPEN <groupName>\n");
            printf("                    CD <groupName>\n");
            printf("                    READ <dataName>\n");
            printf("                    READ <dataName>[<dimension indices...>]\n");
            printf("                    DUMP <dataName> <fileName> \n");
            printf("                    CLOSE\n");
            printf("                    BYTEASCHAR\n");
            printf("                    HELP\n");
            printf("                    EXIT\n");
            printf("\n");
#if HAVE_LIBREADLINE
            printf("Pressing <TAB> after a command or partial nexus object name will complete\n");
            printf("possible names. For example:\n");
            printf("\n");
            printf("    cd ent<TAB KEY PRESSED>     # all items starting with ent are listed\n");
            printf("\n");
#endif
        }
        /* Command is to print byte as char information */
        if (StrEq(command, "BYTEASCHAR")) {
            if (iByteAsChar == 1)
                iByteAsChar = 0;
            else
                iByteAsChar = 1;
        }
        /* Command is to exit the program */
        if (StrEq(command, "EXIT") || StrEq(command, "QUIT")) {
            /* for (i = groupLevel; i > 0; i--) NXclosegroup (the_fileId); */
            NXclose(&the_fileId);
            return NX_OK;
        }
        status = NX_OK;
        free(inputText);
    } while (status == NX_OK);
    return NX_OK;
}