If you really want to see (no pun intended) what I compiler does with your C code, try the "-S" option. No doubt, what an M to C translator would do to most M code is similar. (Actually, the question of whether or not it is possible to automatically generate well structured code is an interesting, and difficult, problem):

#include <stdio.h>

int main()
{
int i,j;
for (i = 1; i <= 100000; i++)
   j = i;
printf("Hello!\n");
}
~:$ cat test.s
        .section __TEXT,__text,regular,pure_instructions
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
        .machine ppc
        .cstring
        .align 2
LC0:
        .ascii "Hello!\12\0"
        .text
        .align 2
        .globl _main
_main:
        mflr r0
        stmw r30,-8(r1)
        stw r0,8(r1)
        stwu r1,-96(r1)
        mr r30,r1
        bcl 20,31,"L00000000001$pb"
"L00000000001$pb":
        mflr r31
        li r0,1
        stw r0,60(r30)
        b L2
L3:
        lwz r0,60(r30)
        stw r0,56(r30)
        lwz r2,60(r30)
        addi r0,r2,1
        stw r0,60(r30)
L2:
        lwz r0,60(r30)
        lis r2,0x1
        ori r2,r2,34464
        cmpw cr7,r0,r2
        ble cr7,L3
        addis r2,r31,ha16(LC0-"L00000000001$pb")
        la r3,lo16(LC0-"L00000000001$pb")(r2)
        bl L_printf$LDBLStub$stub
        lwz r1,0(r1)
        lwz r0,8(r1)
        mtlr r0
        lmw r30,-8(r1)
        blr
.section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
        .align 5
L_printf$LDBLStub$stub:
        .indirect_symbol _printf$LDBLStub
        mflr r0
        bcl 20,31,"L00000000001$spb"
"L00000000001$spb":
        mflr r11
addis r11,r11,ha16(L_printf$LDBLStub$lazy_ptr-"L00000000001 $spb")
        mtlr r0
lwzu r12,lo16(L_printf$LDBLStub$lazy_ptr-"L00000000001$spb") (r11)
        mtctr r12
        bctr
        .lazy_symbol_pointer
L_printf$LDBLStub$lazy_ptr:
        .indirect_symbol _printf$LDBLStub
        .long   dyld_stub_binding_helper
        .subsections_via_symbols
~:$

===
Gregory Woodhouse
[EMAIL PROTECTED]

"The policy of being too cautious is
the greatest risk of all."
--Jawaharlal Nehru


On Jul 17, 2005, at 7:21 PM, Chris Richardson wrote:

Why bother going from MUMPS to C? MUMPS is faster than most other database access methods. The major problem with code translators is that the code
they usually generate is not very supportable and nearly impossible to
modify. It would be far better to embark on a modernization program for the existing code that was written to the old architecture constraints that are no longer issues. This will buy us better modularity, interoperability,
and better code reuse as well as increased execution speed and smaller
symbol tables.  Big job?  Yes, but it also will have big payoffs.





-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to