natives.h
Go to the documentation of this file.
00001 /*
00002         Aseba - an event-based framework for distributed robot control
00003         Copyright (C) 2007--2012:
00004                 Stephane Magnenat <stephane at magnenat dot net>
00005                 (http://stephane.magnenat.net)
00006                 and other contributors, see authors.txt for details
00007         
00008         This program is free software: you can redistribute it and/or modify
00009         it under the terms of the GNU Lesser General Public License as published
00010         by the Free Software Foundation, version 3 of the License.
00011         
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU Lesser General Public License for more details.
00016         
00017         You should have received a copy of the GNU Lesser General Public License
00018         along with this program. If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef __ASEBA_NATIVES_H
00022 #define __ASEBA_NATIVES_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #include "../common/types.h"
00029 #include "vm.h"
00030 
00031 #ifdef _MSC_VER
00032 #pragma warning( disable: 4200) // disable 0 size arrays warning
00033 #define inline __inline                 // msvc does not support the standart C99/C++ static inline construct
00034 #endif
00035 
00043 
00044 // data structures
00045 
00047 typedef struct
00048 {
00049         uint16 size;                    
00050         const char* name;               
00051 } AsebaVariableDescription;
00052 
00054 typedef struct
00055 {
00056         const char* name;               
00057         AsebaVariableDescription variables[];   
00058 } AsebaVMDescription;
00059 
00061 typedef struct
00062 {
00063         const char* name;       
00064         const char* doc;        
00065 } AsebaLocalEventDescription;
00066 
00068 typedef void (*AsebaNativeFunctionPointer)(AsebaVMState *vm);
00069 
00071 typedef struct
00072 {
00073         sint16 size;            
00074         const char* name;       
00075 } AsebaNativeFunctionArgumentDescription;
00076 
00078 typedef struct 
00079 {
00080         const char* name;       
00081         const char* doc;        
00082         AsebaNativeFunctionArgumentDescription arguments[];     
00083 } AsebaNativeFunctionDescription;
00084 
00085 // support functions
00086 
00088 static inline sint16 AsebaNativePopArg(AsebaVMState *vm)
00089 {
00090         return vm->stack[vm->sp--];
00091 }
00092 
00093 // standard natives functions
00094 
00096 void AsebaNative_veccopy(AsebaVMState *vm);
00098 extern const AsebaNativeFunctionDescription AsebaNativeDescription_veccopy;
00099 
00101 void AsebaNative_vecfill(AsebaVMState *vm);
00103 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecfill;
00104 
00106 void AsebaNative_vecaddscalar(AsebaVMState *vm);
00108 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecaddscalar;
00109 
00111 void AsebaNative_vecadd(AsebaVMState *vm);
00113 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecadd;
00114 
00116 void AsebaNative_vecsub(AsebaVMState *vm);
00118 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecsub;
00119 
00121 void AsebaNative_vecmul(AsebaVMState *vm);
00123 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecmul;
00124 
00126 void AsebaNative_vecdiv(AsebaVMState *vm);
00128 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecdiv;
00129 
00131 void AsebaNative_vecmin(AsebaVMState *vm);
00133 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecmin;
00134 
00136 void AsebaNative_vecmax(AsebaVMState *vm);
00138 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecmax;
00139 
00141 void AsebaNative_vecdot(AsebaVMState *vm);
00143 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecdot;
00144 
00146 void AsebaNative_vecstat(AsebaVMState *vm);
00148 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecstat;
00149 
00151 void AsebaNative_vecargbounds(AsebaVMState *vm);
00153 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecargbounds;
00154 
00156 void AsebaNative_vecsort(AsebaVMState *vm);
00158 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecsort;
00159 
00161 void AsebaNative_mathmuldiv(AsebaVMState *vm);
00163 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathmuldiv;
00164 
00166 void AsebaNative_mathatan2(AsebaVMState *vm);
00168 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathatan2;
00169 
00171 void AsebaNative_mathsin(AsebaVMState *vm);
00173 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathsin;
00174 
00176 void AsebaNative_mathcos(AsebaVMState *vm);
00178 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathcos;
00179 
00181 void AsebaNative_mathrot2(AsebaVMState *vm);
00183 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathrot2;
00184 
00186 void AsebaNative_mathsqrt(AsebaVMState *vm);
00188 extern const AsebaNativeFunctionDescription AsebaNativeDescription_mathsqrt;
00189 
00191 void AsebaNative_vecnonzerosequence(AsebaVMState *vm);
00193 extern const AsebaNativeFunctionDescription AsebaNativeDescription_vecnonzerosequence;
00194 
00196 void AsebaSetRandomSeed(uint16 seed);
00198 uint16 AsebaGetRandom();
00200 void AsebaNative_rand(AsebaVMState *vm);
00202 extern const AsebaNativeFunctionDescription AsebaNativeDescription_rand;
00203 
00205 #define ASEBA_NATIVES_STD_COUNT 21
00206 
00208 #define ASEBA_NATIVES_STD_FUNCTIONS \
00209         AsebaNative_veccopy, \
00210         AsebaNative_vecfill, \
00211         AsebaNative_vecaddscalar, \
00212         AsebaNative_vecadd, \
00213         AsebaNative_vecsub, \
00214         AsebaNative_vecmul, \
00215         AsebaNative_vecdiv, \
00216         AsebaNative_vecmin, \
00217         AsebaNative_vecmax, \
00218         AsebaNative_vecdot, \
00219         AsebaNative_vecstat, \
00220         AsebaNative_vecargbounds, \
00221         AsebaNative_vecsort, \
00222         AsebaNative_mathmuldiv, \
00223         AsebaNative_mathatan2, \
00224         AsebaNative_mathsin, \
00225         AsebaNative_mathcos, \
00226         AsebaNative_mathrot2, \
00227         AsebaNative_mathsqrt, \
00228         AsebaNative_vecnonzerosequence, \
00229         AsebaNative_rand
00230 
00232 #define ASEBA_NATIVES_STD_DESCRIPTIONS \
00233         &AsebaNativeDescription_veccopy, \
00234         &AsebaNativeDescription_vecfill, \
00235         &AsebaNativeDescription_vecaddscalar, \
00236         &AsebaNativeDescription_vecadd, \
00237         &AsebaNativeDescription_vecsub, \
00238         &AsebaNativeDescription_vecmul, \
00239         &AsebaNativeDescription_vecdiv, \
00240         &AsebaNativeDescription_vecmin, \
00241         &AsebaNativeDescription_vecmax, \
00242         &AsebaNativeDescription_vecdot, \
00243         &AsebaNativeDescription_vecstat, \
00244         &AsebaNativeDescription_vecargbounds, \
00245         &AsebaNativeDescription_vecsort, \
00246         &AsebaNativeDescription_mathmuldiv, \
00247         &AsebaNativeDescription_mathatan2, \
00248         &AsebaNativeDescription_mathsin, \
00249         &AsebaNativeDescription_mathcos, \
00250         &AsebaNativeDescription_mathrot2, \
00251         &AsebaNativeDescription_mathsqrt, \
00252         &AsebaNativeDescription_vecnonzerosequence, \
00253         &AsebaNativeDescription_rand
00254 
00257 #ifdef __cplusplus
00258 } /* closing brace for extern "C" */
00259 #endif
00260 
00261 #endif


aseba
Author(s): Stéphane Magnenat
autogenerated on Thu Jan 2 2014 11:17:16