C++ Library for the PsiSwarm Robot - Version 0.8
Dependents: PsiSwarm_V8_Blank_CPP Autonomia_RndmWlk
Fork of PsiSwarmV7_CPP by
basic.cpp
00001 /* University of York Robotics Laboratory PsiSwarm Library: Psi-BASIC Interpretter Code 00002 * 00003 * Copyright 2016 University of York 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 00007 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS 00008 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00009 * See the License for the specific language governing permissions and limitations under the License. 00010 * 00011 * File: basic.cpp 00012 * 00013 * Dept. Electronics & Computer Science, University of York 00014 * James Hilder, Alexander Horsfield, Alan Millard, Homero Elizondo, Jon Timmis 00015 * 00016 * PsiSwarm Library Version: 0.8 00017 * 00018 * October 2016 00019 * 00020 */ 00021 00022 #include "psiswarm.h" 00023 00024 LocalFileSystem local("local"); 00025 00026 void Basic::read_list_of_file_names() 00027 { 00028 DIR *dp; 00029 struct dirent *dirp; 00030 dp = opendir("/local"); 00031 if(dp == NULL) pc.printf("- File handling error: Failed to open directory\n"); 00032 psi.debug("- Reading FLASH storage for PsiBasic files\n"); 00033 //read all files in MBED root directory and add matching file names in current directory into filename vector 00034 while((dirp = readdir(dp)) != NULL) { 00035 string filename = (string) dirp->d_name; 00036 if (filename.compare(filename.size()-4,4,".PSI") == 0) 00037 { 00038 psi_basic_file_count ++ ; 00039 psi.debug("- Found file: %s\n",filename.c_str()); 00040 basic_filenames.push_back(filename); 00041 } 00042 } 00043 closedir(dp); 00044 } 00045
Generated on Tue Jul 12 2022 21:11:24 by 1.7.2