PsiSwarm Library  0.8
basic.cpp
1 /* University of York Robotics Laboratory PsiSwarm Library: Psi-BASIC Interpretter Code
2  *
3  * Copyright 2016 University of York
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
7  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS
8  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9  * See the License for the specific language governing permissions and limitations under the License.
10  *
11  * File: basic.cpp
12  *
13  * Dept. Electronics & Computer Science, University of York
14  * James Hilder, Alexander Horsfield, Alan Millard, Homero Elizondo, Jon Timmis
15  *
16  * PsiSwarm Library Version: 0.8
17  *
18  * October 2016
19  *
20  */
21 
22  #include "psiswarm.h"
23 
24  LocalFileSystem local("local");
25 
27  {
28  DIR *dp;
29  struct dirent *dirp;
30  dp = opendir("/local");
31  if(dp == NULL) pc.printf("- File handling error: Failed to open directory\n");
32  psi.debug("- Reading FLASH storage for PsiBasic files\n");
33  //read all files in MBED root directory and add matching file names in current directory into filename vector
34  while((dirp = readdir(dp)) != NULL) {
35  string filename = (string) dirp->d_name;
36  if (filename.compare(filename.size()-4,4,".PSI") == 0)
37  {
38  psi_basic_file_count ++ ;
39  psi.debug("- Found file: %s\n",filename.c_str());
40  basic_filenames.push_back(filename);
41  }
42  }
43  closedir(dp);
44  }
45 
void read_list_of_file_names(void)
Definition: basic.cpp:26
void debug(const char *format,...)
Definition: psiswarm.cpp:325