Announcement

Collapse
No announcement yet.

Is there a list of reserved words....

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is there a list of reserved words....

    ....for the win32api.inc file?

    I'm getting tired of trying to use their reserved words (latest: MI. Go figure) in my programs.

    I only come upon these by accident, but all too frequently...

    --------------------------------------------------

    Added but not relevant

    Unbelievable: Posted this at 10:08PM and it's already on Google search at 10:48PM. 45 minutes
    Last edited by Mel Bishop; 16 Mar 2008, 08:30 PM.
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

  • #2
    Originally posted by Mel Bishop View Post
    ....for the win32api.inc file?
    Maybe the PBIDE could be extended to accept an additional list of reserved words with a different color?

    Comment


    • #3
      Originally posted by Mel Bishop View Post
      ....
      I'm getting tired of trying to use their reserved words (latest: MI. Go figure) in my programs.

      Hmmmmmmmmmmmmm......

      MI is not a reserved word, Mel. Exactly why do you think it's reserved?

      Bob Zale
      PowerBASIC Inc.

      Comment


      • #4
        Because with win32api included, the compiler errors out with MI being a "duplicate name definition". Without the api, it compiles fine.

        Maybe I sould have specified "it appears to be a win32api reserved word".

        Later: Doing some further checking, it appears to affect MACRO functions. The following burps as I described.
        Code:
        #INCLUDE "win32api.inc"
        
            MACRO mi = a / b
            
        FUNCTION PBMAIN()
        
            WAITKEY$
            EXIT FUNCTION
        
            END FUNCTION
        Dump the include file and it compiles fine.
        Last edited by Mel Bishop; 16 Mar 2008, 07:18 PM.
        There are no atheists in a fox hole or the morning of a math test.
        If my flag offends you, I'll help you pack.

        Comment


        • #5
          i have been having a similar issue while trying to learn to program in windows and where certain words can have a meaning in some kind of way.

          the program i am using is not doing a good job to search for word usage and giving me back some useful information, it is manual. i have to first do a manual search for text then manually, run a text viewer to view the file.

          windows programming is getting more complicated or at least there are newer words that can mean, well anything.

          what i would like to have is a program to search files for a matched text and give me a few lines of before the word and a few lines after the word, then i could press a key button that would load the file into a file viewer and place me at the exact line and the file viewer would also let me do more searchs within the document or i could just quit the viewer and go back to searching other files.

          i believe i wrote something like this, that does the first part of finding text in files, in another program, but once i transferred control to the second program to view the whole, the second program just viewed the file at the top then i had to do another search to find the word again.

          the program would actually go through over 10,000 files in seconds looking for text matches and then let you see the a couple of lines above and below. you could supply up to 3 keywords to find and all 3 keywords had to be on one line. a better program would be to let you find as an option the keywords on several lines that are close to each other.

          maybe there is something like this already. it would solve using words already defined or show how code is to be used.

          now that i am learning gui programming and not using msdos software, a better interface than the console program i had written originally can be created.


          paul
          Last edited by Paul Purvis; 16 Mar 2008, 08:21 PM.
          p purvis

          Comment


          • #6
            Here's the UNION that uses it Mel:
            Code:
            UNION mkhunion
                mi AS MOUSEINPUT
                ki AS KEYBDINPUT
                HI AS HARDWAREINPUT
            END UNION

            Comment


            • #7
              here is what i have come up with for now that is freeware.
              i know that this is not exactly what you maybe wanted
              but the program can be altered and placed at different subdirectories for different uses.
              i do not see where this program removes white spaces though.

              http://www.harddisksearch.com/

              it still may help in keeping certain used words from being used and getting examples of where the words are used.
              p purvis

              Comment


              • #8
                It appears to be limited to usage with macros, 'GLOBAL mi AS LONG' compiles fine.
                It appears in the WinAPI32.INC file as a part of a TYPE definition as does/do 'x','y' and other letter combinations that bring up the same error when used in macros.

                If they adjust the IDE to accommodate the reserved words in the API, maybe they will adjust the IDE to accommodate words on the left side of macro equations as well.

                Paul,
                Are you telling us that you have a program that accesses the WinAPI32.INC or the SDK help file that PB has generously supplied us from an application of your own? I just spent quite a bit of time searching the forums for an app that would access the help files, even a line at a time of human readable stuff. Didn't find anything yet.

                Rod
                Rod
                In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                Comment


                • #9
                  Rodney,
                  i was not referring to doing a search on any files other than files formated in an ascii formated file.
                  the program i had written was in cbasic and searches where done on specific files but the program could be converted.
                  i thought i saw a program that would let you view a file and place you at the certain line in the file if given on the command line, it might have been a program not of this forum.

                  i like the utilities written for powerbasic and sdk to search for very common uses.

                  unless i am doing something wrong or the hard way, what i am doing is seeing some written code or documentation on something i am not familiar with and i usually need some more information on understanding what is actually going on or i want to see what files contain whatever it is i am searching and take a glance on how or where it is being used.

                  the word might even be a function i have written in my own code but forgot where the code was located.

                  for example lets say i do not know what %VK_UP is in somebody's code or where i used that or can i use that word without interfering or confusing the word with another file that might be already using the word.

                  so i needed a way to see the use of that or where all the word is found.
                  if the word is being used else where, i need to probably reframe from using it.
                  so searching for words(text) is very helpful to me.

                  many times there is something close to that word that can help me out in other ways too.
                  an example is there is a %VK_PGDN that i might not of known about had i not seen it by viewing the win32api.inc file looking for %VK_UP.
                  now by doing a search for %VK_PGDN, i found an example file usekeys.bas, where i can look to learn more about programming.

                  this may seem quiet easy to an experienced windows programmer, but it is not to the beginner.
                  on this site you see MCM suggesting all kinds of ways to do something and it is because he is very familiar with SDK and a lot of windows functions and/or what keywords mean or do when programming.

                  most of the features, can i use the word features loosely, are grouped close together in the include files, so browsing other words close to ones searched is very useful.

                  i apologize about communicating this subject badly.
                  paul
                  Last edited by Paul Purvis; 16 Mar 2008, 10:46 PM.
                  p purvis

                  Comment


                  • #10
                    Macros are a source of name conflicts that greatly limits its usefulness. If you define MACRO mi = a / b, each time that the compiler finds a mi it will attempt to substitute it for a / b. The solution will be to modify the compiler so it will be more selective and not attempt to substitute each occurrence of mi with a / b if it doesn't make sense, such as variables, members and parameter names.
                    Forum: http://www.jose.it-berater.org/smfforum/index.php

                    Comment


                    • #11
                      Sounds like a dandy reason for using long variable & macro names.

                      =====================================
                      "This book fills a much-needed gap."
                      Moses Hadas (1900-1966) in a review
                      =====================================
                      It's a pretty day. I hope you enjoy it.

                      Gösta

                      JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                      LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                      Comment


                      • #12
                        Paul,
                        Where did you find this 'usekeys.bas' example. Was it under another name? I wouldn't mind having a look at it but I can't find it anywhere.

                        Rod
                        Rod
                        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                        Comment


                        • #13
                          Mel

                          i am sorry my response is sort of off the topic for you a seasoned programmer.
                          but providing valid words(functions, variables, macros, etc) is not when those descriptions are duplicated or used similar to something else may be up your road.

                          here is a console program that i had flung together two years ago to do a search on some text files we had.
                          this was probably one of my first programs in pbcc.
                          when a text match is found on one line, the program stops, shows you lines before and after it for a few lines, then ask if you want to continue searching, abort, or view the whole file, which is viewed now with notepad.

                          this was my first program and i did not have any kind of text viewer at the time and for this program, i guess it is ok for demo purpose.

                          please remember, this was a first and it does great for what i had it for, but it needs much attention to be a programmers aid but the attention need is not by too much.
                          a gui front end would be nice, alone with a text file view that does not let you edit anything, just view and does text searchs along with copying to clipboard.

                          get it at pdptemp.dyndns.org/zipcode
                          findtext.bas findtext.exe

                          made a small change so search is case insensitive
                          Code:
                          'compiled with pbcc40
                          #COMPILE EXE
                          '#DIM ALL
                          GLOBAL FILELISTING() AS STRING
                          GLOBAL LASTFILEINARRAY AS LONG
                          FUNCTION PBMAIN () AS LONG
                          
                          FILETOSEARCH$=TRIM$(COMMAND$)
                          IF FILETOSEARCH$="" THEN
                              STDOUT "place the file name or wildcards names on the command line"
                              GOTO FINISH2
                          END IF
                          
                          TEMP$=DIR$(FILETOSEARCH$)
                          IF TEMP$="" THEN
                                STDOUT "no files found to search text in"
                                GOTO FINISH2
                          END IF
                          DIM FILELISTING(1 TO 20000)
                          LASTFILEINARRAY=1&
                          FILELISTING(1&)=TEMP$
                          
                          FOR I&=2 TO 20000
                          FILELISTING(I&)=DIR$
                          IF FILELISTING(I&)="" THEN EXIT FOR
                          LASTFILEINARRAY=I&
                          
                          NEXT I&
                          IF I&=20000 THEN STDOUT "this program is limited to 20000 files
                          CONSOLE SCREEN 26,120
                          CONSOLE SET SCREEN 18,120
                          CONSOLE SET VIRTUAL 26, 500
                          START:
                          DIM FILELINE$(14)
                          
                          COLOR 15,0
                          CLS
                          STDOUT "search files "+FILETOSEARCH$
                          STDOUT "Matching of a primary key, can be with the secondary keys on the same line or upto 6 lines near the primary key"
                          GOTO QSTRING
                          START1:
                          CLS
                          STDOUT "the last keywords searched"
                          STDOUT "primary :"+A$
                          STDOUT "second  :"+B$
                          STDOUT "third   :"+C$
                          STDOUT "fourth  :"+D$
                          
                          QSTRING:
                          LOCATE 6,1
                          A$=""
                          B$=""
                          C$=""
                          D$=""
                          M$="Y"
                          M&=0
                          INPUT LINE "Additional keywords on lines .Same.Near.Before.After: ",M$
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="S" THEN M&=1&
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="N" THEN M&=2&
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="B" THEN M&=3&
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="A" THEN M&=4&
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="Q" THEN GOTO FINISH2
                          IF LEFT$(UCASE$(TRIM$(M$)),1)="" THEN GOTO FINISH2
                          
                          IF M&=0 THEN GOTO QSTRING
                          
                          
                          LOCATE 6,1
                          STDOUT SPACE$(80);
                          LOCATE 1,45
                          IF M&=1 THEN STDOUT "secondary matching is only on the same line";
                          IF M&=2 THEN STDOUT "secondary matching is same line and/or 6 lines nearby";
                          IF M&=3 THEN STDOUT "secondary matching is same line and/or 6 lines before";
                          IF M&=4 THEN STDOUT "secondary matching is same line and/or 6 lines after";
                          
                          
                          LOCATE 6,1
                          
                          INPUT LINE "Primary string to search: ",A$
                          IF TRIM$(A$)="" GOTO FINISH
                          INPUT LINE "    2nd string to search: ",B$
                          IF TRIM$(B$)="" GOTO STARTSEARCH
                          INPUT LINE "    3rd string to search: ",C$
                          IF TRIM$(C$)="" GOTO STARTSEARCH
                          INPUT LINE "    4th string to search: ",D$
                          IF TRIM$(D$)="" GOTO STARTSEARCH
                          
                          STARTSEARCH:
                          
                          
                          ON ERROR RESUME NEXT
                          FOR I&=1 TO LASTFILEINARRAY&
                          MATCH&=0&
                          
                          ERRCLEAR
                          FILEOPEN&=0&
                          TEMP$=FILELISTING(I&)
                          
                          OPEN TEMP$ FOR INPUT AS #1  LEN=16000
                          IF ERR THEN GOTO AROUND
                          FILEOPEN&=1&
                          AFTERENDOFFILE&=0&
                          REDIM FILELINE$(14)
                          LINECOUNT&=0
                          ERRCLEAR
                          LINE INPUT #1,FILELINE$
                          
                          
                          WHILE ISFALSE EOF(1)
                          
                          ENDOFFILEVIEW:
                          
                          IF FILEOPEN&=1& THEN
                               READANOTHERLINE:
                               LINE INPUT #1,FILELINE$(14)
                               INCR LINECOUNT&
                              ' IF TRIM$(FILELINE$(14))="" THEN PRINT "EMPTY LINE":GOTO READANOTHERLINE
                               ELSE
                               INCR AFTERENDOFFILE&
                               FILELINE$(14)=""
                               END IF
                          FOR J&=1 TO 14
                              SWAP FILELINE$(J&), FILELINE$(J&-1&)
                          NEXT J&
                          
                          
                          IF INSTR(" "+UCASE$(FILELINE$(7)),UCASE$(A$))>0 THEN
                             MATCH&=1&
                             ELSE
                             GOTO AROUND2
                          END IF
                          TEMPSTRING$=" "
                          IF M&=1& THEN
                              TEMPSTRING$=TEMPSTRING$+UCASE$(FILELINE$(7&)) 'all matching must be on same line
                          END IF
                          IF M&=2& THEN
                              FOR J&=1 TO 13
                              TEMPSTRING$=TEMPSTRING$+UCASE$(FILELINE$(J&)) 'matching can be on all 13 mulitple lines
                              NEXT J&
                          END IF
                          
                          IF M&=3& THEN
                              FOR J&=1 TO 7&
                              TEMPSTRING$=TEMPSTRING$+UCASE$(FILELINE$(J&)) 'matching can be on same line and 6 lines before
                              NEXT J&
                          END IF
                          
                          IF M&=4& THEN
                              FOR J&=7 TO 13&
                              TEMPSTRING$=TEMPSTRING$+UCASE$(FILELINE$(J&)) 'matching can be on same line and 6 lines after
                              NEXT J&
                          END IF
                          
                          IF B$<>"" THEN
                             IF INSTR(TEMPSTRING$,UCASE$(B$))=0 THEN MATCH&=0&
                          END IF
                          
                          IF C$<>"" THEN
                             IF INSTR(TEMPSTRING$,UCASE$(C$))=0 THEN MATCH&=0&
                          END IF
                          
                          IF D$<>"" THEN
                             IF INSTR(TEMPSTRING$,UCASE$(D$))=0 THEN MATCH&=0&
                          END IF
                          
                          
                          
                          IF MATCH&=0& THEN GOTO AROUND2
                          ANSWER:
                           LOCATE 11,1
                          STDOUT SPACE$(499);
                          LOCATE 11,1
                          STDOUT TEMP$+"          match found near line"+STR$(linecount&-5&);
                          
                          LOCATE 26,1
                          STDOUT SPACE$(499);
                          
                          FOR J&=1 TO 13
                          LOCATE 12&+J&,1
                          STDOUT SPACE$(500);
                          LOCATE 12&+J&,1
                          BLANK$=" "
                          COLOR 15,0
                          IF (J&<7 AND M&=2) OR (J&<7 AND M&=3)THEN
                              IF TRIM$(B$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(B$)) THEN COLOR 14,0
                              IF TRIM$(C$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(C$)) THEN COLOR 14,0
                              IF TRIM$(D$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(D$)) THEN COLOR 14,0
                              IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(A$)) THEN COLOR 14,0
                          END IF
                          IF (J&>7 AND M&=2) OR (J&>7 AND M&=4) THEN
                              IF TRIM$(B$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(B$)) THEN COLOR 14,0
                              IF TRIM$(C$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(C$)) THEN COLOR 14,0
                              IF TRIM$(D$)<>"" THEN IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(D$)) THEN COLOR 14,0
                              IF INSTR(" "+UCASE$(FILELINE$(J&)),UCASE$(A$)) THEN COLOR 14,0
                          END IF
                             
                          IF J&=7 THEN COLOR 10,0
                          
                          STDOUT FILELINE$(J&);
                          COLOR 15,0
                          NEXT J&
                          CAVQUESTION:
                          LOCATE 10,1
                          STDOUT "                                                               "
                          LOCATE 10,1
                          INPUT LINE "Continue,Quit,View : ",YN$
                          YN$=UCASE$(TRIM$(YN$))
                          IF AFTERENDOFFILE&>0 THEN
                              IF YN$="Q" THEN GOTO START1
                          END IF
                          
                          IF YN$="Q" THEN CLOSE 1:GOTO START1
                          IF YN$="C" THEN GOTO AROUND2
                          IF YN$="" THEN GOTO AROUND2
                          IF AFTERENDOFFILE&>0 THEN
                              IF YN$="V" THEN SHELL "NOTEPAD.EXE  "+TEMP$
                          END IF
                          IF AFTERENDOFFILE&=0 THEN
                          IF YN$="V" THEN CLOSE 1:SHELL "NOTEPAD.EXE "+TEMP$
                          END IF
                          IF YN$="V" THEN GOTO CAVQUESTION
                          
                          GOTO ANSWER
                          
                          AROUND2:
                          IF AFTERENDOFFILE&>6 THEN GOTO AROUND:
                          IF FILEOPEN&=0 THEN GOTO ENDOFFILEVIEW
                          
                          WEND
                          CLOSE 1
                          FILEOPEN&=0&
                          GOTO ENDOFFILEVIEW
                          
                          
                          AROUND:
                          NEXT I&
                          GOTO START
                          
                          FINISH:
                          CLS
                          FINISH2:
                          CONSOLE SCREEN 25, 80
                          END FUNCTION
                          Last edited by Paul Purvis; 17 Mar 2008, 06:38 PM.
                          p purvis

                          Comment


                          • #14
                            Thanks Paul.

                            Rod
                            Rod
                            In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                            Comment


                            • #15
                              i will always have my latest program at the website.
                              i already had a few undesirable results because i had to alter the program from the original, For example the original code did not allow spaces and the the original files search where 80 characters long. i can see this program being enhanced on a regular bases in the short run.
                              the program needs to do more advanced searching like searching words close to another but not on the same lines also it would be better if this program read the whole file up at once in an array then made searches inside the array.
                              oh well on with the funeral music

                              paul
                              p purvis

                              Comment


                              • #16
                                Originally posted by Gösta H. Lovgren-2 View Post
                                Sounds like a dandy reason for using long variable & macro names.

                                long AND descriptive.
                                Do not go quiet into that good night,
                                ... Rage, rage against the dark.

                                Comment


                                • #17
                                  Rodney,
                                  i am sorry i missed that post where you where asking for usekeys.bas

                                  i had it under the examples directory of pbwin80.
                                  apparently i created it from poffs
                                  it was written by Joseph Boccanera
                                  and i just have the main part of the program and i even had a hard time figuring out where it came from.
                                  i do not see no source code just where he had listed his program along with some problems, do a search on the word cim62.

                                  i mistook it for a pb example which it was not when i did a search on my hard drive.

                                  sorry about that, i probably mislead some other people.

                                  on another subject of the program i wrote to search files for keyword, i made some much better improvement over the search requirements.
                                  it looks a little better and but it still only searches one directory.
                                  it is not what we ultimately want, but it serves well until we get what we want.

                                  i have also updated my web and this thread above.

                                  paul
                                  p purvis

                                  Comment

                                  Working...
                                  X