From 4454900e108eb554634fcd604483d7eb8566cecf Mon Sep 17 00:00:00 2001 From: turbocat Date: Sun, 23 May 2021 17:21:26 +0000 Subject: [PATCH] Weather 1.6e: - Now uses libc.obj - The binary file has been reduced to ~ 8kb git-svn-id: svn://kolibrios.org@8735 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/other/Weather/Makefile | 9 +- programs/other/Weather/Tupfile.lua | 10 +-- programs/other/Weather/json/Makefile | 13 --- programs/other/Weather/json/inttypes.h | 14 --- programs/other/Weather/json/json.h | 2 +- programs/other/Weather/json/libjson.a | Bin 16264 -> 0 bytes programs/other/Weather/weather.c | 118 ++++++++++++------------- 7 files changed, 66 insertions(+), 100 deletions(-) delete mode 100755 programs/other/Weather/json/Makefile delete mode 100644 programs/other/Weather/json/inttypes.h delete mode 100644 programs/other/Weather/json/libjson.a diff --git a/programs/other/Weather/Makefile b/programs/other/Weather/Makefile index 833f7ff5f3..c69c96beb7 100755 --- a/programs/other/Weather/Makefile +++ b/programs/other/Weather/Makefile @@ -1,16 +1,17 @@ KTCC_DIR = ../../develop/ktcc/trunk +KLIBC = ../../develop/libraries/kolibri-libc NAME = weather KTCC=$(KTCC_DIR)/bin/kos32-tcc KPACK = kpack -SRC= weather.c -CFLAGS= -I $(KTCC_DIR)/libc/include -LIBS = -ljson -lck -limg -lhttp +SRC= weather.c json/json.c +FLAGS= -nostdlib $(KLIBC)/lib/crt0.o -I $(KLIBC)/include -I $(KTCC_DIR)/libc/include -L$(KLIBC)/lib +LIBS =-ltcc -limg -lhttp -lc.obj all: - $(KTCC) $(CFLAGS) -L json $(SRC) $(LIBS) -o $(NAME) + $(KTCC) $(FLAGS) $(SRC) $(LIBS) -o $(NAME) $(KPACK) $(NAME) clean: rm $(NAME) diff --git a/programs/other/Weather/Tupfile.lua b/programs/other/Weather/Tupfile.lua index 1b600974b2..9fbe1ca0f6 100644 --- a/programs/other/Weather/Tupfile.lua +++ b/programs/other/Weather/Tupfile.lua @@ -2,9 +2,9 @@ if tup.getconfig("NO_TCC") ~= "" then return end TCC="kos32-tcc" -CFLAGS = "-I../../develop/ktcc/trunk/libc/include" -LDFLAGS = "-nostdlib ../../develop/ktcc/trunk/bin/lib/start.o -L../../develop/ktcc/trunk/bin/lib -Ljson" -LIBS = "-ljson -lck -limg -lhttp" +CFLAGS = "-I../../develop/libraries/kolibri-libc/include -I../../develop/ktcc/trunk/libc/include" +LDFLAGS = "-nostdlib ../../develop/libraries/kolibri-libc/lib/crt0.o -L../../develop/libraries/kolibri-libc/lib -L../../develop/ktcc/trunk/bin/lib" +LIBS = "-ltcc -limg -lhttp -lc.obj" -COMMAND=string.format("%s %s %s %s %s ", TCC, CFLAGS, "%f -o %o", LDFLAGS, LIBS) -tup.rule("weather.c", COMMAND .. tup.getconfig("KPACK_CMD"), "weather") +COMMAND = string.format("%s %s %s %s %s ", TCC, CFLAGS, "%f -o %o", LDFLAGS, LIBS) +tup.rule({"weather.c", "json/json.c"}, COMMAND .. tup.getconfig("KPACK_CMD"), "weather") diff --git a/programs/other/Weather/json/Makefile b/programs/other/Weather/json/Makefile deleted file mode 100755 index c247e0771c..0000000000 --- a/programs/other/Weather/json/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -KTCC_DIR=../../../develop/ktcc/trunk - -KTCC=$(KTCC_DIR)/bin/kos32-tcc -KPACK=kpack - -SRC=json.c -CFLAGS=-c -nostdinc -I $(KTCC_DIR)/libc/include -I. - -all: - $(KTCC) $(CFLAGS) $(SRC) - ar -crs libjson.a *.o -clean: - rm -f *.o *.a diff --git a/programs/other/Weather/json/inttypes.h b/programs/other/Weather/json/inttypes.h deleted file mode 100644 index 703b57fc91..0000000000 --- a/programs/other/Weather/json/inttypes.h +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#define INT8_MAX 0x7f -#define INT8_MIN (-INT8_MAX - 1) -#define UINT8_MAX (INT8_MAX * 2 + 1) -#define INT16_MAX 0x7fff -#define INT16_MIN (-INT16_MAX - 1) -#define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2U + 1U) -#define INT32_MAX 0x7fffffffL -#define INT32_MIN (-INT32_MAX - 1L) -#define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2UL + 1UL) -#define INT64_MAX 0x7fffffffffffffffLL -#define INT64_MIN (-INT64_MAX - 1LL) -#define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL) diff --git a/programs/other/Weather/json/json.h b/programs/other/Weather/json/json.h index 0b16be582e..9d3bd043a0 100644 --- a/programs/other/Weather/json/json.h +++ b/programs/other/Weather/json/json.h @@ -37,7 +37,7 @@ #ifndef json_int_t #ifndef _MSC_VER - #include "inttypes.h" + #include #define json_int_t int64_t #else #define json_int_t __int64 diff --git a/programs/other/Weather/json/libjson.a b/programs/other/Weather/json/libjson.a deleted file mode 100644 index 679453c04f5508c48c475c6f98e77ddc69d58d3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16264 zcmds8eRNgTl|L^;`k=A*VVNn`emp2qs0bkmAQUw!&-y_$I7Y422_bobXvo7Pe5iB; zA6L1(#4XsrkvbwPC%!sQWObg3csd5W5#+Hu3X3G42`rz(Q#a`c%@&abi*D<>b60n|DZNQ!y0xtBo+esvrbG{qP4#cxV%Gq{?Y0Vz4+B$FoNbr`a322UB5+2#1X2*?S7dx(l>VDcR z*qf(XRX}x#p?WU~9?4U+6i{7is47UXIZxGEK()+Jolb)5^Hk{qs+6I69|@}RRBZ)R zmpLv4@23iZltgV{>V@aUVo4NXu>@@5<#NYA>ZOLf`eFYsNaCMXj;Ggn%u5aW^+SGY z*l#>G`$vBL;F&owh}U@7t3N7+UeVyE4*T^-S2P?RK5^nic2B}f9r79n{Q9_`s_+{J z7VmaGH;se2G?Je>w0N(ReGiKLoY^C%_2a1mK8$26qN~i@2c#Tt5L!DzJeXpt&5-5N zeI$>#?NM%6Q!PIg&+dv-yo4W{y&EGz!mQW`ttx12{av^;jk{>gMhB(K(n9Pg_nOFZ8AsgxF#e)x{Mz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zq#@n3I@8nC-M-o|>O^<^!&w0Xq%dibk~x$NB574&6+4nuYr3T!7SdA?{=3@R^xE!p zk6J!=eia|{`KVT?ZCQ5*%QdQd9g@VJHX^lrEZ}1yAB*@npO3|ORFgq98B|yEQNss& zRI^7ldsMSWHG5REM-6+_utyDh)UZbld(^N;4SUqEM-6+_utzO>)UroywOW_i$O3!S zvR5s8)v{MDd)2a6Eqg7fQpj|*LJQb=L3Pv-$MJ7^@L{amlv3Bgm1FSjMg#eaQ`u!o z9VPsvQvXMIIpREM%C1nVZ2};E^!THJe}fH;_(207#2PKTN~y;IW4OiO3j#3&kslHw zShr3@`*N&5z!>TtCdBs#tVh5723`-IF>LsI2oYr7BE)7AL!c?ES86U`>~y6rGO!$X z@BB%5o`E+R$bW=m{r3Q4c;{yiarA%Sy}EvSH_u~hAj<=r> z^2|f>5u2pcn}ncwix6$MA=t&RY2HqVWask+|G9zhf#F%dgz%#n2axT7`Hvy(W+ zxfuaJ2HjT?0$)!Ez4{1|Ogs!o`hMb|`!53>j2Wv`>P$ekpGO?}Uv1zv!n0v#)Ba`R z;Qv3wF=rP-R>GBltbfGddx*onUqJH4_U8d9&u8IF#Ge2peiM9(_+~)jUm{FFZ&ROy zuMz(-A=>v5V(yO;VlIA12;00(NSn~Npxb0Z*#2XL=OE`HoCQB4oQ*w*5PUWhg3mVz zKd#ij0n!eif{)Qo8wt_qrhY(C_MPsL#C zTM4V-PlPqN%z`g*yt4_>{}Kb+2w|^B2y2nc5iU^bmw+699(;}bE+AY8eF(v43*jQA zo+LaUeg#PSmx(WiT*R+dst&$K`bPOLscTaeQslX80!DDg0PEOfj<0{D*W^r|ExO zUxsSZ!Tge!T3)1n0s=l4=}6i6fjcTpbNK0i@9hFV@*xc&<-(E+WkXTTfe*oL!;j_n E|9a&v3jhEB diff --git a/programs/other/Weather/weather.c b/programs/other/Weather/weather.c index 8120051739..ec187d22bb 100644 --- a/programs/other/Weather/weather.c +++ b/programs/other/Weather/weather.c @@ -8,7 +8,7 @@ { "Celsius": false, // Enabled fahrenheit (Optional) - "Location": "Berlin", // City Berlin + "Location": "Berlin", // city Berlin "Token": "19ffa14b3dc0e238175829461d1788b8", // OpenWeatherMap token "Lang": "ru", // Language (Optional) "AutoUpdate": 5 // In minutes. 0 - disabled (Optional) @@ -21,12 +21,11 @@ #include #include #include "json/json.h" -#include -#include +#include #include #include -#define VERSION "Weather 1.5" +#define VERSION "Weather 1.6e" enum BUTTONS{ BTN_QUIT = 1, @@ -48,7 +47,7 @@ Image *blend=NULL; const char *config_name = "/sys/Settings/weather.json"; unsigned char char_size=1; -uint64_t AutoUpdateTime = 0; +uint64_t auto_update_time = 0; char *wind_speed_str, *pressure_str, *visibility_str, *humidity_str, *update_str, *wind_deg_str; @@ -59,13 +58,13 @@ char full_url_image[256]; char temp_char='K'; -struct kolibri_system_colors sys_color_table; +ksys_colors_table_t sys_color_table; -pos_t win_pos; +ksys_pos_t win_pos; #pragma pack(push,1) struct open_weather_data{ - char City[100]; + char city[100]; int wind_speed; int wind_deg; int pressure; @@ -78,9 +77,8 @@ struct open_weather_data{ }myw; #pragma pack(pop) -void notify_show(char *text) -{ - start_app("/sys/@notify", text); +void notify_show(char *text){ + _ksys_exec("/sys/@notify", text); } void* safe_malloc(size_t size) @@ -94,14 +92,14 @@ void* safe_malloc(size_t size) } } -void draw_format_text_sys(int x, int y, color_t color, const char *format_str, ... ) // Форматированный вывод в окно +void draw_format_text_sys(int x, int y, ksys_color_t color, const char *format_str, ... ) // Форматированный вывод в окно { char tmp_buff[100]; va_list ap; va_start (ap, format_str); vsnprintf(tmp_buff, sizeof tmp_buff ,format_str, ap); va_end(ap); - draw_text_sys(tmp_buff, x, y , 0, color); + _ksys_draw_text(tmp_buff, x, y , 0, color); } void find_and_set(json_value *value, struct open_weather_data* weather) // Ищем значения в json и заполняем структуру "myw" @@ -119,9 +117,9 @@ void find_and_set(json_value *value, struct open_weather_data* weather) // Ищ } if(!strcmp(JSON_OBJ(i).name, "name")){ if(!strcmp(&JSON_OBJ(i).value->u.string.ptr[JSON_OBJ(i).value->u.string.length-3], "’")){ - strncpy(weather->City, JSON_OBJ(i).value->u.string.ptr, JSON_OBJ(i).value->u.string.length-3); + strncpy(weather->city, JSON_OBJ(i).value->u.string.ptr, JSON_OBJ(i).value->u.string.length-3); }else{ - strcpy(weather->City, JSON_OBJ(i).value->u.string.ptr); + strcpy(weather->city, JSON_OBJ(i).value->u.string.ptr); } } if(!strcmp(JSON_OBJ(i).name, "weather")){ @@ -152,9 +150,9 @@ void find_and_set(json_value *value, struct open_weather_data* weather) // Ищ } } -http_msg* get_json(char *City, char *Token, char* Units) +http_msg* get_json(char *city, char *Token, char* Units) { - sprintf(full_url, API, City, Token, Units, lang); + sprintf(full_url, API, city, Token, Units, lang); http_msg *h = http_get(full_url, 0, HTTP_FLAG_BLOCK, ""); http_long_receive(h); if (h->status == OK || h->status == 404) { @@ -194,19 +192,19 @@ void get_image() // Функция загрузки изображения } } -void RedrawGUI() // Перересовываем интерфейс +void redraw_gui() // Перересовываем интерфейс { - begin_draw(); // Начинам прорисовку + _ksys_start_draw(); // Начинам прорисовку - int new_win_w = (strlen(myw.City)/char_size+10)*(UTF8_W+char_size-1); // Если название города не влезает в окно + int new_win_w = (strlen(myw.city)/char_size+12)*(UTF8_W+char_size-1); // Если название города не влезает в окно if(new_win_wu.object.length; i++){ if(!strcmp(JSON_OBJ(i).name, "Location") && JSON_OBJ(i).value->type==json_string){ - *City = JSON_OBJ(i).value->u.string.ptr; // Получаем название города + *city = JSON_OBJ(i).value->u.string.ptr; // Получаем название города } else if(!strcmp(JSON_OBJ(i).name, "Token") && JSON_OBJ(i).value->type==json_string){ - *Token = JSON_OBJ(i).value->u.string.ptr; // Получаем токен + *token = JSON_OBJ(i).value->u.string.ptr; // Получаем токен } else if(!strcmp(JSON_OBJ(i).name, "Celsius") && JSON_OBJ(i).value->type==json_boolean){ if(JSON_OBJ(i).value->u.boolean){ - *Units = "metric"; + *units = "metric"; temp_char = 'C'; }else{ - *Units = "imperial"; + *units = "imperial"; temp_char = 'F'; } } @@ -261,25 +254,24 @@ void get_config(char **City, char **Token, char **Units) // Загружаем strncpy(lang, JSON_OBJ(i).value->u.string.ptr,2); // Получаем язык } else if(!strcmp(JSON_OBJ(i).name, "AutoUpdate") && JSON_OBJ(i).value->type==json_integer){ - AutoUpdateTime = JSON_OBJ(i).value->u.integer; // Получаем время автообновлений данных + auto_update_time = JSON_OBJ(i).value->u.integer; // Получаем время автообновлений данных } } - if(*City==NULL || *Token ==NULL){ + if(*city==NULL || *token ==NULL){ notify_show("'Invalid config!' -E"); exit(0); } - free(config_buff); - fclose(config_j); + free(config_j.data); } -void Update(char* city, char* token, char* units) // Обновление данных +void update(char* city, char* token, char* units) // Обновление данных { if(blend!=NULL){ img_destroy(blend); // Уничтожение картинику с прозрачностью blend = NULL; } memset(&myw, 0, sizeof myw); // Обнуляем структуру - strcpy(myw.City,"None"); + strcpy(myw.city,"None"); strcpy(myw.weath_desc,"unknown"); http_msg *json_file = get_json(city, token, units); // Получаем данные о погоде в формате json if(json_file != NULL){ @@ -325,42 +317,42 @@ void set_lang() int main() { - win_pos = get_mouse_pos(0); // Получаем позицию курсора + win_pos = _ksys_get_mouse_pos(KSYS_MOUSE_SCREEN_POS); // Получаем позицию курсора if(!kolibri_libimg_init()){ // Загружаем libimg.obj notify_show("Libimg.obj not loaded!' -E"); exit(0); } - get_system_colors(&sys_color_table); // Получаем таблица цветов + _ksys_get_system_colors(&sys_color_table); // Получаем таблица цветов - char *City=NULL, *Token=NULL, *Units=NULL; // Указатели на токен, название города, систему мер + char *city=NULL, *token=NULL, *units=NULL; // Указатели на токен, название города, систему мер - get_config(&City, &Token, &Units); // Загружаем конфиг + get_config(&city, &token, &units); // Загружаем конфиг set_lang(); // Установить язык приложения - Update(City, Token, Units); + update(city, token, units); uint32_t (*event)(); - if(AutoUpdateTime<=0){ - event = get_os_event; + if(auto_update_time<=0){ + event = _ksys_get_event; }else{ - event = wait_for_event; + event = _ksys_wait_event; } while(1){ - switch(event(6000*AutoUpdateTime)){ // Получаем системное событие - case KOLIBRI_EVENT_NONE: // Нет события - Update(City, Token, Units); + switch(event(6000*auto_update_time)){ // Получаем системное событие + case KSYS_EVENT_NONE: // Нет события + update(city, token, units); debug_printf("Weather: Update\n"); break; - case KOLIBRI_EVENT_REDRAW: // Событие перерисовки - RedrawGUI(); + case KSYS_EVENT_REDRAW: // Событие перерисовки + redraw_gui(); break; - case KOLIBRI_EVENT_BUTTON: // Событие кнопок - switch (get_os_button()){ + case KSYS_EVENT_BUTTON: // Событие кнопок + switch (_ksys_get_button()){ case BTN_UPDATE: - Update(City, Token, Units); - RedrawGUI(); + update(city, token, units); + redraw_gui(); break; case BTN_QUIT: // Кнопка выхода exit(0);