реклама на сайте
подробности

 
 
 
Reply to this topicStart new topic
> project от Chan(c), вопрос по программе
kostik2
сообщение Apr 19 2009, 08:20
Сообщение #1


Участник
*

Группа: Участник
Сообщений: 61
Регистрация: 16-02-06
Пользователь №: 14 375



CODE
/*---------------------------------------------------------------------------
Extended itoa, puts and printf ©ChaN, 2006

-----------------------------------------------------------------------------*/

#ifndef XITOA
#define XITOA

#include <macros.h>
#include <string.h>

extern void (*xfunc_out)(char);

/* This is a pointer to user defined output function. It must be initialized
before using this modle.
*/

void xputc(char chr);

/* This is a stub function to forward outputs to user defined output function.
All outputs from this module are output via this function.
*/


/*-----------------------------------------------------------------------------*/
void xputs(const prog_char *string);

/* The string placed in the ROM is forwarded to xputc() directly.
*/


/*-----------------------------------------------------------------------------*/
void xitoa(long value, char radix, char width);

/* Extended itoa().

value radix width output
100 10 6 " 100"
100 10 -6 "000100"
100 10 0 "100"
4294967295 10 0 "4294967295"
4294967295 -10 0 "-1"
655360 16 -8 "000A0000"
1024 16 0 "400"
0x55 2 -8 "01010101"
*/


/*-----------------------------------------------------------------------------*/
void xprintf(const prog_char *format);

/* Format string is placed in the ROM. The format flags is similar to printf().

%[flag][width][size]type

flag
A '0' means filled with '0' when output is shorter than width.
' ' is used in default. This is effective only numeral type.
width
Minimum width in decimal number. This is effective only numeral type.
Default width is zero.
size
A 'l' means the argument is long(32bit). Default is short(16bit).
This is effective only numeral type.
type
'c' : Character, argument is the value
's' : String placed on the RAM, argument is the pointer
'S' : String placed on the ROM, argument is the pointer
'd' : Signed decimal, argument is the value
'u' : Unsigned decimal, argument is the value
'X' : Hex decimal, argument is the value
'b' : Binary, argument is the value
'%' : '%'

*/


/*-----------------------------------------------------------------------------*/
char xatoi(char **str, long *ret);

/* Get value of the numeral string.

str
Pointer to pointer to source string

"0b11001010" binary
"0377" octal
"0xff800" hexdecimal
"1250000" decimal
"-25000" decimal

ret
Pointer to return value
*/

#endif /* XITOA */


!!!!!!!!!!!!!!Компилятор ругается на строчку void xputs(const prog_char *string); ?
что не так я делаю. программирую в ICC7.
Причина редактирования: Оформление цитаты исходника.
Go to the top of the page
 
+Quote Post
yod
сообщение Apr 19 2009, 08:59
Сообщение #2


Участник
*

Группа: Новичок
Сообщений: 24
Регистрация: 20-10-06
Пользователь №: 21 500



скорее всего компилятор ругается на "const prog_char*" -это спец тип - константный указатель на строку во флеш-памяти
так что где-нить в документации погляди как правильно прописать такой тип и все будет "ок"
Go to the top of the page
 
+Quote Post
demiurg_spb
сообщение Apr 19 2009, 10:49
Сообщение #3


неотягощённый злом
******

Группа: Свой
Сообщений: 2 746
Регистрация: 31-01-08
Из: Санкт-Петербург
Пользователь №: 34 643



Код
typedef  char __flash prog_char;


--------------------
“Будьте внимательны к своим мыслям - они начало поступков” (Лао-Цзы)
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 чел. читают эту тему (гостей: 1, скрытых пользователей: 0)
Пользователей: 0

 


RSS Текстовая версия Сейчас: 19th July 2025 - 22:43
Рейтинг@Mail.ru


Страница сгенерированна за 0.01338 секунд с 7
ELECTRONIX ©2004-2016