亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? worldfile.cc

?? 一個機器人平臺
?? CC
?? 第 1 頁 / 共 3 頁
字號:
/* *  Stage : a multi-robot simulator. *  Copyright (C) 2001, 2002 Richard Vaughan, Andrew Howard and Brian Gerkey. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* * Desc: A class for reading in the world file. * Authors: Andrew Howard <ahoward@usc.edu> *          Richard Vaughan <vaughan@hrl.com> *          Douglas S. Blank <dblank@brynmawr.edu> * * Date: 15 Nov 2001 * CVS info: $Id: worldfile.cc,v 1.25.4.1 2003/04/17 23:40:10 rtv Exp $ */#include <assert.h>#include <ctype.h>#include <errno.h>#include <limits.h> // for PATH_MAX#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>//#define DEBUG#include "replace.h" // for dirname(3)#include "stage_types.hh"#include "colors.hh"#include "worldfile.hh"// the isblank() macro is not standard - it's a GNU extension// and it doesn't work for me, so here's an implementation - rtv#ifndef isblank#define isblank(a) (a == ' ' || a == '\t')#endif///////////////////////////////////////////////////////////////////////////// Useful macros for dumping parser errors#define TOKEN_ERR(z, l) \  PRINT_ERR2("%s:%d : " z, this->filename, l)#define PARSE_ERR(z, l) \  PRINT_ERR2("%s:%d : " z, this->filename, l)///////////////////////////////////////////////////////////////////////////// Default constructorCWorldFile::CWorldFile() {  this->filename = NULL;  this->token_size = 0;  this->token_count = 0;  this->tokens = NULL;  this->macro_count = 0;  this->macro_size = 0;  this->macros = NULL;  this->entity_count = 0;  this->entity_size = 0;  this->entities = NULL;  this->property_count = 0;  this->property_size = 0;  this->properties = NULL;  // Set defaults units  this->unit_length = 1.0;  this->unit_angle = M_PI / 180;}///////////////////////////////////////////////////////////////////////////// DestructorCWorldFile::~CWorldFile(){  ClearProperties();  ClearMacros();  ClearEntities();  ClearTokens();  if (this->filename)    free(this->filename);}FILE *CWorldFile::FileOpen(const char *filename, const char* method){   FILE *fp = fopen(filename, method);   // if this opens, then we will go with it:   if (fp) {     PRINT_DEBUG1( "Loading: %s", filename);     return fp;   }   // else, search other places, and set this->filename   // accordingly if found:   char *stagepath = getenv("STAGEPATH");   char *token = strtok(stagepath, ":");   char *fullpath = (char*) malloc(PATH_MAX);   char *tmp = strdup(filename);   char *base = basename(tmp);   while (token != NULL) {     // for each part of the path, try it:     memset( fullpath, 0, PATH_MAX);     strcat( fullpath, token);     strcat( fullpath, "/" );     strcat( fullpath, base);     assert(strlen(fullpath) + 1 < PATH_MAX);     fp = fopen(fullpath, method);     if (fp) {       this->filename = fullpath;       PRINT_DEBUG1( "Loading: %s", filename);       free(tmp);       return fp;     }     token = strtok(NULL, ":");   }   free(tmp);   return NULL;}///////////////////////////////////////////////////////////////////////////// Load world from filebool CWorldFile::Load(const char *filename){  // Shouldnt call load more than once,  // so this should be null.  assert(this->filename == NULL);  this->filename = strdup(filename);  // Open the file  //FILE *file = fopen(this->filename, "r");  FILE *file = FileOpen(this->filename, "r");  if (!file)  {    PRINT_ERR2("unable to open world file %s : %s",               this->filename, strerror(errno));    return false;  }  ClearTokens();    // Read tokens from the file  if (!LoadTokens(file, 0))  {    //DumpTokens();    return false;  }  // Parse the tokens to identify entities  if (!ParseTokens())  {    //DumpTokens();    return false;  }  // Dump contents and exit if this file is meant for debugging only.  if (ReadInt(0, "test", 0) != 0)  {    PRINT_ERR("this is a test file; quitting");    DumpTokens();    DumpMacros();    DumpEntities();    DumpProperties();    return false;  }    // Work out what the length units are  const char *unit = ReadString(0, "unit_length", "m");  if (strcmp(unit, "m") == 0)    this->unit_length = 1.0;  else if (strcmp(unit, "cm") == 0)    this->unit_length = 0.01;  else if (strcmp(unit, "mm") == 0)    this->unit_length = 0.001;  // Work out what the angle units are  unit = ReadString(0, "unit_angle", "degrees");  if (strcmp(unit, "degrees") == 0)    this->unit_angle = M_PI / 180;  else if (strcmp(unit, "radians") == 0)    this->unit_angle = 1;    return true;}///////////////////////////////////////////////////////////////////////////// Save world to filebool CWorldFile::Save(const char *filename){  // Debugging  //DumpProperties();    // If no filename is supplied, use default  if (!filename)    filename = this->filename;  // Open file  //FILE *file = fopen(filename, "w+");  FILE *file = FileOpen(filename, "w+");  if (!file)  {    PRINT_ERR2("unable to open world file %s : %s",               filename, strerror(errno));    return false;  }  // Write the current set of tokens to the file  if (!SaveTokens(file))  {    fclose(file);    return false;  }  fclose(file);  return true;}///////////////////////////////////////////////////////////////////////////// Check for unused properties and print warningsbool CWorldFile::WarnUnused(){  bool unused = false;  for (int i = 0; i < this->property_count; i++)  {    CProperty *property = this->properties + i;    if (!property->used)    {      unused = true;      PRINT_WARN3("worldfile %s:%d : property [%s] is defined but not used",                  this->filename, property->line, property->name);    }  }  return unused;}///////////////////////////////////////////////////////////////////////////// Load tokens from a file.bool CWorldFile::LoadTokens(FILE *file, int include){  int ch;  int line;  char token[256];    line = 1;  while (true)  {    ch = fgetc(file);    if (ch == EOF)      break;        if ((char) ch == '#')    {      ungetc(ch, file);      if (!LoadTokenComment(file, &line, include))        return false;    }    else if (isalpha(ch))    {      ungetc(ch, file);      if (!LoadTokenWord(file, &line, include))        return false;    }    else if (strchr("+-.0123456789", ch))    {      ungetc(ch, file);      if (!LoadTokenNum(file, &line, include))        return false;    }    else if (isblank(ch))    {      ungetc(ch, file);      if (!LoadTokenSpace(file, &line, include))        return false;    }    else if (ch == '"')    {      ungetc(ch, file);      if (!LoadTokenString(file, &line, include))        return false;    }    else if (strchr("(", ch))    {      token[0] = ch;      token[1] = 0;      AddToken(TokenOpenEntity, token, include);    }    else if (strchr(")", ch))    {      token[0] = ch;      token[1] = 0;      AddToken(TokenCloseEntity, token, include);    }    else if (strchr("[", ch))    {      token[0] = ch;      token[1] = 0;      AddToken(TokenOpenTuple, token, include);    }    else if (strchr("]", ch))    {      token[0] = ch;      token[1] = 0;      AddToken(TokenCloseTuple, token, include);    }    else if (ch == '\n')    {      line++;      AddToken(TokenEOL, "\n", include);    }    else    {      TOKEN_ERR("syntax error", line);      return false;    }  }  return true;}///////////////////////////////////////////////////////////////////////////// Read in a comment tokenbool CWorldFile::LoadTokenComment(FILE *file, int *line, int include){  char token[256];  int len;  int ch;  len = 0;  memset(token, 0, sizeof(token));    while (true)  {    ch = fgetc(file);    if (ch == EOF)    {      AddToken(TokenComment, token, include);      return true;    }    else if (ch == '\n')    {      ungetc(ch, file);      AddToken(TokenComment, token, include);      return true;    }    else      token[len++] = ch;  }  return true;}///////////////////////////////////////////////////////////////////////////// Read in a word tokenbool CWorldFile::LoadTokenWord(FILE *file, int *line, int include){  char token[256];  int len;  int ch;    len = 0;  memset(token, 0, sizeof(token));    while (true)  {    ch = fgetc(file);    if (ch == EOF)    {      AddToken(TokenWord, token, include);      return true;    }    else if (isalpha(ch) || isdigit(ch) || strchr(".-_[]", ch))    {      token[len++] = ch;    }    else    {      if (strcmp(token, "include") == 0)      {        ungetc(ch, file);        AddToken(TokenWord, token, include);        if (!LoadTokenInclude(file, line, include))          return false;      }      else      {        ungetc(ch, file);        AddToken(TokenWord, token, include);      }      return true;    }  }  assert(false);  return false;}///////////////////////////////////////////////////////////////////////////// Load an include token; this will load the include file.bool CWorldFile::LoadTokenInclude(FILE *file, int *line, int include){  int ch;  const char *filename;  char *fullpath;  ch = fgetc(file);  if (ch == EOF)  {    TOKEN_ERR("incomplete include statement", *line);    return false;  }  else if (!isblank(ch))  {    TOKEN_ERR("syntax error in include statement", *line);    return false;  }  ungetc(ch, file);  if (!LoadTokenSpace(file, line, include))    return false;  ch = fgetc(file);    if (ch == EOF)  {    TOKEN_ERR("incomplete include statement", *line);    return false;  }  else if (ch != '"')  {    TOKEN_ERR("syntax error in include statement", *line);    return false;  }  ungetc(ch, file);  if (!LoadTokenString(file, line, include))    return false;  // This is the basic filename  filename = GetTokenValue(this->token_count - 1);  // Now do some manipulation.  If its a relative path,  // we append the path of the world file.  if (filename[0] == '/' || filename[0] == '~')  {    fullpath = strdup(filename);  }  else if (this->filename[0] == '/' || this->filename[0] == '~')  {    // Note that dirname() modifies the contents, so    // we need to make a copy of the filename.    // There's no bounds-checking, but what the heck.    char *tmp = strdup(this->filename);    fullpath = (char*) malloc(PATH_MAX);    memset(fullpath, 0, PATH_MAX);    strcat( fullpath, dirname(tmp));    strcat( fullpath, "/" );     strcat( fullpath, filename );    assert(strlen(fullpath) + 1 < PATH_MAX);    free(tmp);  }  else  {    // Note that dirname() modifies the contents, so    // we need to make a copy of the filename.    // There's no bounds-checking, but what the heck.    char *tmp = strdup(this->filename);    fullpath = (char*) malloc(PATH_MAX);    getcwd(fullpath, PATH_MAX);    strcat( fullpath, "/" );     strcat( fullpath, dirname(tmp));    strcat( fullpath, "/" );     strcat( fullpath, filename );    assert(strlen(fullpath) + 1 < PATH_MAX);    free(tmp);  }  printf( "[Include %s]", filename );  fflush( stdout );  // Open the include file  FILE *infile = FileOpen(fullpath, "r");  if (!infile)  {    PRINT_ERR2("unable to open include file %s : %s",               fullpath, strerror(errno));    free(fullpath);    return false;  }  // Terminate the include line  AddToken(TokenEOL, "\n", include);        // Read tokens from the file  if (!LoadTokens(infile, include + 1))  {    //DumpTokens();    free(fullpath);    return false;  }  free(fullpath);  return true;}///////////////////////////////////////////////////////////////////////////// Read in a number tokenbool CWorldFile::LoadTokenNum(FILE *file, int *line, int include){  char token[256];  int len;  int ch;    len = 0;  memset(token, 0, sizeof(token));    while (true)  {    ch = fgetc(file);    if (ch == EOF)    {      AddToken(TokenNum, token, include);      return true;    }    else if (strchr("+-.0123456789", ch))    {      token[len++] = ch;    }    else    {      AddToken(TokenNum, token, include);      ungetc(ch, file);      return true;    }  }  assert(false);  return false;}///////////////////////////////////////////////////////////////////////////// Read in a string tokenbool CWorldFile::LoadTokenString(FILE *file, int *line, int include){

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久久蜜臀图片| 国产一区二区福利| 欧洲在线/亚洲| 亚洲美女视频在线观看| 一本高清dvd不卡在线观看| 亚洲女同ⅹxx女同tv| 91久久奴性调教| 天天影视网天天综合色在线播放| 欧美欧美午夜aⅴ在线观看| 日韩不卡一区二区| 精品精品国产高清a毛片牛牛| 国产专区欧美精品| 国产欧美精品在线观看| 国产成人精品免费在线| 亚洲色图.com| 欧美日韩不卡在线| 国模大尺度一区二区三区| 国产精品网站导航| 色悠久久久久综合欧美99| 亚洲va国产va欧美va观看| 日韩欧美亚洲国产另类| 国产成人免费在线| 亚洲精品国产高清久久伦理二区| 欧美日韩激情一区二区| 国产一区二区三区最好精华液| 国产精品萝li| 欧美精品丝袜久久久中文字幕| 韩国三级中文字幕hd久久精品| 国产精品伦一区二区三级视频| 欧美中文字幕久久| 蜜桃av一区二区在线观看 | 婷婷六月综合网| 亚洲精品一区二区三区在线观看| 成人动漫中文字幕| 午夜一区二区三区在线观看| 久久嫩草精品久久久精品| 精品国产网站在线观看| av亚洲产国偷v产偷v自拍| 亚洲成人免费观看| 国产欧美一区二区精品久导航 | 91蜜桃免费观看视频| 蜜臀国产一区二区三区在线播放 | 日韩一卡二卡三卡| 97精品电影院| 美女网站一区二区| 亚洲一区日韩精品中文字幕| 久久男人中文字幕资源站| 欧美人动与zoxxxx乱| 99免费精品在线| 国产伦精品一区二区三区在线观看| 一区二区三区在线视频观看58| 久久婷婷色综合| 欧美一区二区在线视频| 91美女福利视频| 盗摄精品av一区二区三区| 午夜激情久久久| 一卡二卡三卡日韩欧美| 中文字幕成人在线观看| 久久综合九色综合欧美亚洲| 欧美午夜宅男影院| 色综合久久中文字幕综合网| 国产美女在线精品| 久久国产乱子精品免费女| 亚洲成a人片综合在线| 亚洲免费观看在线观看| 国产精品网曝门| 国产视频911| 欧美大片一区二区| 欧美日韩国产综合视频在线观看| 99久久免费精品| 成人小视频免费观看| 国产精品一区二区你懂的| 美女免费视频一区| 水蜜桃久久夜色精品一区的特点| 亚洲综合男人的天堂| 亚洲人妖av一区二区| 自拍av一区二区三区| 国产精品久线在线观看| 国产精品伦理一区二区| 欧美国产日韩a欧美在线观看| 久久在线观看免费| 久久久久久免费网| 国产偷国产偷精品高清尤物| 久久精品夜色噜噜亚洲a∨| 26uuu精品一区二区在线观看| 日韩免费看网站| 精品国产一二三区| 久久―日本道色综合久久| 久久亚洲一级片| 国产亚洲视频系列| 中文成人av在线| 136国产福利精品导航| 亚洲欧洲中文日韩久久av乱码| 日韩伦理av电影| 一区二区久久久久久| 亚洲影视在线观看| 婷婷综合五月天| 韩国三级在线一区| 成人美女视频在线看| av在线播放不卡| 色天天综合色天天久久| 欧美日韩综合在线免费观看| 制服丝袜av成人在线看| 久久新电视剧免费观看| 国产精品超碰97尤物18| 亚洲国产aⅴ成人精品无吗| 午夜成人免费视频| 国产一区在线观看麻豆| 成人毛片视频在线观看| 欧美最新大片在线看 | 福利一区在线观看| 96av麻豆蜜桃一区二区| 欧美精品粉嫩高潮一区二区| 精品国产青草久久久久福利| 国产精品毛片久久久久久| 亚洲综合色噜噜狠狠| 激情另类小说区图片区视频区| 岛国精品在线播放| 欧美日韩国产另类一区| 久久久久国产一区二区三区四区| 亚洲日本在线观看| 日本91福利区| 波多野结衣中文一区| 欧美一区二区三区日韩| 国产精品国产精品国产专区不片| 亚洲第一激情av| 国产成人免费高清| 欧美区视频在线观看| 国产精品不卡在线| 另类专区欧美蜜桃臀第一页| 99久久777色| 亚洲精品一区二区三区四区高清 | 国产高清无密码一区二区三区| 日本韩国欧美在线| 久久久久久一二三区| 午夜精品123| 99九九99九九九视频精品| 欧美一级日韩不卡播放免费| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 日韩和的一区二区| 97国产一区二区| 久久久久高清精品| 奇米777欧美一区二区| 色999日韩国产欧美一区二区| 久久人人超碰精品| 午夜精品福利视频网站| 99久久99久久精品免费观看| 久久先锋影音av鲁色资源| 日韩电影一区二区三区四区| 色狠狠桃花综合| 中文字幕五月欧美| 国产盗摄精品一区二区三区在线| 91麻豆精品国产综合久久久久久| 亚洲精品免费视频| 99久久综合狠狠综合久久| 久久久久久久电影| 久久99九九99精品| 欧美一级高清大全免费观看| 亚洲成av人片在线观看无码| 91毛片在线观看| 亚洲欧美在线观看| 成人久久久精品乱码一区二区三区| 精品不卡在线视频| 老汉av免费一区二区三区| 5月丁香婷婷综合| 婷婷六月综合亚洲| 欧美日本一区二区三区四区| 亚洲电影在线免费观看| 在线免费观看成人短视频| 亚洲男女一区二区三区| 99精品国产99久久久久久白柏 | 欧美日本免费一区二区三区| 一区二区三区在线观看动漫| 色综合视频一区二区三区高清| 综合欧美一区二区三区| 91一区一区三区| 亚洲精品国产一区二区精华液| 色欧美88888久久久久久影院| 亚洲视频在线观看三级| 色婷婷av一区二区三区gif| 亚洲制服欧美中文字幕中文字幕| 色菇凉天天综合网| 亚洲高清中文字幕| 91精品国产欧美一区二区成人| 免费观看在线综合色| 精品播放一区二区| 成人深夜在线观看| 日韩一区在线播放| 欧美性猛交xxxxxx富婆| 视频一区欧美精品| 精品日韩欧美在线| 懂色av噜噜一区二区三区av| 中文字幕一区不卡| 欧美日韩免费观看一区三区| 奇米色777欧美一区二区| 久久综合中文字幕| 99国产精品一区| 五月天亚洲婷婷| 欧美精品一区二区三区蜜臀| 丁香婷婷综合五月|