home *** CD-ROM | disk | FTP | other *** search
- //StrToLong by Jason Toffaletti email: catalyst@kagi.com
- //A simple realbasic plugin for learning by example.
- //Thanks to Ecky, Nick, Kevin, James, and Einhuger for help with learning C.
- //http://catalyst.hypermart.net for other software by Jason and Ryan.
-
- #include "rb_plugin.h"
- #include <math.h> //Also need to include MathLib in the project.
-
- void PluginEntry(void);
-
- static double StrToLong(REALstring str)
- {
- int x=3;
- double temp=0;
- while (x != -1) {
- temp = temp + ( pow(256,(4-(x+1))) * REALCString(str)[x] ); //pow is defined in math.h
- x--;
- }
- return temp;
- }
-
- //Everything after this is to register the function with REALBasic.
-
- REALexport pluginExports[] = {
- { nil, StrToLong}
- };
-
- short pluginExportCode = sizeof(pluginExports) / sizeof(REALexport);
-
- REALmethodDefinition StrToLongdefn = {
- 0,
- "StrToLong(thestr as string) as double"
- };
-
- void PluginEntry(void)
- {
- REALRegisterMethod(&StrToLongdefn);
- }
-