JUMPIFA ... %if name == 0 ... is testing ADDR(name) against ADDR(0) - need to pick out PUSHI 0 as a special case. ---------------------------------------------------------------------------- test218: record (*) name in first param list is picking up a DEF from the perms, maybe entry #0? #include // Edinburgh IMP77 Compiler - Version 8.4 // // 1 ! // 2 ! specs for deimos perm routines // 3 ! // 4 %externalroutinespec pon(%record(*) %name p) extern void PON(struct FILE *P); ---------------------------------------------------------------------------- a string(*) array does not man a string (255) array. It is not an array of pointers, it is an array of string bodies of arbitrary (but all the same) size. // 5 %routine %spec STRINGSORT(%string(*)%array %name X, // 6+ %integer F, T) Add #line on every generated line so that the decode program can interleave the imp source correctly (and so that diags will work once I add them...) (which requires fixing the copying of .line in tuples which also messes up the current crude inclusion of the imp source in the generated C) anything with %name passing arrays with >= 2 dimensions as parameters getting string types correct for %result = and %result == some problems with passing string value parameters when max length doesn't match. Change _imp_string to a union and assign/retrieve different fields as in *({ _imp_string tmp; tmp.s32 = function(); &tmp.s15; }) ? related to both of the above: string array initialisation ... _imp_str_literal macro not compatible. The trick of using anonymous procedures to allow %begin/%end blocks to implement %return by using C's "return;" statement fails when there is a jump from outside the block into the block :-( No way around that other than mapping %begin/%end blocks to "{ ... }" blocks in C, which means that %return has to be mapped to a jump to the %end ... order of array indices and subtracting base values from them are opposite! DONE default or missing case labels - dispatch code to be added at end of procedures DONE converting %begin/%end blocks into anonymous parameterless procedures DONE add a new structtype to handle %name variables and parameters, needs dope vectors for arrays at runtime. 1-D arrays can be handled with an offset but N-D arrays definitely need a dopevector when passed to procedures. (although we do have the option of creating slices pointing to each larger dimension) accessing namearraynames with extra '&' and with proper bounds. mostly done I think at least for 1D arrays (Access to record fields under array elements or other records are currently being worked on.) (indirect bit not being removed in inherited types of parent expression (eg map = map + 1 ... 'map + 1' is also being treated as a map.) That's what I invented F_EXPR for. Maybe fixed.) %longinteger (i.e. 64 bits) is not supported by icode even though pass1 parses it OK. (ICode size of PUSHI parameter is limited) Range check for switch jumps. DONE optimise the checks added to %for loops when they can be done at compile time. (multiple of step check, inside-out check etc) (array index base adjustment - mostly done) DONE (except for 2D params) array parameters "(*)" (or "(* procname)" for procedures in parameter list DONE (ADDR(map) or ADDR(name) - probably done but check...) "%record(fm) fred = 0" maps to "struct FM FRED; FRED = { 0 };" ... the {} are needed when assigning 0 to all fields of a record. Also, when later assigning "fred = 0" in the code, a cast is *required*: "FRED = (FM) { 0 };" DONE Note the difference between the above and assigning a null pointer, e.g. "%record (fm) %name fred = 0" which becomes "struct FM *FRED = 0;" or an assignment in the code, "fred == 0" which is "FRED = 0;" btw the use of "= 0" above is a non-standard imp77 hack by PSR. The proper way to specify this would have been "== RECORD(0)"... etc etc