Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-08

2 questions on ansistrings

14 messages · 10 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Emerson

1. If a segment is deleted from an ansistring, e.g. ...

s := 'abcdefghijklmnop';
delete (s, 5, 6);

yielding s = 'abcdelmnop'

...does the system "shift" the 'lmnop' to the left, or does the string get hooked together with pointers, thus saving much time with long strings?

2. Is there any documentation yet of the ansistring internals? If not, what file contains the source?

Thanks,
Mark

Michael Van Canneyt
to Mark Emerson
Mark Emerson wrote 9 lines
1. If a segment is deleted from an ansistring, e.g. ... s := 'abcdefghijklmnop'; delete (s, 5, 6); yielding s = 'abcdelmnop' ...does the system "shift" the 'lmnop' to the left, or does the string get hooked together with pointers, thus saving much time with long strings?

It is shifted. Hooked together would maybe make 'delete' faster, but would considerably slow down other operations.

But the memory is not reallocated in this case, unless the string had a reference count of 2.

And the shift is done using a 'Move' instruction, which is highly optimized.

2. Is there any documentation yet of the ansistring internals? If not, what file contains the source?

The memory layout is documented in the programmer's guide:

Memory Issues
+ Data Formats
+ String types
+ Ansistring types

The source is rtl/inc/astrings.inc

Michael.

Marco van de Voort
to Mark Emerson: 1. If a segment is deleted from an ansistring, e.g. ... s := 'abcdefghijklmnop'; delete…
Show quoted text 9 lines
1. If a segment is deleted from an ansistring, e.g. ... s := 'abcdefghijklmnop'; delete (s, 5, 6); yielding s = 'abcdelmnop' ...does the system "shift" the 'lmnop' to the left, or does the string get hooked together with pointers, thus saving much time with long strings?

No shifting, ansistrings are not sparse (at least not in this implementation.

Note that sparse strings save time with this kind of operations, but cost quite some extra time when parsing them.

2. Is there any documentation yet of the ansistring internals? If not, what file contains the source?

I don't know, but the file is inc/astrings.inc Maybe there are some asm parts in <processor>.inc too

The idea is quite simple. Ansistrings essentially are pchars, with alloocation size, length and reference count prefixed on negative offsets of variable^.

The fact that it has the length, also means that it can contain any character.

Renato Borges A. Prado
to Marco van de Voort

The www.lazarus.freepascal.org has been down for a while, does anyone know what exactly what happened?

[]'s
Renato

Earlier message 24 lines
----- Original Message ----- From: "Marco van de Voort" To: Sent: Thursday, August 28, 2003 4:25 AM Subject: Re: [fpc-pascal]2 questions on ansistrings > > > > > > yielding s = 'abcdelmnop' > > > > > > ...does the system "shift" the 'lmnop' to the left, or does the string > > > get hooked together with pointers, thus saving much time with long strings? > > > > No shifting, ansistrings are not sparse (at least not in this implementation. > > should be: > > It does shifting, but isn't sparse. > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Renato Borges A. Prado
to Michael Van Canneyt: A hacker attacked it. Michael Hess is working on it. Michael.

Thanks for answering.

I am finishing downloading it, but I have some time to wait yet (56k and only a few hours per weekend). How is the project going?

[]'s
Renato Borges A. Prado
VW Gol Power 1.0 16V 02/02
Poá-SP

Earlier message 22 lines
----- Original Message ----- From: "Michael Van Canneyt" To: Sent: Thursday, August 28, 2003 11:08 AM Subject: Re: [fpc-pascal]Lazarus > > > On Thu, 28 Aug 2003, Renato Borges A. Prado wrote: > > > The www.lazarus.freepascal.org has been down for a while, does anyone know > > what exactly what happened? > > A hacker attacked it. Michael Hess is working on it. > > Michael. > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal
James Mills
to Marco van de Voort
Marco van de Voort wrote 5 lines
> The www.lazarus.freepascal.org has been down for a while, does anyone know > what exactly what happened? Some hacker activity, and the owner wanted to reinstall to make sure that they were entirely gone.

That's so pathetic. What'd the hacker do anyhow ? And how the heck does a hacker break into a *nix box ? (I assume it is...)

cheers
James

- -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape.
Sigurd Stordal
to James Mills
That's so pathetic. What'd the hacker do anyhow ? And how the heck does a hacker break into a *nix box ? (I assume it is...)

It's easy. At least if you run an old redhat, or run some of the dangerous services.
I remember my machine been hacked into some year ago. The redhat of then just completely blew all my security measures and installed a service I didn't want or needed opening my machine wide up.
As to why. When it came to my machine I reckon it was used to either break into some other computer or as a DoS attack machine.

So, if you had the impression that a *nix box was hacker proof, then your wrong. You have to be on the alert all the time, running some sort of intrusion defense program, and be aware of what services you run, and possible security problem with them.

totally OT, but I just couldn't help myself.

Sigurd Stordal President of GOGS Experimental Petrologist
Michael A. Hess
to Sigurd Stordal
Sigurd Stordal wrote
> That's so pathetic. What'd the hacker do anyhow ? And how the heck does > a hacker break into a *nix box ? (I assume it is...) It's easy. At least if you run an old redhat, or run some of the dangerous services.

You really need to be deligent and keep up with the security updates and apply them when a hole comes up. I was busy and lazy and didn't get around to one of them and that is how they got in. :-\

==== Programming my first best destiny! ==== Michael A. Hess Miracle Concepts, Inc. http://www.miraclec.com Phone: 570-388-2211 Fax: 570-388-6101
A.J. Venter
to Sigurd Stordal: It's easy. At least if you run an old redhat, or run some of the dangerous services. I…

Not to be pedantic, but can I request that we as TRUE hackers at least get the terminology right. The site was a cracked by a cracker. FPC was created, and is used by a large number of hackers.

Maybe I should just give up........sigh.

Ciao
A.J.

Sigurd Stordal wrote 16 lines
> That's so pathetic. What'd the hacker do anyhow ? And how the heck does > a hacker break into a *nix box ? (I assume it is...) It's easy. At least if you run an old redhat, or run some of the dangerous services. I remember my machine been hacked into some year ago. The redhat of then just completely blew all my security measures and installed a service I didn't want or needed opening my machine wide up. As to why. When it came to my machine I reckon it was used to either break into some other computer or as a DoS attack machine. So, if you had the impression that a *nix box was hacker proof, then your wrong. You have to be on the alert all the time, running some sort of intrusion defense program, and be aware of what services you run, and possible security problem with them. totally OT, but I just couldn't help myself.
Jeff Pohlmeyer
Show quoted text 9 lines
> That's so pathetic. What'd the hacker do anyhow ? And how the heck does > > a hacker break into a *nix box ? (I assume it is...) > It's easy. At least if you run an old redhat, or run some of the dangerous > services. You really need to be deligent and keep up with the security updates and apply them when a hole comes up. I was busy and lazy and didn't get around to one of them and that is how they got in. :-\

It happens to the best of them...
http://linuxtoday.com/news_story.php3?ltsn=2000-05-05-009-04-PS http://www.internetnews.com/infra/article.php/2248811

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com