⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch19p2_tokenizertester.cpp

📁 游戏开发特殊技巧-special.effects.game.programming
💻 CPP
字号:
// Ch19p2_TokenizerTester.cpp : Defines the entry point for the console application.
//
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <conio.h>

#include "Ch19p1_ParticleEmitterTokenizer.h"

int main(int argc, char* argv[])
{
  if (argc < 2) {
    printf("usage: Ch19p2_TokenizerTester <scriptname>");
    return(-1);
  }

  int handle = open(argv[1], O_RDONLY | O_BINARY);
  if (handle == -1) { printf("can't open input file"); return(-2); }

  int len = filelength(handle);

  char *strScript = new char[len+1];

  memset(strScript, 0, len+1);
  read(handle, strScript, len);
  close(handle);
  printf("Input Script: \n%s\n\n", strScript);


  CParticleEmitterTokenizer tokenizer;

  printf("=====[ Tokens: ] ============================================\n");
  
  tokenizer.Tokenize(strScript);
  
  for (std::vector<CParticleEmitterToken>::iterator i = tokenizer.m_TokenVector.begin(); i != tokenizer.m_TokenVector.end(); i++) {
    CParticleEmitterToken &token = (*i);
    printf("Token - type: %20s, value: %s\n", token.TypeAsString().c_str(), token.m_strValue.c_str());

    
  }

	
  delete[] strScript;

  getch();

	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -