예제 #1
0
void ID3V2::parse_comment_frame(FXint framesize) {
  FXString key,field;

  const FXuchar & encoding = buffer[p];
  const FXchar* textstart  = (const FXchar*)(buffer+p+4);
  const FXint   textlength = framesize - 4;

  if (encoding==UTF16_BOM || encoding==UTF16) {
    FXint ksize = strwlen(textstart,textlength);
    FXint vsize = strwlen(textstart+ksize+2,textlength-ksize-2);
    parse_text(encoding,textstart,ksize,key);
    parse_text(encoding,textstart+ksize+2,vsize,field);
    }
  else {
    FXint ksize = strnlen(textstart,textlength);
    FXint vsize = strnlen(textstart+ksize+1,textlength-ksize-1);
    parse_text(encoding,textstart,ksize,key);
    parse_text(encoding,textstart+ksize+1,vsize,field);
    }

  FXString comment = key + " " + field;
  if (comment.find("iTunSMPB")>=0) {
    comment.simplify().scan("iTunSMPB %*x %hx %hx %lx",&padstart,&padend,&length);
    GM_DEBUG_PRINT("[id3v2] found iTunSMPB (padding %d %d, length %ld)\n",padstart,padend,length);
    }
  }
예제 #2
0
void ap_parse_pls(const FXString & data,FXStringList & mrl) {
  FXint start=0,end=0,pos,next;
  for (FXint i=0;i<data.length();i++) {
    if (data[i]=='\n') {
      end=i;
      next=i+1;

      /// Skip white space
      while(start<end && Ascii::isSpace(data[start])) start++;

      /// Skip white space
      while(end>start && Ascii::isSpace(data[end])) end--;

      /// Parse the actual line.
      if ((end-start)>6) {
        if (compare(&data[start],"File",4)==0) {
          pos = data.find('=',start+4);
          if (pos==-1) continue;
          pos++;
          if (end-pos>0) {
            mrl.append(data.mid(pos,1+end-pos));
            }
          }
        }
      start=next;
      }
    }
  }
예제 #3
0
// Get frame number from filename
static FXint frameFromFilename(const FXString& file){
  FXint head=file.rfind(PATHSEP)+1;
  FXint tail=file.find('.',head);
  FXint frame=0;
  if(0<tail){
    FXint wgt=1;
    while(head<tail && Ascii::isDigit(file[tail-1])){
      frame+=wgt*Ascii::digitValue(file[--tail]); wgt*=10;
      }
    }
  return frame;
  }
예제 #4
0
/** The text entered in the command textfield is sent (enter key pressed)
  *
  *
  * \param o A parameter used for FOX callbacks
  * \param s A parameter used for FOX callbacks
  * \param v The text comming from the command textfield
  *
  * \return Always 1
  *
  */
long RainbruRPG::Gui::FtpClientWindow::
treatNewCommand(FXObject* o,FXSelector s,void* v){
  FXString str;
  str=(FX::FXchar*)v;

  FXString filename=(FX::FXchar*)v;

  // If the entered text is not empty
  if (!str.empty()){

    fxText->appendText( "> " );
    fxText->appendText( str );
    fxText->appendText( "\n" );
    
    FXTextField* a=(FXTextField*)o;
    a->setText("");


    str=str.upper();
    if (str.contains("HELP")!=0){
      if (str.contains("USER")!=0){
	showHelpUser();
      }
      else if (str.contains("PASS")!=0){
	showHelpPass();
      }
      else if (str.contains("PASV")!=0){
	showHelpPasv();
      }
      else if (str.contains("PWD")!=0){
	showHelpPwd();
      }
      else if (str.contains("LIST")!=0){
	showHelpList();
      }
      else if (str.contains("SYST")!=0){
	showHelpSyst();
      }
      else if (str.contains("BINARY")!=0){
	showHelpBinary();
      }
      else if (str.contains("ASCII")!=0){
	showHelpAscii();
      }
      else if (str.contains("STOR")!=0){
	showHelpStore();
      }
      else if (str.contains("RETR")!=0){
	showHelpRetrieve();
      }
      else{
	onHelp(NULL,0,NULL);

      }
    }
    else if (str.contains("LIST")!=0){
      string s=ftpClient->commandLIST();
      FXString str=s.c_str();
      str.substitute('\r', ' ', true );
      logMessage(str);
    }
    else if (str.contains("PASV")!=0){
      ftpClient->toggleTransferMode();
      string s=ftpClient->waitControlResponse();
      logMessage(s.c_str());
    }
    else if (str.contains("PWD")!=0){
      string s=ftpClient->commandPWD();
      logMessage(s.c_str());
    }
    else if (str.contains("SYST")!=0){
      string s=ftpClient->commandSYST();
      logMessage(s.c_str());
    }
    else if (str.contains("BINARY")!=0){
      string s=ftpClient->commandBINARY();
      logMessage(s.c_str());
    }
    else if (str.contains("ASCII")!=0){
      string s=ftpClient->commandASCII();
      logMessage(s.c_str());
    }
    else if (str.contains("STOR")!=0){
      // because str is in UPPER case
      // I get the no-upper string
      int pos = str.find("STOR", 0);
      filename.erase( pos, 5 );

      LOGCATS("Filename :");
      LOGCATS(filename.text());
      LOGCAT();

      std::string fn(filename.text());

      // Get filename
      int filesize=ftpClient->getFilesize(fn);
      labTrPb->setTotal(filesize);

      // Change transfer information
      labTransName->setText(filename);
      labTransOrie->setText("Out");
      labTransSize->setText(filesizeToString(filesize));

      string s=ftpClient->commandSTOR(fn);
      logMessage(s.c_str());
    }
    else if (str.contains("RETR")!=0){
      // because str is in UPPER case
      // I get the no-upper string
      int pos = str.find("RETR", 0);
      filename.erase( pos, 5 );

      LOGCATS("Filename :");
      LOGCATS(filename.text());
      LOGCAT();

      std::string fn(filename.text());

      // Change transfer information
      labTransName->setText(filename);
      labTransOrie->setText("In");

      string s=ftpClient->commandRETR(fn);
      logMessage(s.c_str());
    }
    else{
      logMessage("Unknown command");
    }
  }

  scrollDown();
  return 1;
}
예제 #5
0
// When BuildClassTree() is called, ctags parses all source files in the directory list.
// This routine is called by the CmdIO object, once for each line of output from ctags.
long TagParserBase::onParseAllSources(FXObject*o, FXSelector sel, void*p)
{
  const FXString* s=(const FXString*)p;
  if (FXSELTYPE(sel)==SEL_IO_EXCEPT) { return 1; }
  LocationIndex dirindex=(LocationIndex)((FXuval)((CmdIO*)o)->getUserData());
  FXString ancestor=FXString::null;
  FXString scopename=FXString::null;
  FXint linenum=ExtractLineNumber(s);
  FXchar kind=s->section('\t', 3)[0];
  FXString tagname=s->section('\t',0);
  FXString filename=s->section('\t',1);
  if (current_filename!=filename) {
    current_filename=filename;
    dirs[dirindex]->append(filename);
  }
  const FXchar ext=Ascii::toLower(FXPath::extension(filename)[0]);

  if ( (kind=='n') ) {
    if (ext=='c') { return 1; } // namespaces are only interesting if they are in a public header
  }
  for (FXint i=4; i<=s->contains('\t'); i++) {
    const FXString sect=s->section('\t', i);
    if (sect.find(':')>0) {
      const FXString key=sect.section(':',0);
      if ((kind=='s')&&(key=="access")) {  // ignore structs defined inside a class
        return 1;
      } else if ((kind=='f')&&((key=="class")||(key=="namespace"))) {
        scopename=sect.section(':',1,1024);
        StripNamespace(scopename);
      } else if (key=="inherits") {
        ancestor=sect.section(':',1);
        if (ancestor.find(',')>0) {
          ancestor=ancestor.section(',',0);  // can't do multiple inheritence
        }
        StripNamespace(ancestor);
      }
    }
  }
  switch (kind) {
    case 'c':
    case 'n':    
    case 's': {
      tag_info_list->append(kind, tagname, ancestor, dirindex, dirs[dirindex]->no()-1, linenum);
      break;
    }
    default: {
      FXString* entry = new FXString();
      entry->format(
        "%c\t%s%s%s\t%d",
        kind,
        scopename.text(),
        scopename.empty()?"":"::",
        tagname.text(),
        linenum
      );
      dirs[dirindex]->tail()->append(entry);
      break;
    }
  }
  return 1;
}