/packages/amunits/src/otherlibs/amarquee.pas
Pascal | 1155 lines | 890 code | 128 blank | 137 comment | 6 complexity | e307e5e17655eac8b49d5f477861b1f0 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
1{ 2 This file is part of the Free Pascal run time library. 3 4 A file in Amiga system run time library. 5 Copyright (c) 1998-2000 by Nils Sjoholm 6 member of the Amiga RTL development team. 7 8 See the file COPYING.FPC, included in this distribution, 9 for details about the copyright. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 14 15 **********************************************************************} 16 17{ 18 History: 19 20 First translation of AMarquee.h to FPC pascal. 21 No testing has been done so there could be bugs 22 in here. If you find any bugs please let me know. 23 25 Aug 2000. 24 25 Added functions and procedures with array of const. 26 For use with fpc 1.0.7 27 30 Nov 2002. 28 29 Added the defines use_amiga_smartlink and 30 use_auto_openlib. 31 12 Jan 2003. 32 33 Changed startcode for unit. 34 10 Feb 2003. 35 36 nils.sjoholm@mailbox.swipnet.se 37 38} 39 40{$mode objfpc} 41{$I useamigasmartlink.inc} 42{$ifdef use_amiga_smartlink} 43 {$smartlink on} 44{$endif use_amiga_smartlink} 45unit amarquee; 46 47 48interface 49 50 51uses exec, utility; 52 53 54 55 { This library contains definitions and structures necessary to use amarquee.library. } 56 { Different error types that can be returned to the client in QMessages } 57 { Everything is okay } 58 59 const 60 AMARQUEENAME : PChar = 'amarquee.library'; 61 62 QERROR_NO_ERROR = 0; 63 { Don't know what the error was. } 64 QERROR_UNKNOWN = -(1); 65 { Keystring could not be parsed or "dir" does not exist } 66 QERROR_MALFORMED_KEY = -(2); 67 { Server did not have enough mem available to complete request } 68 QERROR_NO_SERVER_MEM = -(3); 69 { The connection to the server went south } 70 QERROR_NO_CONNECTION = -(4); 71 { You're not allowed to do that! } 72 QERROR_UNPRIVILEGED = -(5); 73 { Feature you requested does not exist yet } 74 QERROR_UNIMPLEMENTED = -(6); 75 { Your computer didn't have enough memory available to complete an action } 76 QERROR_NO_CLIENT_MEM = -(7); 77 { This message is a "wall" text message from a server admin } 78 QERROR_SYS_MESSAGE = -(8); 79 { This message is a "send done" notification from your client TCP thread (new for v47) } 80 QERROR_SEND_DONE = -(9); 81 { These error types may be returned by QFreeSession() or set to the error code 82 variable (set with the QSESSION_ERRORCODEPTR tag), after a QSession 83 allocation attempt fails. } 84 { TCP stack wasn't running } 85 QERROR_NO_TCP_STACK = -(20); 86 { Hostname lookup of server failed } 87 QERROR_HOSTNAME_LOOKUP = -(21); 88 { TCP thread got a control-C } 89 QERROR_ABORTED = -(22); 90 { No AMarquee server at requested host/port } 91 QERROR_NO_SERVER = -(23); 92 { The program wasn't launched by inetd } 93 QERROR_NO_INETD = -(24); 94 { The server wouldn't accept our connection } 95 QERROR_ACCESS_DENIED = -(25); 96 { The client is out of memory } 97 QERROR_NO_MEMORY = -(26); 98 { No server at requested host/port } 99 QERROR_NO_TCPSERVER = -(27); 100 { Flags to use with QGo() } 101 { Request notification via sync packet when all has settled on the server side } 102 QGOF_SYNC = 1 shl 0; 103 { Request notification via QERROR_SEND_DONE message when the TCP thread has finished sending this transaction (new for v47) } 104 QGOF_NOTIFY = 1 shl 1; 105 { Flags representing special privileges; used with QRequestPrivileges(), etc } 106 { license to kill! } 107 QPRIV_KILLCLIENTS = 1 shl 0; 108 { Ability to set env vars, etc, on the server } 109 QPRIV_ADMIN = 1 shl 1; 110 { Ability to receive special sysadmin messages } 111 QPRIV_GETSYSMESSAGES = 1 shl 2; 112 { Ability to send special sysadmin messages } 113 QPRIV_SENDSYSMESSAGES = 1 shl 3; 114 { all possible QPRIV_ bits } 115 QPRIV_ALL = $0F; 116 { Wait() on this for QMessages! } 117 { } 118 { Invisible, private info is here... don't trust sizeof(QSession)! } 119 { } 120 121 type 122 PQSession = ^TQSession; 123 TQSession = record 124 qMsgPort : PMsgPort; 125 end; 126 127 { All events from AMarquee come in this package! } 128 { Don't directly use the contents of qm_Msg! } 129 { Message ID # of transaction related to this opCode, or -1 if no ID is applicable. } 130 { One of the QERROR_ codes defined in AMarquee headers. } 131 { Pathname of a node, or NULL if not applicable. } 132 { Pointer to beginning of data buffer, or NULL if not applicable. } 133 { Length of qm_Data buffer, or 0 if not applicable. } 134 { Length of the data buffer stored on the AMarquee server. } 135 { Line # of the server source code that generated the error. Useful for debugging. } 136 { Private info used by FreeQMessage() } 137 { Added for v48; more private info used by FreeQMessage() } 138 { Added for v50. The session this message comes from. Necessary with shared msgports } 139 PQMessage = ^TQMessage; 140 TQMessage = record 141 qm_Msg : tMessage; 142 qm_ID : LONG; 143 qm_Status : longint; 144 qm_Path : Pchar; 145 qm_Data : pointer; 146 qm_DataLen : ULONG; 147 qm_ActualLen : ULONG; 148 qm_ErrorLine : ULONG; 149 qm_Private : pointer; 150 qm_Private2 : pointer; 151 qm_Session : PQSession; 152 end; 153 154 { The theoretical maximum number of bytes your server may allocate. } 155 { The number of bytes currently allocated by your server. } 156 { The number of bytes that may actually be allocated by your server. } 157 { Bit-chord of QPRIV_ bits, showing what special privs you have. } 158 { Bit-chord of QPRIV_ bits, showing what special privs you could get if you asked. } 159 PQRunInfo = ^TQRunInfo; 160 TQRunInfo = record 161 qr_Allowed : LONG; 162 qr_Alloced : LONG; 163 qr_Avail : LONG; 164 qr_CurrentPrivs : ULONG; 165 qr_PossiblePrivs : ULONG; 166 end; 167 168 { Used internally } 169 { the message port to listen on } 170 PQSharedMessagePort = ^TQSharedMessagePort; 171 TQSharedMessagePort = record 172 qs_private : tSignalSemaphore; 173 qs_mp : PMsgPort; 174 end; 175 176 { the QRAWSESSION_PROTOCOLSTOPHOOK Hook function receive a pointer to the Hook in A0, the QSession 177 pointer in A2 and a pointer to a QProtocolStopMarkerMessage in A1. Return the length of the buffer 178 to send to the client. Return a length of 0 if not enough data is present. With this function 179 it's easy to make sure that no structs or other datatypes get stripped. } 180 PQProtocolStopMarkerMessage = ^TQProtocolStopMarkerMessage; 181 TQProtocolStopMarkerMessage = record 182 buffer : STRPTR; 183 length : ULONG; 184 userdata : ULONG; 185 id : LONG; 186 end; 187 188 { Tags to use with QNewSocketSession(Async) } 189 { (ULONG maxBufSize) The maximum buffer size to use (same as QSetMaxRawBufSize()) } 190 191 const 192 QRAWSESSION_MAXBUFFERSIZE = $a0000001; 193 { (struct Hook stopmarkerfunc) A hook with the function which sets the stop marker for a block of data } 194 QRAWSESSION_PROTOCOLSTOPHOOK = $a0000002; 195 { (BOOL b) default TRUE. Shall the last data before the connection is broken be sent to the client even though the PROTOCOLSTOPHOOK hook specify it shouldn't ? } 196 QRAWSESSION_RECEIVE_EXCEEDING_DATA = $a0000003; 197 { (ULONG u) The initial value of the userdata field in struct QProtocolStopMarkerMessage } 198 QRAWSESSION_PROTOCOLSTOPHOOK_USERDATA = $a0000004; 199 { Tags to use with QNew Session(Async) and QNewSocket Session(Async) } 200 { (LONG errorCode) A pointer to the variable that will hold the error code } 201 QSESSION_ERRORCODEPTR = $b0000001; 202 { (struct QSharedMessagePort mp) A shared message port created with QCreateSharedMessagePort() } 203 QSESSION_SHAREDMSGPORT = $b0000002; 204 205VAR AMarqueeBase : pLibrary; 206 207FUNCTION QFreeSession(session : pQSession) : LONGINT; 208FUNCTION QDebugOp(session : pQSession; string_ : pCHar) : LONGINT; 209FUNCTION QGetOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 210FUNCTION QDeleteOp(session : pQSession; path : pCHar) : LONGINT; 211FUNCTION QRenameOp(session : pQSession; path : pCHar; label_ : pCHar) : LONGINT; 212FUNCTION QSubscribeOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 213FUNCTION QSetOp(session : pQSession; path : pCHar; buf : POINTER; len : ULONG) : LONGINT; 214FUNCTION QClearSubscriptionsOp(session : pQSession; which : LONGINT) : LONGINT; 215FUNCTION QPingOp(session : pQSession) : LONGINT; 216FUNCTION QInfoOp(session : pQSession) : LONGINT; 217FUNCTION QSetAccessOp(session : pQSession; hosts : pCHar) : LONGINT; 218PROCEDURE FreeQMessage(session : pQSession; qmsg : pQMessage); 219FUNCTION QGo(session : pQSession; sync : ULONG) : LONGINT; 220FUNCTION QStreamOp(session : pQSession; path : pCHar; buf : POINTER; len : ULONG) : LONGINT; 221FUNCTION QSetMessageAccessOp(session : pQSession; access : pCHar; maxbytes : LONGINT) : LONGINT; 222FUNCTION QMessageOp(session : pQSession; hosts : pCHar; buffer : POINTER; len : ULONG) : LONGINT; 223FUNCTION QNumQueuedPackets(session : pQSession) : ULONG; 224FUNCTION QNumQueuedBytes(session : pQSession) : ULONG; 225FUNCTION QErrorName(session : LONGINT) : pCHar; 226FUNCTION QRequestPrivilegesOp(session : pQSession; privBits : ULONG) : LONGINT; 227FUNCTION QReleasePrivilegesOp(session : pQSession; privBits : ULONG) : LONGINT; 228FUNCTION QKillClientsOp(session : pQSession; hosts : pCHar) : LONGINT; 229FUNCTION QSetParameterOp(session : pQSession; paramName : pCHar; newValue : pCHar) : LONGINT; 230FUNCTION QGetParameterOp(session : pQSession; paramName : pCHar) : LONGINT; 231FUNCTION QSysMessageOp(session : pQSession; hosts : pCHar; message : pCHar) : LONGINT; 232FUNCTION QGetAndSubscribeOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 233FUNCTION QDetachSession(session : pQSession; flags : ULONG) : BOOLEAN; 234FUNCTION QReattachSession(session : pQSession; flags : ULONG) : BOOLEAN; 235FUNCTION QNewSocketSession(host : pCHar; port : LONGINT; tags : pTagItem) : pQSession; 236FUNCTION QSendRawOp(session : pQSession; buf : POINTER; len : ULONG) : LONGINT; 237FUNCTION QNewSocketSessionAsync(host : pCHar; port : LONGINT; tags : pTagItem) : pQSession; 238FUNCTION QNewSocketServerSession( port : pLONGINT; tags : pTagItem) : pQSession; 239FUNCTION QSetKeyAccessOp(session : pQSession; path : pCHar; hosts : pCHar) : LONGINT; 240FUNCTION QGetHostName(session : pQSession) : pCHar; 241FUNCTION QGetProgName(session : pQSession) : pCHar; 242PROCEDURE QSetMaxRawBufSize(session : pQSession; maxBufSize : ULONG); 243FUNCTION QNewSession(host : pCHar; port : LONGINT; name : pCHar; taglist : pTagItem) : pQSession; 244FUNCTION QNewSessionAsync(host : pCHar; port : LONGINT; name : pCHar; taglist : pTagItem) : pQSession; 245FUNCTION QNewHostSession(hostnames : pCHar; port : pLONGINT; names : pCHar; taglist : pTagItem) : pQSession; 246FUNCTION QNewServerSession(hostNames : pCHar; progNames : pCHar; taglist : pTagItem) : pQSession; 247FUNCTION QCreateSharedMessagePort : pQSharedMessagePort; 248PROCEDURE QDeleteSharedMessagePort(mp : pQSharedMessagePort); 249FUNCTION QGetLocalIP(session : pQSession) : pCHAR; 250 251{ 252 This is functions and procedures with array of const. 253 For use with fpc 1.0 and above. 254 255} 256FUNCTION QNewSocketSessiontags(host : pCHar; port : LONGINT; const argv : Array Of Const) : pQSession; 257FUNCTION QNewSocketSessionAsyncTags(host : pCHar; port : LONGINT; const argv : Array Of Const) : pQSession; 258FUNCTION QNewSocketServerSessionTags( port : pLONGINT; const argv : Array Of Const) : pQSession; 259FUNCTION QNewSessionTags(host : pCHar; port : LONGINT; name : pCHar; const argv : Array Of Const) : pQSession; 260FUNCTION QNewSessionAsyncTags(host : pCHar; port : LONGINT; name : pCHar; const argv : Array Of Const) : pQSession; 261FUNCTION QNewHostSessionTags(hostnames : pCHar; port : pLONGINT; names : pCHar; const argv : Array Of Const) : pQSession; 262FUNCTION QNewServerSessionTags(hostNames : pCHar; progNames : pCHar; const argv : Array Of Const) : pQSession; 263 264 265FUNCTION QDebugOp(session : pQSession; string_ : string) : LONGINT; 266FUNCTION QGetOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 267FUNCTION QDeleteOp(session : pQSession; path : string) : LONGINT; 268FUNCTION QRenameOp(session : pQSession; path : string; label_ : string) : LONGINT; 269FUNCTION QSubscribeOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 270FUNCTION QSetOp(session : pQSession; path : string; buf : POINTER; len : ULONG) : LONGINT; 271FUNCTION QSetAccessOp(session : pQSession; hosts : string) : LONGINT; 272FUNCTION QStreamOp(session : pQSession; path : string; buf : POINTER; len : ULONG) : LONGINT; 273FUNCTION QSetMessageAccessOp(session : pQSession; access : string; maxbytes : LONGINT) : LONGINT; 274FUNCTION QMessageOp(session : pQSession; hosts : string; buffer : POINTER; len : ULONG) : LONGINT; 275FUNCTION QKillClientsOp(session : pQSession; hosts : string) : LONGINT; 276FUNCTION QSetParameterOp(session : pQSession; paramName : string; newValue : string) : LONGINT; 277FUNCTION QGetParameterOp(session : pQSession; paramName : string) : LONGINT; 278FUNCTION QSysMessageOp(session : pQSession; hosts : string; message : string) : LONGINT; 279FUNCTION QGetAndSubscribeOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 280FUNCTION QNewSocketSession(host : string; port : LONGINT; tags : pTagItem) : pQSession; 281FUNCTION QNewSocketSessionAsync(host : string; port : LONGINT; tags : pTagItem) : pQSession; 282FUNCTION QSetKeyAccessOp(session : pQSession; path : string; hosts : string) : LONGINT; 283FUNCTION QNewSession(host : string; port : LONGINT; name : string; taglist : pTagItem) : pQSession; 284FUNCTION QNewSessionAsync(host : string; port : LONGINT; name : string; taglist : pTagItem) : pQSession; 285FUNCTION QNewHostSession(hostnames : string; port : pLONGINT; names : string; taglist : pTagItem) : pQSession; 286FUNCTION QNewServerSession(hostNames : string; progNames : string; taglist : pTagItem) : pQSession; 287 288{ 289 This is functions and procedures with array of const. 290 For use with fpc 1.0 and above. 291} 292 293FUNCTION QNewSocketSessionTags(host : string; port : LONGINT; const argv : Array Of Const) : pQSession; 294FUNCTION QNewSocketSessionAsyncTags(host : string; port : LONGINT; const argv : Array Of Const) : pQSession; 295FUNCTION QNewSessionTags(host : string; port : LONGINT; name : string; const argv : Array Of Const) : pQSession; 296FUNCTION QNewSessionAsyncTags(host : string; port : LONGINT; name : string; const argv : Array Of Const) : pQSession; 297FUNCTION QNewHostSessionTags(hostnames : string; port : pLONGINT; names : string; const argv : Array Of Const) : pQSession; 298FUNCTION QNewServerSessionTags(hostNames : string; progNames : string; const argv : Array Of Const) : pQSession; 299 300{You can remove this include and use a define instead} 301{$I useautoopenlib.inc} 302{$ifdef use_init_openlib} 303procedure InitAMARQUEELibrary; 304{$endif use_init_openlib} 305 306{This is a variable that knows how the unit is compiled} 307var 308 AMARQUEEIsCompiledHow : longint; 309 310IMPLEMENTATION 311 312uses 313{$ifndef dont_use_openlib} 314msgbox, 315{$endif dont_use_openlib} 316pastoc,tagsarray; 317 318 319FUNCTION QFreeSession(session : pQSession) : LONGINT; 320BEGIN 321 ASM 322 MOVE.L A6,-(A7) 323 MOVEA.L session,A0 324 MOVEA.L AMarqueeBase,A6 325 JSR -036(A6) 326 MOVEA.L (A7)+,A6 327 MOVE.L D0,@RESULT 328 END; 329END; 330 331FUNCTION QDebugOp(session : pQSession; string_ : pCHar) : LONGINT; 332BEGIN 333 ASM 334 MOVE.L A6,-(A7) 335 MOVEA.L session,A0 336 MOVEA.L string_,A1 337 MOVEA.L AMarqueeBase,A6 338 JSR -042(A6) 339 MOVEA.L (A7)+,A6 340 MOVE.L D0,@RESULT 341 END; 342END; 343 344FUNCTION QGetOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 345BEGIN 346 ASM 347 MOVE.L A6,-(A7) 348 MOVEA.L session,A0 349 MOVEA.L path,A1 350 MOVE.L maxBytes,D0 351 MOVEA.L AMarqueeBase,A6 352 JSR -048(A6) 353 MOVEA.L (A7)+,A6 354 MOVE.L D0,@RESULT 355 END; 356END; 357 358FUNCTION QDeleteOp(session : pQSession; path : pCHar) : LONGINT; 359BEGIN 360 ASM 361 MOVE.L A6,-(A7) 362 MOVEA.L session,A0 363 MOVEA.L path,A1 364 MOVEA.L AMarqueeBase,A6 365 JSR -054(A6) 366 MOVEA.L (A7)+,A6 367 MOVE.L D0,@RESULT 368 END; 369END; 370 371FUNCTION QRenameOp(session : pQSession; path : pCHar; label_ : pCHar) : LONGINT; 372BEGIN 373 ASM 374 MOVE.L A6,-(A7) 375 MOVEA.L session,A0 376 MOVEA.L path,A1 377 MOVE.L label_,D0 378 MOVEA.L AMarqueeBase,A6 379 JSR -060(A6) 380 MOVEA.L (A7)+,A6 381 MOVE.L D0,@RESULT 382 END; 383END; 384 385FUNCTION QSubscribeOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 386BEGIN 387 ASM 388 MOVE.L A6,-(A7) 389 MOVEA.L session,A0 390 MOVEA.L path,A1 391 MOVE.L maxBytes,D0 392 MOVEA.L AMarqueeBase,A6 393 JSR -066(A6) 394 MOVEA.L (A7)+,A6 395 MOVE.L D0,@RESULT 396 END; 397END; 398 399FUNCTION QSetOp(session : pQSession; path : pCHar; buf : POINTER; len : ULONG) : LONGINT; 400BEGIN 401 ASM 402 MOVE.L A6,-(A7) 403 MOVEA.L session,A0 404 MOVEA.L path,A1 405 MOVE.L buf,D0 406 MOVE.L len,D1 407 MOVEA.L AMarqueeBase,A6 408 JSR -072(A6) 409 MOVEA.L (A7)+,A6 410 MOVE.L D0,@RESULT 411 END; 412END; 413 414FUNCTION QClearSubscriptionsOp(session : pQSession; which : LONGINT) : LONGINT; 415BEGIN 416 ASM 417 MOVE.L A6,-(A7) 418 MOVEA.L session,A0 419 MOVE.L which,D0 420 MOVEA.L AMarqueeBase,A6 421 JSR -078(A6) 422 MOVEA.L (A7)+,A6 423 MOVE.L D0,@RESULT 424 END; 425END; 426 427FUNCTION QPingOp(session : pQSession) : LONGINT; 428BEGIN 429 ASM 430 MOVE.L A6,-(A7) 431 MOVEA.L session,A0 432 MOVEA.L AMarqueeBase,A6 433 JSR -084(A6) 434 MOVEA.L (A7)+,A6 435 MOVE.L D0,@RESULT 436 END; 437END; 438 439FUNCTION QInfoOp(session : pQSession) : LONGINT; 440BEGIN 441 ASM 442 MOVE.L A6,-(A7) 443 MOVEA.L session,A0 444 MOVEA.L AMarqueeBase,A6 445 JSR -090(A6) 446 MOVEA.L (A7)+,A6 447 MOVE.L D0,@RESULT 448 END; 449END; 450 451FUNCTION QSetAccessOp(session : pQSession; hosts : pCHar) : LONGINT; 452BEGIN 453 ASM 454 MOVE.L A6,-(A7) 455 MOVEA.L session,A0 456 MOVEA.L hosts,A1 457 MOVEA.L AMarqueeBase,A6 458 JSR -096(A6) 459 MOVEA.L (A7)+,A6 460 MOVE.L D0,@RESULT 461 END; 462END; 463 464PROCEDURE FreeQMessage(session : pQSession; qmsg : pQMessage); 465BEGIN 466 ASM 467 MOVE.L A6,-(A7) 468 MOVEA.L session,A0 469 MOVEA.L qmsg,A1 470 MOVEA.L AMarqueeBase,A6 471 JSR -102(A6) 472 MOVEA.L (A7)+,A6 473 END; 474END; 475 476FUNCTION QGo(session : pQSession; sync : ULONG) : LONGINT; 477BEGIN 478 ASM 479 MOVE.L A6,-(A7) 480 MOVEA.L session,A0 481 MOVE.L sync,D0 482 MOVEA.L AMarqueeBase,A6 483 JSR -108(A6) 484 MOVEA.L (A7)+,A6 485 MOVE.L D0,@RESULT 486 END; 487END; 488 489FUNCTION QStreamOp(session : pQSession; path : pCHar; buf : POINTER; len : ULONG) : LONGINT; 490BEGIN 491 ASM 492 MOVE.L A6,-(A7) 493 MOVEA.L session,A0 494 MOVEA.L path,A1 495 MOVE.L buf,D0 496 MOVE.L len,D1 497 MOVEA.L AMarqueeBase,A6 498 JSR -120(A6) 499 MOVEA.L (A7)+,A6 500 MOVE.L D0,@RESULT 501 END; 502END; 503 504FUNCTION QSetMessageAccessOp(session : pQSession; access : pCHar; maxbytes : LONGINT) : LONGINT; 505BEGIN 506 ASM 507 MOVE.L A6,-(A7) 508 MOVEA.L session,A0 509 MOVEA.L access,A1 510 MOVE.L maxbytes,D0 511 MOVEA.L AMarqueeBase,A6 512 JSR -132(A6) 513 MOVEA.L (A7)+,A6 514 MOVE.L D0,@RESULT 515 END; 516END; 517 518FUNCTION QMessageOp(session : pQSession; hosts : pCHar; buffer : POINTER; len : ULONG) : LONGINT; 519BEGIN 520 ASM 521 MOVE.L A6,-(A7) 522 MOVEA.L session,A0 523 MOVEA.L hosts,A1 524 MOVE.L buffer,D0 525 MOVE.L len,D1 526 MOVEA.L AMarqueeBase,A6 527 JSR -138(A6) 528 MOVEA.L (A7)+,A6 529 MOVE.L D0,@RESULT 530 END; 531END; 532 533FUNCTION QNumQueuedPackets(session : pQSession) : ULONG; 534BEGIN 535 ASM 536 MOVE.L A6,-(A7) 537 MOVEA.L session,A0 538 MOVEA.L AMarqueeBase,A6 539 JSR -150(A6) 540 MOVEA.L (A7)+,A6 541 MOVE.L D0,@RESULT 542 END; 543END; 544 545FUNCTION QNumQueuedBytes(session : pQSession) : ULONG; 546BEGIN 547 ASM 548 MOVE.L A6,-(A7) 549 MOVEA.L session,A0 550 MOVEA.L AMarqueeBase,A6 551 JSR -156(A6) 552 MOVEA.L (A7)+,A6 553 MOVE.L D0,@RESULT 554 END; 555END; 556 557FUNCTION QErrorName(session : LONGINT) : pCHar; 558BEGIN 559 ASM 560 MOVE.L A6,-(A7) 561 MOVE.L session,D0 562 MOVEA.L AMarqueeBase,A6 563 JSR -162(A6) 564 MOVEA.L (A7)+,A6 565 MOVE.L D0,@RESULT 566 END; 567END; 568 569FUNCTION QRequestPrivilegesOp(session : pQSession; privBits : ULONG) : LONGINT; 570BEGIN 571 ASM 572 MOVE.L A6,-(A7) 573 MOVEA.L session,A0 574 MOVE.L privBits,D0 575 MOVEA.L AMarqueeBase,A6 576 JSR -168(A6) 577 MOVEA.L (A7)+,A6 578 MOVE.L D0,@RESULT 579 END; 580END; 581 582FUNCTION QReleasePrivilegesOp(session : pQSession; privBits : ULONG) : LONGINT; 583BEGIN 584 ASM 585 MOVE.L A6,-(A7) 586 MOVEA.L session,A0 587 MOVE.L privBits,D0 588 MOVEA.L AMarqueeBase,A6 589 JSR -174(A6) 590 MOVEA.L (A7)+,A6 591 MOVE.L D0,@RESULT 592 END; 593END; 594 595FUNCTION QKillClientsOp(session : pQSession; hosts : pCHar) : LONGINT; 596BEGIN 597 ASM 598 MOVE.L A6,-(A7) 599 MOVEA.L session,A0 600 MOVEA.L hosts,A1 601 MOVEA.L AMarqueeBase,A6 602 JSR -180(A6) 603 MOVEA.L (A7)+,A6 604 MOVE.L D0,@RESULT 605 END; 606END; 607 608FUNCTION QSetParameterOp(session : pQSession; paramName : pCHar; newValue : pCHar) : LONGINT; 609BEGIN 610 ASM 611 MOVE.L A6,-(A7) 612 MOVEA.L session,A0 613 MOVEA.L paramName,A1 614 MOVE.L newValue,D0 615 MOVEA.L AMarqueeBase,A6 616 JSR -186(A6) 617 MOVEA.L (A7)+,A6 618 MOVE.L D0,@RESULT 619 END; 620END; 621 622FUNCTION QGetParameterOp(session : pQSession; paramName : pCHar) : LONGINT; 623BEGIN 624 ASM 625 MOVE.L A6,-(A7) 626 MOVEA.L session,A0 627 MOVEA.L paramName,A1 628 MOVEA.L AMarqueeBase,A6 629 JSR -192(A6) 630 MOVEA.L (A7)+,A6 631 MOVE.L D0,@RESULT 632 END; 633END; 634 635FUNCTION QSysMessageOp(session : pQSession; hosts : pCHar; message : pCHar) : LONGINT; 636BEGIN 637 ASM 638 MOVE.L A6,-(A7) 639 MOVEA.L session,A0 640 MOVEA.L hosts,A1 641 MOVE.L message,D0 642 MOVEA.L AMarqueeBase,A6 643 JSR -198(A6) 644 MOVEA.L (A7)+,A6 645 MOVE.L D0,@RESULT 646 END; 647END; 648 649FUNCTION QGetAndSubscribeOp(session : pQSession; path : pCHar; maxBytes : LONGINT) : LONGINT; 650BEGIN 651 ASM 652 MOVE.L A6,-(A7) 653 MOVEA.L session,A0 654 MOVEA.L path,A1 655 MOVE.L maxBytes,D0 656 MOVEA.L AMarqueeBase,A6 657 JSR -210(A6) 658 MOVEA.L (A7)+,A6 659 MOVE.L D0,@RESULT 660 END; 661END; 662 663FUNCTION QDetachSession(session : pQSession; flags : ULONG) : BOOLEAN; 664BEGIN 665 ASM 666 MOVE.L A6,-(A7) 667 MOVEA.L session,A0 668 MOVE.L flags,D0 669 MOVEA.L AMarqueeBase,A6 670 JSR -216(A6) 671 MOVEA.L (A7)+,A6 672 TST.W D0 673 BEQ.B @end 674 MOVEQ #1,D0 675 @end: MOVE.B D0,@RESULT 676 END; 677END; 678 679FUNCTION QReattachSession(session : pQSession; flags : ULONG) : BOOLEAN; 680BEGIN 681 ASM 682 MOVE.L A6,-(A7) 683 MOVEA.L session,A0 684 MOVE.L flags,D0 685 MOVEA.L AMarqueeBase,A6 686 JSR -222(A6) 687 MOVEA.L (A7)+,A6 688 TST.W D0 689 BEQ.B @end 690 MOVEQ #1,D0 691 @end: MOVE.B D0,@RESULT 692 END; 693END; 694 695FUNCTION QNewSocketSession(host : pCHar; port : LONGINT; tags : pTagItem) : pQSession; 696BEGIN 697 ASM 698 MOVE.L A6,-(A7) 699 MOVEA.L host,A0 700 MOVE.L port,D0 701 MOVEA.L tags,A1 702 MOVEA.L AMarqueeBase,A6 703 JSR -228(A6) 704 MOVEA.L (A7)+,A6 705 MOVE.L D0,@RESULT 706 END; 707END; 708 709FUNCTION QSendRawOp(session : pQSession; buf : POINTER; len : ULONG) : LONGINT; 710BEGIN 711 ASM 712 MOVE.L A6,-(A7) 713 MOVEA.L session,A0 714 MOVEA.L buf,A1 715 MOVE.L len,D0 716 MOVEA.L AMarqueeBase,A6 717 JSR -234(A6) 718 MOVEA.L (A7)+,A6 719 MOVE.L D0,@RESULT 720 END; 721END; 722 723FUNCTION QNewSocketSessionAsync(host : pCHar; port : LONGINT; tags : pTagItem) : pQSession; 724BEGIN 725 ASM 726 MOVE.L A6,-(A7) 727 MOVEA.L host,A0 728 MOVE.L port,D0 729 MOVEA.L tags,A1 730 MOVEA.L AMarqueeBase,A6 731 JSR -240(A6) 732 MOVEA.L (A7)+,A6 733 MOVE.L D0,@RESULT 734 END; 735END; 736 737FUNCTION QNewSocketServerSession(port : pLONGINT; tags : pTagItem) : pQSession; 738BEGIN 739 ASM 740 MOVE.L A6,-(A7) 741 MOVEA.L port,A0 742 MOVEA.L tags,A1 743 MOVEA.L AMarqueeBase,A6 744 JSR -246(A6) 745 MOVEA.L (A7)+,A6 746 MOVE.L D0,@RESULT 747 END; 748END; 749 750FUNCTION QSetKeyAccessOp(session : pQSession; path : pCHar; hosts : pCHar) : LONGINT; 751BEGIN 752 ASM 753 MOVE.L A6,-(A7) 754 MOVEA.L session,A0 755 MOVEA.L path,A1 756 MOVE.L hosts,D0 757 MOVEA.L AMarqueeBase,A6 758 JSR -252(A6) 759 MOVEA.L (A7)+,A6 760 MOVE.L D0,@RESULT 761 END; 762END; 763 764FUNCTION QGetHostName(session : pQSession) : pCHar; 765BEGIN 766 ASM 767 MOVE.L A6,-(A7) 768 MOVEA.L session,A0 769 MOVEA.L AMarqueeBase,A6 770 JSR -258(A6) 771 MOVEA.L (A7)+,A6 772 MOVE.L D0,@RESULT 773 END; 774END; 775 776FUNCTION QGetProgName(session : pQSession) : pCHar; 777BEGIN 778 ASM 779 MOVE.L A6,-(A7) 780 MOVEA.L session,A0 781 MOVEA.L AMarqueeBase,A6 782 JSR -264(A6) 783 MOVEA.L (A7)+,A6 784 MOVE.L D0,@RESULT 785 END; 786END; 787 788PROCEDURE QSetMaxRawBufSize(session : pQSession; maxBufSize : ULONG); 789BEGIN 790 ASM 791 MOVE.L A6,-(A7) 792 MOVEA.L session,A0 793 MOVE.L maxBufSize,D0 794 MOVEA.L AMarqueeBase,A6 795 JSR -270(A6) 796 MOVEA.L (A7)+,A6 797 END; 798END; 799 800FUNCTION QNewSession(host : pCHar; port : LONGINT; name : pCHar; taglist : pTagItem) : pQSession; 801BEGIN 802 ASM 803 MOVE.L A6,-(A7) 804 MOVEA.L host,A0 805 MOVE.L port,D0 806 MOVEA.L name,A1 807 MOVE.L taglist,D1 808 MOVEA.L AMarqueeBase,A6 809 JSR -276(A6) 810 MOVEA.L (A7)+,A6 811 MOVE.L D0,@RESULT 812 END; 813END; 814 815FUNCTION QNewSessionAsync(host : pCHar; port : LONGINT; name : pCHar; taglist : pTagItem) : pQSession; 816BEGIN 817 ASM 818 MOVE.L A6,-(A7) 819 MOVEA.L host,A0 820 MOVE.L port,D0 821 MOVEA.L name,A1 822 MOVE.L taglist,D1 823 MOVEA.L AMarqueeBase,A6 824 JSR -282(A6) 825 MOVEA.L (A7)+,A6 826 MOVE.L D0,@RESULT 827 END; 828END; 829 830FUNCTION QNewHostSession(hostnames : pCHar; port : pLONGINT; names : pCHar; taglist : pTagItem) : pQSession; 831BEGIN 832 ASM 833 MOVE.L A6,-(A7) 834 MOVEA.L hostnames,A0 835 MOVEA.L port,A1 836 MOVE.L names,D0 837 MOVE.L taglist,D1 838 MOVEA.L AMarqueeBase,A6 839 JSR -288(A6) 840 MOVEA.L (A7)+,A6 841 MOVE.L D0,@RESULT 842 END; 843END; 844 845FUNCTION QNewServerSession(hostNames : pCHar; progNames : pCHar; taglist : pTagItem) : pQSession; 846BEGIN 847 ASM 848 MOVE.L A6,-(A7) 849 MOVEA.L hostNames,A0 850 MOVEA.L progNames,A1 851 MOVE.L taglist,D0 852 MOVEA.L AMarqueeBase,A6 853 JSR -294(A6) 854 MOVEA.L (A7)+,A6 855 MOVE.L D0,@RESULT 856 END; 857END; 858 859FUNCTION QCreateSharedMessagePort : pQSharedMessagePort; 860BEGIN 861 ASM 862 MOVE.L A6,-(A7) 863 MOVEA.L AMarqueeBase,A6 864 JSR -300(A6) 865 MOVEA.L (A7)+,A6 866 MOVE.L D0,@RESULT 867 END; 868END; 869 870PROCEDURE QDeleteSharedMessagePort(mp : pQSharedMessagePort); 871BEGIN 872 ASM 873 MOVE.L A6,-(A7) 874 MOVEA.L mp,A0 875 MOVEA.L AMarqueeBase,A6 876 JSR -306(A6) 877 MOVEA.L (A7)+,A6 878 END; 879END; 880 881 882FUNCTION QGetLocalIP(session : pQSession) : pCHAR; 883BEGIN 884 ASM 885 MOVE.L A6,-(A7) 886 MOVEA.L session,A0 887 MOVEA.L AMarqueeBase,A6 888 JSR -312(A6) 889 MOVEA.L (A7)+,A6 890 MOVE.L D0,@RESULT 891 END; 892END; 893 894 895FUNCTION QDebugOp(session : pQSession; string_ : string) : LONGINT; 896begin 897 QDebugOp := QDebugOp(session,pas2c(string_)); 898end; 899 900FUNCTION QGetOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 901begin 902 QGetOp := QGetOp(session,pas2c(path),maxBytes); 903end; 904 905FUNCTION QDeleteOp(session : pQSession; path : string) : LONGINT; 906begin 907 QDeleteOp := QDeleteOp(session,pas2c(path)); 908end; 909 910FUNCTION QRenameOp(session : pQSession; path : string; label_ : string) : LONGINT; 911begin 912 QRenameOp := QRenameOp(session,pas2c(path),pas2c(label_)); 913end; 914 915FUNCTION QSubscribeOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 916begin 917 QSubscribeOp := QSubscribeOp(session,pas2c(path),maxBytes); 918end; 919 920FUNCTION QSetOp(session : pQSession; path : string; buf : POINTER; len : ULONG) : LONGINT; 921begin 922 QSetOp := QSetOp(session,pas2c(path),buf,len); 923end; 924 925FUNCTION QSetAccessOp(session : pQSession; hosts : string) : LONGINT; 926begin 927 QSetAccessOp := QSetAccessOp(session,pas2c(hosts)); 928end; 929 930FUNCTION QStreamOp(session : pQSession; path : string; buf : POINTER; len : ULONG) : LONGINT; 931begin 932 QStreamOp := QStreamOp(session,pas2c(path),buf,len); 933end; 934 935FUNCTION QSetMessageAccessOp(session : pQSession; access : string; maxbytes : LONGINT) : LONGINT; 936begin 937 QSetMessageAccessOp := QSetMessageAccessOp(session,pas2c(access),maxBytes); 938end; 939 940FUNCTION QMessageOp(session : pQSession; hosts : string; buffer : POINTER; len : ULONG) : LONGINT; 941begin 942 QMessageOp := QMessageOp(session,pas2c(hosts),buffer,len); 943end; 944 945FUNCTION QKillClientsOp(session : pQSession; hosts : string) : LONGINT; 946begin 947 QKillClientsOp := QKillClientsOp(session,pas2c(hosts)); 948end; 949 950FUNCTION QSetParameterOp(session : pQSession; paramName : string; newValue : string) : LONGINT; 951begin 952 QSetParameterOp := QSetParameterOp(session,pas2c(paramName),pas2c(newValue)); 953end; 954 955FUNCTION QGetParameterOp(session : pQSession; paramName : string) : LONGINT; 956begin 957 QGetParameterOp := QGetParameterOp(session,pas2c(paramName)); 958end; 959 960FUNCTION QSysMessageOp(session : pQSession; hosts : string; message : string) : LONGINT; 961begin 962 QSysMessageOp := QSysMessageOp(session,pas2c(hosts),pas2c(message)); 963end; 964 965FUNCTION QGetAndSubscribeOp(session : pQSession; path : string; maxBytes : LONGINT) : LONGINT; 966begin 967 QGetAndSubscribeOp := QGetAndSubscribeOp(session,pas2c(path),maxBytes); 968end; 969 970FUNCTION QNewSocketSession(host : string; port : LONGINT; tags : pTagItem) : pQSession; 971begin 972 QNewSocketSession := QNewSocketSession(pas2c(host),port,tags); 973end; 974 975FUNCTION QNewSocketSessionAsync(host : string; port : LONGINT; tags : pTagItem) : pQSession; 976begin 977 QNewSocketSessionAsync := QNewSocketSessionAsync(pas2c(host),port,tags); 978end; 979 980FUNCTION QSetKeyAccessOp(session : pQSession; path : string; hosts : string) : LONGINT; 981begin 982 QSetKeyAccessOp := QSetKeyAccessOp(session,pas2c(path),pas2c(hosts)); 983end; 984 985FUNCTION QNewSession(host : string; port : LONGINT; name : string; taglist : pTagItem) : pQSession; 986begin 987 QNewSession := QNewSession(pas2c(host),port,pas2c(name),taglist); 988end; 989 990FUNCTION QNewSessionAsync(host : string; port : LONGINT; name : string; taglist : pTagItem) : pQSession; 991begin 992 QNewSessionAsync := QNewSessionAsync(pas2c(host),port,pas2c(name),taglist); 993end; 994 995FUNCTION QNewHostSession(hostnames : string; port : pLONGINT; names : string; taglist : pTagItem) : pQSession; 996begin 997 QNewHostSession := QNewHostSession(pas2c(hostnames),port,pas2c(names),taglist); 998end; 999 1000FUNCTION QNewServerSession(hostNames : string; progNames : string; taglist : pTagItem) : pQSession; 1001begin 1002 QNewServerSession := QNewServerSession(pas2c(hostnames),pas2c(prognames),taglist); 1003end; 1004 1005FUNCTION QNewSocketSessiontags(host : pCHar; port : LONGINT; const argv : Array Of Const) : pQSession; 1006begin 1007 QNewSocketSessiontags := QNewSocketSession(host,port,readintags(argv)); 1008end; 1009 1010FUNCTION QNewSocketSessionAsyncTags(host : pCHar; port : LONGINT; const argv : Array Of Const) : pQSession; 1011begin 1012 QNewSocketSessionAsyncTags := QNewSocketSessionAsync(host,port,readintags(argv)); 1013end; 1014 1015FUNCTION QNewSocketServerSessionTags( port : pLONGINT; const argv : Array Of Const) : pQSession; 1016begin 1017 QNewSocketServerSessionTags := QNewSocketServerSession(port,readintags(argv)); 1018end; 1019 1020FUNCTION QNewSessionTags(host : pCHar; port : LONGINT; name : pCHar; const argv : Array Of Const) : pQSession; 1021begin 1022 QNewSessionTags := QNewSession(host,port,name,readintags(argv)); 1023end; 1024 1025FUNCTION QNewSessionAsyncTags(host : pCHar; port : LONGINT; name : pCHar; const argv : Array Of Const) : pQSession; 1026begin 1027 QNewSessionAsyncTags := QNewSessionAsync(host,port,name,readintags(argv)); 1028end; 1029 1030FUNCTION QNewHostSessionTags(hostnames : pCHar; port : pLONGINT; names : pCHar; const argv : Array Of Const) : pQSession; 1031begin 1032 QNewHostSessionTags := QNewHostSession(hostnames,port,names,readintags(argv)); 1033end; 1034 1035FUNCTION QNewServerSessionTags(hostNames : pCHar; progNames : pCHar; const argv : Array Of Const) : pQSession; 1036begin 1037 QNewServerSessionTags := QNewServerSession(hostnames,prognames,readintags(argv)); 1038end; 1039 1040 1041FUNCTION QNewSocketSessionTags(host : string; port : LONGINT; const argv : Array Of Const) : pQSession; 1042begin 1043 QNewSocketSessionTags := QNewSocketSession(host,port,readintags(argv)); 1044end; 1045 1046FUNCTION QNewSocketSessionAsyncTags(host : string; port : LONGINT; const argv : Array Of Const) : pQSession; 1047begin 1048 QNewSocketSessionAsyncTags := QNewSocketSessionAsync(host,port,readintags(argv)); 1049end; 1050 1051FUNCTION QNewSessionTags(host : string; port : LONGINT; name : string; const argv : Array Of Const) : pQSession; 1052begin 1053 QNewSessionTags := QNewSession(host,port,name,readintags(argv)); 1054end; 1055 1056FUNCTION QNewSessionAsyncTags(host : string; port : LONGINT; name : string; const argv : Array Of Const) : pQSession; 1057begin 1058 QNewSessionAsyncTags := QNewSessionAsync(host,port,name,readintags(argv)); 1059end; 1060 1061FUNCTION QNewHostSessionTags(hostnames : string; port : pLONGINT; names : string; const argv : Array Of Const) : pQSession; 1062begin 1063 QNewHostSessionTags := QNewHostSession(hostnames,port,names,readintags(argv)); 1064end; 1065 1066FUNCTION QNewServerSessionTags(hostNames : string; progNames : string; const argv : Array Of Const) : pQSession; 1067begin 1068 QNewServerSessionTags := QNewServerSession(hostnames,prognames,readintags(argv)); 1069end; 1070 1071const 1072 { Change VERSION and LIBVERSION to proper values } 1073 1074 VERSION : string[2] = '0'; 1075 LIBVERSION : longword = 0; 1076 1077{$ifdef use_init_openlib} 1078 {$Info Compiling initopening of amarquee.library} 1079 {$Info don't forget to use InitAMARQUEELibrary in the beginning of your program} 1080 1081var 1082 amarquee_exit : Pointer; 1083 1084procedure CloseamarqueeLibrary; 1085begin 1086 ExitProc := amarquee_exit; 1087 if AMarqueeBase <> nil then begin 1088 CloseLibrary(AMarqueeBase); 1089 AMarqueeBase := nil; 1090 end; 1091end; 1092 1093procedure InitAMARQUEELibrary; 1094begin 1095 AMarqueeBase := nil; 1096 AMarqueeBase := OpenLibrary(AMARQUEENAME,LIBVERSION); 1097 if AMarqueeBase <> nil then begin 1098 amarquee_exit := ExitProc; 1099 ExitProc := @CloseamarqueeLibrary; 1100 end else begin 1101 MessageBox('FPC Pascal Error', 1102 'Can''t open amarquee.library version ' + VERSION + #10 + 1103 'Deallocating resources and closing down', 1104 'Oops'); 1105 halt(20); 1106 end; 1107end; 1108 1109begin 1110 AMARQUEEIsCompiledHow := 2; 1111{$endif use_init_openlib} 1112 1113{$ifdef use_auto_openlib} 1114 {$Info Compiling autoopening of amarquee.library} 1115 1116var 1117 amarquee_exit : Pointer; 1118 1119procedure CloseamarqueeLibrary; 1120begin 1121 ExitProc := amarquee_exit; 1122 if AMarqueeBase <> nil then begin 1123 CloseLibrary(AMarqueeBase); 1124 AMarqueeBase := nil; 1125 end; 1126end; 1127 1128begin 1129 AMarqueeBase := nil; 1130 AMarqueeBase := OpenLibrary(AMARQUEENAME,LIBVERSION); 1131 if AMarqueeBase <> nil then begin 1132 amarquee_exit := ExitProc; 1133 ExitProc := @CloseamarqueeLibrary; 1134 AMARQUEEIsCompiledHow := 1; 1135 end else begin 1136 MessageBox('FPC Pascal Error', 1137 'Can''t open amarquee.library version ' + VERSION + #10 + 1138 'Deallocating resources and closing down', 1139 'Oops'); 1140 halt(20); 1141 end; 1142 1143{$endif use_auto_openlib} 1144 1145{$ifdef dont_use_openlib} 1146begin 1147 AMARQUEEIsCompiledHow := 3; 1148 {$Warning No autoopening of amarquee.library compiled} 1149 {$Warning Make sure you open amarquee.library yourself} 1150{$endif dont_use_openlib} 1151 1152END. (* UNIT AMARQUEE *) 1153 1154 1155