sniper::p
Зарегистрирован: 04.10.2005 Сообщения: 237 Откуда: rus/73
|
Добавлено: Чт Янв 25 2007 03:15 Заголовок сообщения: Программисты, не проходите мимо! |
|
|
Попробуйте сохранить следующий код в ascii кодировке и откройте паскалем 70/71.
Код: | { New Borlont Poskal 95 example program.
This program lets you use new Borlont Poskal 95, which was built-in in the
Borland Pascal 7.0. (I guess even developers didn't know about it.)
It can be switched on by using double comments the [see below] way }
program external(private,public); { you can specify type of your program.
This is done in Borland Pascal 7.0, but when using Borlont Poskal 95, it
receives new meaning }
{ now, enable Borlont Poskal 95 syntax }
const forward = ^{; (* this string enables Borlont Poskal 95 }
{ now all the syntax of the new Poskal 95 can be used. Look through these
examples to find new features }
private = { Assign Private Action }
BEGIN
in case of export, do not object to destructor and goto library
END;
public = { Assign Public Action }
BEGIN
goto do program and begin with absolute packed unit in assembler
END;
type program = unit; { you can give any name to your identifiers }
program = library; { you can redefine any type as many times }
program = program; { as you want }
type = var; { you can define type "type" }
type = const;
var program : program; { you can redefine variables too }
program : program with library; { you can use any syntax you want }
program : program with unit;
var : program; { you can even define variable "var" }
var : const;
var : type;
const program : program = program or unit and library;
program : program = unit with library in program;
const : const = type shl string in unit shr and;
{ new free object definition }
type object = object (do not object to object)
constructor begin; external in library program;
destructor end; assembler with program;
procedure function; interrupt with assembler;
function procedure:constructor; packed assembler unit in program;
and end;
{ Now execute program with predefined constants (what does it mean?) }
do PROGRAM external ( const private, const public );
{ new function/procedure definition - you don't have any restriction to
function/procedure definition now! }
Function Function (Function:Function):Function; Function and Not Procedure;
FUNCTION BEGIN
Function:=Program(Unit Near.External(Far));
FUNCTION END
Procedure Function (far,near : object) : function or procedure;
begin
Function(or procedure):=far far far far in program;
and; { even if you mixed "end" with "and", compiler will understand it }
{ new "if" statement - no any restriction to the syntax }
IF procedure or function far far in program THEN
while repeat do repeat while;
{ You can construct any operator via constructors and destructors
(again, no restriction to the syntax) }
Constructor And (in library) : And:=library.and;
Destructor Constructor (Procedure : Function) : Program; Var;
{ New Great Assembler! Allows to write everything in words }
asm
1. Write Message "Formatting disk C" on the screen
2. Format Disk C (and also ignore all the Windows tries to stop it)
3. Physically destroy hard drive
4. Connect to the Internet
5. Cheat Pentagon
6. Download secret plans to the disk A:
7. Disconnect and destroy computer (along with everything in 10 000 km^2
around)
8. Finish
end;
{ and at last, very free syntax. Just write everthing you want and
compiler will understand what you meant }
array begin:case[const] of constructor ...
destructor div do downto else end
exports file for function goto
if implementation in inherited inline then interface label library mod nil
not object or packed procedure program record repeat
set shl string to type shr
unit until uses var
while with xor
{ The only bad thing about Borlont Poskal 95 extension is the next:
Your program will NEVER run (although will ALWAYS compile) ;) guess why? :) }
(* And now, switch back to the Borland Pascal 7.0 with uncomment :*)
{ next lines are written in Borland Pascal 7.0. }
type far = string;
function near(far:far):far;far;
begin
external.near:=external.far(far);
end;
{ you can also switch to the Poskal 95 extension with next line: }
const assembler = ^'; { '
begin
uses program external in unit forward xor string with far far in near
end. (* it is not end of program *)
(* another feature: number of begin's and end's doesn't have to match *)
procedure constructor and destructor(function:function and procedure);
begin
if constructor then destructor else function in constructor;
end:
end;
end,
end.
end.
begin. begin. begin, begin begin(begin(end)).
asm
(c) Pavel Anokhin 1999
Net Mail: 2:5027/16.20
E-Mail: mna@valley.ru
end and begin;
{ ok, I think that's enough, switch back to BP7 with next character:}
{ we're back in BP. Enjoy :) Pascal rulezzzz forever!!! }
begin
near(forward);
end. |
ЗЫ Главное, не забудьте скомпилировать _________________ Нет предела совершенствованию |
|