|
Joined: 21 Sep 2006, 02:31 Posts: 3
|
 Palm SDK Developer Suite Help! How do I create an app?
Hello Everyone
I am new to this board and actually kinda new to palm got my first one almost a year ago and found out what exactly I had been missing. I recently found out that the palm os was programmed in C/C++ and that there were development kits avaiable for free to allow programmers to design their own applications, of course I was interested but I have no experience in this area.
So I have come to the experts to ask if any one of you could help me figure out how to put code that I have have/found/written in C/C++ on the palm in application for using the new developer suite. For example I would love to put the code shown below on my palm as an app, but don't know how. Can any of you guys help me with this.
#include <iostream.h>
#include <time.h>
#include <math.h>
#include <iomanip.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <string.h>
#include <fstream.h>
const int MAX_COUNT1 = 100;
const int MAX_COUNT2 = 100;
void When_Case_STMT_Gen (int BIT_NUMBER, int Select_Statement_Type1, int NUMBER_OF_STMTS, int STARTING_AT, ofstream& out_file)
{
int BIT_WIDTH_VA, CURRENT_NUMBER, CURRENT_NUMBER1, a,b,c,d, POW_CON;
int BINARY_NUMBER_ARRAY[MAX_COUNT1][MAX_COUNT2];
CURRENT_NUMBER = STARTING_AT;
CURRENT_NUMBER1 = STARTING_AT;
for ( a = 0; a < NUMBER_OF_STMTS + 1; a++ )
{
BIT_WIDTH_VA = BIT_NUMBER - 1;
for ( b = 0; b < BIT_NUMBER ; b++ )
{
POW_CON = (int) pow(2, (double) BIT_WIDTH_VA);
if ( POW_CON > CURRENT_NUMBER )
{
BINARY_NUMBER_ARRAY[a][BIT_WIDTH_VA] = 0;
}
else if ( POW_CON < CURRENT_NUMBER || POW_CON == CURRENT_NUMBER)
{
CURRENT_NUMBER = CURRENT_NUMBER - (int) pow(2,(double) BIT_WIDTH_VA);
BINARY_NUMBER_ARRAY[a][BIT_WIDTH_VA] = 1;
}
//out_file<<BINARY_NUMBER_ARRAY[m][BIT_WIDTH_VA]<<\" M IS \" <<m<< \" BIT_WIDTH_VA is \"<< BIT_WIDTH_VA<<\" (int) pow(2,(double) is \"<< POW_CON <<\" AND CURRENT # IS \"<<CURRENT_NUMBER<<endl;
BIT_WIDTH_VA = BIT_WIDTH_VA - 1;
}
CURRENT_NUMBER1 = CURRENT_NUMBER1 + 1;
CURRENT_NUMBER = CURRENT_NUMBER1;
}
if ( Select_Statement_Type1 == 1 )
{
out_file<< \" case SELECT is \\n\";
out_file<<endl;
for ( c = 0; c < NUMBER_OF_STMTS; c++)
{
out_file<<\" when '\";
for ( d = BIT_NUMBER - 1; d >= 0; d--)
{
if ( d == 0 )
{
out_file<<BINARY_NUMBER_ARRAY[c][d]<<\"' => \\n\";
out_file<<\" Variable <= '????';\\n\";
}
else
{
out_file<<BINARY_NUMBER_ARRAY[c][d];
}
}
}
out_file<<\" when OTHERS => \\n\";
out_file<<\" Variable <= ZZZZZ;\";
out_file<<\"end case;\\n\";
}
else if ( Select_Statement_Type1 == 2 )
{
out_file<< \" with SELECT is \\n\";
out_file<<endl;
out_file<<\"SIGNAL\";
for ( c =0; c < NUMBER_OF_STMTS; c++)
{
out_file<<\" <= VALUE when '\";
for ( d = BIT_NUMBER -1; d >= 0; d--)
{
if ( d == 0 )
{
out_file<<BINARY_NUMBER_ARRAY[c][d]<<\"' , \\n\";
}
else
{
out_file<<BINARY_NUMBER_ARRAY[c][d];
}
}
}
out_file <<\" <= 'ZZZZZZ' when OTHERS;\\n \";
}
return ;
}
int i;
void IF_STMT_GEN (int IF_COUNT, ofstream& out_file )
{
out_file << \" if ( expression ) then \\n\";
out_file<<endl;
out_file<<\" SIGNAL <= \"<<\"????;\";
out_file<<endl;
for ( i = 0; i<= IF_COUNT; i++)
{
out_file << \" else if ( expression ) then \\n\";
out_file <<endl;
out_file<<\" SIGNAL <= \"<<\"????;\";
out_file<<endl;
}
out_file<<\" end if; \";
return ;
}
int main()
{
// The number 12 represents the CHECK_BIT VALUE.
const int MAX_COUNT = 100;
int i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, DATA_LENGTH, DATA_COUNTER, CB_COUNTER, a, z, b,c, d, e;
int DATA_WIDTH, CHECK_BIT_COUNT, CODE_WIDTH, VALUE, CHECK_BIT_COUNT1, DATA_BIT_NUMBER, SPOT_FOUND,POW_CON ;
int DATA_POSITION, BIT_WIDTH_SEARCH, BIT_WIDTH, CURRENT_NUMBER, WIDTH_OF_THE_BINARY_BIT_ARRAY;
int PARITY_BIT_POSITION[MAX_COUNT], SYNDROME_EQUATION_ARRAY[MAX_COUNT][MAX_COUNT], BINARY_NUMBER_ARRAY[MAX_COUNT][MAX_COUNT], DATA_POINT_COUNT_ARRAY[MAX_COUNT];
int CODE_SEGMENT[MAX_COUNT], TW0_SQ_K_MINUS_1, CURRENT_LOCATION, BIT_WIDTH_VA,PRESENT_CHECK_BIT;
int LOOP_CONTROL, PARITY_BIT_POSITION1[MAX_COUNT], SPACE_COUNT, SPACE_COUNT2, SPACE_COUNT3;
int Select_Statement_Type, STARTINGAT, NUMOFSTMTS, BIT_COUNT, STATE_MENT_COUNT;
ofstream out_file;
out_file.open(\"C:/STATEMENT_GEN.txt\"); // opening the points file.
if (out_file.fail()) // ensuring that the file opened properly
{
cout <<\"\\nThe file did not open\"<<endl;
cout <<\"\\nHey check to ensure the file actually exists\"<< endl;
exit(1);
}
cout<<\" Hello what type of select statement would like to generate.\\n\";
cout<<\" You have three types to choose from \\n\";
cout<<\" 1. Case Statement\\n\";
cout<<\" 2. With Statement\\n\";
cout<<\" 3. IF Else Statemtne\\n\";
cout<<\" Please choose enter 1 2 or 3.\\n\";
cin>>Select_Statement_Type;
if ( Select_Statement_Type == 3 )
{
cout<<\" OK got it, now how many iterations of this statement do you want.\";
cin>>STATE_MENT_COUNT;
IF_STMT_GEN(STATE_MENT_COUNT, out_file);
}
else
{
cout<<\" OK got it, how many bits are in the selection variable.\";
cin>>BIT_COUNT;
cout<<endl;
cout<< \" How many statements do you want ?\";
cin>>NUMOFSTMTS;
cout<<\" Starting at what number ?\";
cin>>STARTINGAT;
When_Case_STMT_Gen (BIT_COUNT, Select_Statement_Type, NUMOFSTMTS, STARTINGAT, out_file);
}
out_file.close();
return 0;
}
|