void Log_Notice(char *Ident, char *Message, ...);
void Log_Log(char *Ident, char *Message, ...);
void Log_Debug(char *Ident, char *Message, ...);
-//static Uint64 Log_Int_GetIdent(const char *Str);
// === EXPORTS ===
-EXPORT(Log_KernelPanic);
EXPORT(Log_Panic);
EXPORT(Log_Error);
EXPORT(Log_Warning);
WM_SetFlags(NULL, 0);
- // Create Sidebar
+ // -- Create Sidebar --
gpInterface_Sidebar = WM_CreateElement(NULL, ELETYPE_TOOLBAR, ELEFLAG_VERTICAL);
WM_SetSize( gpInterface_Sidebar, giInterface_Width );
- // Create Main Area and regions within
- gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
- gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
- gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
- gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
- // Main segment of the "taskbar"
+ // --- Top segment ---
area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL);
- // Menu Button
- btn = WM_CreateElement(area, ELETYPE_BUTTON, ELEFLAG_NOEXPAND);
+ // ---- Menu Button ----
+ btn = WM_CreateElement(area, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH);
WM_SetSize(btn, giInterface_Width);
//text = WM_CreateElement(btn, ELETYPE_IMAGE, ELEFLAG_SCALE);
//WM_SetText(text, "asset://LogoSmall.sif");
text = WM_CreateElement(btn, ELETYPE_TEXT, 0);
WM_SetText(text, "Acess");
- // Plain <hr/> style spacer
+ // ---- Plain <hr/> style spacer ----
WM_CreateElement(area, ELETYPE_SPACER, 0);
// Windows Go Here
- // Bottom Segment
+ // --- Bottom Segment ---
area = WM_CreateElement(gpInterface_Sidebar, ELETYPE_BOX, ELEFLAG_VERTICAL|ELEFLAG_ALIGN_END);
- // Plain <hr/> style spacer
+ // ---- Plain <hr/> style spacer ----
WM_CreateElement(area, ELETYPE_SPACER, 0);
- // Version String
+ // ---- Version String ----
text = WM_CreateElement(area, ELETYPE_TEXT, ELEFLAG_WRAP);
WM_SetText(text, "AxWin 1.0");
+
+ // -- Create Main Area and regions within --
+ gpInterface_MainArea = WM_CreateElement(NULL, ELETYPE_BOX, ELEFLAG_VERTICAL);
+ gpInterface_HeaderBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
+ gpInterface_TabBar = WM_CreateElement(gpInterface_MainArea, ELETYPE_TABBAR, 0);
+ gpInterface_TabContent = WM_CreateElement(gpInterface_MainArea, ELETYPE_BOX, 0);
}
void Interface_Update(void)
// Pass 2 - Set sizes and recurse
for( child = Element->FirstChild; child; child = child->NextSibling )
{
- // Cross Size
- if( child->FixedCross ) {
- if( Element->Flags & ELEFLAG_VERTICAL )
- child->CachedW = child->FixedCross;
- else
- child->CachedH = child->FixedCross;
- }
- else {
- int cross;
- _SysDebug("%p,%p ->MinCross = %i", Element, child, child->MinCross);
- // Expand to fill?
- // TODO: Extra flag so options are (Expand, Equal, Wrap)
- if( child->Flags & ELEFLAG_NOEXPAND )
- cross = child->MinCross;
- else
- cross = fullCross;
-
- _SysDebug("%p,%p - cross = %i", Element, child, cross);
-
- if( Element->Flags & ELEFLAG_VERTICAL )
- child->CachedW = cross;
- else
- child->CachedH = cross;
- }
+ int cross, with;
- // With size
- if( child->FixedWith ) {
- if( Element->Flags & ELEFLAG_VERTICAL )
- child->CachedH = child->FixedWith;
- else
- child->CachedW = child->FixedWith;
- }
- else {
- if( Element->Flags & ELEFLAG_VERTICAL )
- child->CachedH = dynWith;
- else
- child->CachedW = dynWith;
- }
+ _SysDebug("%p,%p ->MinCross = %i", Element, child, child->MinCross);
+
+
+ // --- Cross Size ---
+ if( child->FixedCross )
+ cross = child->FixedCross;
+ // Expand to fill?
+ // TODO: Extra flag so options are (Expand, Equal, Wrap)
+ else if( child->Flags & ELEFLAG_NOEXPAND )
+ cross = child->MinCross;
+ else
+ cross = fullCross;
+ _SysDebug("%p,%p - cross = %i", Element, child, cross);
+ if( Element->Flags & ELEFLAG_VERTICAL )
+ child->CachedW = cross;
+ else
+ child->CachedH = cross;
+
+ // --- With Size ---
+ if( child->FixedWith)
+ with = child->FixedWith;
+ else if( child->Flags & ELEFLAG_NOSTRETCH )
+ with = child->MinWith;
+ else
+ with = dynWith;
+ _SysDebug("%p,%p - with = %i", Element, child, with);
+ if( Element->Flags & ELEFLAG_VERTICAL )
+ child->CachedH = with;
+ else
+ child->CachedW = with;
WM_UpdateDimensions(child, 0);
}
* its parent) as is needed to encase the contents of the element.
* Otherwise, the element will expand to fill all avaliable space.
*/
- ELEFLAG_NOEXPAND = 0x040, // ELEFLAG_EXPAND = 0x000
+ ELEFLAG_NOEXPAND = 0x040,
+
+ ELEFLAG_NOSTRETCH = 0x080,
/**
* \brief Center alignment
*/
- ELEFLAG_ALIGN_CENTER= 0x080,
+ ELEFLAG_ALIGN_CENTER= 0x100,
/**
* \brief Right/Bottom alignment
*/
- ELEFLAG_ALIGN_END = 0x100
+ ELEFLAG_ALIGN_END = 0x200
};
/**
ASFLAGS = -felf
CPPFLAGS = -I$(ACESSDIR)/Usermode/include/
-CFLAGS = -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS)
-LDFLAGS = -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L.. -lacess
+CFLAGS = -g -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS)
+LDFLAGS = -g -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L.. -lacess
$(BIN): $(OBJ)
$(LD) $(LDFLAGS) -o $(BIN) $(OBJ)
- @$(OBJDUMP) -d $(BIN) > $(BIN).dsm
+ @$(OBJDUMP) -d -S $(BIN) > $(BIN).dsm
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
#define _stdout 1\r
\r
// === PROTOTYPES ===\r
-EXPORT void itoa(char *buf, uint64_t num, int base, int minLength, char pad, int bSigned);\r
+EXPORT void itoa(char *buf, uint64_t num, uint base, int minLength, char pad, int bSigned);\r
struct sFILE *get_file_struct();\r
\r
// === GLOBALS ===\r
*/\r
EXPORT int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list args)\r
{\r
- char tmp[33];\r
+ char tmp[65];\r
int c, minSize;\r
int pos = 0;\r
char *p;\r
buf[pos+2] = 'x';\r
}\r
pos += 3;\r
+ arg = va_arg(args, uint32_t);\r
+ itoa(tmp, arg, 16, minSize, pad, 0);\r
+ goto sprintf_puts;\r
// Fall through to hex\r
// Unsigned Hexadecimal\r
case 'x':\r
p = (void*)(intptr_t)arg;\r
sprintf_puts:\r
if(!p) p = "(null)";\r
+ //_SysDebug("vsnprintf: p = '%s'", p);\r
if(buf) {\r
while(*p) {\r
if(pos < __maxlen) buf[pos] = *p;\r
}\r
if(buf && pos < __maxlen) buf[pos] = '\0';\r
\r
+ //_SysDebug("vsnprintf: buf = '%s'", buf);\r
+ \r
return pos;\r
}\r
\r
* \fn static void itoa(char *buf, uint64_t num, int base, int minLength, char pad, int bSigned)\r
* \brief Convert an integer into a character string\r
*/\r
-EXPORT void itoa(char *buf, uint64_t num, int base, int minLength, char pad, int bSigned)\r
+EXPORT void itoa(char *buf, uint64_t num, size_t base, int minLength, char pad, int bSigned)\r
{\r
- char tmpBuf[32];\r
+ char tmpBuf[64];\r
int pos=0, i;\r
\r
if(!buf) return;\r
- if(base > 16) {\r
+ if(base > 16 || base < 2) {\r
buf[0] = 0;\r
return;\r
}\r
bSigned = 0;\r
\r
while(num > base-1) {\r
- tmpBuf[pos] = cUCDIGITS[ num % base ];\r
- num = (long) num / base; // Shift {number} right 1 digit\r
- pos++;\r
+ tmpBuf[pos++] = cUCDIGITS[ num % base ];\r
+ num = (uint64_t) num / (uint64_t)base; // Shift {number} right 1 digit\r
}\r
\r
tmpBuf[pos++] = cUCDIGITS[ num % base ]; // Last digit of {number}\r
if(bSigned) tmpBuf[pos++] = '-'; // Append sign symbol if needed\r
+ \r
i = 0;\r
minLength -= pos;\r
while(minLength-- > 0) buf[i++] = pad;\r
*/
uint64_t __udivdi3(uint64_t Num, uint64_t Den)
{
+ #if 0
uint64_t ret = 0;
if(Den == 0) // Call Div by Zero Error
__asm__ __volatile__ ("int $0");
+
+ if(Den == 1) return Num;
+ if(Den == 2) return Num >> 1;
+ if(Den == 4) return Num >> 2;
+ if(Den == 8) return Num >> 3;
+ if(Den == 16) return Num >> 4;
+ if(Den == 32) return Num >> 5;
+ if(Den == 64) return Num >> 6;
+ if(Den == 128) return Num >> 7;
+ if(Den == 256) return Num >> 8;
+
while(Num > Den) {
ret ++;
Num -= Den;
}
return ret;
+ #else
+ uint64_t P[64], q, n;
+ int i;
+
+ if(Den == 0) __asm__ __volatile__ ("int $0x0");
+ // Common speedups
+ if(Den == 1) return Num;
+ if(Den == 2) return Num >> 1;
+ if(Den == 16) return Num >> 4;
+
+
+ // Non-restoring division, from wikipedia
+ // http://en.wikipedia.org/wiki/Division_(digital)
+ P[0] = Num;
+ for( i = 0; i < 64; i ++ )
+ {
+ if( P[i] >= 0 ) {
+ q |= (uint64_t)1 << (63-i);
+ P[i+1] = 2*P[i] - Den;
+ }
+ else {
+ //q |= 0 << (63-i);
+ P[i+1] = 2*P[i] + Den;
+ }
+ }
+
+ n = ~q;
+ n = -n;
+ q += n;
+
+ return q;
+ #endif
}
/**
*/
uint64_t __umoddi3(uint64_t Num, uint64_t Den)
{
- if(Den == 0) // Call Div by Zero Error
- __asm__ __volatile__ ("int $0");
- while(Num >= Den)
- Num -= Den;
+ #if 0
+ if(Den == 0) __asm__ __volatile__ ("int $0"); // Call Div by Zero Error
+
+ if(Den == 1) return 0;
+ if(Den == 2) return Num & 0x01;
+ if(Den == 4) return Num & 0x03;
+ if(Den == 8) return Num & 0x07;
+ if(Den == 16) return Num & 0x0F;
+ if(Den == 32) return Num & 0x1F;
+ if(Den == 64) return Num & 0x3F;
+ if(Den == 128) return Num & 0x3F;
+ if(Den == 256) return Num & 0x7F;
+
+ while(Num >= Den) Num -= Den;
+
return Num;
+ #else
+ if(Den == 0) __asm__ __volatile__ ("int $0"); // Call Div by Zero Error
+ // Speedups for common operations
+ if(Den == 1) return 0;
+ if(Den == 2) return Num & 0x01;
+ if(Den == 16) return Num & 0x0F;
+ return Num - __udivdi3(Num, Den) * Den;
+ #endif
}