function chkperiod(in isperiod) { //check if allowed to post into other periods if (isperiod ne (fin.currperiod ^ "/" ^ fin.curryear)) { if (not(authorised("JOURNAL POST OUTSIDE CURRENT PERIOD", msg, ""))) { return invalid2(msg); } } //check minimum period var minperiod = gen.company.a(16); if (minperiod) { //T=MIN.PERIOD[-2,2]:('00':FIELD(MIN.PERIOD,'/',1))[-2,2] var tt = addcent(minperiod.substr(-2, 2)) ^ ("00" ^ minperiod.field("/", 1)).substr(-2, 2); //IF ADDCENT(T) GE ADDCENT(IS.PERIOD[-2,2]:('00':FIELD(IS.PERIOD,'/',1))[-2,2]) THEN var t2 = addcent(isperiod.field("/", 2)) ^ ("00" ^ isperiod.field("/", 1)).substr(-2, 2); //call msg(t:' ':t2:' ':is.period) if (tt >= t2) { msg = "Sorry, the ledgers are closed up to " ^ addcent(minperiod) ^ "|for company " ^ (DQ ^ (gen.company.a(1) ^ DQ)) ^ " (" ^ fin.currcompany ^ ")"; return invalid2(msg); } } //check maximum month var tt = isperiod.field("/", 1); if (tt < 1 or tt > fin.maxperiod or not tt.match("0N")) { badperiod: msg = "Please enter a period, or period/year|eg. " ^ (DQ ^ (fin.currperiod ^ DQ)) ^ " or " ^ (DQ ^ (fin.currperiod ^ "/" ^ fin.curryear ^ DQ)); return invalid2(msg); } //check year tt = (isperiod.field("/", 2)).substr(-2, 2); //IF t matches '1N' or T MATCHES '2N' ELSE GOTO BADPERIOD if (not tt.match("2N")) { goto badperiod; } //check maximum year if (addcent(tt) > addcent((gen.company.a(2)).substr(-2, 2))) { msg = "The year " ^ (DQ ^ (addcent(tt) ^ DQ)) ^ " must be opened for|" ^ gen.company.a(1) ^ "|before you can post to it"; return invalid2(msg); } //note if not current year if (interactive and tt ne fin.curryear) { tt = addcent(fin.curryear) - addcent(tt); if (tt > 5) { msg = "WARNING: THAT IS " ^ tt ^ " YEARS BEFORE THE CURRENT YEAR !!!"; gosub note3(msg); } //not needed by reval.subs //MSG='NOTE. THE CURRENT YEAR IS ':CURRYEAR //GOSUB NOTE3 } return 1; }
int main(int argc, char **argv) { GURL real1("file://localhost/e:/Alex/workspace/demonstrator/Genesis/build/bin/x64/DEBUG/L32f.png"); std::cout << (real1.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (real1.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(real1); GURL url("http://*****:*****@wwww.furious-typing.com:1234/test/main.html?id=12356&mid=carlos#location"); std::cout << (url.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (url.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(url); GURL invalid1("c:\\blubber"); std::cout << (invalid1.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (invalid1.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(invalid1); GURL invalid2("file:/host/path"); std::cout << (invalid2.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (invalid2.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(invalid2); GURL url1("http://*****:*****@wwww.furious-typing.com:1234/test/main file.html?id=12356&mid=carlos#location"); std::cout << (url1.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (url1.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(url1); GURL real2("file://localhost///192.168.0.2/path/to/file.txt"); std::cout << (real2.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (real2.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(real2); GURL real3("file://localhost/e%3A/Alex/workspace/demonstrator/Genesis/build/bin/x64/DEBUG/L%5B32%5Df.pfm"); std::cout << (real3.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (real3.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(real3); GURL real4("file://localhost/e:/Alex/workspace/demonstrator/Genesis/build/bin/x64/DEBUG/L[32]f.pfm"); std::cout << (real4.is_valid() ? "is valid" : "is invalid") << '\n'; std::cout << (real4.IsStandard() ? "is standard" : "is not standard") << '\n'; print_uri(real4); return 0; }