/** * Add a manual grade to the given problem. A manual grade is a grade you enter at the keyboard, not tested by the comp * * @param problem the problem to add the manual grade to * @param description a description of the manual grade * @param points the points associated with this manual grade * @param is_extra_credit is this manual grade extra credit? */ void add_manual_grade(PROBLEM* problem, const char* description, int points, BOOL is_extra_credit) { TEST* test = test_create(description, &_get_manual_grade); test->is_manual = TRUE; test->is_ec = is_extra_credit; test->max_score = (is_extra_credit ? 0 : points); test->max_ec_score = (is_extra_credit ? points : 0); ll_push_back(problem->tests, test); }
/** * Add a new extra credit to the given problem, given the function to test * * @param problem the problem to which to add the test * @param description a description of the test to add to the problem * @param points the number of extra credit points to attribute to the test * @param test_function the function that is called and associated with this test */ void add_new_ec_test(PROBLEM* problem, const char* description, double points, void (*test_function)() ) { TEST* test = test_create(description, test_function); test->is_manual = FALSE; test->is_ec = TRUE; test->max_score = 0; test->max_ec_score = points; ll_push_back(problem->tests, test); }
PROBLEM* add_new_problem(const char* name, int number){ static BOOL problems_initialized = FALSE; PROBLEM* prob; if(problems_initialized == FALSE){ problems = ll_create(&problem_free); problems_initialized = TRUE; } prob = problem_initialize(name, number); ll_push_back(problems, prob); return prob; }
BOOL Payload::append_addresses_payload( int nSize, vector<Address *> * vAddresses ) { PAYLOAD_ELEMENT * lpsPayloadElement = NULL; if( ( lpsPayloadElement = (PAYLOAD_ELEMENT *)calloc( 1, sizeof( PAYLOAD_ELEMENT ) ) ) == NULL ) { dprintflvl( 1, "Unable to allocate space for payload" ); return FALSE; } lpsPayloadElement->nSize = nSize; lpsPayloadElement->eType = PAYLOAD_ADDRESS_MULTIPLE; lpsPayloadElement->u.vPayloadAddresses = vAddresses; ll_push_back( lpsPayloadElement ); }
BOOL Payload::append_payload( PAYLOAD_ELEMENT_TYPE eType, int nSize, unsigned char * lpucContents, unsigned char * lpucRestrictedChars ) { PAYLOAD_ELEMENT * lpsPayloadElement = NULL; if( ( lpsPayloadElement = (PAYLOAD_ELEMENT *)calloc( 1, sizeof( PAYLOAD_ELEMENT ) ) ) == NULL ) { dprintflvl( 1, "Unable to allocate space for payload" ); return FALSE; } lpsPayloadElement->nSize = nSize; lpsPayloadElement->eType = eType; //if( eType == PAYLOAD_ADDRESS_MULTIPLE ) { //lpsPayloadElement->u.lpucContentsArray = (unsigned char **)lpucContents; //} //else { lpsPayloadElement->u.lpucContents = lpucContents; //} lpsPayloadElement->lpucRestrictedChars = lpucRestrictedChars; ll_push_back( lpsPayloadElement ); }