Difference between revisions of "Team Mighty Morphin Coding Rangers - OOP344"
(→Dachuan) |
(→Dachuan) |
||
Line 169: | Line 169: | ||
===Dachuan=== | ===Dachuan=== | ||
Placing void in Function(void) for Borland is important. It has gotten me frustrated a few times. <br /> | Placing void in Function(void) for Borland is important. It has gotten me frustrated a few times. <br /> | ||
− | <s>bio_putint() doesn't seem to work under VCC now?</s> fixed <br /> | + | <s>bio_putint() doesn't seem to work under VCC now?</s> fixed. <br /> |
− | <s>bio_move() doesn't not work in Borland.</s> fixed <br /> | + | <s>bio_move() doesn't not work in Borland.</s> fixed. <br /> |
When using Putty, don't forget to set Function/Keyboard/Xterm R6! <br /> | When using Putty, don't forget to set Function/Keyboard/Xterm R6! <br /> |
Revision as of 21:27, 21 February 2010
[
OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources
Contents
A1 Function assignment
Last Name | Name | Branches in workspace | Simple Function(s) | Complex Function(s) |
---|---|---|---|---|
Chau | Sunny | ScsC workspace | bio_move - Committed to trunk | bio_edit |
Cheung | Christopher | cgcheung workspace | bio_clrscr | ~ |
Huang | Dachuan | Dachuan workspace | bio_flush - Committed to trunck |
bio_displayMenuItem - Committed to trunk bio_edit - Committed to trunk (my part) |
John-Sandy | Anastasia | ~ | bio_cols - Committed to trunk | ~ |
Oberes | Donna | Daoberes workspace | bio_rows - Committed to trunk bio_getch - Committed to trunk |
bio_edit - Validation logic for *offset, *curpos, & *offset = NULL *DONE*; Before editing begins, if *curpos & *offset have invalid values *DONE*; Validation of positions that *curpos is never allowed to take *DONE*; !ReadOnly and *insertmode *To be modified* |
Wang | Cong | ~ | ~ | bio_display/bio_displayflag |
Wang | Shengwei | Shengwei workspace | bio_putstr - Committed to trunk |
bio_menuItem Committed to trunk bio_putint Committed to trunk |
Xue | Yong | Yong workspace | bio_putch Committed to trunk | bio_flag()Committed to trunk |
SVN Repository
oop344_101rep4
Coding Style
The Coding Rangers had their first somewhat informal meeting on Jan. 21 to determine a uniform coding style. They came up with the following:
- Comment as much as you can using /* ... */.
- At the top of every file, include your name, the filename, and the purpose of the file.
- Comment on what a function is supposed to do before the function definition.
- Change to newline once you reach column 80. Nothing to be typed beyond column 80!
- When naming variables,
- use single letters (like i, j, a, or v) for counters only;
- assign the variable a name that best describes what it is used for (but please don't make it too long);
- and separate words with caps.
Eg. noOfOrders, not nooforders
- When naming a function, name it according to what it is supposed to do.
Eg.void updateDelivery, int setInitialValue
, notvoid Deliveries, int InitialValues
- Class names must begin with a capital letter
- Declare each variable at the beginning of blocks.
- Declare each variable in a line by itself. It is easier to comment a variable this way. Do not use commas to separate the variable names if they have the same data type.
- Type four (4) spaces over for every block of code. (This is as opposed to tabbing.) For example:
- Only
main ()
will start at column 1. Tab every block of code four spaces over. - Include an empty line after the declaration of variables (see above example).
- When using operators, make sure to have a space between the operands and the operator for readability.
Eg.i = 0;
, noti=0;
- For keywords such as
while, for, if, else,
put a space after the keyword and the expression following it.
Eg.if (x == 0)
is correct;if(x == 0)
is incorrect - When using brackets, put the opening bracket on the same line as the function or expression that opens it.
Eg. CORRECT:
int setSafeEmptyState {
...
}
INCORRECT:
int setSafeEmptyState
{
...
}
Eg.
main () { int length = 0; // correct, at the beginning of the block ... ... int flag = 1; // incorrect, at the middle of the block if ( length = 0) { int i = 0; // correct, at the beginning of the block ... ... bool valid = true; // incorrect, at the middle of the block } return 0; }
Eg. correct int i; //To count the number of times in for-loop
int j;
int k; //To count another variable
Eg. wrong int i,j,k; //How do I separately comment
int i; int j; int k; //the variables here?
main () {
int x; //Notice the four spaces over
int y;
for (x = 0, y = 10; x < 10 && y >0; x++, y++) {
printf("x is %d, y is %d\n", x, y);
printf("The sum of x and y is %d\n", x + y);
if (x == 5)
printf("We've reached the halfway point!\n"); //Moved four spaces over again
}
printf("Hello, world!\n");
}
Issues
Each member will post updates about their progress on the project. Triumphs, conflicts, and blood and tears will go here.
Sunny
However, a new "Error E2040 C:\Borland\BCC55\Include\conio.h 1: Declaration terminated incorrectly" has appeared. Fixed! Feb11th
I am running into this error "Error E2209 biof.c 32: Unable to open include file 'conio.h'". Know a way to fix this? Fixed!
Donna
Feb 20, 2010 - Just found out yesterday that another variable, int ReadOnly, has been added to parameters passed to bio_edit. ReadOnly is supposed to toggle between ReadOnly and !ReadOnly. This changes the default of the switch statement slightly.
Feb 4, 2010 - Committed my bio_rows to trunk. I ran into a few troubles while compiling, the biggest being Borland. Never used this compiler before. The frustrating part, after fixing all of my mistakes, is forgetting to take note of what went wrong so that I know how to fix it in the future. However, as far as I can recall, some of the biggest problems were:
- Having to include -IC:\Borland\BCC55\Include \LC:\Borland\BCC55\Lib during compilation.
- Empty parameters in the function prototypes (in biof.h) actually needed the word "void" rather than just leaving them empty. (I just checked the function prototypes in the biof.c file, and some of them are empty. However, fixing just the .h file was enough). For some reason, they're as good as being not prototyped.
There was something hinky about visual c++, too, but I forget now. I'll keep it in mind for next time.
As for the actual coding, I forgot that the word "struct" has to be included when creating a struct. (struct text_info x;
).
Shengwei
Just to reserve a space. :)
Dachuan
Placing void in Function(void) for Borland is important. It has gotten me frustrated a few times.
bio_putint() doesn't seem to work under VCC now? fixed.
bio_move() doesn't not work in Borland. fixed.
When using Putty, don't forget to set Function/Keyboard/Xterm R6!
When compiling on Mac: cc biomain.c biof.c -lcurses (and then) ./a.out
Cong
i really appreciate Sunny's help, my code works now.And i understand what link problem is.
Cgcheung
Not really an issue but my own mistake. A reminder to include "-l ncurses" to the compile line in linux >_> .
Member list
Last Name | Name | Seneca Username | Section | Blog Url | IRC Nick | SVN ID | My Contributions | Role | Alternative Email Address |
---|---|---|---|---|---|---|---|---|---|
Chau | Sunny | schau5 | B | Blog | ScsC | TBA | Contributions | The Experienced Guy | ~ |
Cheung | Christopher | cgcheung | B | http://rocketpants.blog.ca/ | Rocketpants | n/a | Contributions | Team Contact | ~ |
Huang | Dachuan | dhuang | B | Blog | Da_Truth | dhuang18 | Contributions | Team Contact | |
John-Sandy | Anastasia | ajohn-sandy | B | http://anastasiasaurus.blogspot.com | annieJS | ajohn-sandy | Contributions | Team Contact | annieJS@gmail.com |
Oberes | Donna | daoberes | B | Blog | Donna_Oberes | n/a | Contributions | De-Facto Leader | ~ |
Wang | Cong | Cwang84 | A | http://wangcong422.blogspot.com/ | cwang84 | n/a | Contributions | Team Contact | ~ |
Wang | Shengwei | swang94 | A | http://shengwei-seneca.blogspot.com/ | Shengwei | swang94 | Contributions | Team Contact | |
Xue | Yong | yxue11 | B | http://yxue11.blogspot.com/ | yxue11 | n/a | Contributions | Team Contact | ~ |
~ | ~ | e-mail all @ once | ~ | ~ | ~ | ~ | ~ | ~ | ~ |
Project Progress
Update the current project's progress here. List what's done in each part, and what's not done. Simply cross-out things that are done.
void bio_init(void)
(COMPLETED)
void bio_end(void)
(COMPLETED)
int bio_rows(void)
(COMPLETED)
int bio_cols(void)
(COMPLETED)
void bio_clrscr(void)
(COMPLETED)
void bio_flush(void)
(COMPLETED)
int bio_getch(void)
(COMPLETED)
void bio_move(int row, int col)
(COMPLETED)
void bio_putch(int ch)
(COMPLETED)
void bio_putstr(const char* str)
(COMPLETED)
Complex Functions
void bio_display(const char* str, int row, int col, int len)
(IN PROGRESS)
void bio_displayflag(const char* format, int row, int col, int status)
(IN PROGRESS)
int bio_flag(const char* format, int row, int col, int* status, int radio)
(Completed)
int bio_edit(char* str, int row, int col, int fieldlen, int maxdatalen, int *insertmode, int *offset, int *curpos, int IsTextEditor)
(IN PROGRESS)
Keys:
UP (IN PROGRESS)
DOWN (IN PROGRESS)
LEFT (IN PROGRESS)
RIGHT (IN PROGRESS)
PGUP (IN PROGRESS)
PGDN (IN PROGRESS)
HOME (IN PROGRESS)
END (IN PROGRESS)
ENTER (COMPLETED)
TAB (COMPLETED)
BACKSPACE (COMPLETED)
ESCAPE (IN PROGRESS)
DEL (COMPLETED)
INSERT (COMPLETED)
F1-F10 (IN PROGRESS)
void bio_displayMenuItem(const char *format, const char *menuItem, int row, int col, int len, int status)
(COMPLETED)
int bio_menuItem(const char* format, const char* menuItem, int row, int col, int len, int* status)
(COMPLETED)
Helper Functions
void bio_putint(int val)
- It prints an integer on the screen.
char* toUpperCase(char* str)
- This function only changes those letters in lower case to upper case. It changes the original string.
char* myItoa(int val, char* str, int base)
- This function converts a decimal base integer to any other non-decimal base number, such as binary number or octal number, or hex number, and than converts that number into a string variable. Or, it converts a decimal base integer directly into a string. The function returns the address of the string at the end.
char* myFtoa(double val, char* str)
- This function converts a double to a string variable, and returns the string. There will only be 2 decimal positions shown in the string. If we want to print a double value on the console screen, we can say: bio_putstr(myFtoa(val, str)). I think there is no need to code another function for bio_putdouble.
int myPrint(const char* msg, ...)
- This function works very similar with printf in stdio.h library. Float data type dose not work here; only double dose. The function only shows 2 decimal positions.
Microsoft SkyDrive
We can put some useful files here.
- It's 25GB space, and the max size of a file which can be uploaded is 50MB.
- All files can be set a certain permissions to allow different kinds of access.
SkyDrive
ID: oop344_101rep4(same name as the repository)
PW: rangers