maureen@SCIRTP.UUCP (mo) (07/31/85)
We are trying to port some Intel PLM code to our unix sys III micro. Scanning the PLM source shows a very close mapping between it and 'c'. The syntax is the only major difference. The job of converting PLM to c can easily be done with lex/yacc however I'm not familiar enough with these to do it myself. Does anyone have any "neat" conversion tools? This would help us out tremendously and save us of alot of mind numbing vi work. Thanks in advance. Maureen Chew {akgua,decvax}!mcnc!rti-sel!scirtp!maureen Here is a small segment of what is needed: PLM code: declare def$limit literally '2000', def$buffer (def$limit) word external; declare buffer$ptr pointer external, buffer$word based buffer$ptr (1) word, buffer$byte based buffer$ptr (1) byte; mark$field: procedure external; end mark$field; display$next$line$no: procedure external; end display$next$line$no; dschar: procedure (char) external; declare char byte; end dschar; dspace: procedure (number) external; declare number byte; end dspace; unit$read: procedure (unitio$pblk$ptr) external; declare unitio$pblk$ptr pointer; declare dsp$pblk structure (device$code byte, area byte, unit$number word, unit$memory$addr pointer) external; declare underline literally '5fh'; $include (dataty.x86) /* the following literals are declared for "word" comparison purpose. note that the order of the two letters are reversed. */ declare lit$lb literally '''bl''', lit$cm literally '''mc'''; display$resident$item: procedure (string$ptr); declare string$ptr pointer, string$word based string$ptr (1) word; declare (l, k) byte; call mark$field; unitio$pblk.direction = 0; unitio$pblk.area = 1; do l = 1 to 50h; unitio$pblk.unit$number = l; call unit$read (@unitio$pblk); buffer$ptr = unitio$pblk.unit$memory$addr; if string$word (0) = buffer$word (0) then do; do k = 8 to 31; call dschar (buffer$byte (k)); end; call dspace (5); return; end; end; end display$resident$item; Here is the comparable C code: #include "types.x86" #define def_limit 2000 extern word def_buffer[def_limit]; extern pointer buffer_ptr; extern pointer def_build_ptr; extern void mark_field(); extern void dschar(); extern void dspace(); extern void unit_read(); extern struct { byte direction; byte area; word unit_number; pointer unit_memory_addr;} unitio_pblk; byte num_buffer[16]; byte dsp_buffer[20]; #define quote 0x22 #include "dataty.x86" /* the following literals are d for "word" comparison purpose. note that the order of the two letters are reversed. */ #define lit_lb 'bl' #define lit_cm 'mc' dsp_resident_item(string_word) word *string_word; { byte l, k; mark_field(); unitio_pblk.direction = 0; unitio_pblk.area = 1; for (l=1;l<=0x50;l++) { unitio_pblk.unit_number = l; unit_read (&unitio_pblk); buffer_ptr._ = unitio_pblk.unit_memory_addr._; if(string_word[0] == buffer_ptr.w[0]) { for (k=8;k<=31;k++) { dschr (buffer_ptr.b[k]); } dspace (5); return; } } }