projects
/
henge
/
webcc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Lexer actually lexes filenames now, and odats are made out of mapvariants
[henge/webcc.git]
/
src
/
apc
/
irmem.c
diff --git
a/src/apc/irmem.c
b/src/apc/irmem.c
index
3716d59
..
415399c
100644
(file)
--- a/
src/apc/irmem.c
+++ b/
src/apc/irmem.c
@@
-11,7
+11,7
@@
struct cdat*
alloc_cdat(void);
struct odat*
alloc_odat(void);
alloc_cdat(void);
struct odat*
alloc_odat(void);
-void
+struct vdat*
alloc_vdat(void);
struct link*
alloc_link(void);
alloc_vdat(void);
struct link*
alloc_link(void);
@@
-23,6
+23,8
@@
struct odat*
curr_odat(void);
struct vdat*
curr_vdat(void);
curr_odat(void);
struct vdat*
curr_vdat(void);
+struct map*
+curr_map(void);
struct set*
curr_set(void);
struct ref*
struct set*
curr_set(void);
struct ref*
@@
-41,7
+43,7
@@
struct chunk_stack
void* dsp[MAX_CHUNKS]; //dat stack pointer (per chunk)
int chunk_size; //size of a chunk (including its forfeited page)
int max_dats; //number of dats per chunk for this stack
void* dsp[MAX_CHUNKS]; //dat stack pointer (per chunk)
int chunk_size; //size of a chunk (including its forfeited page)
int max_dats; //number of dats per chunk for this stack
-} ocs, vcs, ccs, rcs, lcs, pcs
; //odat, vdat, and cdat
, ref, link, post stacks
+} ocs, vcs, ccs, rcs, lcs, pcs
, mcs; //odat, vdat, cdat,map
, ref, link, post stacks
//type safety handled by macro expansion (do not call these directly from code, make dependent macros for access to these)
#define CHUNKS_LEN(STACK) ((STACK).csp - (STACK).chunks)
//type safety handled by macro expansion (do not call these directly from code, make dependent macros for access to these)
#define CHUNKS_LEN(STACK) ((STACK).csp - (STACK).chunks)
@@
-80,6
+82,11
@@
struct chunk_stack
#define CDAT_FULL() (DATA_FULL(ccs, struct cdat))
#define CDAT_ALLOC() (ALLOC_DAT(ccs, struct cdat))
#define CCS_FULL() (CHUNKS_FULL(ccs))
#define CDAT_FULL() (DATA_FULL(ccs, struct cdat))
#define CDAT_ALLOC() (ALLOC_DAT(ccs, struct cdat))
#define CCS_FULL() (CHUNKS_FULL(ccs))
+#define INIT_MAP() (INIT_STACK(mcs, struct map))
+#define CURRENT_MAP() (CURRENT_DATP(mcs, struct map))
+#define MAP_FULL() (DATA_FULL(mcs, struct map))
+#define MAP_ALLOC() (ALLOC_DAT(mcs, struct map))
+#define MCS_FULL() (CHUNKS_FULL(mcs))
#define INIT_LINK() (INIT_STACK(lcs, struct link))
#define CURRENT_LINK() (CURRENT_DATP(lcs,struct link))
#define LDAT_FULL() (DATA_FULL(lcs, struct link))
#define INIT_LINK() (INIT_STACK(lcs, struct link))
#define CURRENT_LINK() (CURRENT_DATP(lcs,struct link))
#define LDAT_FULL() (DATA_FULL(lcs, struct link))
@@
-98,10
+105,10
@@
struct chunk_stack
#define RCS_FULL() (CHUNKS_FULL(rcs))
//Metadata
#define CURRENT_SET() (CURRENT_CDAT()->set_list[CURRENT_CDAT()->num_sets])
#define RCS_FULL() (CHUNKS_FULL(rcs))
//Metadata
#define CURRENT_SET() (CURRENT_CDAT()->set_list[CURRENT_CDAT()->num_sets])
-#define CURRENT_MODEL() (CURRENT_VDAT()->model_list[CURRENT_VDAT()->num_models])
+//#define CURRENT_QUAD() (CURRENT_MAP()->quad_list[CURRENT_MAP()->num_quads])
+//#define CURRENT_MODEL() (CURRENT_VDAT()->model_list[CURRENT_VDAT()->num_models])
-#define CURR_QUAD (CURR_ODAT->quad_file)
long pagesize;
long pagesize;
@@
-114,8
+121,10
@@
int num_odats = 0;
int num_vdats = 0;
int num_vdats = 0;
+int num_maps = 0;
+
int num_refs = 0;
int num_refs = 0;
-
uint64_t ss_ref_id = 0x00
FFFFFF; /* system space for ref_ids */
+
int ss_ref_id = 0x0F
FFFFFF; /* system space for ref_ids */
int num_posts = 0;
int num_posts = 0;
@@
-133,10
+142,12
@@
ir_init()
INIT_CDAT();
*cdat_stackp = CURRENT_CDAT();
INIT_CDAT();
*cdat_stackp = CURRENT_CDAT();
+
memmove((*cdat_stackp)->name, root, 32);
INIT_ODAT();
INIT_VDAT();
memmove((*cdat_stackp)->name, root, 32);
INIT_ODAT();
INIT_VDAT();
+ INIT_MAP();
INIT_LINK();
INIT_REF();
INIT_POST();
INIT_LINK();
INIT_REF();
INIT_POST();
@@
-201,7
+212,7
@@
struct odat*
alloc_odat
()
{
alloc_odat
()
{
- num_odats++;
+
num_odats++;
if(ODAT_FULL())
{ if(!OCS_FULL())
{ fprintf(stderr, "You have allocated to many (%d) odats ", num_odats);
if(ODAT_FULL())
{ if(!OCS_FULL())
{ fprintf(stderr, "You have allocated to many (%d) odats ", num_odats);
@@
-216,7
+227,7
@@
alloc_odat
return CURRENT_ODAT();
}
return CURRENT_ODAT();
}
-void
+struct vdat*
alloc_vdat
()
{ num_vdats++;
alloc_vdat
()
{ num_vdats++;
@@
-230,8
+241,29
@@
alloc_vdat
}
else
VDAT_ALLOC();
}
else
VDAT_ALLOC();
+
+ return CURRENT_VDAT();
+}
+
+struct map*
+alloc_map
+()
+{ num_maps++;
+ if(MAP_FULL())
+ { if(!MCS_FULL())
+ { fprintf(stderr, "You have allocated to many (%d) maps ", num_maps);
+ exit(EXIT_FAILURE);
+ }
+ else
+ CSP_PUSH(mcs);
+ }
+ else
+ MAP_ALLOC();
+
+ return CURRENT_MAP();
}
}
+
struct link*
alloc_link
()
struct link*
alloc_link
()
@@
-322,9
+354,21
@@
curr_ref
{
return CURRENT_REF();
}
{
return CURRENT_REF();
}
-struct m
odel
*
-curr_m
odel
+struct m
ap
*
+curr_m
ap
()
{
()
{
- return
&CURRENT_MODEL
();
+ return
CURRENT_MAP
();
}
}
+/* struct quad* */
+/* curr_quad */
+/* () */
+/* { */
+/* return &CURRENT_QUAD(); */
+/* } */
+/* struct model* */
+/* curr_model */
+/* () */
+/* { */
+/* return &CURRENT_MODEL(); */
+/* } */