Changeset 4925
- Timestamp:
- Jul 29, 2006, 2:40:57 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-sysio.lisp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-sysio.lisp
r4915 r4925 282 282 (external-format :initform :default :initarg :external-format 283 283 :accessor file-stream-external-format))) 284 284 285 285 286 … … 296 297 (setf (slot-value s 'actual-filename) new)) 297 298 298 (def method print-object ((s fundamental-file-stream)out)299 (defun print-file-stream (s out) 299 300 (print-unreadable-object (s out :type t :identity t) 300 301 (let* ((file-ioblock (stream-ioblock s nil))) … … 303 304 (format out "~d)" (file-ioblock-device file-ioblock)) 304 305 (format out ":closed"))))) 305 306 307 (defmethod print-object ((s fundamental-file-stream) out) 308 (print-file-stream s out)) 309 310 (make-built-in-class 'basic-file-stream 'basic-stream 'file-stream) 311 312 (defmethod stream-filename ((s basic-file-stream)) 313 (basic-file-stream.filename s)) 314 315 (defmethod stream-actual-filename ((s basic-file-stream)) 316 (basic-file-stream.actual-filename s)) 317 318 (defmethod (setf stream-filename) (new (s basic-file-stream)) 319 (setf (basic-file-stream.filename s) new)) 320 321 (defmethod (setf stream-actual-filename) (new (s basic-file-stream)) 322 (setf (basic-file-stream.actual-filename s) new)) 323 324 (defmethod print-object ((s basic-file-stream) out) 325 (print-file-stream s out)) 326 306 327 (defmethod stream-create-ioblock ((stream fundamental-file-stream) &rest args &key) 307 328 (declare (dynamic-extent args)) 308 329 (apply #'make-file-ioblock :stream stream args)) 309 330 331 (defmethod stream-create-ioblock ((stream basic-file-stream) &rest args &key) 332 (declare (dynamic-extent args)) 333 (apply #'make-file-ioblock :stream stream args)) 334 310 335 (defclass fundamental-file-input-stream (fundamental-file-stream fd-input-stream) 311 336 ()) 312 337 338 (make-built-in-class 'basic-file-input-stream 'basic-file-stream 'basic-input-stream) 339 340 313 341 (defclass fundamental-file-output-stream (fundamental-file-stream fd-output-stream) 314 342 ()) 315 343 344 (make-built-in-class 'basic-file-output-stream 'basic-file-stream 'basic-output-stream) 345 316 346 (defclass fundamental-file-io-stream (fundamental-file-stream fd-io-stream) 317 347 ()) 348 349 (make-built-in-class 'basic-file-io-stream 'basic-file-stream 'basic-io-stream) 350 318 351 319 352 (defclass fundamental-file-character-input-stream (fundamental-file-input-stream … … 321 354 ()) 322 355 356 (make-built-in-class 'basic-file-character-input-stream 'basic-file-input-stream 'basic-character-input-stream) 357 358 323 359 (defclass fundamental-file-character-output-stream (fundamental-file-output-stream 324 360 fd-character-output-stream) 325 361 ()) 326 362 363 (make-built-in-class 'basic-file-character-output-stream 'basic-file-output-stream 'basic-character-output-stream) 364 327 365 (defclass fundamental-file-character-io-stream (fundamental-file-io-stream 328 366 fd-character-io-stream) 329 367 ()) 330 368 369 (make-built-in-class 'basic-file-character-io-stream 'basic-file-io-stream 'basic-character-io-stream) 370 331 371 (defclass fundamental-file-binary-input-stream (fundamental-file-input-stream 332 372 fd-binary-input-stream) 333 373 ()) 334 374 375 (make-built-in-class 'basic-file-binary-input-stream 'basic-file-input-stream 'basic-binary-input-stream) 376 335 377 (defclass fundamental-file-binary-output-stream (fundamental-file-output-stream 336 378 fd-binary-output-stream) 337 379 ()) 338 380 381 (make-built-in-class 'basic-file-binary-output-stream 'basic-file-output-stream 'basic-binary-output-stream) 382 339 383 (defclass fundamental-file-binary-io-stream (fundamental-file-io-stream fd-binary-io-stream) 340 384 ()) 385 386 (make-built-in-class 'basic-file-binary-io-stream 'basic-file-io-stream 'basic-binary-io-stream) 387 341 388 342 389 ;;; This stuff is a lot simpler if we restrict the hair to the … … 350 397 (synch-file-octet-filepos file-ioblock) 351 398 nil)) 399 400 401 (defmethod stream-clear-input ((f basic-file-input-stream)) 402 (let* ((file-ioblock (basic-stream-ioblock f))) 403 (with-ioblock-input-locked (file-ioblock) 404 (call-next-method) 405 (synch-file-octet-filepos file-ioblock) 406 nil))) 407 352 408 353 409 (defmethod stream-clear-input ((f fundamental-file-io-stream)) … … 358 414 nil)) 359 415 416 (defmethod stream-clear-input ((f basic-file-io-stream)) 417 (let* ((file-ioblock (basic-stream-ioblock f))) 418 (with-ioblock-input-locked (file-ioblock) 419 (call-next-method) 420 (synch-file-octet-filepos file-ioblock) 421 nil))) 422 360 423 (defmethod stream-clear-output ((f fundamental-file-output-stream)) 361 424 (with-stream-ioblock-output (file-ioblock f :speedy t) … … 363 426 (synch-file-octet-filepos file-ioblock) 364 427 nil)) 428 429 (defmethod stream-clear-output ((f basic-file-output-stream)) 430 (let* ((file-ioblock (basic-stream-ioblock f))) 431 (with-ioblock-input-locked (file-ioblock) 432 (call-next-method) 433 (synch-file-octet-filepos file-ioblock) 434 nil))) 365 435 366 436 ;;; Fill the input buffer, possibly doing newline translation. … … 442 512 443 513 514 (defmethod stream-position ((stream basic-file-input-stream) &optional newpos) 515 (let* ((file-ioblock (basic-stream-ioblock stream))) 516 (with-ioblock-input-locked (file-ioblock) 517 (%ioblock-input-file-position file-ioblock newpos)))) 444 518 445 519 (defmethod stream-position ((stream fundamental-file-output-stream) &optional newpos) … … 447 521 (%ioblock-output-file-position file-ioblock newpos))) 448 522 523 (defmethod stream-position ((stream basic-file-output-stream) &optional newpos) 524 (let* ((file-ioblock (basic-stream-ioblock stream))) 525 (with-ioblock-output-locked (file-ioblock) 526 (%ioblock-output-file-position file-ioblock newpos)))) 449 527 450 528 … … 453 531 (%ioblock-io-file-position file-ioblock newpos))) 454 532 533 (defmethod stream-position ((stream basic-file-io-stream) &optional newpos) 534 (let* ((file-ioblock (basic-stream-ioblock stream))) 535 (with-ioblock-input-locked (file-ioblock) 536 (%ioblock-io-file-position file-ioblock newpos)))) 455 537 456 538 … … 459 541 (%ioblock-input-file-length file-ioblock newlen))) 460 542 543 (defmethod stream-length ((stream basic-file-input-stream) &optional newlen) 544 (let* ((file-ioblock (basic-stream-ioblock stream))) 545 (with-ioblock-input-locked (file-ioblock) 546 (%ioblock-input-file-length file-ioblock newlen)))) 461 547 462 548 … … 465 551 (%ioblock-output-file-length file-ioblock newlen))) 466 552 553 554 (defmethod stream-length ((stream basic-file-output-stream) &optional newlen) 555 (let* ((file-ioblock (basic-stream-ioblock stream))) 556 (with-ioblock-output-locked (file-ioblock) 557 (%ioblock-output-file-length file-ioblock newlen)))) 558 467 559 (defmethod stream-length ((s fundamental-file-io-stream) &optional newlen) 468 560 (with-stream-ioblock-input (file-ioblock s :speedy t) 469 561 (%ioblock-output-file-length file-ioblock newlen))) 470 562 471 (defmethod close ((s fundamental-file-stream) &key abort) 563 (defmethod stream-length ((stream basic-file-io-stream) &optional newlen) 564 (let* ((file-ioblock (basic-stream-ioblock stream))) 565 (with-ioblock-input-locked (file-ioblock) 566 (%ioblock-output-file-length file-ioblock newlen)))) 567 568 (defun close-file-stream (s abort) 472 569 (when (open-stream-p s) 473 570 (let* ((ioblock (stream-ioblock s t)) … … 481 578 (unix-rename (namestring actual-filename) (probe-file-x filename))) 482 579 (delete-file actual-filename))) 483 (setq *open-file-streams* (nremove s *open-file-streams*)) 484 (call-next-method)))) 580 (setq *open-file-streams* (nremove s *open-file-streams*))))) 581 582 583 (defmethod close ((s fundamental-file-stream) &key abort) 584 (close-file-stream s abort) 585 (call-next-method)) 586 587 (defmethod close ((s basic-file-stream) &key abort) 588 (close-file-stream s abort) 589 (call-next-method)) 485 590 486 591 (defmethod select-stream-class ((class fundamental-file-stream) in-p out-p char-p) … … 637 742 (file-stream-external-format s)) 638 743 744 (defmethod stream-external-format ((s basic-file-stream)) 745 (basic-file-stream.external-format s)) 746 639 747 (defmethod stream-external-format ((s broadcast-stream)) 640 748 (let* ((last (last-broadcast-stream s)))
Note:
See TracChangeset
for help on using the changeset viewer.
