#1 2008-05-25 18:50

Miki
Member
Registered: 2008-05-25
Posts: 4

Declaring a pointer before record

I am new to renamer, and even newer to pascal.

I have seen this type of code written for pascal-

type nptr = ^node;
     node = RECORD
           nextNode,prevNode: nptr;
           lastI : Integer
     END;

. . . but when i attempt to compile this in the PascalScript compiler, I immediately get the error "Identifier Expected" on the line "nptr = ^node".
Is this code incorrect?

Thanks.

Offline

#2 2008-05-26 16:11

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Declaring a pointer before record

Hmmm roll

is
"nptr = ^node" correct???

or better
"nptr = node" ?


Just guessing.....:/


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#3 2008-05-26 20:37

Miki
Member
Registered: 2008-05-25
Posts: 4

Re: Declaring a pointer before record

Well, i would like it to be a pointer, but written as you suggested, i get the error "Unknown type 'node' "
so the question remains. . .

Offline

#4 2008-05-26 20:44

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 1,161

Re: Declaring a pointer before record

Not all you can do in Pascal you can do in PascalScript.
Not all you can do in PascalScript you can do in ReNamer.
Take a look in ReNamer help and there in PascalScript section to know what ReNamer support.

If you would post what you want to archive ... maybe some one more familiar whit PascalScript may help you whit the syntax.


Read the  *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)

Offline

#5 2008-05-26 21:22

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Declaring a pointer before record

PascalScript component/language does not (yet) have support for Pointers.

Why do you need them? What are you trying to do? I am sure that you can achieve your goal without using pointers.

Offline

#6 2008-07-09 06:57

Miki
Member
Registered: 2008-05-25
Posts: 4

Re: Declaring a pointer before record

My how time flies!

Thank you for offering to help.
My problem was as follows:
I have LOTS (thousands) of well-organized pictures.  The problem is [of course] that the pictures themselves are poorly named (img0001, etc.)
I wanted to automatically name each file the name of it's immediate parent folder + index.  However, my folders have many levels--which are 'flattened' by a strict alphabetical rule when i import the root into Renamer.  For example, if i have Folders 'A', 'C', 'Z', and files 'b', 'd' all in the 'Root' folder, Renamer will import all of the files in 'A', then return to 'Root' to list file 'b', then proceed into folder 'C', then back for file 'd', etc.  Therefore, if I want 'd' to be labeled 'root 2', i need some way of remembering (ie storing) that the root folder has already begun indexing [ie before the program moved on to folder 'C'.]
whew! hope that was clear so far.
One simple solution would be to enter each new folder name encountered into a map--mapping the folder name to an integer of the last index so far.  This has two problems: 1 is that some of my folders have the same name. (ie more than one folder has a subfolder entitled 'day one', so the map would have repeat issues.  Another issue is that this method is fairly inefficient.
Instead, I was hoping to create either a linked list or a stack that would keep track of the filepath depth.--every time renamer had to go deeper, push the new folder name.  If it reached the end of a folder, it would keep popping folders from the stack until the folder name on top of the stack and the next file in renamer matched up.  The program could then check the filepath of each file off of the deepest folders 1st--which is much more efficient than searching every folder to find a match.

However, making linked lists and stacks requires pointers... which you say are unavailable in renamer.

Any other suggestions, other than brute force? (i know it can be done that way... but its not pretty  wink  )

Thanks again for all of your help, I hope that was clear enough,
-Miki

Offline

#7 2008-07-17 14:50

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,378

Re: Declaring a pointer before record

Sorry for late reply, very busy as usual...

Anyway, I couldn't fully understand what you need to do, but for storing list of folders or paths you can use Arrays. You can easily keep track of how many folders you have processed, how deep you are in the folder structure, when you switch to a new folder, etc. If you can give a more concrete example, or even a pseudo code, I will help you with PascalScript for it.

Offline

#8 2008-07-17 17:37

Miki
Member
Registered: 2008-05-25
Posts: 4

Re: Declaring a pointer before record

wow, you are absolutely right...
i guess i didnt think of that because i am so unaccustomed to assigning an array size based on an estimate* rather than dynamically adding nodes.
I will try again and see how it goes.

Thanks again for answering--i find it remarkable that you really do get around to everyone's questions.
-Miki

*in this case, an estimate of greatest folder depth

Offline

Board footer

Powered by FluxBB