void *_Malloc(long number,int type) { if (type==TT_ONLY && Sversion()<0x1900) return (void *)0; if (Sversion()>=0x1900) return Mxalloc(number,type); else return Malloc(number); }
void *Atari_SysMalloc(Uint32 size, Uint16 alloc_type) { /* Test if Mxalloc() available */ if (atari_mxalloc_avail<0) { atari_mxalloc_avail = ((Sversion()&0xFF)>=0x01) | (Sversion()>=0x1900); } if (atari_mxalloc_avail) { return (void *) Mxalloc(size, alloc_type); } else { \ return (void *) Malloc(size); } }
void init_os_info(void) { int16_t out[4]; long cookie_FSMC = 0; atari_sysinfo.gemdos_version = Sversion(); if( tos_getcookie (C_FSMC, &cookie_FSMC ) == C_FOUND ) { atari_sysinfo.gdos_FSMC = 1; } else { atari_sysinfo.gdos_FSMC = 0; } atari_sysinfo.large_sfont_pxh = 13; atari_sysinfo.medium_sfont_pxh = 6; atari_sysinfo.small_sfont_pxh = 4; /* todo: detect if system font is monospaced */ atari_sysinfo.sfont_monospaced = true; if( appl_xgetinfo(AES_LARGEFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ) { atari_sysinfo.large_sfont_pxh = out[0]; } if( appl_xgetinfo(AES_SMALLFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ) { atari_sysinfo.small_sfont_pxh = out[0]; } atari_sysinfo.aes_max_win_title_len = 79; if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { if (sys_NAES()) { atari_sysinfo.aes_max_win_title_len = 127; } if (sys_XAAES()) { atari_sysinfo.aes_max_win_title_len = 200; } } }
long _freeRam(int type) { int i; long adr[100],len,total=0; if (type==TT_ONLY && Sversion()<0x1900) return 0L; i=0; do { if (Sversion()>=0x1900) len=(long)Mxalloc(-1L,type); else len=(long)Malloc(-1L); if (len>0) { if (Sversion()>=0x1900) adr[i]=(long)Mxalloc(len,type); else adr[i]=(long)Malloc(len); if (adr[i]<0) { adr[i]=0; i=100; } else total+=len; i+=1; } adr[i]=0; } while (len>0 && i<100); i=0; while (adr[i]!=0) { Mfree((void *)adr[i]); adr[i++]=0; } return total; }
WORD get_file(WORD label) { WORD butn, ii; BYTE tmp_path[64], tmp_name[13]; if ( !sav_rcspath[0] ) get_defpath(tmp_path, "*.RSC"); else strcpy(tmp_path, sav_rcspath); tmp_name[0] = '\0'; #if GEMDOS if (Sversion() >= 0x0140) { LONG fs_label; fs_label = string_addr(label); fsel_exinput(ADDR(&tmp_path[0]), ADDR(&tmp_name[0]), &butn, (BYTE FAR *)fs_label); } else #endif fsel_input(ADDR(&tmp_path[0]), ADDR(&tmp_name[0]), &butn); graf_mouse(rcs_mform, 0x0L); if (butn) { if (!tmp_name[0]) if (hndl_alert(1, string_addr(NOFNAME)) == 1) return(FALSE); if (strcmp(sav_rcspath, tmp_path)) { #if GEMDOS Dsetpath((const char *)ADDR(tmp_path)); #else dos_chdir(ADDR(tmp_path)); #endif strcpy(sav_rcspath, tmp_path); } strcpy(rcs_rfile, &tmp_path[0]); for (ii = 0; rcs_rfile[ii] && rcs_rfile[ii] != '*'; ii++) ; rcs_rfile[ii - 1] = NULL; /* knock off slash */ strcat(rcs_rfile, "\\"); strcpy(&rsc_path[1], rcs_rfile); rsc_path[0] = strlen(rcs_rfile); strcat(rcs_rfile, &tmp_name[0]); /* Force 'rsc' extension on resource file.*/ r_to_xfile(rcs_rfile, "RSC"); r_to_xfile(rcs_dfile, "DFN"); return (TRUE); } /* if butn */ else return (FALSE); } /* get_file */