;Alto->8086 small-c compiler rev 2.0 C_CODE SEGMENT $INCLUDE(8086LIB.D) $INCLUDE(rpcagent.DEC) ASSUME CS:C_CODE, DS:C_DATA ; #include ; extern struct ZN *myZone; ; extern int CallFailed; ; extern int ImportFailed; ; extern AddType(); ; extern int CallFormatted(); ; extern CONT(); ; extern dBlock(); ; extern ENABLE(); ; extern struct ImportInstance *ImportInterface(); ; extern struct ShortSTRING *CStringToString(); ; static struct ImportInstance *agentInstance; ; static int args[10]; ; static struct ShortSTRING *specABN, *specAA, *specW; ; static int zip[2]; ; int /* really Authentication */ ; AgentAuthenticate(nonceId, caller, callee, lvAuthenticator) _AgentAuthenticate: ; int nonceId, caller, callee, *lvAuthenticator; CALL StkChk PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; struct Seal sl; ; int authentication; ; if (ENABLE(CallFailed, &CONT, &sl) || (agentInstance==0 && AgentInitialize()==false)) return (0); ADD SP,0FFFAX MOV BX,_CallFailed PUSH BX ;&_sl LEA BX,[BP-8] MOV CX,OFFSET _CONT CALL _ENABLE POP DX OR BX,BX JNZ X3 MOV BX,_agentInstance OR BX,BX JNZ X4 CALL _AgentInitialize OR BX,BX X4: JNZ X2 X3: MOV AL,1 JR X5 X2: XOR AL,AL X5: OR AL,AL JZ X1 XOR BX,BX MOV SP,BP POP BP RET; X1: ; args[0] = nonceId; ; BX _ _nonceId MOV BX,[BP+6] MOV _args,BX ; args[1] = caller; ; BX _ _caller MOV BX,[BP+4] MOV _args+2,BX ; args[2] = callee; ; BX _ _callee MOV BX,[BP-2] MOV _args+4,BX ; authentication = CallFormatted(agentInstance, doAuthenticate, specABN, specAA, args); MOV BX,_agentInstance PUSH BX MOV BX,4 PUSH BX MOV BX,_specABN PUSH BX LEA BX,_args MOV CX,_specAA CALL _CallFormatted ADD SP,6 ; _authentication _ BX POP DX PUSH BX ; *lvAuthenticator = args[4]; ; BX _ _lvAuthenticator MOV BX,[BP-4] MOV CX,_args+8 MOV [BX],CX ; return (authentication); ; BX _ _authentication POP BX PUSH BX MOV SP,BP POP BP RET; ; }; ; int /* really ShortSTRING */ ; AgentInstanceForInterface(range, type, instance) _AgentInstanceForInterface: ; int range, type, instance; CALL StkChk PUSH BP MOV BP,SP PUSH CX PUSH BX ; { ; struct Seal sl; ; if (ENABLE(CallFailed, &CONT, &sl) || (agentInstance==0 && AgentInitialize()==false)) return (0); ADD SP,0FFFCX MOV BX,_CallFailed PUSH BX ;&_sl LEA BX,[BP-8] MOV CX,OFFSET _CONT CALL _ENABLE POP DX OR BX,BX JNZ X8 MOV BX,_agentInstance OR BX,BX JNZ X9 CALL _AgentInitialize OR BX,BX X9: JNZ X7 X8: MOV AL,1 JR X10 X7: XOR AL,AL X10: OR AL,AL JZ X6 XOR BX,BX MOV SP,BP POP BP RET; X6: ; args[0] = range ? range: (int) zip; ; BX _ _range MOV BX,[BP+4] OR BX,BX JZ X11 ; BX _ _range MOV BX,[BP+4] JR X12 X11: LEA BX,_zip X12: MOV _args,BX ; args[1] = type; ; BX _ _type MOV BX,[BP-2] MOV _args+2,BX ; args[2] = instance; ; BX _ _instance MOV BX,[BP-4] MOV _args+4,BX ; return (swab(CallFormatted(agentInstance, doInstanceForInterface, specABN, specW, args))); MOV BX,_agentInstance PUSH BX MOV BX,5 PUSH BX MOV BX,_specABN PUSH BX LEA BX,_args MOV CX,_specW CALL _CallFormatted ADD SP,6 CALL _swab MOV SP,BP POP BP RET; ; }; ; int /*BOOL*/ AgentInitialize() _AgentInitialize: CALL StkChk PUSH BP MOV BP,SP ; { ; struct InterfaceName interface; ; struct Seal sl; ADD SP,0FFF4X ; Zero(&interface, lenInterfaceName); MOV BX,4 ;&_interface LEA CX,[BP-8] CALL _Zero ; interface.type = CstringToString("Agent.Lark"); MOV BX,"Agent.Lark" CALL _CstringToString ; _interface _ BX MOV [BP-8],BX ; interface.instance = 0; MOV WORD PTR [BP-6],0 ; if (ENABLE(ImportFailed, &CONT, &sl)) return false; MOV BX,_ImportFailed PUSH BX ;&_sl LEA BX,[BP-12] MOV CX,OFFSET _CONT CALL _ENABLE POP DX OR BX,BX JZ X13 XOR BX,BX MOV SP,BP POP BP RET; X13: ; agentInstance = ImportInterface(&interface); ;&_interface LEA BX,[BP-8] CALL _ImportInterface MOV _agentInstance,BX ; specABN = CstringToString("DSS"); MOV BX,"DSS" CALL _CstringToString MOV _specABN,BX ; specAA = CstringToString("KK"); MOV BX,"KK" CALL _CstringToString MOV _specAA,BX ; specW = CstringToString("W"); MOV BX,"W" CALL _CstringToString MOV _specW,BX ; AddType('K', dBlock(16, 1, 0, true, false)); MOV BX,010X PUSH BX MOV BX,1 PUSH BX XOR BX,BX PUSH BX XOR BX,BX MOV CX,0FFFFX CALL _dBlock ADD SP,6 MOV CX,04BX CALL _AddType ; Block(); CALL _Block ; return (true); MOV BX,0FFFFX MOV SP,BP POP BP RET; ; }; ; Externals Declared Here PUBLIC _AgentAuthenticate PUBLIC _AgentInitialize PUBLIC _AgentInstanceForInterface C_CODE ENDS ; Number of Bytes of Code = 0179X, (377)