--- mercury-extras-0.12.2.orig/concurrency/global.m 2003-03-01 04:20:33.000000000 +1300 +++ mercury-extras-0.12.2/concurrency/global.m 2006-03-29 22:09:36.000000000 +1200 @@ -54,7 +54,7 @@ :- pragma c_code(global__new(Thing::in, Glob::out, IO0::di, IO::uo), will_not_call_mercury, "{ MR_Word *tmp; - MR_incr_hp((MR_Word) tmp, 1); + MR_incr_hp((*(MR_Word*)&(tmp)), 1); *tmp = Thing; Glob = (MR_Word) tmp; IO = IO0; --- mercury-extras-0.12.2.orig/curs/curs.m 2004-12-02 16:22:03.000000000 +1300 +++ mercury-extras-0.12.2/curs/curs.m 2006-03-29 22:13:00.000000000 +1200 @@ -965,7 +965,7 @@ wattrset(w, Attr); wcolor_set(w, Attr, NULL); wclear(w); - (PANEL *)Panel = new_panel(w); + (*(PANEL**)&(Panel)) = new_panel(w); IO = IO0; --- mercury-extras-0.12.2.orig/graphics/mercury_tcltk/mtcltk.m 2005-08-15 21:12:13.000000000 +1200 +++ mercury-extras-0.12.2/graphics/mercury_tcltk/mtcltk.m 2006-03-29 22:28:22.000000000 +1200 @@ -141,7 +141,7 @@ argc++; } - MR_incr_hp(MR_LVALUE_CAST(MR_Word, argv), argc + 1); + MR_incr_hp((*(MR_Word*)&(argv)), argc + 1); for (i = 0, l = Args; l != list_empty(); l = list_tail(l), i++) { argv[i] = (char *) MR_list_head(l); --- mercury-extras-0.12.2.orig/odbc/odbc.m 2005-02-13 02:50:41.000000000 +1300 +++ mercury-extras-0.12.2/odbc/odbc.m 2006-03-29 21:41:48.000000000 +1200 @@ -1316,38 +1316,38 @@ Status::out, DB0::di, DB::uo), may_call_mercury, "{ - MODBC_Statement *stat; + MODBC_Statement *statement; - stat = (MODBC_Statement *) Statement0; + statement = (MODBC_Statement *) Statement0; - MR_assert(stat != NULL); + MR_assert(statement != NULL); - if (stat->num_rows == 0 ) { + if (statement->num_rows == 0 ) { MR_DEBUG(printf(""Fetching rows...\\n"")); } /* Fetching new row */ - Status = SQLFetch(stat->stat_handle); + Status = SQLFetch(statement->stat_handle); if (Status != SQL_NO_DATA_FOUND && ! odbc_check(odbc_env_handle, odbc_connection, - stat->stat_handle, Status)) + statement->stat_handle, Status)) { - odbc_do_cleanup_statement(stat); + odbc_do_cleanup_statement(statement); odbc_throw(); /* not reached */ } /* Update number of rows fetched */ if (Status == SQL_SUCCESS) { - stat->num_rows++; + statement->num_rows++; } if (Status == SQL_NO_DATA_FOUND) { - MR_DEBUG(printf(""Fetched %d rows\\n"", stat->num_rows)); + MR_DEBUG(printf(""Fetched %d rows\\n"", statement->num_rows)); } - Statement = (MR_Word) stat; + Statement = (MR_Word) statement; DB = DB0; }"). @@ -1362,13 +1362,13 @@ Statement::uo, DB0::di, DB::uo), will_not_call_mercury, "{ - MODBC_Statement * stat; + MODBC_Statement * statement; - stat = (MODBC_Statement *) Statement0; + statement = (MODBC_Statement *) Statement0; - MR_assert(stat != NULL); + MR_assert(statement != NULL); - NumColumns = stat->num_columns; + NumColumns = statement->num_columns; DB = DB0; Statement = Statement0; }"). @@ -1384,25 +1384,25 @@ may_call_mercury, "{ - MODBC_Statement *stat; + MODBC_Statement *statement; MODBC_Column *col; SQLRETURN rc; SDWORD column_info; - stat = (MODBC_Statement *) Statement0; + statement = (MODBC_Statement *) Statement0; - MR_assert(stat != NULL); - MR_assert(stat->row != NULL); + MR_assert(statement != NULL); + MR_assert(statement->row != NULL); - MR_DEBUG(printf(""Getting column %i\n"", (int) Column)); + MR_DEBUG(printf(""Getting column %i\\n"", (int) Column)); - if (stat->binding_type == MODBC_GET_DATA) { + if (statement->binding_type == MODBC_GET_DATA) { /* Slurp up the data for this column. */ - odbc_do_get_data(stat, Column); + odbc_do_get_data(statement, Column); } - col = &(stat->row[Column]); + col = &(statement->row[Column]); if (col->value_info == SQL_NULL_DATA) { Type = MODBC_NULL; @@ -1430,7 +1430,7 @@ odbc_message_list = MR_list_cons(overflow_message, odbc_message_list); - odbc_do_cleanup_statement(stat); + odbc_do_cleanup_statement(statement); odbc_throw(); } break; @@ -1475,7 +1475,7 @@ break; } /* end switch (Type) */ - Statement = (MR_Word) stat; + Statement = (MR_Word) statement; DB = DB0; } /* end odbc__get_data() */ @@ -1484,7 +1484,7 @@ :- pragma c_code(" void -odbc_do_get_data(MODBC_Statement *stat, int column_id) +odbc_do_get_data(MODBC_Statement *statement, int column_id) { MODBC_Column *column; SQLRETURN rc; @@ -1494,11 +1494,11 @@ ** byte and nothing else. */ - column = &(stat->row[column_id]); + column = &(statement->row[column_id]); if (column->attr_type == MODBC_VAR_STRING) { /* Just get the length first time through. */ - rc = SQLGetData(stat->stat_handle, column_id, + rc = SQLGetData(statement->stat_handle, column_id, column->conversion_type, dummy_buffer, 1, &(column->value_info)); @@ -1510,9 +1510,9 @@ if (rc != SQL_SUCCESS_WITH_INFO && ! odbc_check(odbc_env_handle, odbc_connection, - stat->stat_handle, rc)) + statement->stat_handle, rc)) { - odbc_do_cleanup_statement(stat); + odbc_do_cleanup_statement(statement); odbc_throw(); } @@ -1535,7 +1535,7 @@ ** length of the available data, rather than the ** total length of data available. */ - odbc_get_data_in_chunks(stat, column_id); + odbc_get_data_in_chunks(statement, column_id); } else { MR_Word data; @@ -1543,42 +1543,42 @@ ** column->value_info == length of data */ column->size = column->value_info + 1; - MR_incr_hp_atomic(MR_LVALUE_CAST(MR_Word, column->data), + MR_incr_hp_atomic((*(MR_Word*)&(column->data)), (column->size + sizeof(MR_Word)) / sizeof(MR_Word)); - odbc_get_data_in_one_go(stat, column_id); + odbc_get_data_in_one_go(statement, column_id); } } else { /* ** It's a fixed length column, so we can ** get the lot in one go. */ - odbc_get_data_in_one_go(stat, column_id); + odbc_get_data_in_one_go(statement, column_id); } } void -odbc_get_data_in_one_go(MODBC_Statement *stat, int column_id) +odbc_get_data_in_one_go(MODBC_Statement *statement, int column_id) { MODBC_Column *col; SQLRETURN rc; - MR_DEBUG(printf(""getting column %i in one go\n"", column_id)); + MR_DEBUG(printf(""getting column %i in one go\\n"", column_id)); - col = &(stat->row[column_id]); + col = &(statement->row[column_id]); - rc = SQLGetData(stat->stat_handle, column_id, col->conversion_type, + rc = SQLGetData(statement->stat_handle, column_id, col->conversion_type, (SQLPOINTER) col->data, col->size, &(col->value_info)); if (! odbc_check(odbc_env_handle, odbc_connection, - stat->stat_handle, rc)) + statement->stat_handle, rc)) { - odbc_do_cleanup_statement(stat); + odbc_do_cleanup_statement(statement); odbc_throw(); } } void -odbc_get_data_in_chunks(MODBC_Statement *stat, int column_id) +odbc_get_data_in_chunks(MODBC_Statement *statement, int column_id) { MODBC_Column *col; SQLRETURN rc; @@ -1586,11 +1586,11 @@ MR_Word chunk_list; String result; - MR_DEBUG(printf(""getting column %i in chunks\n"", column_id)); + MR_DEBUG(printf(""getting column %i in chunks\\n"", column_id)); chunk_list = MR_list_empty(); - col = &(stat->row[column_id]); + col = &(statement->row[column_id]); rc = SQL_SUCCESS_WITH_INFO; @@ -1601,7 +1601,7 @@ */ while (rc == SQL_SUCCESS_WITH_INFO) { - rc = SQLGetData(stat->stat_handle, column_id, + rc = SQLGetData(statement->stat_handle, column_id, col->conversion_type, (SQLPOINTER) this_bit, MODBC_CHUNK_SIZE - 1, &(col->value_info)); @@ -1611,9 +1611,9 @@ if (rc != SQL_SUCCESS_WITH_INFO && ! odbc_check(odbc_env_handle, odbc_connection, - stat->stat_handle, rc)) + statement->stat_handle, rc)) { - odbc_do_cleanup_statement(stat); + odbc_do_cleanup_statement(statement); odbc_throw(); } @@ -1655,12 +1655,12 @@ odbc__cleanup_statement_check_error(Statement::di, DB0::di, DB::uo), may_call_mercury, "{ - MODBC_Statement *stat; + MODBC_Statement *statement; SQLRETURN rc; - stat = (MODBC_Statement *) Statement; + statement = (MODBC_Statement *) Statement; - rc = odbc_do_cleanup_statement(stat); + rc = odbc_do_cleanup_statement(statement); if (! odbc_check(odbc_env_handle, odbc_connection, SQL_NULL_HSTMT, rc)) { @@ -1672,29 +1672,29 @@ :- pragma c_code(" static SQLRETURN -odbc_do_cleanup_statement(MODBC_Statement *stat) +odbc_do_cleanup_statement(MODBC_Statement *statement) { int i; SQLRETURN rc; - if (stat != NULL) { + if (statement != NULL) { MR_DEBUG(printf(""cleaning up statement\\n"")); - if (stat->row != NULL) { - for (i = 1; i <= stat->num_columns; i++) { + if (statement->row != NULL) { + for (i = 1; i <= statement->num_columns; i++) { /* ** Variable length types are allocated directly ** onto the Mercury heap, so don't free them here. */ if (! is_variable_length_sql_type( - stat->row[i].sql_type)) + statement->row[i].sql_type)) { - MR_GC_free(stat->row[i].data); + MR_GC_free(statement->row[i].data); } } - MR_GC_free(stat->row); + MR_GC_free(statement->row); } - rc = SQLFreeStmt(stat->stat_handle, SQL_DROP); - MR_GC_free(stat); + rc = SQLFreeStmt(statement->stat_handle, SQL_DROP); + MR_GC_free(statement); return rc; } else { return SQL_SUCCESS;