Jump to content
Excelsior Forums

slathakamatchi

Members
  • Content count

    0
  • Joined

  • Last visited

    Never

Community Reputation

0 Neutral

About slathakamatchi

  • Rank
    Newbie
  • Birthday 01/01/01
  1. Experts, I provide a part of the code here... IMPLEMENTATION MODULE License; FROM ConvNumb IMPORT NumToString,StringToNum,ConvStatusT,CardToString,StringToCard; FROM StringsP IMPORT CopyString,AppendString,AssignString,StringLength, EqualStrings,ClearString,CompareStringsNoCase, CompareResult,InsertString; FROM FileProc IMPORT OpenTextFile,CloseTextFile, AccessT, TextFile, ReadLine, EndOfTextFile,CreateTextFile,WriteLine,DeleteFile; FROM DirFiles IMPORT AppendFileName,FileExist; FROM Bios IMPORT Shift,LOR,LAND,XOR; FROM Environ IMPORT GetDate; CONST LicFileName = "License.dat"; LicenseErrorStr = "**** No license file present ****"; IllegalErrorStr = "**** License expired ****"; TYPE LicenseT = RECORD CASE Tag: CARDINAL OF 1 : String : ARRAY [0..199] OF CHAR; | 2 : CardArr : ARRAY [0..99] OF CARDINAL; ELSE END; END; PROCEDURE CalculateLicense(String : ARRAY OF CHAR): CARDINAL; VAR Check : CARDINAL; License : LicenseT; i,j : CARDINAL; Len : CARDINAL; BEGIN Len := StringLength(String); AssignString(String,License.String); FOR i:=Len TO 199 DO License.String := 0C; END; Len := Len DIV 2; WITH License DO Check := CardArr[0]; FOR j:=1 TO Len DO i := j-1; IF CardArr[j] # CardArr THEN Check := XOR(Check,CardArr[j]); Check := LOR(Shift(Check,-1), LAND(XOR(Shift(CardArr[j],5),Shift(CardArr[j],2)),1)); END; END; END; RETURN Check; END CalculateLicense; PROCEDURE CreateLicense(LicenseInfoP : LicenseInfoPT; VAR String : ARRAY OF CHAR); VAR Cust : ARRAY [0..4] OF CHAR; Stat : ARRAY [0..4] OF CHAR; TmpString : ARRAY [0..200] OF CHAR; Part : ARRAY [0..2] OF CHAR; i : CARDINAL; BEGIN WITH LicenseInfoP^ DO AssignString(Customer,TmpString); AppendString(NrStations,TmpString); AppendString(SerieNr,TmpString); AppendString(Version,TmpString); AppendString(Option,TmpString); AppendString(ExpDate,TmpString); i := CalculateLicense(TmpString); NumToString(i,16,4,Cust); CopyString(Cust,0,2,Part); AssignString(Part,String); AppendString("-",String); CopyString(Cust,2,2,Part); AppendString(Part,String); AssignString(SerieNr,TmpString); AppendString(NrStations,TmpString); AppendString(Customer,TmpString); i := CalculateLicense(TmpString); NumToString(i,16,4,Stat); AppendString("-",String); CopyString(Stat,0,2,Part); AppendString(Part,String); AppendString("-",String); CopyString(Stat,2,2,Part); AppendString(Part,String); AssignString(Cust,TmpString); AppendString(Stat,TmpString); i := CalculateLicense(TmpString); NumToString(i,16,4,TmpString); AppendString("-",String); CopyString(TmpString,0,2,Part); AppendString(Part,String); AppendString("-",String); CopyString(TmpString,2,2,Part); AppendString(Part,String); END; END CreateLicense; END License.
  2. Dear Sir/Ma'm, I am new to Modula programming.Basically I'm a java programmer. I need to convert a modula program to Java program. So I downloaded your Native XDS-x86 2.45 Modula complier. In my program i need to use bitwise shift operators. But I feel a bit difficult to find which def module the logical AND and OR and bitwise operations defined in. In the program i need to convert,the use the follwoing statement FROM Bios IMPORT Shift,LOR,LAND,XOR; They also use the string functions FROM StringsP IMPORT CopyString,AppendString,AssignString,StringLength, EqualStrings,ClearString,CompareStringsNoCase, CompareResult,InsertString; I replace them with Append and Assign functions. They also use a function NumToString(i,16,4,StringValue); which gives 4 character hexa string. I need to get the definitions for XOR,LOR,SHIFT and LAND functions. Check := XOR(Check,CardArr[j]); Check := LOR(Shift(Check,-1), LAND(XOR(Shift(CardArr[j],5),Shift(CardArr[j],2)),1)); I post the program as next post I humbly request you to provide me the help. Thank you in advance Latha
×