Aelia: upload pre alpha

git-svn-id: svn://kolibrios.org@6043 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-01-07 16:00:59 +00:00
parent 4f91b51e53
commit 4b8415c842
12 changed files with 800 additions and 0 deletions

View File

@ -0,0 +1,6 @@
if tup.getconfig("NO_CMM") ~= "" then return end
if tup.getconfig("LANG") == "ru"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
tup.rule("aelia.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "aelia.com")

View File

@ -0,0 +1,5 @@
C-- "aelia.c"
@del "aelia"
@rename "aelia.com" "aelia"
@del warning.txt
@pause

420
programs/cmm/aelia/aelia.c Normal file
View File

@ -0,0 +1,420 @@
#define MEMSIZE 4096*30
#include "../lib/font.h"
#include "../lib/io.h"
#include "../lib/gui.h"
#include "../lib/list_box.h"
#include "../lib/menu.h"
#include "../lib/obj/box_lib.h"
#include "../lib/obj/libini.h"
#include "../lib/obj/iconv.h"
#include "../lib/obj/proc_lib.h"
#include "../lib/obj/http.h"
#include "../lib/patterns/libimg_load_skin.h"
#include "../lib/patterns/simple_open_dialog.h"
#include "../lib/patterns/history.h"
#include "../browser/http_downloader.h"
#include "parse_address.h"
char default_dir[] = "/rd/1";
od_filter filter2 = {0,0};
char accept_language[]= "Accept-Language: ru\n";
#define TOOLBAR_H 36
#define TOOLBAR_ICON_WIDTH 26
#define TOOLBAR_ICON_HEIGHT 24
#define DEFAULT_EDITOR "/sys/tinypad"
#define DEFAULT_PREVIEW_PATH "/tmp0/1/aelia_preview.txt"
//ATTENTION: each page must have '\0' character at the end of the file
char buidin_page_home[] = FROM "buidin_pages\\home.htm";
char buidin_page_about[] = FROM "buidin_pages\\about.htm";
char buidin_page_not_found[] = FROM "buidin_pages\\not_found.htm";
#define UML 4096*2
scroll_bar scroll = { 15,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1};
llist list;
proc_info Form;
char title[4196];
enum {
OPEN_FILE,
MAGNIFY_MINUS,
MAGNIFY_PLUS,
CHANGE_ENCODING,
RUN_EDIT,
SHOW_INFO,
GO_BACK,
GO_FORWARD,
};
char address[UML]="http://";
int mouse_address_box;
edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,UML,#address,#mouse_address_box,2,19,19};
#include "ini.h"
#include "gui.h"
#include "prepare_page.h"
void InitDlls()
{
load_dll(boxlib, #box_lib_init, 0);
load_dll(libHTTP, #http_lib_init, 1);
load_dll(libio, #libio_init, 1);
load_dll(libimg, #libimg_init, 1);
//load_dll(libini, #lib_init, 1);
load_dll(iconv_lib, #iconv_open, 0);
load_dll(Proc_lib, #OpenDialog_init,0);
}
void main()
{
InitDlls();
OpenDialog_init stdcall (#o_dialog);
label.init(DEFAULT_FONT);
Libimg_LoadImage(#skin, abspath("toolbar.png"));
LoadIniSettings();
list.no_selection = true;
SetEventMask(10000000000000000000000001100111b);
loop()
{
switch(WaitEvent())
{
case evMouse:
HandleMouseEvent();
break;
case evKey:
HandleKeyEvent();
break;
case evButton:
HandleButtonEvent();
break;
case evReDraw:
if (menu.list.cur_y) {
encoding = menu.list.cur_y - 10;
debugln("evReDraw: charset changed");
EventOpenAddress(history.current());
}
draw_window();
}
}
}
void HandleButtonEvent()
{
byte btn = GetButtonID();
if (btn==1) {
SaveIniSettings();
ExitProcess();
}
switch(btn-10)
{
case GO_BACK:
EventGoBack();
break;
case GO_FORWARD:
EventGoForward();
break;
case OPEN_FILE:
EventOpenDialog();
break;
case MAGNIFY_PLUS:
EventMagnifyPlus();
break;
case MAGNIFY_MINUS:
EventMagnifyMinus();
break;
case CHANGE_ENCODING:
EventChangeEncoding();
break;
case RUN_EDIT:
EventRunEdit();
break;
case SHOW_INFO:
EventShowInfo();
break;
}
}
void HandleKeyEvent()
{
GetKeys();
switch (key_scancode)
{
case 059:
EventShowInfo();
return;
case SCAN_CODE_ENTER:
EventOpenAddress(#address);
return;
case SCAN_CODE_BS:
if (! address_box.flags & 0b10) {
EventGoBack();
return;
}
}
if (key_modifier & KEY_LCTRL) || (key_modifier & KEY_RCTRL) {
switch (key_scancode)
{
case 024: //O
EventOpenDialog();
break;
case SCAN_CODE_UP:
EventMagnifyPlus();
break;
case SCAN_CODE_DOWN:
EventMagnifyMinus();
break;
case 018: //E
EventRunEdit();
break;
case 035: //H
EventShowHistory();
break;
case SCAN_CODE_TAB:
EventChangeEncoding();
break;
}
return;
}
if (list.ProcessKey(key_scancode)) {
DrawPage();
return;
}
if (key_ascii != 0x0d)
&& (key_ascii != ASCII_KEY_PGDN)
&& (key_ascii != ASCII_KEY_PGUP) {
EAX = key_ascii << 8;
edit_box_key stdcall(#address_box);
}
}
void HandleMouseEvent()
{
edit_box_mouse stdcall (#address_box);
mouse.get();
list.wheel_size = 7;
if (list.MouseScroll(mouse.vert)) {
DrawPage();
return;
}
scrollbar_v_mouse (#scroll);
if (list.first != scroll.position) {
list.first = scroll.position;
DrawPage();
}
}
/* ----------------------------------------------------- */
void EventOpenDialog()
{
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) EventOpenAddress(#openfile_path);
}
void EventOpenAddress(dword _new_address)
{
char temp[UML];
if (!ESBYTE[_new_address]) return;
debugln("====================================");
debug("address: ");
debugln(_new_address);
strlcpy(#address, _new_address, UML);
strlwr(#address);
DrawAddressBox();
/*
There could be several possible types of addresses:
- build in page
- local file
- url
So we need to detect what incoming address is
and then halndle it in the propper way.
*/
io.buffer_data = 0;
// - build in page
if (!strncmp(#address,"aelia:",6)) {
debugln("this is buildin page");
if (!strcmp(#address,"aelia:home")) io.buffer_data = #buidin_page_home;
if (!strcmp(#address,"aelia:about")) io.buffer_data = #buidin_page_about;
if (!strcmp(#address,"aelia:history")) io.buffer_data = MakePageWithHistory();
}
// - local file
else if (check_is_the_adress_local(#address)==true) {
debugln("this is local address");
io.read(#address);
}
// - url
else {
debugln("this is url");
if (strncmp(#address,"http://",7)!=0) {
strcpy(#temp, "http://");
strlcpy(#temp, #address, UML);
strlcpy(#address, #temp, UML);
DrawAddressBox();
}
if (!downloader.Start(#address)) {
downloader.Stop();
} else {
while (downloader.state!=STATE_COMPLETED)
{
downloader.MonitorProgress();
if (downloader.data_full_size>0)
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT-STEP_1_DOWNLOAD_PAGE*downloader.data_downloaded_size/downloader.data_full_size);
else
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT-STEP_1_DOWNLOAD_PAGE/2);
}
io.buffer_data = downloader.bufpointer;
}
}
if (!io.buffer_data) {
debugln("page not found");
io.buffer_data = #buidin_page_not_found;
}
history.add(#address);
/*
Great! So we have the page in our buffer.
We don't know is it a plain text or html.
So we need to parse it and draw.
*/
list.KeyHome();
list.ClearList();
PreparePage();
}
void EventMagnifyPlus()
{
label.size.pt++;
if(!label.changeSIZE())
label.size.pt--;
else
PreparePage();
}
void EventMagnifyMinus()
{
label.size.pt--;
if(!label.changeSIZE())
label.size.pt++;
else
PreparePage();
}
void EventRunEdit()
{
if (check_is_the_adress_local(history.current())==true) {
io.run(DEFAULT_EDITOR, history.current());
}
else {
//io.write(strlen(io.buffer_data), io.buffer_data, DEFAULT_PREVIEW_PATH); // <--- doesn't work, smth odd, need to check
WriteFile(strlen(io.buffer_data), io.buffer_data, DEFAULT_PREVIEW_PATH);
io.run(DEFAULT_EDITOR, DEFAULT_PREVIEW_PATH);
}
}
void EventChangeEncoding()
{
menu.selected = encoding + 1;
menu.show(Form.left+Form.cwidth-97,Form.top+TOOLBAR_H+skin_height-6, 130, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10);
}
void EventShowInfo() {
EventOpenAddress("aelia:about");
}
void EventShowHistory()
{
EventOpenAddress("aelia:history");
}
void EventGoBack()
{
if (history.back()) EventOpenAddress(history.current());
}
void EventGoForward()
{
if (history.forward()) EventOpenAddress(history.current());
}
/* ------------------------------------------- */
void draw_window()
{
DefineAndDrawWindow(Form.left,Form.top,Form.width,Form.height,0x73,0,#title);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) return;
if (Form.width < 200) { MoveSize(OLD,OLD,200,OLD); return; }
if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); return; }
DrawBar(0, 0, Form.cwidth, TOOLBAR_H - 2, 0xe1e1e1);
DrawBar(0, TOOLBAR_H - 2, Form.cwidth, 1, 0xcecece);
DrawBar(0, TOOLBAR_H - 1, Form.cwidth, 1, 0x7F7F7F);
DrawToolbarButton(GO_BACK, 8);
DrawToolbarButton(GO_FORWARD, 33);
DrawToolbarButton(OPEN_FILE, 68);
DrawToolbarButton(MAGNIFY_PLUS, Form.cwidth - 161);
DrawToolbarButton(MAGNIFY_MINUS, Form.cwidth - 136);
DrawToolbarButton(CHANGE_ENCODING, Form.cwidth - 102);
DrawToolbarButton(RUN_EDIT, Form.cwidth - 68);
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34);
DrawAddressBox();
if ((Form.cwidth-scroll.size_x-1 == list.w) &&
(Form.cheight-TOOLBAR_H == list.h) &&
(list.count)
)
{
DrawPage();
}
else
{
if (!label.raw) { //this code need to be run
if (param) EventOpenAddress(#param); //only once at browser sturtup
else EventOpenAddress("aelia:home");
}
else PreparePage();
}
DrawRectangle(scroll.start_x, scroll.start_y, scroll.size_x, scroll.size_y-1, scroll.bckg_col);
}
void DrawPage()
{
list.CheckDoesValuesOkey();
if (list.count) _PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + label.raw);
DrawScroller();
}
void DrawAddressBox()
{
address_box.left = 97;
address_box.top = 11;
address_box.width = Form.cwidth - address_box.left - 172;
DrawRectangle(address_box.left-4, address_box.top-5, address_box.width+6, 23, 0x8C8C8C);
DrawWideRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 21, 4, address_box.color);
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#address);
address_box.offset = 0;
edit_box_draw stdcall(#address_box);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

75
programs/cmm/aelia/gui.h Normal file
View File

@ -0,0 +1,75 @@
void DrawToolbarButton(char image_id, int x)
{
DefineButton(x+1, 7, TOOLBAR_ICON_WIDTH-2, TOOLBAR_ICON_HEIGHT-2, 10+image_id + BT_HIDE, 0);
img_draw stdcall(skin.image, x, 6, TOOLBAR_ICON_WIDTH, TOOLBAR_ICON_HEIGHT, 0, image_id*TOOLBAR_ICON_HEIGHT);
}
void DrawScroller()
{
scroll.max_area = list.count;
scroll.cur_area = list.visible;
scroll.position = list.first;
scroll.all_redraw = 0;
scroll.start_x = list.x + list.w;
scroll.start_y = list.y;
scroll.size_y = list.h;
scroll.start_x = list.x + list.w;
scrollbar_v_draw(#scroll);
}
dword MakePageWithHistory()
{
int i;
static dword history_page;
if (history_page) free(history_page);
history_page = malloc(history.items.data_size+256);
strcat(history_page, "<html><head><title>History</title></head><body>\n<h1>History</h1>\n");
strcat(history_page, "<h2>Visited pages</h2><br>\n");
for (i=0; i<history.items.count; i++)
{
strcat(history_page, "<a href='");
strcat(history_page, history.items.get(i));
strcat(history_page, "'>");
strcat(history_page, history.items.get(i));
strcat(history_page, "</a><br>\n");
}
return history_page;
}
enum {
STEP_1_DOWNLOAD_PAGE = 0,
STEP_2_COUNT_PAGE_HEIGHT = 30,
STEP_3_DRAW_PAGE_INTO_BUFFER = 60,
STEP_4_SMOOTH_FONT = 94,
STEP_5_STOP = 100,
};
void DrawProgress(int percent)
{
int progress_width;
if (percent<100) {
progress_width = address_box.width+5*percent/100;
DrawBar(address_box.left-3, address_box.top+16, progress_width, 2, 0x72B7EA);
//debugi(percent);
}
else {
progress_width = address_box.width+5;
DrawBar(address_box.left-3, address_box.top+16, progress_width, 2, 0xFFFfff);
}
}
int progress_percent;
void DrawProgressWhileDrawing(dword bufoff, buflen)
{
int progress_cur = bufoff - io.buffer_data;
int progress_max = buflen - io.buffer_data;
int new_progress_percent = STEP_4_SMOOTH_FONT-STEP_3_DRAW_PAGE_INTO_BUFFER*progress_cur/progress_max + STEP_3_DRAW_PAGE_INTO_BUFFER;
if (progress_percent != new_progress_percent) {
progress_percent = new_progress_percent;
DrawProgress(progress_percent);
}
}

34
programs/cmm/aelia/ini.h Normal file
View File

@ -0,0 +1,34 @@
char ini_path[4096];
char config_section[] = "Config";
int encoding;
void LoadIniSettings()
{
label.size.pt = 14;
encoding = CH_CP866;
Form.left = 150;
Form.top = 50;
Form.width = 640;
Form.height = 560;
/*
strcpy(#ini_path, "/sys/settings/treader.ini");
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); label.size.pt = EAX;
ini_get_int stdcall (#ini_path, #config_section, "Encoding", CH_CP866); encoding = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinX", 150); Form.left = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinY", 50); Form.top = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinW", 640); Form.width = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinH", 560); Form.height = EAX;
*/
}
void SaveIniSettings()
{
/*
ini_set_int stdcall (#ini_path, #config_section, "FontSize", label.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "Encoding", encoding);
ini_set_int stdcall (#ini_path, #config_section, "WinX", Form.left);
ini_set_int stdcall (#ini_path, #config_section, "WinY", Form.top);
ini_set_int stdcall (#ini_path, #config_section, "WinW", Form.width);
ini_set_int stdcall (#ini_path, #config_section, "WinH", Form.height);
*/
}

View File

@ -0,0 +1,74 @@
int check_is_the_adress_local(dword _in)
{
if(!strncmp(_in,"/sys/",5)) return true;
if(!strncmp(_in,"/hd/",4)) return true;
if(!strncmp(_in,"/fd/",4)) return true;
if(!strncmp(_in,"/rd/",4)) return true;
if(!strncmp(_in,"/tmp/",5)) return true;
if(!strncmp(_in,"/cd/",4)) return true;
if(!strncmp(_in,"/bd/",4)) return true;
if(!strncmp(_in,"/usbhd/",7)) return true;
if(!strncmp(_in,"/kolibrios/",11)) return true;
return false;
}
/*
int check_is_the_url_absolute(dword in)
{
if(!strncmp(_in,"http:",5)) return true;
if(!strncmp(_in,"https:",6)) return true;
if(!strncmp(_in,"ftp:",4)) return true;
}
void GetAbsoluteURL(dword in_URL)
{
int i;
dword orig_URL = in_URL;
char newurl[UML];
while (i=strstr(in_URL, "&amp;"))
{
strcpy(i+1, i+5);
}
if (UrlIsAbsolute(in_URL)) return;
IF (!strcmpn(in_URL,"./", 2)) in_URL+=2;
if (!http_transfer)
{
strcpy(#newurl, History.current());
}
else
{
strcpy(#newurl, History.items.get(History.active-2));
}
if (ESBYTE[in_URL] == '/') //remove everything after site domain name
{
i = strchr(#newurl+8, '/');
if (i) ESBYTE[i]=0;
in_URL+=1;
}
_CUT_ST_LEVEL_MARK:
if (newurl[strrchr(#newurl, '/')-2]<>'/')
{
newurl[strrchr(#newurl, '/')] = 0x00;
}
IF (!strncmp(in_URL,"../",3))
{
in_URL+=3;
newurl[strrchr(#newurl, '/')-1] = 0x00;
goto _CUT_ST_LEVEL_MARK;
}
if (newurl[strlen(#newurl)-1]<>'/') strcat(#newurl, "/");
strcat(#newurl, in_URL);
strcpy(orig_URL, #newurl);
}
*/

View File

@ -0,0 +1,185 @@
char char_width[255];
void PreparePage()
{
int i;
list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1, Form.cheight-TOOLBAR_H, label.size.pt+1);
//get font chars width, need to increase performance
//if (strstri(io.buffer_data, "<html>")==-1) {
debugln("no <html> found");
label.changeSIZE();
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i);
ChangeCharset(charsets[encoding], "CP866", io.buffer_data);
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT); ParceTxt(false); //get page height to calculate buffer size
DrawProgress(STEP_3_DRAW_PAGE_INTO_BUFFER); ParceTxt(true); //draw text in buffer
DrawProgress(STEP_4_SMOOTH_FONT); label.apply_smooth();
DrawProgress(STEP_5_STOP); DrawPage();
/*}
else {
debugln("<html> tag found");
label.changeSIZE();
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i);
ChangeCharset(charsets[encoding], "CP866", io.buffer_data);
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT); ParceHtml(false); //get page height to calculate buffer size
DrawProgress(STEP_3_DRAW_PAGE_INTO_BUFFER); ParceHtml(true); //draw text in buffer
DrawProgress(STEP_4_SMOOTH_FONT); label.apply_smooth();
DrawProgress(STEP_5_STOP); DrawPage();
}*/
}
void ParceTxt(byte draw)
{
byte ch, zeroch=0;
dword bufoff, buflen, line_start, srch_pos;
int stroka_y=5, line_length=0;
line_start=io.buffer_data;
buflen = strlen(io.buffer_data) + io.buffer_data;
for (bufoff=io.buffer_data; bufoff<buflen; bufoff++)
{
ch = ESBYTE[bufoff];
line_length += char_width[ch];
if (line_length>=list.w-30) || (ch==10) {
srch_pos = bufoff;
loop()
{
if (__isWhite(ESBYTE[srch_pos])) { bufoff=srch_pos+1; break; } //normal word-break
if (srch_pos == line_start) break; //no white space found in whole line
srch_pos--;
}
if (draw==true) {
ESBYTE[bufoff] >< zeroch; //set line end
label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, line_start);
ESBYTE[bufoff] >< zeroch; //restore line
DrawProgressWhileDrawing(bufoff, buflen);
if (stroka_y/list.item_h-list.first==list.visible) DrawPage();
}
stroka_y += list.item_h;
line_start = bufoff;
line_length = 0;
}
}
if (draw==false) {
list.count = stroka_y/list.item_h+2;
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+1*list.item_h;
label.raw_size = 0;
}
if (draw==true) label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, line_start);
}
/*========================================================
= =
= HTML =
= =
========================================================*/
/*
HTML parcer tags:
<title>
<meta encoding>
<a hrf="">
<img src="" alt="">
<h1> ... <h6>
<b>
<u>
<s>
<pre>
*/
struct _DOM {
dword start;
dword end;
dword len;
};
struct _style {
bool b, u, i, s;
bool h1, h2, h3, h4, h5, h6;
bool a;
bool pre;
bool title;
bool br;
} style;
struct _tag {
dword start;
dword name;
dword param[10];
dword value[10];
void parce();
void get_param_value();
};
void _tag::parce()
{
bool closed_status = false;
if (start) debugln(start);
/*
if (strncmp(start, "/", 1)==0) {
start++;
closed_status = true;
}
if (!strcmp(start, "title")) style.title = closed_status;
if (!strcmp(start, "br")) style.br = closed_status;
*/
}
struct _text {
dword start;
int x, y;
void draw();
};
void _text::draw()
{
if (start) debugln(start);
/*
if (style.title) {
strlcpy(#title, start, sizeof(title));
DrawTitle(#title);
return;
}
if (style.br) {
y += list.item_h;
style.br = false;
}
*/
}
void ParceHtml(byte draw)
{
byte ch;
_DOM DOM;
_text text;
_tag tag;
dword DOM_pos;
/* Create DOM */
debugln("starting DOM parce");
DOM.len = strlen(io.buffer_data);
DOM.start = malloc(DOM.len);
DOM.end = DOM.start + DOM.len;
strlcpy(DOM.start, io.buffer_data, DOM.len);
/* Parce DOM */
text.start = DOM_pos;
for (DOM_pos=DOM.start; DOM_pos<DOM.end; DOM_pos++)
{
ch = ESBYTE[DOM_pos];
if (ch=='<') {
ESBYTE[DOM_pos] = NULL;
tag.start = DOM_pos + 1;
text.draw();
}
if (ch=='>') {
ESBYTE[DOM_pos] = NULL;
text.start = DOM_pos + 1;
tag.parce();
}
}
free(DOM.start);
ExitProcess();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -5,3 +5,4 @@ else C_LANG = "LANG_ENG" -- this includes default case without config
end end
tup.rule("example.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "example.com") tup.rule("example.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "example.com")
tup.rule("collections.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "collections.com") tup.rule("collections.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "collections.com")
tup.rule("menu.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "menu.com")